diff --git a/Makefile b/Makefile index 6e41e653bb..3c666a89f5 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ XDRS = $(DOWNLOADABLE_XDRS) xdr/Stellar-exporter.x XDRGEN_COMMIT=e2cac557162d99b12ae73b846cf3d5bfe16636de -XDR_COMMIT=70180d5e8d9caee9e8645ed8a38c36a8cf403cd9 +XDR_COMMIT=4ec28d95dd84b109253e22b151314478d6f00522 .PHONY: xdr xdr-clean xdr-update diff --git a/gxdr/xdr_generated.go b/gxdr/xdr_generated.go index 0b41834ce9..2ccd3d1ff3 100644 --- a/gxdr/xdr_generated.go +++ b/gxdr/xdr_generated.go @@ -813,6 +813,135 @@ const ( ENVELOPE_TYPE_SOROBAN_AUTHORIZATION EnvelopeType = 9 ) +type BucketListType int32 + +const ( + LIVE BucketListType = 0 + HOT_ARCHIVE BucketListType = 1 + COLD_ARCHIVE BucketListType = 2 +) + +/* Entries used to define the bucket list */ +type BucketEntryType int32 + +const ( + // At-and-after protocol 11: bucket metadata, should come first. + METAENTRY BucketEntryType = -1 + // Before protocol 11: created-or-updated; + LIVEENTRY BucketEntryType = 0 + // At-and-after protocol 11: only updated. + DEADENTRY BucketEntryType = 1 + // At-and-after protocol 11: only created. + INITENTRY BucketEntryType = 2 +) + +type HotArchiveBucketEntryType int32 + +const ( + // Bucket metadata, should come first. + HOT_ARCHIVE_METAENTRY HotArchiveBucketEntryType = -1 + // Entry is Archived + HOT_ARCHIVE_ARCHIVED HotArchiveBucketEntryType = 0 + // Entry was previously HOT_ARCHIVE_ARCHIVED, or HOT_ARCHIVE_DELETED, but + HOT_ARCHIVE_LIVE HotArchiveBucketEntryType = 1 + // has been added back to the live BucketList. + // Does not need to be persisted. + HOT_ARCHIVE_DELETED HotArchiveBucketEntryType = 2 +) + +type ColdArchiveBucketEntryType int32 + +const ( + // Bucket metadata, should come first. + COLD_ARCHIVE_METAENTRY ColdArchiveBucketEntryType = -1 + // Full LedgerEntry that was archived during the epoch + COLD_ARCHIVE_ARCHIVED_LEAF ColdArchiveBucketEntryType = 0 + // LedgerKey that was deleted during the epoch + COLD_ARCHIVE_DELETED_LEAF ColdArchiveBucketEntryType = 1 + // Dummy leaf representing low/high bound + COLD_ARCHIVE_BOUNDARY_LEAF ColdArchiveBucketEntryType = 2 + // Intermediary Merkle hash entry + COLD_ARCHIVE_HASH ColdArchiveBucketEntryType = 3 +) + +type BucketMetadata struct { + // Indicates the protocol version used to create / merge this bucket. + LedgerVersion Uint32 + Ext XdrAnon_BucketMetadata_Ext +} + +// reserved for future use +type XdrAnon_BucketMetadata_Ext struct { + // The union discriminant V selects among the following arms: + // 0: + // void + // 1: + // BucketListType() *BucketListType + V int32 + _u interface{} +} + +type BucketEntry struct { + // The union discriminant Type selects among the following arms: + // LIVEENTRY, INITENTRY: + // LiveEntry() *LedgerEntry + // DEADENTRY: + // DeadEntry() *LedgerKey + // METAENTRY: + // MetaEntry() *BucketMetadata + Type BucketEntryType + _u interface{} +} + +type HotArchiveBucketEntry struct { + // The union discriminant Type selects among the following arms: + // HOT_ARCHIVE_ARCHIVED: + // ArchivedEntry() *LedgerEntry + // HOT_ARCHIVE_LIVE, HOT_ARCHIVE_DELETED: + // Key() *LedgerKey + // HOT_ARCHIVE_METAENTRY: + // MetaEntry() *BucketMetadata + Type HotArchiveBucketEntryType + _u interface{} +} + +type ColdArchiveArchivedLeaf struct { + Index Uint32 + ArchivedEntry LedgerEntry +} + +type ColdArchiveDeletedLeaf struct { + Index Uint32 + DeletedKey LedgerKey +} + +type ColdArchiveBoundaryLeaf struct { + Index Uint32 + IsLowerBound bool +} + +type ColdArchiveHashEntry struct { + Index Uint32 + Level Uint32 + Hash Hash +} + +type ColdArchiveBucketEntry struct { + // The union discriminant Type selects among the following arms: + // COLD_ARCHIVE_METAENTRY: + // MetaEntry() *BucketMetadata + // COLD_ARCHIVE_ARCHIVED_LEAF: + // ArchivedLeaf() *ColdArchiveArchivedLeaf + // COLD_ARCHIVE_DELETED_LEAF: + // DeletedLeaf() *ColdArchiveDeletedLeaf + // COLD_ARCHIVE_BOUNDARY_LEAF: + // BoundaryLeaf() *ColdArchiveBoundaryLeaf + // COLD_ARCHIVE_HASH: + // HashEntry() *ColdArchiveHashEntry + Type ColdArchiveBucketEntryType + _u interface{} +} + type UpgradeType = []byte // bound 128 type StellarValueType int32 @@ -973,47 +1102,6 @@ type ConfigUpgradeSet struct { UpdatedEntry []ConfigSettingEntry } -/* Entries used to define the bucket list */ -type BucketEntryType int32 - -const ( - // At-and-after protocol 11: bucket metadata, should come first. - METAENTRY BucketEntryType = -1 - // Before protocol 11: created-or-updated; - LIVEENTRY BucketEntryType = 0 - // At-and-after protocol 11: only updated. - DEADENTRY BucketEntryType = 1 - // At-and-after protocol 11: only created. - INITENTRY BucketEntryType = 2 -) - -type BucketMetadata struct { - // Indicates the protocol version used to create / merge this bucket. - LedgerVersion Uint32 - Ext XdrAnon_BucketMetadata_Ext -} - -// reserved for future use -type XdrAnon_BucketMetadata_Ext struct { - // The union discriminant V selects among the following arms: - // 0: - // void - V int32 - _u interface{} -} - -type BucketEntry struct { - // The union discriminant Type selects among the following arms: - // LIVEENTRY, INITENTRY: - // LiveEntry() *LedgerEntry - // DEADENTRY: - // DeadEntry() *LedgerKey - // METAENTRY: - // MetaEntry() *BucketMetadata - Type BucketEntryType - _u interface{} -} - type TxSetComponentType int32 const ( @@ -2217,6 +2305,7 @@ const ( HOST_FUNCTION_TYPE_INVOKE_CONTRACT HostFunctionType = 0 HOST_FUNCTION_TYPE_CREATE_CONTRACT HostFunctionType = 1 HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM HostFunctionType = 2 + HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2 HostFunctionType = 3 ) type ContractIDPreimageType int32 @@ -2245,6 +2334,13 @@ type CreateContractArgs struct { Executable ContractExecutable } +type CreateContractArgsV2 struct { + ContractIDPreimage ContractIDPreimage + Executable ContractExecutable + // Arguments of the contract's constructor. + ConstructorArgs []SCVal +} + type InvokeContractArgs struct { ContractAddress SCAddress FunctionName SCSymbol @@ -2259,6 +2355,8 @@ type HostFunction struct { // CreateContract() *CreateContractArgs // HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: // Wasm() *[]byte + // HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2: + // CreateContractV2() *CreateContractArgsV2 Type HostFunctionType _u interface{} } @@ -2266,8 +2364,9 @@ type HostFunction struct { type SorobanAuthorizedFunctionType int32 const ( - SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN SorobanAuthorizedFunctionType = 0 - SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN SorobanAuthorizedFunctionType = 1 + SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN SorobanAuthorizedFunctionType = 0 + SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN SorobanAuthorizedFunctionType = 1 + SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN SorobanAuthorizedFunctionType = 2 ) type SorobanAuthorizedFunction struct { @@ -2276,6 +2375,8 @@ type SorobanAuthorizedFunction struct { // ContractFn() *InvokeContractArgs // SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: // CreateContractHostFn() *CreateContractArgs + // SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: + // CreateContractV2HostFn() *CreateContractArgsV2 Type SorobanAuthorizedFunctionType _u interface{} } @@ -2551,6 +2652,53 @@ type LedgerFootprint struct { ReadWrite []LedgerKey } +type ArchivalProofType int32 + +const ( + EXISTENCE ArchivalProofType = 0 + NONEXISTENCE ArchivalProofType = 1 +) + +type ArchivalProofNode struct { + Index Uint32 + Hash Hash +} + +type ProofLevel = []ArchivalProofNode + +type NonexistenceProofBody struct { + EntriesToProve []ColdArchiveBucketEntry + // Vector of vectors, where proofLevels[level] + // contains all HashNodes that correspond with that level + ProofLevels []ProofLevel +} + +type ExistenceProofBody struct { + KeysToProve []LedgerKey + // Bounds for each key being proved, where bound[n] + // corresponds to keysToProve[n] + LowBoundEntries []ColdArchiveBucketEntry + HighBoundEntries []ColdArchiveBucketEntry + // Vector of vectors, where proofLevels[level] + // contains all HashNodes that correspond with that level + ProofLevels []ProofLevel +} + +type ArchivalProof struct { + // AST Subtree for this proof + Epoch Uint32 + Body XdrAnon_ArchivalProof_Body +} +type XdrAnon_ArchivalProof_Body struct { + // The union discriminant T selects among the following arms: + // EXISTENCE: + // NonexistenceProof() *NonexistenceProofBody + // NONEXISTENCE: + // ExistenceProof() *ExistenceProofBody + T ArchivalProofType + _u interface{} +} + // Resource limits for a Soroban transaction. // The transaction will fail if it exceeds any of these limits. type SorobanResources struct { @@ -3831,6 +3979,34 @@ type HmacSha256Mac struct { Mac [32]byte } +type ShortHashSeed struct { + Seed [16]byte +} + +type BinaryFuseFilterType int32 + +const ( + BINARY_FUSE_FILTER_8_BIT BinaryFuseFilterType = 0 + BINARY_FUSE_FILTER_16_BIT BinaryFuseFilterType = 1 + BINARY_FUSE_FILTER_32_BIT BinaryFuseFilterType = 2 +) + +type SerializedBinaryFuseFilter struct { + Type BinaryFuseFilterType + // Seed used to hash input to filter + InputHashSeed ShortHashSeed + // Seed used for internal filter hash operations + FilterSeed ShortHashSeed + SegmentLength Uint32 + SegementLengthMask Uint32 + SegmentCount Uint32 + SegmentCountLength Uint32 + // Length in terms of element count, not bytes + FingerprintLength Uint32 + // Array of uint8_t, uint16_t, or uint32_t depending on filter type + Fingerprints []byte +} + type SCEnvMetaKind int32 const ( @@ -9236,327 +9412,300 @@ type XdrType_EnvelopeType = *EnvelopeType func XDR_EnvelopeType(v *EnvelopeType) *EnvelopeType { return v } -type XdrType_UpgradeType struct { - XdrVecOpaque +var _XdrNames_BucketListType = map[int32]string{ + int32(LIVE): "LIVE", + int32(HOT_ARCHIVE): "HOT_ARCHIVE", + int32(COLD_ARCHIVE): "COLD_ARCHIVE", +} +var _XdrValues_BucketListType = map[string]int32{ + "LIVE": int32(LIVE), + "HOT_ARCHIVE": int32(HOT_ARCHIVE), + "COLD_ARCHIVE": int32(COLD_ARCHIVE), } -func XDR_UpgradeType(v *UpgradeType) XdrType_UpgradeType { - return XdrType_UpgradeType{XdrVecOpaque{v, 128}} +func (BucketListType) XdrEnumNames() map[int32]string { + return _XdrNames_BucketListType } -func (XdrType_UpgradeType) XdrTypeName() string { return "UpgradeType" } -func (v XdrType_UpgradeType) XdrUnwrap() XdrType { return v.XdrVecOpaque } +func (v BucketListType) String() string { + if s, ok := _XdrNames_BucketListType[int32(v)]; ok { + return s + } + return fmt.Sprintf("BucketListType#%d", v) +} +func (v *BucketListType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_BucketListType[stok]; ok { + *v = BucketListType(val) + return nil + } else if stok == "BucketListType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } + } + return XdrError(fmt.Sprintf("%s is not a valid BucketListType.", stok)) + } +} +func (v BucketListType) GetU32() uint32 { return uint32(v) } +func (v *BucketListType) SetU32(n uint32) { *v = BucketListType(n) } +func (v *BucketListType) XdrPointer() interface{} { return v } +func (BucketListType) XdrTypeName() string { return "BucketListType" } +func (v BucketListType) XdrValue() interface{} { return v } +func (v *BucketListType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -var _XdrNames_StellarValueType = map[int32]string{ - int32(STELLAR_VALUE_BASIC): "STELLAR_VALUE_BASIC", - int32(STELLAR_VALUE_SIGNED): "STELLAR_VALUE_SIGNED", +type XdrType_BucketListType = *BucketListType + +func XDR_BucketListType(v *BucketListType) *BucketListType { return v } + +var _XdrNames_BucketEntryType = map[int32]string{ + int32(METAENTRY): "METAENTRY", + int32(LIVEENTRY): "LIVEENTRY", + int32(DEADENTRY): "DEADENTRY", + int32(INITENTRY): "INITENTRY", } -var _XdrValues_StellarValueType = map[string]int32{ - "STELLAR_VALUE_BASIC": int32(STELLAR_VALUE_BASIC), - "STELLAR_VALUE_SIGNED": int32(STELLAR_VALUE_SIGNED), +var _XdrValues_BucketEntryType = map[string]int32{ + "METAENTRY": int32(METAENTRY), + "LIVEENTRY": int32(LIVEENTRY), + "DEADENTRY": int32(DEADENTRY), + "INITENTRY": int32(INITENTRY), } -func (StellarValueType) XdrEnumNames() map[int32]string { - return _XdrNames_StellarValueType +func (BucketEntryType) XdrEnumNames() map[int32]string { + return _XdrNames_BucketEntryType } -func (v StellarValueType) String() string { - if s, ok := _XdrNames_StellarValueType[int32(v)]; ok { +func (v BucketEntryType) String() string { + if s, ok := _XdrNames_BucketEntryType[int32(v)]; ok { return s } - return fmt.Sprintf("StellarValueType#%d", v) + return fmt.Sprintf("BucketEntryType#%d", v) } -func (v *StellarValueType) Scan(ss fmt.ScanState, _ rune) error { +func (v *BucketEntryType) Scan(ss fmt.ScanState, _ rune) error { if tok, err := ss.Token(true, XdrSymChar); err != nil { return err } else { stok := string(tok) - if val, ok := _XdrValues_StellarValueType[stok]; ok { - *v = StellarValueType(val) + if val, ok := _XdrValues_BucketEntryType[stok]; ok { + *v = BucketEntryType(val) return nil - } else if stok == "StellarValueType" { + } else if stok == "BucketEntryType" { if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { return nil } } - return XdrError(fmt.Sprintf("%s is not a valid StellarValueType.", stok)) + return XdrError(fmt.Sprintf("%s is not a valid BucketEntryType.", stok)) } } -func (v StellarValueType) GetU32() uint32 { return uint32(v) } -func (v *StellarValueType) SetU32(n uint32) { *v = StellarValueType(n) } -func (v *StellarValueType) XdrPointer() interface{} { return v } -func (StellarValueType) XdrTypeName() string { return "StellarValueType" } -func (v StellarValueType) XdrValue() interface{} { return v } -func (v *StellarValueType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v BucketEntryType) GetU32() uint32 { return uint32(v) } +func (v *BucketEntryType) SetU32(n uint32) { *v = BucketEntryType(n) } +func (v *BucketEntryType) XdrPointer() interface{} { return v } +func (BucketEntryType) XdrTypeName() string { return "BucketEntryType" } +func (v BucketEntryType) XdrValue() interface{} { return v } +func (v *BucketEntryType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_StellarValueType = *StellarValueType +type XdrType_BucketEntryType = *BucketEntryType -func XDR_StellarValueType(v *StellarValueType) *StellarValueType { return v } +func XDR_BucketEntryType(v *BucketEntryType) *BucketEntryType { return v } -type XdrType_LedgerCloseValueSignature = *LedgerCloseValueSignature +var _XdrComments_BucketEntryType = map[int32]string{ + int32(METAENTRY): "At-and-after protocol 11: bucket metadata, should come first.", + int32(LIVEENTRY): "Before protocol 11: created-or-updated;", + int32(DEADENTRY): "At-and-after protocol 11: only updated.", + int32(INITENTRY): "At-and-after protocol 11: only created.", +} -func (v *LedgerCloseValueSignature) XdrPointer() interface{} { return v } -func (LedgerCloseValueSignature) XdrTypeName() string { return "LedgerCloseValueSignature" } -func (v LedgerCloseValueSignature) XdrValue() interface{} { return v } -func (v *LedgerCloseValueSignature) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LedgerCloseValueSignature) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%snodeID", name), XDR_NodeID(&v.NodeID)) - x.Marshal(x.Sprintf("%ssignature", name), XDR_Signature(&v.Signature)) +func (e BucketEntryType) XdrEnumComments() map[int32]string { + return _XdrComments_BucketEntryType } -func XDR_LedgerCloseValueSignature(v *LedgerCloseValueSignature) *LedgerCloseValueSignature { return v } -var _XdrTags_XdrAnon_StellarValue_Ext = map[int32]bool{ - XdrToI32(STELLAR_VALUE_BASIC): true, - XdrToI32(STELLAR_VALUE_SIGNED): true, +var _XdrNames_HotArchiveBucketEntryType = map[int32]string{ + int32(HOT_ARCHIVE_METAENTRY): "HOT_ARCHIVE_METAENTRY", + int32(HOT_ARCHIVE_ARCHIVED): "HOT_ARCHIVE_ARCHIVED", + int32(HOT_ARCHIVE_LIVE): "HOT_ARCHIVE_LIVE", + int32(HOT_ARCHIVE_DELETED): "HOT_ARCHIVE_DELETED", +} +var _XdrValues_HotArchiveBucketEntryType = map[string]int32{ + "HOT_ARCHIVE_METAENTRY": int32(HOT_ARCHIVE_METAENTRY), + "HOT_ARCHIVE_ARCHIVED": int32(HOT_ARCHIVE_ARCHIVED), + "HOT_ARCHIVE_LIVE": int32(HOT_ARCHIVE_LIVE), + "HOT_ARCHIVE_DELETED": int32(HOT_ARCHIVE_DELETED), } -func (_ XdrAnon_StellarValue_Ext) XdrValidTags() map[int32]bool { - return _XdrTags_XdrAnon_StellarValue_Ext +func (HotArchiveBucketEntryType) XdrEnumNames() map[int32]string { + return _XdrNames_HotArchiveBucketEntryType } -func (u *XdrAnon_StellarValue_Ext) LcValueSignature() *LedgerCloseValueSignature { - switch u.V { - case STELLAR_VALUE_SIGNED: - if v, ok := u._u.(*LedgerCloseValueSignature); ok { - return v - } else { - var zero LedgerCloseValueSignature - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_StellarValue_Ext.LcValueSignature accessed when V == %v", u.V) - return nil +func (v HotArchiveBucketEntryType) String() string { + if s, ok := _XdrNames_HotArchiveBucketEntryType[int32(v)]; ok { + return s } + return fmt.Sprintf("HotArchiveBucketEntryType#%d", v) } -func (u XdrAnon_StellarValue_Ext) XdrValid() bool { - switch u.V { - case STELLAR_VALUE_BASIC, STELLAR_VALUE_SIGNED: - return true - } - return false -} -func (u *XdrAnon_StellarValue_Ext) XdrUnionTag() XdrNum32 { - return XDR_StellarValueType(&u.V) -} -func (u *XdrAnon_StellarValue_Ext) XdrUnionTagName() string { - return "V" -} -func (u *XdrAnon_StellarValue_Ext) XdrUnionBody() XdrType { - switch u.V { - case STELLAR_VALUE_BASIC: - return nil - case STELLAR_VALUE_SIGNED: - return XDR_LedgerCloseValueSignature(u.LcValueSignature()) - } - return nil -} -func (u *XdrAnon_StellarValue_Ext) XdrUnionBodyName() string { - switch u.V { - case STELLAR_VALUE_BASIC: - return "" - case STELLAR_VALUE_SIGNED: - return "LcValueSignature" +func (v *HotArchiveBucketEntryType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_HotArchiveBucketEntryType[stok]; ok { + *v = HotArchiveBucketEntryType(val) + return nil + } else if stok == "HotArchiveBucketEntryType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } + } + return XdrError(fmt.Sprintf("%s is not a valid HotArchiveBucketEntryType.", stok)) } - return "" } +func (v HotArchiveBucketEntryType) GetU32() uint32 { return uint32(v) } +func (v *HotArchiveBucketEntryType) SetU32(n uint32) { *v = HotArchiveBucketEntryType(n) } +func (v *HotArchiveBucketEntryType) XdrPointer() interface{} { return v } +func (HotArchiveBucketEntryType) XdrTypeName() string { return "HotArchiveBucketEntryType" } +func (v HotArchiveBucketEntryType) XdrValue() interface{} { return v } +func (v *HotArchiveBucketEntryType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_XdrAnon_StellarValue_Ext = *XdrAnon_StellarValue_Ext - -func (v *XdrAnon_StellarValue_Ext) XdrPointer() interface{} { return v } -func (XdrAnon_StellarValue_Ext) XdrTypeName() string { return "XdrAnon_StellarValue_Ext" } -func (v XdrAnon_StellarValue_Ext) XdrValue() interface{} { return v } -func (v *XdrAnon_StellarValue_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *XdrAnon_StellarValue_Ext) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - XDR_StellarValueType(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) - switch u.V { - case STELLAR_VALUE_BASIC: - return - case STELLAR_VALUE_SIGNED: - x.Marshal(x.Sprintf("%slcValueSignature", name), XDR_LedgerCloseValueSignature(u.LcValueSignature())) - return - } - XdrPanic("invalid V (%v) in XdrAnon_StellarValue_Ext", u.V) -} -func XDR_XdrAnon_StellarValue_Ext(v *XdrAnon_StellarValue_Ext) *XdrAnon_StellarValue_Ext { return v } +type XdrType_HotArchiveBucketEntryType = *HotArchiveBucketEntryType -type _XdrVec_6_UpgradeType []UpgradeType +func XDR_HotArchiveBucketEntryType(v *HotArchiveBucketEntryType) *HotArchiveBucketEntryType { return v } -func (_XdrVec_6_UpgradeType) XdrBound() uint32 { - const bound uint32 = 6 // Force error if not const or doesn't fit - return bound -} -func (_XdrVec_6_UpgradeType) XdrCheckLen(length uint32) { - if length > uint32(6) { - XdrPanic("_XdrVec_6_UpgradeType length %d exceeds bound 6", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_6_UpgradeType length %d exceeds max int", length) - } -} -func (v _XdrVec_6_UpgradeType) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_6_UpgradeType) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(6); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) - } - nv := make([]UpgradeType, int(length), newcap) - copy(nv, *v) - *v = nv -} -func (v *_XdrVec_6_UpgradeType) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) - } - XDR_UpgradeType(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] - } -} -func (v *_XdrVec_6_UpgradeType) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 6} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) +var _XdrComments_HotArchiveBucketEntryType = map[int32]string{ + int32(HOT_ARCHIVE_METAENTRY): "Bucket metadata, should come first.", + int32(HOT_ARCHIVE_ARCHIVED): "Entry is Archived", + int32(HOT_ARCHIVE_LIVE): "Entry was previously HOT_ARCHIVE_ARCHIVED, or HOT_ARCHIVE_DELETED, but", + int32(HOT_ARCHIVE_DELETED): "has been added back to the live BucketList. Does not need to be persisted.", } -func (_XdrVec_6_UpgradeType) XdrTypeName() string { return "UpgradeType<>" } -func (v *_XdrVec_6_UpgradeType) XdrPointer() interface{} { return (*[]UpgradeType)(v) } -func (v _XdrVec_6_UpgradeType) XdrValue() interface{} { return ([]UpgradeType)(v) } -func (v *_XdrVec_6_UpgradeType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_StellarValue = *StellarValue - -func (v *StellarValue) XdrPointer() interface{} { return v } -func (StellarValue) XdrTypeName() string { return "StellarValue" } -func (v StellarValue) XdrValue() interface{} { return v } -func (v *StellarValue) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *StellarValue) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%stxSetHash", name), XDR_Hash(&v.TxSetHash)) - x.Marshal(x.Sprintf("%scloseTime", name), XDR_TimePoint(&v.CloseTime)) - x.Marshal(x.Sprintf("%supgrades", name), (*_XdrVec_6_UpgradeType)(&v.Upgrades)) - x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_StellarValue_Ext(&v.Ext)) +func (e HotArchiveBucketEntryType) XdrEnumComments() map[int32]string { + return _XdrComments_HotArchiveBucketEntryType } -func XDR_StellarValue(v *StellarValue) *StellarValue { return v } -var _XdrNames_LedgerHeaderFlags = map[int32]string{ - int32(DISABLE_LIQUIDITY_POOL_TRADING_FLAG): "DISABLE_LIQUIDITY_POOL_TRADING_FLAG", - int32(DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG): "DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG", - int32(DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG): "DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG", +var _XdrNames_ColdArchiveBucketEntryType = map[int32]string{ + int32(COLD_ARCHIVE_METAENTRY): "COLD_ARCHIVE_METAENTRY", + int32(COLD_ARCHIVE_ARCHIVED_LEAF): "COLD_ARCHIVE_ARCHIVED_LEAF", + int32(COLD_ARCHIVE_DELETED_LEAF): "COLD_ARCHIVE_DELETED_LEAF", + int32(COLD_ARCHIVE_BOUNDARY_LEAF): "COLD_ARCHIVE_BOUNDARY_LEAF", + int32(COLD_ARCHIVE_HASH): "COLD_ARCHIVE_HASH", } -var _XdrValues_LedgerHeaderFlags = map[string]int32{ - "DISABLE_LIQUIDITY_POOL_TRADING_FLAG": int32(DISABLE_LIQUIDITY_POOL_TRADING_FLAG), - "DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG": int32(DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG), - "DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG": int32(DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG), +var _XdrValues_ColdArchiveBucketEntryType = map[string]int32{ + "COLD_ARCHIVE_METAENTRY": int32(COLD_ARCHIVE_METAENTRY), + "COLD_ARCHIVE_ARCHIVED_LEAF": int32(COLD_ARCHIVE_ARCHIVED_LEAF), + "COLD_ARCHIVE_DELETED_LEAF": int32(COLD_ARCHIVE_DELETED_LEAF), + "COLD_ARCHIVE_BOUNDARY_LEAF": int32(COLD_ARCHIVE_BOUNDARY_LEAF), + "COLD_ARCHIVE_HASH": int32(COLD_ARCHIVE_HASH), } -func (LedgerHeaderFlags) XdrEnumNames() map[int32]string { - return _XdrNames_LedgerHeaderFlags +func (ColdArchiveBucketEntryType) XdrEnumNames() map[int32]string { + return _XdrNames_ColdArchiveBucketEntryType } -func (v LedgerHeaderFlags) String() string { - if s, ok := _XdrNames_LedgerHeaderFlags[int32(v)]; ok { +func (v ColdArchiveBucketEntryType) String() string { + if s, ok := _XdrNames_ColdArchiveBucketEntryType[int32(v)]; ok { return s } - return fmt.Sprintf("LedgerHeaderFlags#%d", v) + return fmt.Sprintf("ColdArchiveBucketEntryType#%d", v) } -func (v *LedgerHeaderFlags) Scan(ss fmt.ScanState, _ rune) error { +func (v *ColdArchiveBucketEntryType) Scan(ss fmt.ScanState, _ rune) error { if tok, err := ss.Token(true, XdrSymChar); err != nil { return err } else { stok := string(tok) - if val, ok := _XdrValues_LedgerHeaderFlags[stok]; ok { - *v = LedgerHeaderFlags(val) + if val, ok := _XdrValues_ColdArchiveBucketEntryType[stok]; ok { + *v = ColdArchiveBucketEntryType(val) return nil - } else if stok == "LedgerHeaderFlags" { + } else if stok == "ColdArchiveBucketEntryType" { if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { return nil } } - return XdrError(fmt.Sprintf("%s is not a valid LedgerHeaderFlags.", stok)) + return XdrError(fmt.Sprintf("%s is not a valid ColdArchiveBucketEntryType.", stok)) } } -func (v LedgerHeaderFlags) GetU32() uint32 { return uint32(v) } -func (v *LedgerHeaderFlags) SetU32(n uint32) { *v = LedgerHeaderFlags(n) } -func (v *LedgerHeaderFlags) XdrPointer() interface{} { return v } -func (LedgerHeaderFlags) XdrTypeName() string { return "LedgerHeaderFlags" } -func (v LedgerHeaderFlags) XdrValue() interface{} { return v } -func (v *LedgerHeaderFlags) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v ColdArchiveBucketEntryType) GetU32() uint32 { return uint32(v) } +func (v *ColdArchiveBucketEntryType) SetU32(n uint32) { *v = ColdArchiveBucketEntryType(n) } +func (v *ColdArchiveBucketEntryType) XdrPointer() interface{} { return v } +func (ColdArchiveBucketEntryType) XdrTypeName() string { return "ColdArchiveBucketEntryType" } +func (v ColdArchiveBucketEntryType) XdrValue() interface{} { return v } +func (v *ColdArchiveBucketEntryType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_LedgerHeaderFlags = *LedgerHeaderFlags +type XdrType_ColdArchiveBucketEntryType = *ColdArchiveBucketEntryType -func XDR_LedgerHeaderFlags(v *LedgerHeaderFlags) *LedgerHeaderFlags { return v } -func (v *LedgerHeaderFlags) XdrInitialize() { - switch LedgerHeaderFlags(0) { - case DISABLE_LIQUIDITY_POOL_TRADING_FLAG, DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG, DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG: - default: - if *v == LedgerHeaderFlags(0) { - *v = DISABLE_LIQUIDITY_POOL_TRADING_FLAG - } - } +func XDR_ColdArchiveBucketEntryType(v *ColdArchiveBucketEntryType) *ColdArchiveBucketEntryType { + return v } -var _XdrTags_XdrAnon_LedgerHeaderExtensionV1_Ext = map[int32]bool{ +var _XdrComments_ColdArchiveBucketEntryType = map[int32]string{ + int32(COLD_ARCHIVE_METAENTRY): "Bucket metadata, should come first.", + int32(COLD_ARCHIVE_ARCHIVED_LEAF): "Full LedgerEntry that was archived during the epoch", + int32(COLD_ARCHIVE_DELETED_LEAF): "LedgerKey that was deleted during the epoch", + int32(COLD_ARCHIVE_BOUNDARY_LEAF): "Dummy leaf representing low/high bound", + int32(COLD_ARCHIVE_HASH): "Intermediary Merkle hash entry", +} + +func (e ColdArchiveBucketEntryType) XdrEnumComments() map[int32]string { + return _XdrComments_ColdArchiveBucketEntryType +} + +var _XdrTags_XdrAnon_BucketMetadata_Ext = map[int32]bool{ XdrToI32(0): true, + XdrToI32(1): true, } -func (_ XdrAnon_LedgerHeaderExtensionV1_Ext) XdrValidTags() map[int32]bool { - return _XdrTags_XdrAnon_LedgerHeaderExtensionV1_Ext +func (_ XdrAnon_BucketMetadata_Ext) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_BucketMetadata_Ext } -func (u XdrAnon_LedgerHeaderExtensionV1_Ext) XdrValid() bool { +func (u *XdrAnon_BucketMetadata_Ext) BucketListType() *BucketListType { switch u.V { - case 0: + case 1: + if v, ok := u._u.(*BucketListType); ok { + return v + } else { + var zero BucketListType + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_BucketMetadata_Ext.BucketListType accessed when V == %v", u.V) + return nil + } +} +func (u XdrAnon_BucketMetadata_Ext) XdrValid() bool { + switch u.V { + case 0, 1: return true } return false } -func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrUnionTag() XdrNum32 { +func (u *XdrAnon_BucketMetadata_Ext) XdrUnionTag() XdrNum32 { return XDR_int32(&u.V) } -func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrUnionTagName() string { +func (u *XdrAnon_BucketMetadata_Ext) XdrUnionTagName() string { return "V" } -func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrUnionBody() XdrType { +func (u *XdrAnon_BucketMetadata_Ext) XdrUnionBody() XdrType { switch u.V { case 0: return nil + case 1: + return XDR_BucketListType(u.BucketListType()) } return nil } -func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrUnionBodyName() string { +func (u *XdrAnon_BucketMetadata_Ext) XdrUnionBodyName() string { switch u.V { case 0: return "" + case 1: + return "BucketListType" } return "" } -type XdrType_XdrAnon_LedgerHeaderExtensionV1_Ext = *XdrAnon_LedgerHeaderExtensionV1_Ext +type XdrType_XdrAnon_BucketMetadata_Ext = *XdrAnon_BucketMetadata_Ext -func (v *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrPointer() interface{} { return v } -func (XdrAnon_LedgerHeaderExtensionV1_Ext) XdrTypeName() string { - return "XdrAnon_LedgerHeaderExtensionV1_Ext" -} -func (v XdrAnon_LedgerHeaderExtensionV1_Ext) XdrValue() interface{} { return v } -func (v *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrRecurse(x XDR, name string) { +func (v *XdrAnon_BucketMetadata_Ext) XdrPointer() interface{} { return v } +func (XdrAnon_BucketMetadata_Ext) XdrTypeName() string { return "XdrAnon_BucketMetadata_Ext" } +func (v XdrAnon_BucketMetadata_Ext) XdrValue() interface{} { return v } +func (v *XdrAnon_BucketMetadata_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_BucketMetadata_Ext) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } @@ -9564,1386 +9713,1286 @@ func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrRecurse(x XDR, name string) { switch u.V { case 0: return + case 1: + x.Marshal(x.Sprintf("%sbucketListType", name), XDR_BucketListType(u.BucketListType())) + return } - XdrPanic("invalid V (%v) in XdrAnon_LedgerHeaderExtensionV1_Ext", u.V) + XdrPanic("invalid V (%v) in XdrAnon_BucketMetadata_Ext", u.V) } -func XDR_XdrAnon_LedgerHeaderExtensionV1_Ext(v *XdrAnon_LedgerHeaderExtensionV1_Ext) *XdrAnon_LedgerHeaderExtensionV1_Ext { +func XDR_XdrAnon_BucketMetadata_Ext(v *XdrAnon_BucketMetadata_Ext) *XdrAnon_BucketMetadata_Ext { return v } -type XdrType_LedgerHeaderExtensionV1 = *LedgerHeaderExtensionV1 +type XdrType_BucketMetadata = *BucketMetadata -func (v *LedgerHeaderExtensionV1) XdrPointer() interface{} { return v } -func (LedgerHeaderExtensionV1) XdrTypeName() string { return "LedgerHeaderExtensionV1" } -func (v LedgerHeaderExtensionV1) XdrValue() interface{} { return v } -func (v *LedgerHeaderExtensionV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LedgerHeaderExtensionV1) XdrRecurse(x XDR, name string) { +func (v *BucketMetadata) XdrPointer() interface{} { return v } +func (BucketMetadata) XdrTypeName() string { return "BucketMetadata" } +func (v BucketMetadata) XdrValue() interface{} { return v } +func (v *BucketMetadata) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *BucketMetadata) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sflags", name), XDR_Uint32(&v.Flags)) - x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_LedgerHeaderExtensionV1_Ext(&v.Ext)) + x.Marshal(x.Sprintf("%sledgerVersion", name), XDR_Uint32(&v.LedgerVersion)) + x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_BucketMetadata_Ext(&v.Ext)) } -func XDR_LedgerHeaderExtensionV1(v *LedgerHeaderExtensionV1) *LedgerHeaderExtensionV1 { return v } +func XDR_BucketMetadata(v *BucketMetadata) *BucketMetadata { return v } -var _XdrTags_XdrAnon_LedgerHeader_Ext = map[int32]bool{ - XdrToI32(0): true, - XdrToI32(1): true, +var _XdrTags_BucketEntry = map[int32]bool{ + XdrToI32(LIVEENTRY): true, + XdrToI32(INITENTRY): true, + XdrToI32(DEADENTRY): true, + XdrToI32(METAENTRY): true, } -func (_ XdrAnon_LedgerHeader_Ext) XdrValidTags() map[int32]bool { - return _XdrTags_XdrAnon_LedgerHeader_Ext +func (_ BucketEntry) XdrValidTags() map[int32]bool { + return _XdrTags_BucketEntry } -func (u *XdrAnon_LedgerHeader_Ext) V1() *LedgerHeaderExtensionV1 { - switch u.V { - case 1: - if v, ok := u._u.(*LedgerHeaderExtensionV1); ok { +func (u *BucketEntry) LiveEntry() *LedgerEntry { + switch u.Type { + case LIVEENTRY, INITENTRY: + if v, ok := u._u.(*LedgerEntry); ok { return v } else { - var zero LedgerHeaderExtensionV1 + var zero LedgerEntry u._u = &zero return &zero } default: - XdrPanic("XdrAnon_LedgerHeader_Ext.V1 accessed when V == %v", u.V) + XdrPanic("BucketEntry.LiveEntry accessed when Type == %v", u.Type) return nil } } -func (u XdrAnon_LedgerHeader_Ext) XdrValid() bool { - switch u.V { - case 0, 1: +func (u *BucketEntry) DeadEntry() *LedgerKey { + switch u.Type { + case DEADENTRY: + if v, ok := u._u.(*LedgerKey); ok { + return v + } else { + var zero LedgerKey + u._u = &zero + return &zero + } + default: + XdrPanic("BucketEntry.DeadEntry accessed when Type == %v", u.Type) + return nil + } +} +func (u *BucketEntry) MetaEntry() *BucketMetadata { + switch u.Type { + case METAENTRY: + if v, ok := u._u.(*BucketMetadata); ok { + return v + } else { + var zero BucketMetadata + u._u = &zero + return &zero + } + default: + XdrPanic("BucketEntry.MetaEntry accessed when Type == %v", u.Type) + return nil + } +} +func (u BucketEntry) XdrValid() bool { + switch u.Type { + case LIVEENTRY, INITENTRY, DEADENTRY, METAENTRY: return true } return false } -func (u *XdrAnon_LedgerHeader_Ext) XdrUnionTag() XdrNum32 { - return XDR_int32(&u.V) +func (u *BucketEntry) XdrUnionTag() XdrNum32 { + return XDR_BucketEntryType(&u.Type) } -func (u *XdrAnon_LedgerHeader_Ext) XdrUnionTagName() string { - return "V" +func (u *BucketEntry) XdrUnionTagName() string { + return "Type" } -func (u *XdrAnon_LedgerHeader_Ext) XdrUnionBody() XdrType { - switch u.V { - case 0: - return nil - case 1: - return XDR_LedgerHeaderExtensionV1(u.V1()) +func (u *BucketEntry) XdrUnionBody() XdrType { + switch u.Type { + case LIVEENTRY, INITENTRY: + return XDR_LedgerEntry(u.LiveEntry()) + case DEADENTRY: + return XDR_LedgerKey(u.DeadEntry()) + case METAENTRY: + return XDR_BucketMetadata(u.MetaEntry()) } return nil } -func (u *XdrAnon_LedgerHeader_Ext) XdrUnionBodyName() string { - switch u.V { - case 0: - return "" - case 1: - return "V1" +func (u *BucketEntry) XdrUnionBodyName() string { + switch u.Type { + case LIVEENTRY, INITENTRY: + return "LiveEntry" + case DEADENTRY: + return "DeadEntry" + case METAENTRY: + return "MetaEntry" } return "" } -type XdrType_XdrAnon_LedgerHeader_Ext = *XdrAnon_LedgerHeader_Ext +type XdrType_BucketEntry = *BucketEntry -func (v *XdrAnon_LedgerHeader_Ext) XdrPointer() interface{} { return v } -func (XdrAnon_LedgerHeader_Ext) XdrTypeName() string { return "XdrAnon_LedgerHeader_Ext" } -func (v XdrAnon_LedgerHeader_Ext) XdrValue() interface{} { return v } -func (v *XdrAnon_LedgerHeader_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *XdrAnon_LedgerHeader_Ext) XdrRecurse(x XDR, name string) { +func (v *BucketEntry) XdrPointer() interface{} { return v } +func (BucketEntry) XdrTypeName() string { return "BucketEntry" } +func (v BucketEntry) XdrValue() interface{} { return v } +func (v *BucketEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *BucketEntry) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) - switch u.V { - case 0: + XDR_BucketEntryType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case LIVEENTRY, INITENTRY: + x.Marshal(x.Sprintf("%sliveEntry", name), XDR_LedgerEntry(u.LiveEntry())) return - case 1: - x.Marshal(x.Sprintf("%sv1", name), XDR_LedgerHeaderExtensionV1(u.V1())) + case DEADENTRY: + x.Marshal(x.Sprintf("%sdeadEntry", name), XDR_LedgerKey(u.DeadEntry())) + return + case METAENTRY: + x.Marshal(x.Sprintf("%smetaEntry", name), XDR_BucketMetadata(u.MetaEntry())) return } - XdrPanic("invalid V (%v) in XdrAnon_LedgerHeader_Ext", u.V) + XdrPanic("invalid Type (%v) in BucketEntry", u.Type) } -func XDR_XdrAnon_LedgerHeader_Ext(v *XdrAnon_LedgerHeader_Ext) *XdrAnon_LedgerHeader_Ext { return v } +func XDR_BucketEntry(v *BucketEntry) *BucketEntry { return v } -type _XdrArray_4_Hash [4]Hash +var _XdrTags_HotArchiveBucketEntry = map[int32]bool{ + XdrToI32(HOT_ARCHIVE_ARCHIVED): true, + XdrToI32(HOT_ARCHIVE_LIVE): true, + XdrToI32(HOT_ARCHIVE_DELETED): true, + XdrToI32(HOT_ARCHIVE_METAENTRY): true, +} -func (_XdrArray_4_Hash) XdrArraySize() uint32 { - const bound uint32 = 4 // Force error if not const or doesn't fit - return bound +func (_ HotArchiveBucketEntry) XdrValidTags() map[int32]bool { + return _XdrTags_HotArchiveBucketEntry } -func (v *_XdrArray_4_Hash) XdrRecurse(x XDR, name string) { - for i := 0; i < len(*v); i++ { - XDR_Hash(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) +func (u *HotArchiveBucketEntry) ArchivedEntry() *LedgerEntry { + switch u.Type { + case HOT_ARCHIVE_ARCHIVED: + if v, ok := u._u.(*LedgerEntry); ok { + return v + } else { + var zero LedgerEntry + u._u = &zero + return &zero + } + default: + XdrPanic("HotArchiveBucketEntry.ArchivedEntry accessed when Type == %v", u.Type) + return nil } } -func (v *_XdrArray_4_Hash) XdrPointer() interface{} { return (*[4]Hash)(v) } -func (_XdrArray_4_Hash) XdrTypeName() string { return "Hash[]" } -func (v *_XdrArray_4_Hash) XdrValue() interface{} { return v[:] } -func (v *_XdrArray_4_Hash) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_LedgerHeader = *LedgerHeader - -func (v *LedgerHeader) XdrPointer() interface{} { return v } -func (LedgerHeader) XdrTypeName() string { return "LedgerHeader" } -func (v LedgerHeader) XdrValue() interface{} { return v } -func (v *LedgerHeader) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LedgerHeader) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (u *HotArchiveBucketEntry) Key() *LedgerKey { + switch u.Type { + case HOT_ARCHIVE_LIVE, HOT_ARCHIVE_DELETED: + if v, ok := u._u.(*LedgerKey); ok { + return v + } else { + var zero LedgerKey + u._u = &zero + return &zero + } + default: + XdrPanic("HotArchiveBucketEntry.Key accessed when Type == %v", u.Type) + return nil } - x.Marshal(x.Sprintf("%sledgerVersion", name), XDR_Uint32(&v.LedgerVersion)) - x.Marshal(x.Sprintf("%spreviousLedgerHash", name), XDR_Hash(&v.PreviousLedgerHash)) - x.Marshal(x.Sprintf("%sscpValue", name), XDR_StellarValue(&v.ScpValue)) - x.Marshal(x.Sprintf("%stxSetResultHash", name), XDR_Hash(&v.TxSetResultHash)) - x.Marshal(x.Sprintf("%sbucketListHash", name), XDR_Hash(&v.BucketListHash)) - x.Marshal(x.Sprintf("%sledgerSeq", name), XDR_Uint32(&v.LedgerSeq)) - x.Marshal(x.Sprintf("%stotalCoins", name), XDR_Int64(&v.TotalCoins)) - x.Marshal(x.Sprintf("%sfeePool", name), XDR_Int64(&v.FeePool)) - x.Marshal(x.Sprintf("%sinflationSeq", name), XDR_Uint32(&v.InflationSeq)) - x.Marshal(x.Sprintf("%sidPool", name), XDR_Uint64(&v.IdPool)) - x.Marshal(x.Sprintf("%sbaseFee", name), XDR_Uint32(&v.BaseFee)) - x.Marshal(x.Sprintf("%sbaseReserve", name), XDR_Uint32(&v.BaseReserve)) - x.Marshal(x.Sprintf("%smaxTxSetSize", name), XDR_Uint32(&v.MaxTxSetSize)) - x.Marshal(x.Sprintf("%sskipList", name), (*_XdrArray_4_Hash)(&v.SkipList)) - x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_LedgerHeader_Ext(&v.Ext)) } -func XDR_LedgerHeader(v *LedgerHeader) *LedgerHeader { return v } - -var _XdrNames_LedgerUpgradeType = map[int32]string{ - int32(LEDGER_UPGRADE_VERSION): "LEDGER_UPGRADE_VERSION", - int32(LEDGER_UPGRADE_BASE_FEE): "LEDGER_UPGRADE_BASE_FEE", - int32(LEDGER_UPGRADE_MAX_TX_SET_SIZE): "LEDGER_UPGRADE_MAX_TX_SET_SIZE", - int32(LEDGER_UPGRADE_BASE_RESERVE): "LEDGER_UPGRADE_BASE_RESERVE", - int32(LEDGER_UPGRADE_FLAGS): "LEDGER_UPGRADE_FLAGS", - int32(LEDGER_UPGRADE_CONFIG): "LEDGER_UPGRADE_CONFIG", - int32(LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE): "LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE", +func (u *HotArchiveBucketEntry) MetaEntry() *BucketMetadata { + switch u.Type { + case HOT_ARCHIVE_METAENTRY: + if v, ok := u._u.(*BucketMetadata); ok { + return v + } else { + var zero BucketMetadata + u._u = &zero + return &zero + } + default: + XdrPanic("HotArchiveBucketEntry.MetaEntry accessed when Type == %v", u.Type) + return nil + } } -var _XdrValues_LedgerUpgradeType = map[string]int32{ - "LEDGER_UPGRADE_VERSION": int32(LEDGER_UPGRADE_VERSION), - "LEDGER_UPGRADE_BASE_FEE": int32(LEDGER_UPGRADE_BASE_FEE), - "LEDGER_UPGRADE_MAX_TX_SET_SIZE": int32(LEDGER_UPGRADE_MAX_TX_SET_SIZE), - "LEDGER_UPGRADE_BASE_RESERVE": int32(LEDGER_UPGRADE_BASE_RESERVE), - "LEDGER_UPGRADE_FLAGS": int32(LEDGER_UPGRADE_FLAGS), - "LEDGER_UPGRADE_CONFIG": int32(LEDGER_UPGRADE_CONFIG), - "LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE": int32(LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE), +func (u HotArchiveBucketEntry) XdrValid() bool { + switch u.Type { + case HOT_ARCHIVE_ARCHIVED, HOT_ARCHIVE_LIVE, HOT_ARCHIVE_DELETED, HOT_ARCHIVE_METAENTRY: + return true + } + return false } - -func (LedgerUpgradeType) XdrEnumNames() map[int32]string { - return _XdrNames_LedgerUpgradeType +func (u *HotArchiveBucketEntry) XdrUnionTag() XdrNum32 { + return XDR_HotArchiveBucketEntryType(&u.Type) } -func (v LedgerUpgradeType) String() string { - if s, ok := _XdrNames_LedgerUpgradeType[int32(v)]; ok { - return s +func (u *HotArchiveBucketEntry) XdrUnionTagName() string { + return "Type" +} +func (u *HotArchiveBucketEntry) XdrUnionBody() XdrType { + switch u.Type { + case HOT_ARCHIVE_ARCHIVED: + return XDR_LedgerEntry(u.ArchivedEntry()) + case HOT_ARCHIVE_LIVE, HOT_ARCHIVE_DELETED: + return XDR_LedgerKey(u.Key()) + case HOT_ARCHIVE_METAENTRY: + return XDR_BucketMetadata(u.MetaEntry()) } - return fmt.Sprintf("LedgerUpgradeType#%d", v) + return nil } -func (v *LedgerUpgradeType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_LedgerUpgradeType[stok]; ok { - *v = LedgerUpgradeType(val) - return nil - } else if stok == "LedgerUpgradeType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } - } - return XdrError(fmt.Sprintf("%s is not a valid LedgerUpgradeType.", stok)) +func (u *HotArchiveBucketEntry) XdrUnionBodyName() string { + switch u.Type { + case HOT_ARCHIVE_ARCHIVED: + return "ArchivedEntry" + case HOT_ARCHIVE_LIVE, HOT_ARCHIVE_DELETED: + return "Key" + case HOT_ARCHIVE_METAENTRY: + return "MetaEntry" } + return "" } -func (v LedgerUpgradeType) GetU32() uint32 { return uint32(v) } -func (v *LedgerUpgradeType) SetU32(n uint32) { *v = LedgerUpgradeType(n) } -func (v *LedgerUpgradeType) XdrPointer() interface{} { return v } -func (LedgerUpgradeType) XdrTypeName() string { return "LedgerUpgradeType" } -func (v LedgerUpgradeType) XdrValue() interface{} { return v } -func (v *LedgerUpgradeType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_LedgerUpgradeType = *LedgerUpgradeType +type XdrType_HotArchiveBucketEntry = *HotArchiveBucketEntry -func XDR_LedgerUpgradeType(v *LedgerUpgradeType) *LedgerUpgradeType { return v } -func (v *LedgerUpgradeType) XdrInitialize() { - switch LedgerUpgradeType(0) { - case LEDGER_UPGRADE_VERSION, LEDGER_UPGRADE_BASE_FEE, LEDGER_UPGRADE_MAX_TX_SET_SIZE, LEDGER_UPGRADE_BASE_RESERVE, LEDGER_UPGRADE_FLAGS, LEDGER_UPGRADE_CONFIG, LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: - default: - if *v == LedgerUpgradeType(0) { - *v = LEDGER_UPGRADE_VERSION - } +func (v *HotArchiveBucketEntry) XdrPointer() interface{} { return v } +func (HotArchiveBucketEntry) XdrTypeName() string { return "HotArchiveBucketEntry" } +func (v HotArchiveBucketEntry) XdrValue() interface{} { return v } +func (v *HotArchiveBucketEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *HotArchiveBucketEntry) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_HotArchiveBucketEntryType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case HOT_ARCHIVE_ARCHIVED: + x.Marshal(x.Sprintf("%sarchivedEntry", name), XDR_LedgerEntry(u.ArchivedEntry())) + return + case HOT_ARCHIVE_LIVE, HOT_ARCHIVE_DELETED: + x.Marshal(x.Sprintf("%skey", name), XDR_LedgerKey(u.Key())) + return + case HOT_ARCHIVE_METAENTRY: + x.Marshal(x.Sprintf("%smetaEntry", name), XDR_BucketMetadata(u.MetaEntry())) + return } + XdrPanic("invalid Type (%v) in HotArchiveBucketEntry", u.Type) } +func XDR_HotArchiveBucketEntry(v *HotArchiveBucketEntry) *HotArchiveBucketEntry { return v } -type XdrType_ConfigUpgradeSetKey = *ConfigUpgradeSetKey +type XdrType_ColdArchiveArchivedLeaf = *ColdArchiveArchivedLeaf -func (v *ConfigUpgradeSetKey) XdrPointer() interface{} { return v } -func (ConfigUpgradeSetKey) XdrTypeName() string { return "ConfigUpgradeSetKey" } -func (v ConfigUpgradeSetKey) XdrValue() interface{} { return v } -func (v *ConfigUpgradeSetKey) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ConfigUpgradeSetKey) XdrRecurse(x XDR, name string) { +func (v *ColdArchiveArchivedLeaf) XdrPointer() interface{} { return v } +func (ColdArchiveArchivedLeaf) XdrTypeName() string { return "ColdArchiveArchivedLeaf" } +func (v ColdArchiveArchivedLeaf) XdrValue() interface{} { return v } +func (v *ColdArchiveArchivedLeaf) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ColdArchiveArchivedLeaf) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%scontractID", name), XDR_Hash(&v.ContractID)) - x.Marshal(x.Sprintf("%scontentHash", name), XDR_Hash(&v.ContentHash)) + x.Marshal(x.Sprintf("%sindex", name), XDR_Uint32(&v.Index)) + x.Marshal(x.Sprintf("%sarchivedEntry", name), XDR_LedgerEntry(&v.ArchivedEntry)) } -func XDR_ConfigUpgradeSetKey(v *ConfigUpgradeSetKey) *ConfigUpgradeSetKey { return v } +func XDR_ColdArchiveArchivedLeaf(v *ColdArchiveArchivedLeaf) *ColdArchiveArchivedLeaf { return v } -var _XdrTags_LedgerUpgrade = map[int32]bool{ - XdrToI32(LEDGER_UPGRADE_VERSION): true, - XdrToI32(LEDGER_UPGRADE_BASE_FEE): true, - XdrToI32(LEDGER_UPGRADE_MAX_TX_SET_SIZE): true, - XdrToI32(LEDGER_UPGRADE_BASE_RESERVE): true, - XdrToI32(LEDGER_UPGRADE_FLAGS): true, - XdrToI32(LEDGER_UPGRADE_CONFIG): true, - XdrToI32(LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE): true, -} +type XdrType_ColdArchiveDeletedLeaf = *ColdArchiveDeletedLeaf -func (_ LedgerUpgrade) XdrValidTags() map[int32]bool { - return _XdrTags_LedgerUpgrade +func (v *ColdArchiveDeletedLeaf) XdrPointer() interface{} { return v } +func (ColdArchiveDeletedLeaf) XdrTypeName() string { return "ColdArchiveDeletedLeaf" } +func (v ColdArchiveDeletedLeaf) XdrValue() interface{} { return v } +func (v *ColdArchiveDeletedLeaf) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ColdArchiveDeletedLeaf) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sindex", name), XDR_Uint32(&v.Index)) + x.Marshal(x.Sprintf("%sdeletedKey", name), XDR_LedgerKey(&v.DeletedKey)) } +func XDR_ColdArchiveDeletedLeaf(v *ColdArchiveDeletedLeaf) *ColdArchiveDeletedLeaf { return v } -// update ledgerVersion -func (u *LedgerUpgrade) NewLedgerVersion() *Uint32 { - switch u.Type { - case LEDGER_UPGRADE_VERSION: - if v, ok := u._u.(*Uint32); ok { - return v - } else { - var zero Uint32 - u._u = &zero - return &zero - } - default: - XdrPanic("LedgerUpgrade.NewLedgerVersion accessed when Type == %v", u.Type) - return nil +type XdrType_ColdArchiveBoundaryLeaf = *ColdArchiveBoundaryLeaf + +func (v *ColdArchiveBoundaryLeaf) XdrPointer() interface{} { return v } +func (ColdArchiveBoundaryLeaf) XdrTypeName() string { return "ColdArchiveBoundaryLeaf" } +func (v ColdArchiveBoundaryLeaf) XdrValue() interface{} { return v } +func (v *ColdArchiveBoundaryLeaf) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ColdArchiveBoundaryLeaf) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%sindex", name), XDR_Uint32(&v.Index)) + x.Marshal(x.Sprintf("%sisLowerBound", name), XDR_bool(&v.IsLowerBound)) } +func XDR_ColdArchiveBoundaryLeaf(v *ColdArchiveBoundaryLeaf) *ColdArchiveBoundaryLeaf { return v } -// update baseFee -func (u *LedgerUpgrade) NewBaseFee() *Uint32 { - switch u.Type { - case LEDGER_UPGRADE_BASE_FEE: - if v, ok := u._u.(*Uint32); ok { - return v - } else { - var zero Uint32 - u._u = &zero - return &zero - } - default: - XdrPanic("LedgerUpgrade.NewBaseFee accessed when Type == %v", u.Type) - return nil +type XdrType_ColdArchiveHashEntry = *ColdArchiveHashEntry + +func (v *ColdArchiveHashEntry) XdrPointer() interface{} { return v } +func (ColdArchiveHashEntry) XdrTypeName() string { return "ColdArchiveHashEntry" } +func (v ColdArchiveHashEntry) XdrValue() interface{} { return v } +func (v *ColdArchiveHashEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ColdArchiveHashEntry) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%sindex", name), XDR_Uint32(&v.Index)) + x.Marshal(x.Sprintf("%slevel", name), XDR_Uint32(&v.Level)) + x.Marshal(x.Sprintf("%shash", name), XDR_Hash(&v.Hash)) } +func XDR_ColdArchiveHashEntry(v *ColdArchiveHashEntry) *ColdArchiveHashEntry { return v } -// update maxTxSetSize -func (u *LedgerUpgrade) NewMaxTxSetSize() *Uint32 { +var _XdrTags_ColdArchiveBucketEntry = map[int32]bool{ + XdrToI32(COLD_ARCHIVE_METAENTRY): true, + XdrToI32(COLD_ARCHIVE_ARCHIVED_LEAF): true, + XdrToI32(COLD_ARCHIVE_DELETED_LEAF): true, + XdrToI32(COLD_ARCHIVE_BOUNDARY_LEAF): true, + XdrToI32(COLD_ARCHIVE_HASH): true, +} + +func (_ ColdArchiveBucketEntry) XdrValidTags() map[int32]bool { + return _XdrTags_ColdArchiveBucketEntry +} +func (u *ColdArchiveBucketEntry) MetaEntry() *BucketMetadata { switch u.Type { - case LEDGER_UPGRADE_MAX_TX_SET_SIZE: - if v, ok := u._u.(*Uint32); ok { + case COLD_ARCHIVE_METAENTRY: + if v, ok := u._u.(*BucketMetadata); ok { return v } else { - var zero Uint32 + var zero BucketMetadata u._u = &zero return &zero } default: - XdrPanic("LedgerUpgrade.NewMaxTxSetSize accessed when Type == %v", u.Type) + XdrPanic("ColdArchiveBucketEntry.MetaEntry accessed when Type == %v", u.Type) return nil } } - -// update baseReserve -func (u *LedgerUpgrade) NewBaseReserve() *Uint32 { +func (u *ColdArchiveBucketEntry) ArchivedLeaf() *ColdArchiveArchivedLeaf { switch u.Type { - case LEDGER_UPGRADE_BASE_RESERVE: - if v, ok := u._u.(*Uint32); ok { + case COLD_ARCHIVE_ARCHIVED_LEAF: + if v, ok := u._u.(*ColdArchiveArchivedLeaf); ok { return v } else { - var zero Uint32 + var zero ColdArchiveArchivedLeaf u._u = &zero return &zero } default: - XdrPanic("LedgerUpgrade.NewBaseReserve accessed when Type == %v", u.Type) + XdrPanic("ColdArchiveBucketEntry.ArchivedLeaf accessed when Type == %v", u.Type) return nil } } - -// update flags -func (u *LedgerUpgrade) NewFlags() *Uint32 { +func (u *ColdArchiveBucketEntry) DeletedLeaf() *ColdArchiveDeletedLeaf { switch u.Type { - case LEDGER_UPGRADE_FLAGS: - if v, ok := u._u.(*Uint32); ok { + case COLD_ARCHIVE_DELETED_LEAF: + if v, ok := u._u.(*ColdArchiveDeletedLeaf); ok { return v } else { - var zero Uint32 + var zero ColdArchiveDeletedLeaf u._u = &zero return &zero } default: - XdrPanic("LedgerUpgrade.NewFlags accessed when Type == %v", u.Type) + XdrPanic("ColdArchiveBucketEntry.DeletedLeaf accessed when Type == %v", u.Type) return nil } } - -// Update arbitrary `ConfigSetting` entries identified by the key. -func (u *LedgerUpgrade) NewConfig() *ConfigUpgradeSetKey { +func (u *ColdArchiveBucketEntry) BoundaryLeaf() *ColdArchiveBoundaryLeaf { switch u.Type { - case LEDGER_UPGRADE_CONFIG: - if v, ok := u._u.(*ConfigUpgradeSetKey); ok { + case COLD_ARCHIVE_BOUNDARY_LEAF: + if v, ok := u._u.(*ColdArchiveBoundaryLeaf); ok { return v } else { - var zero ConfigUpgradeSetKey + var zero ColdArchiveBoundaryLeaf u._u = &zero return &zero } default: - XdrPanic("LedgerUpgrade.NewConfig accessed when Type == %v", u.Type) + XdrPanic("ColdArchiveBucketEntry.BoundaryLeaf accessed when Type == %v", u.Type) return nil } } - -// Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without -// using `LEDGER_UPGRADE_CONFIG`. -func (u *LedgerUpgrade) NewMaxSorobanTxSetSize() *Uint32 { +func (u *ColdArchiveBucketEntry) HashEntry() *ColdArchiveHashEntry { switch u.Type { - case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: - if v, ok := u._u.(*Uint32); ok { + case COLD_ARCHIVE_HASH: + if v, ok := u._u.(*ColdArchiveHashEntry); ok { return v } else { - var zero Uint32 + var zero ColdArchiveHashEntry u._u = &zero return &zero } default: - XdrPanic("LedgerUpgrade.NewMaxSorobanTxSetSize accessed when Type == %v", u.Type) + XdrPanic("ColdArchiveBucketEntry.HashEntry accessed when Type == %v", u.Type) return nil } } -func (u LedgerUpgrade) XdrValid() bool { +func (u ColdArchiveBucketEntry) XdrValid() bool { switch u.Type { - case LEDGER_UPGRADE_VERSION, LEDGER_UPGRADE_BASE_FEE, LEDGER_UPGRADE_MAX_TX_SET_SIZE, LEDGER_UPGRADE_BASE_RESERVE, LEDGER_UPGRADE_FLAGS, LEDGER_UPGRADE_CONFIG, LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + case COLD_ARCHIVE_METAENTRY, COLD_ARCHIVE_ARCHIVED_LEAF, COLD_ARCHIVE_DELETED_LEAF, COLD_ARCHIVE_BOUNDARY_LEAF, COLD_ARCHIVE_HASH: return true } return false } -func (u *LedgerUpgrade) XdrUnionTag() XdrNum32 { - return XDR_LedgerUpgradeType(&u.Type) +func (u *ColdArchiveBucketEntry) XdrUnionTag() XdrNum32 { + return XDR_ColdArchiveBucketEntryType(&u.Type) } -func (u *LedgerUpgrade) XdrUnionTagName() string { +func (u *ColdArchiveBucketEntry) XdrUnionTagName() string { return "Type" } -func (u *LedgerUpgrade) XdrUnionBody() XdrType { +func (u *ColdArchiveBucketEntry) XdrUnionBody() XdrType { switch u.Type { - case LEDGER_UPGRADE_VERSION: - return XDR_Uint32(u.NewLedgerVersion()) - case LEDGER_UPGRADE_BASE_FEE: - return XDR_Uint32(u.NewBaseFee()) - case LEDGER_UPGRADE_MAX_TX_SET_SIZE: - return XDR_Uint32(u.NewMaxTxSetSize()) - case LEDGER_UPGRADE_BASE_RESERVE: - return XDR_Uint32(u.NewBaseReserve()) - case LEDGER_UPGRADE_FLAGS: - return XDR_Uint32(u.NewFlags()) - case LEDGER_UPGRADE_CONFIG: - return XDR_ConfigUpgradeSetKey(u.NewConfig()) - case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: - return XDR_Uint32(u.NewMaxSorobanTxSetSize()) + case COLD_ARCHIVE_METAENTRY: + return XDR_BucketMetadata(u.MetaEntry()) + case COLD_ARCHIVE_ARCHIVED_LEAF: + return XDR_ColdArchiveArchivedLeaf(u.ArchivedLeaf()) + case COLD_ARCHIVE_DELETED_LEAF: + return XDR_ColdArchiveDeletedLeaf(u.DeletedLeaf()) + case COLD_ARCHIVE_BOUNDARY_LEAF: + return XDR_ColdArchiveBoundaryLeaf(u.BoundaryLeaf()) + case COLD_ARCHIVE_HASH: + return XDR_ColdArchiveHashEntry(u.HashEntry()) } return nil } -func (u *LedgerUpgrade) XdrUnionBodyName() string { +func (u *ColdArchiveBucketEntry) XdrUnionBodyName() string { switch u.Type { - case LEDGER_UPGRADE_VERSION: - return "NewLedgerVersion" - case LEDGER_UPGRADE_BASE_FEE: - return "NewBaseFee" - case LEDGER_UPGRADE_MAX_TX_SET_SIZE: - return "NewMaxTxSetSize" - case LEDGER_UPGRADE_BASE_RESERVE: - return "NewBaseReserve" - case LEDGER_UPGRADE_FLAGS: - return "NewFlags" - case LEDGER_UPGRADE_CONFIG: - return "NewConfig" - case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: - return "NewMaxSorobanTxSetSize" + case COLD_ARCHIVE_METAENTRY: + return "MetaEntry" + case COLD_ARCHIVE_ARCHIVED_LEAF: + return "ArchivedLeaf" + case COLD_ARCHIVE_DELETED_LEAF: + return "DeletedLeaf" + case COLD_ARCHIVE_BOUNDARY_LEAF: + return "BoundaryLeaf" + case COLD_ARCHIVE_HASH: + return "HashEntry" } return "" } -type XdrType_LedgerUpgrade = *LedgerUpgrade +type XdrType_ColdArchiveBucketEntry = *ColdArchiveBucketEntry -func (v *LedgerUpgrade) XdrPointer() interface{} { return v } -func (LedgerUpgrade) XdrTypeName() string { return "LedgerUpgrade" } -func (v LedgerUpgrade) XdrValue() interface{} { return v } -func (v *LedgerUpgrade) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *LedgerUpgrade) XdrRecurse(x XDR, name string) { +func (v *ColdArchiveBucketEntry) XdrPointer() interface{} { return v } +func (ColdArchiveBucketEntry) XdrTypeName() string { return "ColdArchiveBucketEntry" } +func (v ColdArchiveBucketEntry) XdrValue() interface{} { return v } +func (v *ColdArchiveBucketEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *ColdArchiveBucketEntry) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_LedgerUpgradeType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + XDR_ColdArchiveBucketEntryType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) switch u.Type { - case LEDGER_UPGRADE_VERSION: - x.Marshal(x.Sprintf("%snewLedgerVersion", name), XDR_Uint32(u.NewLedgerVersion())) - return - case LEDGER_UPGRADE_BASE_FEE: - x.Marshal(x.Sprintf("%snewBaseFee", name), XDR_Uint32(u.NewBaseFee())) - return - case LEDGER_UPGRADE_MAX_TX_SET_SIZE: - x.Marshal(x.Sprintf("%snewMaxTxSetSize", name), XDR_Uint32(u.NewMaxTxSetSize())) + case COLD_ARCHIVE_METAENTRY: + x.Marshal(x.Sprintf("%smetaEntry", name), XDR_BucketMetadata(u.MetaEntry())) return - case LEDGER_UPGRADE_BASE_RESERVE: - x.Marshal(x.Sprintf("%snewBaseReserve", name), XDR_Uint32(u.NewBaseReserve())) + case COLD_ARCHIVE_ARCHIVED_LEAF: + x.Marshal(x.Sprintf("%sarchivedLeaf", name), XDR_ColdArchiveArchivedLeaf(u.ArchivedLeaf())) return - case LEDGER_UPGRADE_FLAGS: - x.Marshal(x.Sprintf("%snewFlags", name), XDR_Uint32(u.NewFlags())) + case COLD_ARCHIVE_DELETED_LEAF: + x.Marshal(x.Sprintf("%sdeletedLeaf", name), XDR_ColdArchiveDeletedLeaf(u.DeletedLeaf())) return - case LEDGER_UPGRADE_CONFIG: - x.Marshal(x.Sprintf("%snewConfig", name), XDR_ConfigUpgradeSetKey(u.NewConfig())) + case COLD_ARCHIVE_BOUNDARY_LEAF: + x.Marshal(x.Sprintf("%sboundaryLeaf", name), XDR_ColdArchiveBoundaryLeaf(u.BoundaryLeaf())) return - case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: - x.Marshal(x.Sprintf("%snewMaxSorobanTxSetSize", name), XDR_Uint32(u.NewMaxSorobanTxSetSize())) + case COLD_ARCHIVE_HASH: + x.Marshal(x.Sprintf("%shashEntry", name), XDR_ColdArchiveHashEntry(u.HashEntry())) return } - XdrPanic("invalid Type (%v) in LedgerUpgrade", u.Type) + XdrPanic("invalid Type (%v) in ColdArchiveBucketEntry", u.Type) } -func (v *LedgerUpgrade) XdrInitialize() { - var zero LedgerUpgradeType - switch zero { - case LEDGER_UPGRADE_VERSION, LEDGER_UPGRADE_BASE_FEE, LEDGER_UPGRADE_MAX_TX_SET_SIZE, LEDGER_UPGRADE_BASE_RESERVE, LEDGER_UPGRADE_FLAGS, LEDGER_UPGRADE_CONFIG, LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: - default: - if v.Type == zero { - v.Type = LEDGER_UPGRADE_VERSION - } - } +func XDR_ColdArchiveBucketEntry(v *ColdArchiveBucketEntry) *ColdArchiveBucketEntry { return v } + +type XdrType_UpgradeType struct { + XdrVecOpaque } -func XDR_LedgerUpgrade(v *LedgerUpgrade) *LedgerUpgrade { return v } -type _XdrVec_unbounded_ConfigSettingEntry []ConfigSettingEntry +func XDR_UpgradeType(v *UpgradeType) XdrType_UpgradeType { + return XdrType_UpgradeType{XdrVecOpaque{v, 128}} +} +func (XdrType_UpgradeType) XdrTypeName() string { return "UpgradeType" } +func (v XdrType_UpgradeType) XdrUnwrap() XdrType { return v.XdrVecOpaque } -func (_XdrVec_unbounded_ConfigSettingEntry) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound +var _XdrNames_StellarValueType = map[int32]string{ + int32(STELLAR_VALUE_BASIC): "STELLAR_VALUE_BASIC", + int32(STELLAR_VALUE_SIGNED): "STELLAR_VALUE_SIGNED", } -func (_XdrVec_unbounded_ConfigSettingEntry) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_ConfigSettingEntry length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_ConfigSettingEntry length %d exceeds max int", length) - } +var _XdrValues_StellarValueType = map[string]int32{ + "STELLAR_VALUE_BASIC": int32(STELLAR_VALUE_BASIC), + "STELLAR_VALUE_SIGNED": int32(STELLAR_VALUE_SIGNED), } -func (v _XdrVec_unbounded_ConfigSettingEntry) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_ConfigSettingEntry) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) + +func (StellarValueType) XdrEnumNames() map[int32]string { + return _XdrNames_StellarValueType +} +func (v StellarValueType) String() string { + if s, ok := _XdrNames_StellarValueType[int32(v)]; ok { + return s } - nv := make([]ConfigSettingEntry, int(length), newcap) - copy(nv, *v) - *v = nv + return fmt.Sprintf("StellarValueType#%d", v) } -func (v *_XdrVec_unbounded_ConfigSettingEntry) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) +func (v *StellarValueType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_StellarValueType[stok]; ok { + *v = StellarValueType(val) + return nil + } else if stok == "StellarValueType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } } - XDR_ConfigSettingEntry(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] + return XdrError(fmt.Sprintf("%s is not a valid StellarValueType.", stok)) } } -func (v *_XdrVec_unbounded_ConfigSettingEntry) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) -} -func (_XdrVec_unbounded_ConfigSettingEntry) XdrTypeName() string { return "ConfigSettingEntry<>" } -func (v *_XdrVec_unbounded_ConfigSettingEntry) XdrPointer() interface{} { - return (*[]ConfigSettingEntry)(v) -} -func (v _XdrVec_unbounded_ConfigSettingEntry) XdrValue() interface{} { - return ([]ConfigSettingEntry)(v) -} -func (v *_XdrVec_unbounded_ConfigSettingEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v StellarValueType) GetU32() uint32 { return uint32(v) } +func (v *StellarValueType) SetU32(n uint32) { *v = StellarValueType(n) } +func (v *StellarValueType) XdrPointer() interface{} { return v } +func (StellarValueType) XdrTypeName() string { return "StellarValueType" } +func (v StellarValueType) XdrValue() interface{} { return v } +func (v *StellarValueType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_ConfigUpgradeSet = *ConfigUpgradeSet +type XdrType_StellarValueType = *StellarValueType -func (v *ConfigUpgradeSet) XdrPointer() interface{} { return v } -func (ConfigUpgradeSet) XdrTypeName() string { return "ConfigUpgradeSet" } -func (v ConfigUpgradeSet) XdrValue() interface{} { return v } -func (v *ConfigUpgradeSet) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ConfigUpgradeSet) XdrRecurse(x XDR, name string) { +func XDR_StellarValueType(v *StellarValueType) *StellarValueType { return v } + +type XdrType_LedgerCloseValueSignature = *LedgerCloseValueSignature + +func (v *LedgerCloseValueSignature) XdrPointer() interface{} { return v } +func (LedgerCloseValueSignature) XdrTypeName() string { return "LedgerCloseValueSignature" } +func (v LedgerCloseValueSignature) XdrValue() interface{} { return v } +func (v *LedgerCloseValueSignature) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerCloseValueSignature) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%supdatedEntry", name), (*_XdrVec_unbounded_ConfigSettingEntry)(&v.UpdatedEntry)) + x.Marshal(x.Sprintf("%snodeID", name), XDR_NodeID(&v.NodeID)) + x.Marshal(x.Sprintf("%ssignature", name), XDR_Signature(&v.Signature)) } -func XDR_ConfigUpgradeSet(v *ConfigUpgradeSet) *ConfigUpgradeSet { return v } +func XDR_LedgerCloseValueSignature(v *LedgerCloseValueSignature) *LedgerCloseValueSignature { return v } -var _XdrNames_BucketEntryType = map[int32]string{ - int32(METAENTRY): "METAENTRY", - int32(LIVEENTRY): "LIVEENTRY", - int32(DEADENTRY): "DEADENTRY", - int32(INITENTRY): "INITENTRY", -} -var _XdrValues_BucketEntryType = map[string]int32{ - "METAENTRY": int32(METAENTRY), - "LIVEENTRY": int32(LIVEENTRY), - "DEADENTRY": int32(DEADENTRY), - "INITENTRY": int32(INITENTRY), +var _XdrTags_XdrAnon_StellarValue_Ext = map[int32]bool{ + XdrToI32(STELLAR_VALUE_BASIC): true, + XdrToI32(STELLAR_VALUE_SIGNED): true, } -func (BucketEntryType) XdrEnumNames() map[int32]string { - return _XdrNames_BucketEntryType -} -func (v BucketEntryType) String() string { - if s, ok := _XdrNames_BucketEntryType[int32(v)]; ok { - return s - } - return fmt.Sprintf("BucketEntryType#%d", v) +func (_ XdrAnon_StellarValue_Ext) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_StellarValue_Ext } -func (v *BucketEntryType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_BucketEntryType[stok]; ok { - *v = BucketEntryType(val) - return nil - } else if stok == "BucketEntryType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } +func (u *XdrAnon_StellarValue_Ext) LcValueSignature() *LedgerCloseValueSignature { + switch u.V { + case STELLAR_VALUE_SIGNED: + if v, ok := u._u.(*LedgerCloseValueSignature); ok { + return v + } else { + var zero LedgerCloseValueSignature + u._u = &zero + return &zero } - return XdrError(fmt.Sprintf("%s is not a valid BucketEntryType.", stok)) + default: + XdrPanic("XdrAnon_StellarValue_Ext.LcValueSignature accessed when V == %v", u.V) + return nil } } -func (v BucketEntryType) GetU32() uint32 { return uint32(v) } -func (v *BucketEntryType) SetU32(n uint32) { *v = BucketEntryType(n) } -func (v *BucketEntryType) XdrPointer() interface{} { return v } -func (BucketEntryType) XdrTypeName() string { return "BucketEntryType" } -func (v BucketEntryType) XdrValue() interface{} { return v } -func (v *BucketEntryType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_BucketEntryType = *BucketEntryType - -func XDR_BucketEntryType(v *BucketEntryType) *BucketEntryType { return v } - -var _XdrComments_BucketEntryType = map[int32]string{ - int32(METAENTRY): "At-and-after protocol 11: bucket metadata, should come first.", - int32(LIVEENTRY): "Before protocol 11: created-or-updated;", - int32(DEADENTRY): "At-and-after protocol 11: only updated.", - int32(INITENTRY): "At-and-after protocol 11: only created.", -} - -func (e BucketEntryType) XdrEnumComments() map[int32]string { - return _XdrComments_BucketEntryType -} - -var _XdrTags_XdrAnon_BucketMetadata_Ext = map[int32]bool{ - XdrToI32(0): true, -} - -func (_ XdrAnon_BucketMetadata_Ext) XdrValidTags() map[int32]bool { - return _XdrTags_XdrAnon_BucketMetadata_Ext -} -func (u XdrAnon_BucketMetadata_Ext) XdrValid() bool { +func (u XdrAnon_StellarValue_Ext) XdrValid() bool { switch u.V { - case 0: + case STELLAR_VALUE_BASIC, STELLAR_VALUE_SIGNED: return true } return false } -func (u *XdrAnon_BucketMetadata_Ext) XdrUnionTag() XdrNum32 { - return XDR_int32(&u.V) +func (u *XdrAnon_StellarValue_Ext) XdrUnionTag() XdrNum32 { + return XDR_StellarValueType(&u.V) } -func (u *XdrAnon_BucketMetadata_Ext) XdrUnionTagName() string { +func (u *XdrAnon_StellarValue_Ext) XdrUnionTagName() string { return "V" } -func (u *XdrAnon_BucketMetadata_Ext) XdrUnionBody() XdrType { +func (u *XdrAnon_StellarValue_Ext) XdrUnionBody() XdrType { switch u.V { - case 0: + case STELLAR_VALUE_BASIC: return nil + case STELLAR_VALUE_SIGNED: + return XDR_LedgerCloseValueSignature(u.LcValueSignature()) } return nil } -func (u *XdrAnon_BucketMetadata_Ext) XdrUnionBodyName() string { +func (u *XdrAnon_StellarValue_Ext) XdrUnionBodyName() string { switch u.V { - case 0: + case STELLAR_VALUE_BASIC: return "" + case STELLAR_VALUE_SIGNED: + return "LcValueSignature" } return "" } -type XdrType_XdrAnon_BucketMetadata_Ext = *XdrAnon_BucketMetadata_Ext +type XdrType_XdrAnon_StellarValue_Ext = *XdrAnon_StellarValue_Ext -func (v *XdrAnon_BucketMetadata_Ext) XdrPointer() interface{} { return v } -func (XdrAnon_BucketMetadata_Ext) XdrTypeName() string { return "XdrAnon_BucketMetadata_Ext" } -func (v XdrAnon_BucketMetadata_Ext) XdrValue() interface{} { return v } -func (v *XdrAnon_BucketMetadata_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *XdrAnon_BucketMetadata_Ext) XdrRecurse(x XDR, name string) { +func (v *XdrAnon_StellarValue_Ext) XdrPointer() interface{} { return v } +func (XdrAnon_StellarValue_Ext) XdrTypeName() string { return "XdrAnon_StellarValue_Ext" } +func (v XdrAnon_StellarValue_Ext) XdrValue() interface{} { return v } +func (v *XdrAnon_StellarValue_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_StellarValue_Ext) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + XDR_StellarValueType(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) switch u.V { - case 0: + case STELLAR_VALUE_BASIC: + return + case STELLAR_VALUE_SIGNED: + x.Marshal(x.Sprintf("%slcValueSignature", name), XDR_LedgerCloseValueSignature(u.LcValueSignature())) return } - XdrPanic("invalid V (%v) in XdrAnon_BucketMetadata_Ext", u.V) -} -func XDR_XdrAnon_BucketMetadata_Ext(v *XdrAnon_BucketMetadata_Ext) *XdrAnon_BucketMetadata_Ext { - return v + XdrPanic("invalid V (%v) in XdrAnon_StellarValue_Ext", u.V) } +func XDR_XdrAnon_StellarValue_Ext(v *XdrAnon_StellarValue_Ext) *XdrAnon_StellarValue_Ext { return v } -type XdrType_BucketMetadata = *BucketMetadata - -func (v *BucketMetadata) XdrPointer() interface{} { return v } -func (BucketMetadata) XdrTypeName() string { return "BucketMetadata" } -func (v BucketMetadata) XdrValue() interface{} { return v } -func (v *BucketMetadata) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *BucketMetadata) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sledgerVersion", name), XDR_Uint32(&v.LedgerVersion)) - x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_BucketMetadata_Ext(&v.Ext)) -} -func XDR_BucketMetadata(v *BucketMetadata) *BucketMetadata { return v } +type _XdrVec_6_UpgradeType []UpgradeType -var _XdrTags_BucketEntry = map[int32]bool{ - XdrToI32(LIVEENTRY): true, - XdrToI32(INITENTRY): true, - XdrToI32(DEADENTRY): true, - XdrToI32(METAENTRY): true, +func (_XdrVec_6_UpgradeType) XdrBound() uint32 { + const bound uint32 = 6 // Force error if not const or doesn't fit + return bound } - -func (_ BucketEntry) XdrValidTags() map[int32]bool { - return _XdrTags_BucketEntry +func (_XdrVec_6_UpgradeType) XdrCheckLen(length uint32) { + if length > uint32(6) { + XdrPanic("_XdrVec_6_UpgradeType length %d exceeds bound 6", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_6_UpgradeType length %d exceeds max int", length) + } } -func (u *BucketEntry) LiveEntry() *LedgerEntry { - switch u.Type { - case LIVEENTRY, INITENTRY: - if v, ok := u._u.(*LedgerEntry); ok { - return v - } else { - var zero LedgerEntry - u._u = &zero - return &zero +func (v _XdrVec_6_UpgradeType) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_6_UpgradeType) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] } - default: - XdrPanic("BucketEntry.LiveEntry accessed when Type == %v", u.Type) - return nil + return } -} -func (u *BucketEntry) DeadEntry() *LedgerKey { - switch u.Type { - case DEADENTRY: - if v, ok := u._u.(*LedgerKey); ok { - return v - } else { - var zero LedgerKey - u._u = &zero - return &zero + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(6); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 } - default: - XdrPanic("BucketEntry.DeadEntry accessed when Type == %v", u.Type) - return nil + newcap = int(bound) } + nv := make([]UpgradeType, int(length), newcap) + copy(nv, *v) + *v = nv } -func (u *BucketEntry) MetaEntry() *BucketMetadata { - switch u.Type { - case METAENTRY: - if v, ok := u._u.(*BucketMetadata); ok { - return v - } else { - var zero BucketMetadata - u._u = &zero - return &zero +func (v *_XdrVec_6_UpgradeType) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) } - default: - XdrPanic("BucketEntry.MetaEntry accessed when Type == %v", u.Type) - return nil + XDR_UpgradeType(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } -} -func (u BucketEntry) XdrValid() bool { - switch u.Type { - case LIVEENTRY, INITENTRY, DEADENTRY, METAENTRY: - return true + if int(n) < len(*v) { + *v = (*v)[:int(n)] } - return false -} -func (u *BucketEntry) XdrUnionTag() XdrNum32 { - return XDR_BucketEntryType(&u.Type) } -func (u *BucketEntry) XdrUnionTagName() string { - return "Type" -} -func (u *BucketEntry) XdrUnionBody() XdrType { - switch u.Type { - case LIVEENTRY, INITENTRY: - return XDR_LedgerEntry(u.LiveEntry()) - case DEADENTRY: - return XDR_LedgerKey(u.DeadEntry()) - case METAENTRY: - return XDR_BucketMetadata(u.MetaEntry()) - } - return nil -} -func (u *BucketEntry) XdrUnionBodyName() string { - switch u.Type { - case LIVEENTRY, INITENTRY: - return "LiveEntry" - case DEADENTRY: - return "DeadEntry" - case METAENTRY: - return "MetaEntry" - } - return "" +func (v *_XdrVec_6_UpgradeType) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 6} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } +func (_XdrVec_6_UpgradeType) XdrTypeName() string { return "UpgradeType<>" } +func (v *_XdrVec_6_UpgradeType) XdrPointer() interface{} { return (*[]UpgradeType)(v) } +func (v _XdrVec_6_UpgradeType) XdrValue() interface{} { return ([]UpgradeType)(v) } +func (v *_XdrVec_6_UpgradeType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_BucketEntry = *BucketEntry +type XdrType_StellarValue = *StellarValue -func (v *BucketEntry) XdrPointer() interface{} { return v } -func (BucketEntry) XdrTypeName() string { return "BucketEntry" } -func (v BucketEntry) XdrValue() interface{} { return v } -func (v *BucketEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *BucketEntry) XdrRecurse(x XDR, name string) { +func (v *StellarValue) XdrPointer() interface{} { return v } +func (StellarValue) XdrTypeName() string { return "StellarValue" } +func (v StellarValue) XdrValue() interface{} { return v } +func (v *StellarValue) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *StellarValue) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_BucketEntryType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case LIVEENTRY, INITENTRY: - x.Marshal(x.Sprintf("%sliveEntry", name), XDR_LedgerEntry(u.LiveEntry())) - return - case DEADENTRY: - x.Marshal(x.Sprintf("%sdeadEntry", name), XDR_LedgerKey(u.DeadEntry())) - return - case METAENTRY: - x.Marshal(x.Sprintf("%smetaEntry", name), XDR_BucketMetadata(u.MetaEntry())) - return - } - XdrPanic("invalid Type (%v) in BucketEntry", u.Type) + x.Marshal(x.Sprintf("%stxSetHash", name), XDR_Hash(&v.TxSetHash)) + x.Marshal(x.Sprintf("%scloseTime", name), XDR_TimePoint(&v.CloseTime)) + x.Marshal(x.Sprintf("%supgrades", name), (*_XdrVec_6_UpgradeType)(&v.Upgrades)) + x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_StellarValue_Ext(&v.Ext)) } -func XDR_BucketEntry(v *BucketEntry) *BucketEntry { return v } +func XDR_StellarValue(v *StellarValue) *StellarValue { return v } -var _XdrNames_TxSetComponentType = map[int32]string{ - int32(TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE): "TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE", +var _XdrNames_LedgerHeaderFlags = map[int32]string{ + int32(DISABLE_LIQUIDITY_POOL_TRADING_FLAG): "DISABLE_LIQUIDITY_POOL_TRADING_FLAG", + int32(DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG): "DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG", + int32(DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG): "DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG", } -var _XdrValues_TxSetComponentType = map[string]int32{ - "TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE": int32(TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE), +var _XdrValues_LedgerHeaderFlags = map[string]int32{ + "DISABLE_LIQUIDITY_POOL_TRADING_FLAG": int32(DISABLE_LIQUIDITY_POOL_TRADING_FLAG), + "DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG": int32(DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG), + "DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG": int32(DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG), } -func (TxSetComponentType) XdrEnumNames() map[int32]string { - return _XdrNames_TxSetComponentType +func (LedgerHeaderFlags) XdrEnumNames() map[int32]string { + return _XdrNames_LedgerHeaderFlags } -func (v TxSetComponentType) String() string { - if s, ok := _XdrNames_TxSetComponentType[int32(v)]; ok { +func (v LedgerHeaderFlags) String() string { + if s, ok := _XdrNames_LedgerHeaderFlags[int32(v)]; ok { return s } - return fmt.Sprintf("TxSetComponentType#%d", v) + return fmt.Sprintf("LedgerHeaderFlags#%d", v) } -func (v *TxSetComponentType) Scan(ss fmt.ScanState, _ rune) error { +func (v *LedgerHeaderFlags) Scan(ss fmt.ScanState, _ rune) error { if tok, err := ss.Token(true, XdrSymChar); err != nil { return err } else { stok := string(tok) - if val, ok := _XdrValues_TxSetComponentType[stok]; ok { - *v = TxSetComponentType(val) + if val, ok := _XdrValues_LedgerHeaderFlags[stok]; ok { + *v = LedgerHeaderFlags(val) return nil - } else if stok == "TxSetComponentType" { + } else if stok == "LedgerHeaderFlags" { if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { return nil } } - return XdrError(fmt.Sprintf("%s is not a valid TxSetComponentType.", stok)) + return XdrError(fmt.Sprintf("%s is not a valid LedgerHeaderFlags.", stok)) } } -func (v TxSetComponentType) GetU32() uint32 { return uint32(v) } -func (v *TxSetComponentType) SetU32(n uint32) { *v = TxSetComponentType(n) } -func (v *TxSetComponentType) XdrPointer() interface{} { return v } -func (TxSetComponentType) XdrTypeName() string { return "TxSetComponentType" } -func (v TxSetComponentType) XdrValue() interface{} { return v } -func (v *TxSetComponentType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_TxSetComponentType = *TxSetComponentType +func (v LedgerHeaderFlags) GetU32() uint32 { return uint32(v) } +func (v *LedgerHeaderFlags) SetU32(n uint32) { *v = LedgerHeaderFlags(n) } +func (v *LedgerHeaderFlags) XdrPointer() interface{} { return v } +func (LedgerHeaderFlags) XdrTypeName() string { return "LedgerHeaderFlags" } +func (v LedgerHeaderFlags) XdrValue() interface{} { return v } +func (v *LedgerHeaderFlags) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func XDR_TxSetComponentType(v *TxSetComponentType) *TxSetComponentType { return v } +type XdrType_LedgerHeaderFlags = *LedgerHeaderFlags -var _XdrComments_TxSetComponentType = map[int32]string{ - int32(TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE): "txs with effective fee <= bid derived from a base fee (if any). If base fee is not specified, no discount is applied.", +func XDR_LedgerHeaderFlags(v *LedgerHeaderFlags) *LedgerHeaderFlags { return v } +func (v *LedgerHeaderFlags) XdrInitialize() { + switch LedgerHeaderFlags(0) { + case DISABLE_LIQUIDITY_POOL_TRADING_FLAG, DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG, DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG: + default: + if *v == LedgerHeaderFlags(0) { + *v = DISABLE_LIQUIDITY_POOL_TRADING_FLAG + } + } } -func (e TxSetComponentType) XdrEnumComments() map[int32]string { - return _XdrComments_TxSetComponentType +var _XdrTags_XdrAnon_LedgerHeaderExtensionV1_Ext = map[int32]bool{ + XdrToI32(0): true, } -type _XdrPtr_Int64 struct { - p **Int64 +func (_ XdrAnon_LedgerHeaderExtensionV1_Ext) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_LedgerHeaderExtensionV1_Ext } -type _ptrflag_Int64 _XdrPtr_Int64 - -func (v _ptrflag_Int64) String() string { - if *v.p == nil { - return "nil" +func (u XdrAnon_LedgerHeaderExtensionV1_Ext) XdrValid() bool { + switch u.V { + case 0: + return true } - return "non-nil" + return false } -func (v _ptrflag_Int64) Scan(ss fmt.ScanState, r rune) error { - tok, err := ss.Token(true, func(c rune) bool { - return c == '-' || (c >= 'a' && c <= 'z') - }) - if err != nil { - return err - } - switch string(tok) { - case "nil": - v.SetU32(0) - case "non-nil": - v.SetU32(1) - default: - return XdrError("Int64 flag should be \"nil\" or \"non-nil\"") - } - return nil +func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrUnionTag() XdrNum32 { + return XDR_int32(&u.V) } -func (v _ptrflag_Int64) GetU32() uint32 { - if *v.p == nil { - return 0 - } - return 1 +func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrUnionTagName() string { + return "V" } -func (v _ptrflag_Int64) SetU32(nv uint32) { - switch nv { +func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrUnionBody() XdrType { + switch u.V { case 0: - *v.p = nil - case 1: - if *v.p == nil { - *v.p = new(Int64) - } - default: - XdrPanic("*Int64 present flag value %d should be 0 or 1", nv) - } -} -func (_ptrflag_Int64) XdrTypeName() string { return "Int64?" } -func (v _ptrflag_Int64) XdrPointer() interface{} { return nil } -func (v _ptrflag_Int64) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_Int64) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_Int64) XdrBound() uint32 { return 1 } -func (v _XdrPtr_Int64) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_Int64) SetPresent(present bool) { - if !present { - *v.p = nil - } else if *v.p == nil { - *v.p = new(Int64) + return nil } + return nil } -func (v _XdrPtr_Int64) XdrMarshalValue(x XDR, name string) { - if *v.p != nil { - XDR_Int64(*v.p).XdrMarshal(x, name) +func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrUnionBodyName() string { + switch u.V { + case 0: + return "" } + return "" } -func (v _XdrPtr_Int64) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_Int64) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_Int64(v)) - v.XdrMarshalValue(x, name) -} -func (_XdrPtr_Int64) XdrTypeName() string { return "Int64*" } -func (v _XdrPtr_Int64) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_Int64) XdrValue() interface{} { return *v.p } -type _XdrVec_unbounded_TransactionEnvelope []TransactionEnvelope +type XdrType_XdrAnon_LedgerHeaderExtensionV1_Ext = *XdrAnon_LedgerHeaderExtensionV1_Ext -func (_XdrVec_unbounded_TransactionEnvelope) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound +func (v *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrPointer() interface{} { return v } +func (XdrAnon_LedgerHeaderExtensionV1_Ext) XdrTypeName() string { + return "XdrAnon_LedgerHeaderExtensionV1_Ext" } -func (_XdrVec_unbounded_TransactionEnvelope) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_TransactionEnvelope length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_TransactionEnvelope length %d exceeds max int", length) +func (v XdrAnon_LedgerHeaderExtensionV1_Ext) XdrValue() interface{} { return v } +func (v *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_LedgerHeaderExtensionV1_Ext) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } -} -func (v _XdrVec_unbounded_TransactionEnvelope) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_TransactionEnvelope) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } + XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + switch u.V { + case 0: return } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) - } - nv := make([]TransactionEnvelope, int(length), newcap) - copy(nv, *v) - *v = nv + XdrPanic("invalid V (%v) in XdrAnon_LedgerHeaderExtensionV1_Ext", u.V) } -func (v *_XdrVec_unbounded_TransactionEnvelope) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) - } - XDR_TransactionEnvelope(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] - } -} -func (v *_XdrVec_unbounded_TransactionEnvelope) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) -} -func (_XdrVec_unbounded_TransactionEnvelope) XdrTypeName() string { return "TransactionEnvelope<>" } -func (v *_XdrVec_unbounded_TransactionEnvelope) XdrPointer() interface{} { - return (*[]TransactionEnvelope)(v) -} -func (v _XdrVec_unbounded_TransactionEnvelope) XdrValue() interface{} { - return ([]TransactionEnvelope)(v) -} -func (v *_XdrVec_unbounded_TransactionEnvelope) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_XdrAnon_TxSetComponent_TxsMaybeDiscountedFee = *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee - -func (v *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) XdrPointer() interface{} { return v } -func (XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) XdrTypeName() string { - return "XdrAnon_TxSetComponent_TxsMaybeDiscountedFee" -} -func (v XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) XdrValue() interface{} { return v } -func (v *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) XdrMarshal(x XDR, name string) { - x.Marshal(name, v) -} -func (v *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sbaseFee", name), _XdrPtr_Int64{&v.BaseFee}) - x.Marshal(x.Sprintf("%stxs", name), (*_XdrVec_unbounded_TransactionEnvelope)(&v.Txs)) -} -func XDR_XdrAnon_TxSetComponent_TxsMaybeDiscountedFee(v *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee { - return v -} - -var _XdrTags_TxSetComponent = map[int32]bool{ - XdrToI32(TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE): true, -} - -func (_ TxSetComponent) XdrValidTags() map[int32]bool { - return _XdrTags_TxSetComponent -} -func (u *TxSetComponent) TxsMaybeDiscountedFee() *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee { - switch u.Type { - case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: - if v, ok := u._u.(*XdrAnon_TxSetComponent_TxsMaybeDiscountedFee); ok { - return v - } else { - var zero XdrAnon_TxSetComponent_TxsMaybeDiscountedFee - u._u = &zero - return &zero - } - default: - XdrPanic("TxSetComponent.TxsMaybeDiscountedFee accessed when Type == %v", u.Type) - return nil - } -} -func (u TxSetComponent) XdrValid() bool { - switch u.Type { - case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: - return true - } - return false -} -func (u *TxSetComponent) XdrUnionTag() XdrNum32 { - return XDR_TxSetComponentType(&u.Type) -} -func (u *TxSetComponent) XdrUnionTagName() string { - return "Type" -} -func (u *TxSetComponent) XdrUnionBody() XdrType { - switch u.Type { - case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: - return XDR_XdrAnon_TxSetComponent_TxsMaybeDiscountedFee(u.TxsMaybeDiscountedFee()) - } - return nil -} -func (u *TxSetComponent) XdrUnionBodyName() string { - switch u.Type { - case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: - return "TxsMaybeDiscountedFee" - } - return "" +func XDR_XdrAnon_LedgerHeaderExtensionV1_Ext(v *XdrAnon_LedgerHeaderExtensionV1_Ext) *XdrAnon_LedgerHeaderExtensionV1_Ext { + return v } -type XdrType_TxSetComponent = *TxSetComponent +type XdrType_LedgerHeaderExtensionV1 = *LedgerHeaderExtensionV1 -func (v *TxSetComponent) XdrPointer() interface{} { return v } -func (TxSetComponent) XdrTypeName() string { return "TxSetComponent" } -func (v TxSetComponent) XdrValue() interface{} { return v } -func (v *TxSetComponent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *TxSetComponent) XdrRecurse(x XDR, name string) { +func (v *LedgerHeaderExtensionV1) XdrPointer() interface{} { return v } +func (LedgerHeaderExtensionV1) XdrTypeName() string { return "LedgerHeaderExtensionV1" } +func (v LedgerHeaderExtensionV1) XdrValue() interface{} { return v } +func (v *LedgerHeaderExtensionV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerHeaderExtensionV1) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_TxSetComponentType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: - x.Marshal(x.Sprintf("%stxsMaybeDiscountedFee", name), XDR_XdrAnon_TxSetComponent_TxsMaybeDiscountedFee(u.TxsMaybeDiscountedFee())) - return - } - XdrPanic("invalid Type (%v) in TxSetComponent", u.Type) -} -func XDR_TxSetComponent(v *TxSetComponent) *TxSetComponent { return v } - -type _XdrVec_unbounded_TxSetComponent []TxSetComponent - -func (_XdrVec_unbounded_TxSetComponent) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound -} -func (_XdrVec_unbounded_TxSetComponent) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_TxSetComponent length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_TxSetComponent length %d exceeds max int", length) - } -} -func (v _XdrVec_unbounded_TxSetComponent) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_TxSetComponent) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) - } - nv := make([]TxSetComponent, int(length), newcap) - copy(nv, *v) - *v = nv -} -func (v *_XdrVec_unbounded_TxSetComponent) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) - } - XDR_TxSetComponent(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] - } -} -func (v *_XdrVec_unbounded_TxSetComponent) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) + x.Marshal(x.Sprintf("%sflags", name), XDR_Uint32(&v.Flags)) + x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_LedgerHeaderExtensionV1_Ext(&v.Ext)) } -func (_XdrVec_unbounded_TxSetComponent) XdrTypeName() string { return "TxSetComponent<>" } -func (v *_XdrVec_unbounded_TxSetComponent) XdrPointer() interface{} { return (*[]TxSetComponent)(v) } -func (v _XdrVec_unbounded_TxSetComponent) XdrValue() interface{} { return ([]TxSetComponent)(v) } -func (v *_XdrVec_unbounded_TxSetComponent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func XDR_LedgerHeaderExtensionV1(v *LedgerHeaderExtensionV1) *LedgerHeaderExtensionV1 { return v } -var _XdrTags_TransactionPhase = map[int32]bool{ +var _XdrTags_XdrAnon_LedgerHeader_Ext = map[int32]bool{ XdrToI32(0): true, + XdrToI32(1): true, } -func (_ TransactionPhase) XdrValidTags() map[int32]bool { - return _XdrTags_TransactionPhase +func (_ XdrAnon_LedgerHeader_Ext) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_LedgerHeader_Ext } -func (u *TransactionPhase) V0Components() *[]TxSetComponent { +func (u *XdrAnon_LedgerHeader_Ext) V1() *LedgerHeaderExtensionV1 { switch u.V { - case 0: - if v, ok := u._u.(*[]TxSetComponent); ok { + case 1: + if v, ok := u._u.(*LedgerHeaderExtensionV1); ok { return v } else { - var zero []TxSetComponent + var zero LedgerHeaderExtensionV1 u._u = &zero return &zero } default: - XdrPanic("TransactionPhase.V0Components accessed when V == %v", u.V) + XdrPanic("XdrAnon_LedgerHeader_Ext.V1 accessed when V == %v", u.V) return nil } } -func (u TransactionPhase) XdrValid() bool { +func (u XdrAnon_LedgerHeader_Ext) XdrValid() bool { switch u.V { - case 0: + case 0, 1: return true } return false } -func (u *TransactionPhase) XdrUnionTag() XdrNum32 { +func (u *XdrAnon_LedgerHeader_Ext) XdrUnionTag() XdrNum32 { return XDR_int32(&u.V) } -func (u *TransactionPhase) XdrUnionTagName() string { +func (u *XdrAnon_LedgerHeader_Ext) XdrUnionTagName() string { return "V" } -func (u *TransactionPhase) XdrUnionBody() XdrType { +func (u *XdrAnon_LedgerHeader_Ext) XdrUnionBody() XdrType { switch u.V { case 0: - return (*_XdrVec_unbounded_TxSetComponent)(u.V0Components()) + return nil + case 1: + return XDR_LedgerHeaderExtensionV1(u.V1()) } return nil } -func (u *TransactionPhase) XdrUnionBodyName() string { +func (u *XdrAnon_LedgerHeader_Ext) XdrUnionBodyName() string { switch u.V { case 0: - return "V0Components" + return "" + case 1: + return "V1" } return "" } -type XdrType_TransactionPhase = *TransactionPhase +type XdrType_XdrAnon_LedgerHeader_Ext = *XdrAnon_LedgerHeader_Ext -func (v *TransactionPhase) XdrPointer() interface{} { return v } -func (TransactionPhase) XdrTypeName() string { return "TransactionPhase" } -func (v TransactionPhase) XdrValue() interface{} { return v } -func (v *TransactionPhase) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *TransactionPhase) XdrRecurse(x XDR, name string) { +func (v *XdrAnon_LedgerHeader_Ext) XdrPointer() interface{} { return v } +func (XdrAnon_LedgerHeader_Ext) XdrTypeName() string { return "XdrAnon_LedgerHeader_Ext" } +func (v XdrAnon_LedgerHeader_Ext) XdrValue() interface{} { return v } +func (v *XdrAnon_LedgerHeader_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_LedgerHeader_Ext) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) switch u.V { case 0: - x.Marshal(x.Sprintf("%sv0Components", name), (*_XdrVec_unbounded_TxSetComponent)(u.V0Components())) + return + case 1: + x.Marshal(x.Sprintf("%sv1", name), XDR_LedgerHeaderExtensionV1(u.V1())) return } - XdrPanic("invalid V (%v) in TransactionPhase", u.V) -} -func XDR_TransactionPhase(v *TransactionPhase) *TransactionPhase { return v } - -type XdrType_TransactionSet = *TransactionSet - -func (v *TransactionSet) XdrPointer() interface{} { return v } -func (TransactionSet) XdrTypeName() string { return "TransactionSet" } -func (v TransactionSet) XdrValue() interface{} { return v } -func (v *TransactionSet) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TransactionSet) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%spreviousLedgerHash", name), XDR_Hash(&v.PreviousLedgerHash)) - x.Marshal(x.Sprintf("%stxs", name), (*_XdrVec_unbounded_TransactionEnvelope)(&v.Txs)) + XdrPanic("invalid V (%v) in XdrAnon_LedgerHeader_Ext", u.V) } -func XDR_TransactionSet(v *TransactionSet) *TransactionSet { return v } +func XDR_XdrAnon_LedgerHeader_Ext(v *XdrAnon_LedgerHeader_Ext) *XdrAnon_LedgerHeader_Ext { return v } -type _XdrVec_unbounded_TransactionPhase []TransactionPhase +type _XdrArray_4_Hash [4]Hash -func (_XdrVec_unbounded_TransactionPhase) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit +func (_XdrArray_4_Hash) XdrArraySize() uint32 { + const bound uint32 = 4 // Force error if not const or doesn't fit return bound } -func (_XdrVec_unbounded_TransactionPhase) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_TransactionPhase length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_TransactionPhase length %d exceeds max int", length) +func (v *_XdrArray_4_Hash) XdrRecurse(x XDR, name string) { + for i := 0; i < len(*v); i++ { + XDR_Hash(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } } -func (v _XdrVec_unbounded_TransactionPhase) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_TransactionPhase) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return +func (v *_XdrArray_4_Hash) XdrPointer() interface{} { return (*[4]Hash)(v) } +func (_XdrArray_4_Hash) XdrTypeName() string { return "Hash[]" } +func (v *_XdrArray_4_Hash) XdrValue() interface{} { return v[:] } +func (v *_XdrArray_4_Hash) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_LedgerHeader = *LedgerHeader + +func (v *LedgerHeader) XdrPointer() interface{} { return v } +func (LedgerHeader) XdrTypeName() string { return "LedgerHeader" } +func (v LedgerHeader) XdrValue() interface{} { return v } +func (v *LedgerHeader) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerHeader) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) + x.Marshal(x.Sprintf("%sledgerVersion", name), XDR_Uint32(&v.LedgerVersion)) + x.Marshal(x.Sprintf("%spreviousLedgerHash", name), XDR_Hash(&v.PreviousLedgerHash)) + x.Marshal(x.Sprintf("%sscpValue", name), XDR_StellarValue(&v.ScpValue)) + x.Marshal(x.Sprintf("%stxSetResultHash", name), XDR_Hash(&v.TxSetResultHash)) + x.Marshal(x.Sprintf("%sbucketListHash", name), XDR_Hash(&v.BucketListHash)) + x.Marshal(x.Sprintf("%sledgerSeq", name), XDR_Uint32(&v.LedgerSeq)) + x.Marshal(x.Sprintf("%stotalCoins", name), XDR_Int64(&v.TotalCoins)) + x.Marshal(x.Sprintf("%sfeePool", name), XDR_Int64(&v.FeePool)) + x.Marshal(x.Sprintf("%sinflationSeq", name), XDR_Uint32(&v.InflationSeq)) + x.Marshal(x.Sprintf("%sidPool", name), XDR_Uint64(&v.IdPool)) + x.Marshal(x.Sprintf("%sbaseFee", name), XDR_Uint32(&v.BaseFee)) + x.Marshal(x.Sprintf("%sbaseReserve", name), XDR_Uint32(&v.BaseReserve)) + x.Marshal(x.Sprintf("%smaxTxSetSize", name), XDR_Uint32(&v.MaxTxSetSize)) + x.Marshal(x.Sprintf("%sskipList", name), (*_XdrArray_4_Hash)(&v.SkipList)) + x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_LedgerHeader_Ext(&v.Ext)) +} +func XDR_LedgerHeader(v *LedgerHeader) *LedgerHeader { return v } + +var _XdrNames_LedgerUpgradeType = map[int32]string{ + int32(LEDGER_UPGRADE_VERSION): "LEDGER_UPGRADE_VERSION", + int32(LEDGER_UPGRADE_BASE_FEE): "LEDGER_UPGRADE_BASE_FEE", + int32(LEDGER_UPGRADE_MAX_TX_SET_SIZE): "LEDGER_UPGRADE_MAX_TX_SET_SIZE", + int32(LEDGER_UPGRADE_BASE_RESERVE): "LEDGER_UPGRADE_BASE_RESERVE", + int32(LEDGER_UPGRADE_FLAGS): "LEDGER_UPGRADE_FLAGS", + int32(LEDGER_UPGRADE_CONFIG): "LEDGER_UPGRADE_CONFIG", + int32(LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE): "LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE", +} +var _XdrValues_LedgerUpgradeType = map[string]int32{ + "LEDGER_UPGRADE_VERSION": int32(LEDGER_UPGRADE_VERSION), + "LEDGER_UPGRADE_BASE_FEE": int32(LEDGER_UPGRADE_BASE_FEE), + "LEDGER_UPGRADE_MAX_TX_SET_SIZE": int32(LEDGER_UPGRADE_MAX_TX_SET_SIZE), + "LEDGER_UPGRADE_BASE_RESERVE": int32(LEDGER_UPGRADE_BASE_RESERVE), + "LEDGER_UPGRADE_FLAGS": int32(LEDGER_UPGRADE_FLAGS), + "LEDGER_UPGRADE_CONFIG": int32(LEDGER_UPGRADE_CONFIG), + "LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE": int32(LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE), +} + +func (LedgerUpgradeType) XdrEnumNames() map[int32]string { + return _XdrNames_LedgerUpgradeType +} +func (v LedgerUpgradeType) String() string { + if s, ok := _XdrNames_LedgerUpgradeType[int32(v)]; ok { + return s } - nv := make([]TransactionPhase, int(length), newcap) - copy(nv, *v) - *v = nv + return fmt.Sprintf("LedgerUpgradeType#%d", v) } -func (v *_XdrVec_unbounded_TransactionPhase) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) +func (v *LedgerUpgradeType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_LedgerUpgradeType[stok]; ok { + *v = LedgerUpgradeType(val) + return nil + } else if stok == "LedgerUpgradeType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } } - XDR_TransactionPhase(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] + return XdrError(fmt.Sprintf("%s is not a valid LedgerUpgradeType.", stok)) } } -func (v *_XdrVec_unbounded_TransactionPhase) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) -} -func (_XdrVec_unbounded_TransactionPhase) XdrTypeName() string { return "TransactionPhase<>" } -func (v *_XdrVec_unbounded_TransactionPhase) XdrPointer() interface{} { - return (*[]TransactionPhase)(v) +func (v LedgerUpgradeType) GetU32() uint32 { return uint32(v) } +func (v *LedgerUpgradeType) SetU32(n uint32) { *v = LedgerUpgradeType(n) } +func (v *LedgerUpgradeType) XdrPointer() interface{} { return v } +func (LedgerUpgradeType) XdrTypeName() string { return "LedgerUpgradeType" } +func (v LedgerUpgradeType) XdrValue() interface{} { return v } +func (v *LedgerUpgradeType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_LedgerUpgradeType = *LedgerUpgradeType + +func XDR_LedgerUpgradeType(v *LedgerUpgradeType) *LedgerUpgradeType { return v } +func (v *LedgerUpgradeType) XdrInitialize() { + switch LedgerUpgradeType(0) { + case LEDGER_UPGRADE_VERSION, LEDGER_UPGRADE_BASE_FEE, LEDGER_UPGRADE_MAX_TX_SET_SIZE, LEDGER_UPGRADE_BASE_RESERVE, LEDGER_UPGRADE_FLAGS, LEDGER_UPGRADE_CONFIG, LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + default: + if *v == LedgerUpgradeType(0) { + *v = LEDGER_UPGRADE_VERSION + } + } } -func (v _XdrVec_unbounded_TransactionPhase) XdrValue() interface{} { return ([]TransactionPhase)(v) } -func (v *_XdrVec_unbounded_TransactionPhase) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_TransactionSetV1 = *TransactionSetV1 +type XdrType_ConfigUpgradeSetKey = *ConfigUpgradeSetKey -func (v *TransactionSetV1) XdrPointer() interface{} { return v } -func (TransactionSetV1) XdrTypeName() string { return "TransactionSetV1" } -func (v TransactionSetV1) XdrValue() interface{} { return v } -func (v *TransactionSetV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TransactionSetV1) XdrRecurse(x XDR, name string) { +func (v *ConfigUpgradeSetKey) XdrPointer() interface{} { return v } +func (ConfigUpgradeSetKey) XdrTypeName() string { return "ConfigUpgradeSetKey" } +func (v ConfigUpgradeSetKey) XdrValue() interface{} { return v } +func (v *ConfigUpgradeSetKey) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ConfigUpgradeSetKey) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%spreviousLedgerHash", name), XDR_Hash(&v.PreviousLedgerHash)) - x.Marshal(x.Sprintf("%sphases", name), (*_XdrVec_unbounded_TransactionPhase)(&v.Phases)) + x.Marshal(x.Sprintf("%scontractID", name), XDR_Hash(&v.ContractID)) + x.Marshal(x.Sprintf("%scontentHash", name), XDR_Hash(&v.ContentHash)) } -func XDR_TransactionSetV1(v *TransactionSetV1) *TransactionSetV1 { return v } +func XDR_ConfigUpgradeSetKey(v *ConfigUpgradeSetKey) *ConfigUpgradeSetKey { return v } -var _XdrTags_GeneralizedTransactionSet = map[int32]bool{ - XdrToI32(1): true, +var _XdrTags_LedgerUpgrade = map[int32]bool{ + XdrToI32(LEDGER_UPGRADE_VERSION): true, + XdrToI32(LEDGER_UPGRADE_BASE_FEE): true, + XdrToI32(LEDGER_UPGRADE_MAX_TX_SET_SIZE): true, + XdrToI32(LEDGER_UPGRADE_BASE_RESERVE): true, + XdrToI32(LEDGER_UPGRADE_FLAGS): true, + XdrToI32(LEDGER_UPGRADE_CONFIG): true, + XdrToI32(LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE): true, } -func (_ GeneralizedTransactionSet) XdrValidTags() map[int32]bool { - return _XdrTags_GeneralizedTransactionSet +func (_ LedgerUpgrade) XdrValidTags() map[int32]bool { + return _XdrTags_LedgerUpgrade } -func (u *GeneralizedTransactionSet) V1TxSet() *TransactionSetV1 { - switch u.V { - case 1: - if v, ok := u._u.(*TransactionSetV1); ok { + +// update ledgerVersion +func (u *LedgerUpgrade) NewLedgerVersion() *Uint32 { + switch u.Type { + case LEDGER_UPGRADE_VERSION: + if v, ok := u._u.(*Uint32); ok { return v } else { - var zero TransactionSetV1 + var zero Uint32 u._u = &zero return &zero } default: - XdrPanic("GeneralizedTransactionSet.V1TxSet accessed when V == %v", u.V) + XdrPanic("LedgerUpgrade.NewLedgerVersion accessed when Type == %v", u.Type) return nil } } -func (u GeneralizedTransactionSet) XdrValid() bool { - switch u.V { - case 1: - return true + +// update baseFee +func (u *LedgerUpgrade) NewBaseFee() *Uint32 { + switch u.Type { + case LEDGER_UPGRADE_BASE_FEE: + if v, ok := u._u.(*Uint32); ok { + return v + } else { + var zero Uint32 + u._u = &zero + return &zero + } + default: + XdrPanic("LedgerUpgrade.NewBaseFee accessed when Type == %v", u.Type) + return nil } - return false -} -func (u *GeneralizedTransactionSet) XdrUnionTag() XdrNum32 { - return XDR_int32(&u.V) -} -func (u *GeneralizedTransactionSet) XdrUnionTagName() string { - return "V" } -func (u *GeneralizedTransactionSet) XdrUnionBody() XdrType { - switch u.V { - case 1: - return XDR_TransactionSetV1(u.V1TxSet()) + +// update maxTxSetSize +func (u *LedgerUpgrade) NewMaxTxSetSize() *Uint32 { + switch u.Type { + case LEDGER_UPGRADE_MAX_TX_SET_SIZE: + if v, ok := u._u.(*Uint32); ok { + return v + } else { + var zero Uint32 + u._u = &zero + return &zero + } + default: + XdrPanic("LedgerUpgrade.NewMaxTxSetSize accessed when Type == %v", u.Type) + return nil } - return nil } -func (u *GeneralizedTransactionSet) XdrUnionBodyName() string { - switch u.V { - case 1: - return "V1TxSet" + +// update baseReserve +func (u *LedgerUpgrade) NewBaseReserve() *Uint32 { + switch u.Type { + case LEDGER_UPGRADE_BASE_RESERVE: + if v, ok := u._u.(*Uint32); ok { + return v + } else { + var zero Uint32 + u._u = &zero + return &zero + } + default: + XdrPanic("LedgerUpgrade.NewBaseReserve accessed when Type == %v", u.Type) + return nil } - return "" } -type XdrType_GeneralizedTransactionSet = *GeneralizedTransactionSet - -func (v *GeneralizedTransactionSet) XdrPointer() interface{} { return v } -func (GeneralizedTransactionSet) XdrTypeName() string { return "GeneralizedTransactionSet" } -func (v GeneralizedTransactionSet) XdrValue() interface{} { return v } -func (v *GeneralizedTransactionSet) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *GeneralizedTransactionSet) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +// update flags +func (u *LedgerUpgrade) NewFlags() *Uint32 { + switch u.Type { + case LEDGER_UPGRADE_FLAGS: + if v, ok := u._u.(*Uint32); ok { + return v + } else { + var zero Uint32 + u._u = &zero + return &zero + } + default: + XdrPanic("LedgerUpgrade.NewFlags accessed when Type == %v", u.Type) + return nil } - XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) - switch u.V { - case 1: - x.Marshal(x.Sprintf("%sv1TxSet", name), XDR_TransactionSetV1(u.V1TxSet())) - return - } - XdrPanic("invalid V (%v) in GeneralizedTransactionSet", u.V) } -func (v *GeneralizedTransactionSet) XdrInitialize() { - var zero int32 - switch zero { - case 1: + +// Update arbitrary `ConfigSetting` entries identified by the key. +func (u *LedgerUpgrade) NewConfig() *ConfigUpgradeSetKey { + switch u.Type { + case LEDGER_UPGRADE_CONFIG: + if v, ok := u._u.(*ConfigUpgradeSetKey); ok { + return v + } else { + var zero ConfigUpgradeSetKey + u._u = &zero + return &zero + } default: - if v.V == zero { - v.V = 1 + XdrPanic("LedgerUpgrade.NewConfig accessed when Type == %v", u.Type) + return nil + } +} + +// Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without +// using `LEDGER_UPGRADE_CONFIG`. +func (u *LedgerUpgrade) NewMaxSorobanTxSetSize() *Uint32 { + switch u.Type { + case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + if v, ok := u._u.(*Uint32); ok { + return v + } else { + var zero Uint32 + u._u = &zero + return &zero } + default: + XdrPanic("LedgerUpgrade.NewMaxSorobanTxSetSize accessed when Type == %v", u.Type) + return nil } } -func XDR_GeneralizedTransactionSet(v *GeneralizedTransactionSet) *GeneralizedTransactionSet { return v } +func (u LedgerUpgrade) XdrValid() bool { + switch u.Type { + case LEDGER_UPGRADE_VERSION, LEDGER_UPGRADE_BASE_FEE, LEDGER_UPGRADE_MAX_TX_SET_SIZE, LEDGER_UPGRADE_BASE_RESERVE, LEDGER_UPGRADE_FLAGS, LEDGER_UPGRADE_CONFIG, LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + return true + } + return false +} +func (u *LedgerUpgrade) XdrUnionTag() XdrNum32 { + return XDR_LedgerUpgradeType(&u.Type) +} +func (u *LedgerUpgrade) XdrUnionTagName() string { + return "Type" +} +func (u *LedgerUpgrade) XdrUnionBody() XdrType { + switch u.Type { + case LEDGER_UPGRADE_VERSION: + return XDR_Uint32(u.NewLedgerVersion()) + case LEDGER_UPGRADE_BASE_FEE: + return XDR_Uint32(u.NewBaseFee()) + case LEDGER_UPGRADE_MAX_TX_SET_SIZE: + return XDR_Uint32(u.NewMaxTxSetSize()) + case LEDGER_UPGRADE_BASE_RESERVE: + return XDR_Uint32(u.NewBaseReserve()) + case LEDGER_UPGRADE_FLAGS: + return XDR_Uint32(u.NewFlags()) + case LEDGER_UPGRADE_CONFIG: + return XDR_ConfigUpgradeSetKey(u.NewConfig()) + case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + return XDR_Uint32(u.NewMaxSorobanTxSetSize()) + } + return nil +} +func (u *LedgerUpgrade) XdrUnionBodyName() string { + switch u.Type { + case LEDGER_UPGRADE_VERSION: + return "NewLedgerVersion" + case LEDGER_UPGRADE_BASE_FEE: + return "NewBaseFee" + case LEDGER_UPGRADE_MAX_TX_SET_SIZE: + return "NewMaxTxSetSize" + case LEDGER_UPGRADE_BASE_RESERVE: + return "NewBaseReserve" + case LEDGER_UPGRADE_FLAGS: + return "NewFlags" + case LEDGER_UPGRADE_CONFIG: + return "NewConfig" + case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + return "NewMaxSorobanTxSetSize" + } + return "" +} -type XdrType_TransactionResultPair = *TransactionResultPair +type XdrType_LedgerUpgrade = *LedgerUpgrade -func (v *TransactionResultPair) XdrPointer() interface{} { return v } -func (TransactionResultPair) XdrTypeName() string { return "TransactionResultPair" } -func (v TransactionResultPair) XdrValue() interface{} { return v } -func (v *TransactionResultPair) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TransactionResultPair) XdrRecurse(x XDR, name string) { +func (v *LedgerUpgrade) XdrPointer() interface{} { return v } +func (LedgerUpgrade) XdrTypeName() string { return "LedgerUpgrade" } +func (v LedgerUpgrade) XdrValue() interface{} { return v } +func (v *LedgerUpgrade) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *LedgerUpgrade) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%stransactionHash", name), XDR_Hash(&v.TransactionHash)) - x.Marshal(x.Sprintf("%sresult", name), XDR_TransactionResult(&v.Result)) + XDR_LedgerUpgradeType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case LEDGER_UPGRADE_VERSION: + x.Marshal(x.Sprintf("%snewLedgerVersion", name), XDR_Uint32(u.NewLedgerVersion())) + return + case LEDGER_UPGRADE_BASE_FEE: + x.Marshal(x.Sprintf("%snewBaseFee", name), XDR_Uint32(u.NewBaseFee())) + return + case LEDGER_UPGRADE_MAX_TX_SET_SIZE: + x.Marshal(x.Sprintf("%snewMaxTxSetSize", name), XDR_Uint32(u.NewMaxTxSetSize())) + return + case LEDGER_UPGRADE_BASE_RESERVE: + x.Marshal(x.Sprintf("%snewBaseReserve", name), XDR_Uint32(u.NewBaseReserve())) + return + case LEDGER_UPGRADE_FLAGS: + x.Marshal(x.Sprintf("%snewFlags", name), XDR_Uint32(u.NewFlags())) + return + case LEDGER_UPGRADE_CONFIG: + x.Marshal(x.Sprintf("%snewConfig", name), XDR_ConfigUpgradeSetKey(u.NewConfig())) + return + case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + x.Marshal(x.Sprintf("%snewMaxSorobanTxSetSize", name), XDR_Uint32(u.NewMaxSorobanTxSetSize())) + return + } + XdrPanic("invalid Type (%v) in LedgerUpgrade", u.Type) } -func XDR_TransactionResultPair(v *TransactionResultPair) *TransactionResultPair { return v } +func (v *LedgerUpgrade) XdrInitialize() { + var zero LedgerUpgradeType + switch zero { + case LEDGER_UPGRADE_VERSION, LEDGER_UPGRADE_BASE_FEE, LEDGER_UPGRADE_MAX_TX_SET_SIZE, LEDGER_UPGRADE_BASE_RESERVE, LEDGER_UPGRADE_FLAGS, LEDGER_UPGRADE_CONFIG, LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: + default: + if v.Type == zero { + v.Type = LEDGER_UPGRADE_VERSION + } + } +} +func XDR_LedgerUpgrade(v *LedgerUpgrade) *LedgerUpgrade { return v } -type _XdrVec_unbounded_TransactionResultPair []TransactionResultPair +type _XdrVec_unbounded_ConfigSettingEntry []ConfigSettingEntry -func (_XdrVec_unbounded_TransactionResultPair) XdrBound() uint32 { +func (_XdrVec_unbounded_ConfigSettingEntry) XdrBound() uint32 { const bound uint32 = 4294967295 // Force error if not const or doesn't fit return bound } -func (_XdrVec_unbounded_TransactionResultPair) XdrCheckLen(length uint32) { +func (_XdrVec_unbounded_ConfigSettingEntry) XdrCheckLen(length uint32) { if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_TransactionResultPair length %d exceeds bound 4294967295", length) + XdrPanic("_XdrVec_unbounded_ConfigSettingEntry length %d exceeds bound 4294967295", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_TransactionResultPair length %d exceeds max int", length) + XdrPanic("_XdrVec_unbounded_ConfigSettingEntry length %d exceeds max int", length) } } -func (v _XdrVec_unbounded_TransactionResultPair) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_TransactionResultPair) SetVecLen(length uint32) { +func (v _XdrVec_unbounded_ConfigSettingEntry) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_ConfigSettingEntry) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -10960,314 +11009,483 @@ func (v *_XdrVec_unbounded_TransactionResultPair) SetVecLen(length uint32) { } newcap = int(bound) } - nv := make([]TransactionResultPair, int(length), newcap) + nv := make([]ConfigSettingEntry, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_unbounded_TransactionResultPair) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_unbounded_ConfigSettingEntry) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_TransactionResultPair(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_ConfigSettingEntry(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_unbounded_TransactionResultPair) XdrRecurse(x XDR, name string) { +func (v *_XdrVec_unbounded_ConfigSettingEntry) XdrRecurse(x XDR, name string) { size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_unbounded_TransactionResultPair) XdrTypeName() string { return "TransactionResultPair<>" } -func (v *_XdrVec_unbounded_TransactionResultPair) XdrPointer() interface{} { - return (*[]TransactionResultPair)(v) +func (_XdrVec_unbounded_ConfigSettingEntry) XdrTypeName() string { return "ConfigSettingEntry<>" } +func (v *_XdrVec_unbounded_ConfigSettingEntry) XdrPointer() interface{} { + return (*[]ConfigSettingEntry)(v) } -func (v _XdrVec_unbounded_TransactionResultPair) XdrValue() interface{} { - return ([]TransactionResultPair)(v) +func (v _XdrVec_unbounded_ConfigSettingEntry) XdrValue() interface{} { + return ([]ConfigSettingEntry)(v) } -func (v *_XdrVec_unbounded_TransactionResultPair) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *_XdrVec_unbounded_ConfigSettingEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_TransactionResultSet = *TransactionResultSet +type XdrType_ConfigUpgradeSet = *ConfigUpgradeSet -func (v *TransactionResultSet) XdrPointer() interface{} { return v } -func (TransactionResultSet) XdrTypeName() string { return "TransactionResultSet" } -func (v TransactionResultSet) XdrValue() interface{} { return v } -func (v *TransactionResultSet) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TransactionResultSet) XdrRecurse(x XDR, name string) { +func (v *ConfigUpgradeSet) XdrPointer() interface{} { return v } +func (ConfigUpgradeSet) XdrTypeName() string { return "ConfigUpgradeSet" } +func (v ConfigUpgradeSet) XdrValue() interface{} { return v } +func (v *ConfigUpgradeSet) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ConfigUpgradeSet) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sresults", name), (*_XdrVec_unbounded_TransactionResultPair)(&v.Results)) + x.Marshal(x.Sprintf("%supdatedEntry", name), (*_XdrVec_unbounded_ConfigSettingEntry)(&v.UpdatedEntry)) } -func XDR_TransactionResultSet(v *TransactionResultSet) *TransactionResultSet { return v } +func XDR_ConfigUpgradeSet(v *ConfigUpgradeSet) *ConfigUpgradeSet { return v } -var _XdrTags_XdrAnon_TransactionHistoryEntry_Ext = map[int32]bool{ - XdrToI32(0): true, - XdrToI32(1): true, +var _XdrNames_TxSetComponentType = map[int32]string{ + int32(TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE): "TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE", +} +var _XdrValues_TxSetComponentType = map[string]int32{ + "TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE": int32(TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE), } -func (_ XdrAnon_TransactionHistoryEntry_Ext) XdrValidTags() map[int32]bool { - return _XdrTags_XdrAnon_TransactionHistoryEntry_Ext +func (TxSetComponentType) XdrEnumNames() map[int32]string { + return _XdrNames_TxSetComponentType } -func (u *XdrAnon_TransactionHistoryEntry_Ext) GeneralizedTxSet() *GeneralizedTransactionSet { - switch u.V { - case 1: - if v, ok := u._u.(*GeneralizedTransactionSet); ok { - return v - } else { - var zero GeneralizedTransactionSet - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_TransactionHistoryEntry_Ext.GeneralizedTxSet accessed when V == %v", u.V) - return nil +func (v TxSetComponentType) String() string { + if s, ok := _XdrNames_TxSetComponentType[int32(v)]; ok { + return s } + return fmt.Sprintf("TxSetComponentType#%d", v) } -func (u XdrAnon_TransactionHistoryEntry_Ext) XdrValid() bool { - switch u.V { - case 0, 1: - return true +func (v *TxSetComponentType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_TxSetComponentType[stok]; ok { + *v = TxSetComponentType(val) + return nil + } else if stok == "TxSetComponentType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } + } + return XdrError(fmt.Sprintf("%s is not a valid TxSetComponentType.", stok)) } - return false -} -func (u *XdrAnon_TransactionHistoryEntry_Ext) XdrUnionTag() XdrNum32 { - return XDR_int32(&u.V) -} -func (u *XdrAnon_TransactionHistoryEntry_Ext) XdrUnionTagName() string { - return "V" } -func (u *XdrAnon_TransactionHistoryEntry_Ext) XdrUnionBody() XdrType { - switch u.V { - case 0: - return nil - case 1: - return XDR_GeneralizedTransactionSet(u.GeneralizedTxSet()) +func (v TxSetComponentType) GetU32() uint32 { return uint32(v) } +func (v *TxSetComponentType) SetU32(n uint32) { *v = TxSetComponentType(n) } +func (v *TxSetComponentType) XdrPointer() interface{} { return v } +func (TxSetComponentType) XdrTypeName() string { return "TxSetComponentType" } +func (v TxSetComponentType) XdrValue() interface{} { return v } +func (v *TxSetComponentType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_TxSetComponentType = *TxSetComponentType + +func XDR_TxSetComponentType(v *TxSetComponentType) *TxSetComponentType { return v } + +var _XdrComments_TxSetComponentType = map[int32]string{ + int32(TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE): "txs with effective fee <= bid derived from a base fee (if any). If base fee is not specified, no discount is applied.", +} + +func (e TxSetComponentType) XdrEnumComments() map[int32]string { + return _XdrComments_TxSetComponentType +} + +type _XdrPtr_Int64 struct { + p **Int64 +} +type _ptrflag_Int64 _XdrPtr_Int64 + +func (v _ptrflag_Int64) String() string { + if *v.p == nil { + return "nil" + } + return "non-nil" +} +func (v _ptrflag_Int64) Scan(ss fmt.ScanState, r rune) error { + tok, err := ss.Token(true, func(c rune) bool { + return c == '-' || (c >= 'a' && c <= 'z') + }) + if err != nil { + return err + } + switch string(tok) { + case "nil": + v.SetU32(0) + case "non-nil": + v.SetU32(1) + default: + return XdrError("Int64 flag should be \"nil\" or \"non-nil\"") } return nil } -func (u *XdrAnon_TransactionHistoryEntry_Ext) XdrUnionBodyName() string { - switch u.V { +func (v _ptrflag_Int64) GetU32() uint32 { + if *v.p == nil { + return 0 + } + return 1 +} +func (v _ptrflag_Int64) SetU32(nv uint32) { + switch nv { case 0: - return "" + *v.p = nil case 1: - return "GeneralizedTxSet" + if *v.p == nil { + *v.p = new(Int64) + } + default: + XdrPanic("*Int64 present flag value %d should be 0 or 1", nv) } - return "" } +func (_ptrflag_Int64) XdrTypeName() string { return "Int64?" } +func (v _ptrflag_Int64) XdrPointer() interface{} { return nil } +func (v _ptrflag_Int64) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_Int64) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_Int64) XdrBound() uint32 { return 1 } +func (v _XdrPtr_Int64) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_Int64) SetPresent(present bool) { + if !present { + *v.p = nil + } else if *v.p == nil { + *v.p = new(Int64) + } +} +func (v _XdrPtr_Int64) XdrMarshalValue(x XDR, name string) { + if *v.p != nil { + XDR_Int64(*v.p).XdrMarshal(x, name) + } +} +func (v _XdrPtr_Int64) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_Int64) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_Int64(v)) + v.XdrMarshalValue(x, name) +} +func (_XdrPtr_Int64) XdrTypeName() string { return "Int64*" } +func (v _XdrPtr_Int64) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_Int64) XdrValue() interface{} { return *v.p } -type XdrType_XdrAnon_TransactionHistoryEntry_Ext = *XdrAnon_TransactionHistoryEntry_Ext +type _XdrVec_unbounded_TransactionEnvelope []TransactionEnvelope -func (v *XdrAnon_TransactionHistoryEntry_Ext) XdrPointer() interface{} { return v } -func (XdrAnon_TransactionHistoryEntry_Ext) XdrTypeName() string { - return "XdrAnon_TransactionHistoryEntry_Ext" +func (_XdrVec_unbounded_TransactionEnvelope) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound } -func (v XdrAnon_TransactionHistoryEntry_Ext) XdrValue() interface{} { return v } -func (v *XdrAnon_TransactionHistoryEntry_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *XdrAnon_TransactionHistoryEntry_Ext) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (_XdrVec_unbounded_TransactionEnvelope) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_TransactionEnvelope length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_TransactionEnvelope length %d exceeds max int", length) } - XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) - switch u.V { - case 0: - return - case 1: - x.Marshal(x.Sprintf("%sgeneralizedTxSet", name), XDR_GeneralizedTransactionSet(u.GeneralizedTxSet())) +} +func (v _XdrVec_unbounded_TransactionEnvelope) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_TransactionEnvelope) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] + } return } - XdrPanic("invalid V (%v) in XdrAnon_TransactionHistoryEntry_Ext", u.V) + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) + } + nv := make([]TransactionEnvelope, int(length), newcap) + copy(nv, *v) + *v = nv } -func XDR_XdrAnon_TransactionHistoryEntry_Ext(v *XdrAnon_TransactionHistoryEntry_Ext) *XdrAnon_TransactionHistoryEntry_Ext { - return v +func (v *_XdrVec_unbounded_TransactionEnvelope) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_TransactionEnvelope(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] + } +} +func (v *_XdrVec_unbounded_TransactionEnvelope) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } +func (_XdrVec_unbounded_TransactionEnvelope) XdrTypeName() string { return "TransactionEnvelope<>" } +func (v *_XdrVec_unbounded_TransactionEnvelope) XdrPointer() interface{} { + return (*[]TransactionEnvelope)(v) +} +func (v _XdrVec_unbounded_TransactionEnvelope) XdrValue() interface{} { + return ([]TransactionEnvelope)(v) +} +func (v *_XdrVec_unbounded_TransactionEnvelope) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_TransactionHistoryEntry = *TransactionHistoryEntry +type XdrType_XdrAnon_TxSetComponent_TxsMaybeDiscountedFee = *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee -func (v *TransactionHistoryEntry) XdrPointer() interface{} { return v } -func (TransactionHistoryEntry) XdrTypeName() string { return "TransactionHistoryEntry" } -func (v TransactionHistoryEntry) XdrValue() interface{} { return v } -func (v *TransactionHistoryEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TransactionHistoryEntry) XdrRecurse(x XDR, name string) { +func (v *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) XdrPointer() interface{} { return v } +func (XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) XdrTypeName() string { + return "XdrAnon_TxSetComponent_TxsMaybeDiscountedFee" +} +func (v XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) XdrValue() interface{} { return v } +func (v *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) XdrMarshal(x XDR, name string) { + x.Marshal(name, v) +} +func (v *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sledgerSeq", name), XDR_Uint32(&v.LedgerSeq)) - x.Marshal(x.Sprintf("%stxSet", name), XDR_TransactionSet(&v.TxSet)) - x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_TransactionHistoryEntry_Ext(&v.Ext)) + x.Marshal(x.Sprintf("%sbaseFee", name), _XdrPtr_Int64{&v.BaseFee}) + x.Marshal(x.Sprintf("%stxs", name), (*_XdrVec_unbounded_TransactionEnvelope)(&v.Txs)) +} +func XDR_XdrAnon_TxSetComponent_TxsMaybeDiscountedFee(v *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee) *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee { + return v } -func XDR_TransactionHistoryEntry(v *TransactionHistoryEntry) *TransactionHistoryEntry { return v } -var _XdrTags_XdrAnon_TransactionHistoryResultEntry_Ext = map[int32]bool{ - XdrToI32(0): true, +var _XdrTags_TxSetComponent = map[int32]bool{ + XdrToI32(TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE): true, } -func (_ XdrAnon_TransactionHistoryResultEntry_Ext) XdrValidTags() map[int32]bool { - return _XdrTags_XdrAnon_TransactionHistoryResultEntry_Ext +func (_ TxSetComponent) XdrValidTags() map[int32]bool { + return _XdrTags_TxSetComponent } -func (u XdrAnon_TransactionHistoryResultEntry_Ext) XdrValid() bool { - switch u.V { - case 0: +func (u *TxSetComponent) TxsMaybeDiscountedFee() *XdrAnon_TxSetComponent_TxsMaybeDiscountedFee { + switch u.Type { + case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: + if v, ok := u._u.(*XdrAnon_TxSetComponent_TxsMaybeDiscountedFee); ok { + return v + } else { + var zero XdrAnon_TxSetComponent_TxsMaybeDiscountedFee + u._u = &zero + return &zero + } + default: + XdrPanic("TxSetComponent.TxsMaybeDiscountedFee accessed when Type == %v", u.Type) + return nil + } +} +func (u TxSetComponent) XdrValid() bool { + switch u.Type { + case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: return true } return false } -func (u *XdrAnon_TransactionHistoryResultEntry_Ext) XdrUnionTag() XdrNum32 { - return XDR_int32(&u.V) +func (u *TxSetComponent) XdrUnionTag() XdrNum32 { + return XDR_TxSetComponentType(&u.Type) } -func (u *XdrAnon_TransactionHistoryResultEntry_Ext) XdrUnionTagName() string { - return "V" +func (u *TxSetComponent) XdrUnionTagName() string { + return "Type" } -func (u *XdrAnon_TransactionHistoryResultEntry_Ext) XdrUnionBody() XdrType { - switch u.V { - case 0: - return nil +func (u *TxSetComponent) XdrUnionBody() XdrType { + switch u.Type { + case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: + return XDR_XdrAnon_TxSetComponent_TxsMaybeDiscountedFee(u.TxsMaybeDiscountedFee()) } return nil } -func (u *XdrAnon_TransactionHistoryResultEntry_Ext) XdrUnionBodyName() string { - switch u.V { - case 0: - return "" +func (u *TxSetComponent) XdrUnionBodyName() string { + switch u.Type { + case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: + return "TxsMaybeDiscountedFee" } return "" } -type XdrType_XdrAnon_TransactionHistoryResultEntry_Ext = *XdrAnon_TransactionHistoryResultEntry_Ext +type XdrType_TxSetComponent = *TxSetComponent -func (v *XdrAnon_TransactionHistoryResultEntry_Ext) XdrPointer() interface{} { return v } -func (XdrAnon_TransactionHistoryResultEntry_Ext) XdrTypeName() string { - return "XdrAnon_TransactionHistoryResultEntry_Ext" -} -func (v XdrAnon_TransactionHistoryResultEntry_Ext) XdrValue() interface{} { return v } -func (v *XdrAnon_TransactionHistoryResultEntry_Ext) XdrMarshal(x XDR, name string) { - x.Marshal(name, v) -} -func (u *XdrAnon_TransactionHistoryResultEntry_Ext) XdrRecurse(x XDR, name string) { +func (v *TxSetComponent) XdrPointer() interface{} { return v } +func (TxSetComponent) XdrTypeName() string { return "TxSetComponent" } +func (v TxSetComponent) XdrValue() interface{} { return v } +func (v *TxSetComponent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *TxSetComponent) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) - switch u.V { - case 0: + XDR_TxSetComponentType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: + x.Marshal(x.Sprintf("%stxsMaybeDiscountedFee", name), XDR_XdrAnon_TxSetComponent_TxsMaybeDiscountedFee(u.TxsMaybeDiscountedFee())) return } - XdrPanic("invalid V (%v) in XdrAnon_TransactionHistoryResultEntry_Ext", u.V) -} -func XDR_XdrAnon_TransactionHistoryResultEntry_Ext(v *XdrAnon_TransactionHistoryResultEntry_Ext) *XdrAnon_TransactionHistoryResultEntry_Ext { - return v + XdrPanic("invalid Type (%v) in TxSetComponent", u.Type) } +func XDR_TxSetComponent(v *TxSetComponent) *TxSetComponent { return v } -type XdrType_TransactionHistoryResultEntry = *TransactionHistoryResultEntry +type _XdrVec_unbounded_TxSetComponent []TxSetComponent -func (v *TransactionHistoryResultEntry) XdrPointer() interface{} { return v } -func (TransactionHistoryResultEntry) XdrTypeName() string { return "TransactionHistoryResultEntry" } -func (v TransactionHistoryResultEntry) XdrValue() interface{} { return v } -func (v *TransactionHistoryResultEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TransactionHistoryResultEntry) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (_XdrVec_unbounded_TxSetComponent) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound +} +func (_XdrVec_unbounded_TxSetComponent) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_TxSetComponent length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_TxSetComponent length %d exceeds max int", length) } - x.Marshal(x.Sprintf("%sledgerSeq", name), XDR_Uint32(&v.LedgerSeq)) - x.Marshal(x.Sprintf("%stxResultSet", name), XDR_TransactionResultSet(&v.TxResultSet)) - x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_TransactionHistoryResultEntry_Ext(&v.Ext)) } -func XDR_TransactionHistoryResultEntry(v *TransactionHistoryResultEntry) *TransactionHistoryResultEntry { - return v +func (v _XdrVec_unbounded_TxSetComponent) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_TxSetComponent) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] + } + return + } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) + } + nv := make([]TxSetComponent, int(length), newcap) + copy(nv, *v) + *v = nv +} +func (v *_XdrVec_unbounded_TxSetComponent) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_TxSetComponent(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] + } +} +func (v *_XdrVec_unbounded_TxSetComponent) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } +func (_XdrVec_unbounded_TxSetComponent) XdrTypeName() string { return "TxSetComponent<>" } +func (v *_XdrVec_unbounded_TxSetComponent) XdrPointer() interface{} { return (*[]TxSetComponent)(v) } +func (v _XdrVec_unbounded_TxSetComponent) XdrValue() interface{} { return ([]TxSetComponent)(v) } +func (v *_XdrVec_unbounded_TxSetComponent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -var _XdrTags_XdrAnon_LedgerHeaderHistoryEntry_Ext = map[int32]bool{ +var _XdrTags_TransactionPhase = map[int32]bool{ XdrToI32(0): true, } -func (_ XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrValidTags() map[int32]bool { - return _XdrTags_XdrAnon_LedgerHeaderHistoryEntry_Ext +func (_ TransactionPhase) XdrValidTags() map[int32]bool { + return _XdrTags_TransactionPhase } -func (u XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrValid() bool { +func (u *TransactionPhase) V0Components() *[]TxSetComponent { + switch u.V { + case 0: + if v, ok := u._u.(*[]TxSetComponent); ok { + return v + } else { + var zero []TxSetComponent + u._u = &zero + return &zero + } + default: + XdrPanic("TransactionPhase.V0Components accessed when V == %v", u.V) + return nil + } +} +func (u TransactionPhase) XdrValid() bool { switch u.V { case 0: return true } return false } -func (u *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrUnionTag() XdrNum32 { +func (u *TransactionPhase) XdrUnionTag() XdrNum32 { return XDR_int32(&u.V) } -func (u *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrUnionTagName() string { +func (u *TransactionPhase) XdrUnionTagName() string { return "V" } -func (u *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrUnionBody() XdrType { +func (u *TransactionPhase) XdrUnionBody() XdrType { switch u.V { case 0: - return nil + return (*_XdrVec_unbounded_TxSetComponent)(u.V0Components()) } return nil } -func (u *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrUnionBodyName() string { +func (u *TransactionPhase) XdrUnionBodyName() string { switch u.V { case 0: - return "" + return "V0Components" } return "" } -type XdrType_XdrAnon_LedgerHeaderHistoryEntry_Ext = *XdrAnon_LedgerHeaderHistoryEntry_Ext +type XdrType_TransactionPhase = *TransactionPhase -func (v *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrPointer() interface{} { return v } -func (XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrTypeName() string { - return "XdrAnon_LedgerHeaderHistoryEntry_Ext" -} -func (v XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrValue() interface{} { return v } -func (v *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrRecurse(x XDR, name string) { +func (v *TransactionPhase) XdrPointer() interface{} { return v } +func (TransactionPhase) XdrTypeName() string { return "TransactionPhase" } +func (v TransactionPhase) XdrValue() interface{} { return v } +func (v *TransactionPhase) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *TransactionPhase) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) switch u.V { case 0: + x.Marshal(x.Sprintf("%sv0Components", name), (*_XdrVec_unbounded_TxSetComponent)(u.V0Components())) return } - XdrPanic("invalid V (%v) in XdrAnon_LedgerHeaderHistoryEntry_Ext", u.V) -} -func XDR_XdrAnon_LedgerHeaderHistoryEntry_Ext(v *XdrAnon_LedgerHeaderHistoryEntry_Ext) *XdrAnon_LedgerHeaderHistoryEntry_Ext { - return v + XdrPanic("invalid V (%v) in TransactionPhase", u.V) } +func XDR_TransactionPhase(v *TransactionPhase) *TransactionPhase { return v } -type XdrType_LedgerHeaderHistoryEntry = *LedgerHeaderHistoryEntry +type XdrType_TransactionSet = *TransactionSet -func (v *LedgerHeaderHistoryEntry) XdrPointer() interface{} { return v } -func (LedgerHeaderHistoryEntry) XdrTypeName() string { return "LedgerHeaderHistoryEntry" } -func (v LedgerHeaderHistoryEntry) XdrValue() interface{} { return v } -func (v *LedgerHeaderHistoryEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LedgerHeaderHistoryEntry) XdrRecurse(x XDR, name string) { +func (v *TransactionSet) XdrPointer() interface{} { return v } +func (TransactionSet) XdrTypeName() string { return "TransactionSet" } +func (v TransactionSet) XdrValue() interface{} { return v } +func (v *TransactionSet) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TransactionSet) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%shash", name), XDR_Hash(&v.Hash)) - x.Marshal(x.Sprintf("%sheader", name), XDR_LedgerHeader(&v.Header)) - x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_LedgerHeaderHistoryEntry_Ext(&v.Ext)) + x.Marshal(x.Sprintf("%spreviousLedgerHash", name), XDR_Hash(&v.PreviousLedgerHash)) + x.Marshal(x.Sprintf("%stxs", name), (*_XdrVec_unbounded_TransactionEnvelope)(&v.Txs)) } -func XDR_LedgerHeaderHistoryEntry(v *LedgerHeaderHistoryEntry) *LedgerHeaderHistoryEntry { return v } +func XDR_TransactionSet(v *TransactionSet) *TransactionSet { return v } -type _XdrVec_unbounded_SCPEnvelope []SCPEnvelope +type _XdrVec_unbounded_TransactionPhase []TransactionPhase -func (_XdrVec_unbounded_SCPEnvelope) XdrBound() uint32 { +func (_XdrVec_unbounded_TransactionPhase) XdrBound() uint32 { const bound uint32 = 4294967295 // Force error if not const or doesn't fit return bound } -func (_XdrVec_unbounded_SCPEnvelope) XdrCheckLen(length uint32) { +func (_XdrVec_unbounded_TransactionPhase) XdrCheckLen(length uint32) { if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_SCPEnvelope length %d exceeds bound 4294967295", length) + XdrPanic("_XdrVec_unbounded_TransactionPhase length %d exceeds bound 4294967295", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_SCPEnvelope length %d exceeds max int", length) + XdrPanic("_XdrVec_unbounded_TransactionPhase length %d exceeds max int", length) } } -func (v _XdrVec_unbounded_SCPEnvelope) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_SCPEnvelope) SetVecLen(length uint32) { +func (v _XdrVec_unbounded_TransactionPhase) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_TransactionPhase) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -11284,346 +11502,159 @@ func (v *_XdrVec_unbounded_SCPEnvelope) SetVecLen(length uint32) { } newcap = int(bound) } - nv := make([]SCPEnvelope, int(length), newcap) + nv := make([]TransactionPhase, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_unbounded_SCPEnvelope) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_unbounded_TransactionPhase) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_SCPEnvelope(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_TransactionPhase(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_unbounded_SCPEnvelope) XdrRecurse(x XDR, name string) { +func (v *_XdrVec_unbounded_TransactionPhase) XdrRecurse(x XDR, name string) { size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_unbounded_SCPEnvelope) XdrTypeName() string { return "SCPEnvelope<>" } -func (v *_XdrVec_unbounded_SCPEnvelope) XdrPointer() interface{} { return (*[]SCPEnvelope)(v) } -func (v _XdrVec_unbounded_SCPEnvelope) XdrValue() interface{} { return ([]SCPEnvelope)(v) } -func (v *_XdrVec_unbounded_SCPEnvelope) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_LedgerSCPMessages = *LedgerSCPMessages - -func (v *LedgerSCPMessages) XdrPointer() interface{} { return v } -func (LedgerSCPMessages) XdrTypeName() string { return "LedgerSCPMessages" } -func (v LedgerSCPMessages) XdrValue() interface{} { return v } -func (v *LedgerSCPMessages) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LedgerSCPMessages) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sledgerSeq", name), XDR_Uint32(&v.LedgerSeq)) - x.Marshal(x.Sprintf("%smessages", name), (*_XdrVec_unbounded_SCPEnvelope)(&v.Messages)) +func (_XdrVec_unbounded_TransactionPhase) XdrTypeName() string { return "TransactionPhase<>" } +func (v *_XdrVec_unbounded_TransactionPhase) XdrPointer() interface{} { + return (*[]TransactionPhase)(v) } -func XDR_LedgerSCPMessages(v *LedgerSCPMessages) *LedgerSCPMessages { return v } +func (v _XdrVec_unbounded_TransactionPhase) XdrValue() interface{} { return ([]TransactionPhase)(v) } +func (v *_XdrVec_unbounded_TransactionPhase) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_SCPHistoryEntryV0 = *SCPHistoryEntryV0 +type XdrType_TransactionSetV1 = *TransactionSetV1 -func (v *SCPHistoryEntryV0) XdrPointer() interface{} { return v } -func (SCPHistoryEntryV0) XdrTypeName() string { return "SCPHistoryEntryV0" } -func (v SCPHistoryEntryV0) XdrValue() interface{} { return v } -func (v *SCPHistoryEntryV0) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SCPHistoryEntryV0) XdrRecurse(x XDR, name string) { +func (v *TransactionSetV1) XdrPointer() interface{} { return v } +func (TransactionSetV1) XdrTypeName() string { return "TransactionSetV1" } +func (v TransactionSetV1) XdrValue() interface{} { return v } +func (v *TransactionSetV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TransactionSetV1) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%squorumSets", name), (*_XdrVec_unbounded_SCPQuorumSet)(&v.QuorumSets)) - x.Marshal(x.Sprintf("%sledgerMessages", name), XDR_LedgerSCPMessages(&v.LedgerMessages)) + x.Marshal(x.Sprintf("%spreviousLedgerHash", name), XDR_Hash(&v.PreviousLedgerHash)) + x.Marshal(x.Sprintf("%sphases", name), (*_XdrVec_unbounded_TransactionPhase)(&v.Phases)) } -func XDR_SCPHistoryEntryV0(v *SCPHistoryEntryV0) *SCPHistoryEntryV0 { return v } +func XDR_TransactionSetV1(v *TransactionSetV1) *TransactionSetV1 { return v } -var _XdrTags_SCPHistoryEntry = map[int32]bool{ - XdrToI32(0): true, +var _XdrTags_GeneralizedTransactionSet = map[int32]bool{ + XdrToI32(1): true, } -func (_ SCPHistoryEntry) XdrValidTags() map[int32]bool { - return _XdrTags_SCPHistoryEntry +func (_ GeneralizedTransactionSet) XdrValidTags() map[int32]bool { + return _XdrTags_GeneralizedTransactionSet } -func (u *SCPHistoryEntry) V0() *SCPHistoryEntryV0 { +func (u *GeneralizedTransactionSet) V1TxSet() *TransactionSetV1 { switch u.V { - case 0: - if v, ok := u._u.(*SCPHistoryEntryV0); ok { + case 1: + if v, ok := u._u.(*TransactionSetV1); ok { return v } else { - var zero SCPHistoryEntryV0 + var zero TransactionSetV1 u._u = &zero return &zero } default: - XdrPanic("SCPHistoryEntry.V0 accessed when V == %v", u.V) + XdrPanic("GeneralizedTransactionSet.V1TxSet accessed when V == %v", u.V) return nil } } -func (u SCPHistoryEntry) XdrValid() bool { +func (u GeneralizedTransactionSet) XdrValid() bool { switch u.V { - case 0: + case 1: return true } return false } -func (u *SCPHistoryEntry) XdrUnionTag() XdrNum32 { +func (u *GeneralizedTransactionSet) XdrUnionTag() XdrNum32 { return XDR_int32(&u.V) } -func (u *SCPHistoryEntry) XdrUnionTagName() string { +func (u *GeneralizedTransactionSet) XdrUnionTagName() string { return "V" } -func (u *SCPHistoryEntry) XdrUnionBody() XdrType { +func (u *GeneralizedTransactionSet) XdrUnionBody() XdrType { switch u.V { - case 0: - return XDR_SCPHistoryEntryV0(u.V0()) + case 1: + return XDR_TransactionSetV1(u.V1TxSet()) } return nil } -func (u *SCPHistoryEntry) XdrUnionBodyName() string { +func (u *GeneralizedTransactionSet) XdrUnionBodyName() string { switch u.V { - case 0: - return "V0" + case 1: + return "V1TxSet" } return "" } -type XdrType_SCPHistoryEntry = *SCPHistoryEntry +type XdrType_GeneralizedTransactionSet = *GeneralizedTransactionSet -func (v *SCPHistoryEntry) XdrPointer() interface{} { return v } -func (SCPHistoryEntry) XdrTypeName() string { return "SCPHistoryEntry" } -func (v SCPHistoryEntry) XdrValue() interface{} { return v } -func (v *SCPHistoryEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *SCPHistoryEntry) XdrRecurse(x XDR, name string) { +func (v *GeneralizedTransactionSet) XdrPointer() interface{} { return v } +func (GeneralizedTransactionSet) XdrTypeName() string { return "GeneralizedTransactionSet" } +func (v GeneralizedTransactionSet) XdrValue() interface{} { return v } +func (v *GeneralizedTransactionSet) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *GeneralizedTransactionSet) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) switch u.V { - case 0: - x.Marshal(x.Sprintf("%sv0", name), XDR_SCPHistoryEntryV0(u.V0())) + case 1: + x.Marshal(x.Sprintf("%sv1TxSet", name), XDR_TransactionSetV1(u.V1TxSet())) return } - XdrPanic("invalid V (%v) in SCPHistoryEntry", u.V) -} -func XDR_SCPHistoryEntry(v *SCPHistoryEntry) *SCPHistoryEntry { return v } - -var _XdrNames_LedgerEntryChangeType = map[int32]string{ - int32(LEDGER_ENTRY_CREATED): "LEDGER_ENTRY_CREATED", - int32(LEDGER_ENTRY_UPDATED): "LEDGER_ENTRY_UPDATED", - int32(LEDGER_ENTRY_REMOVED): "LEDGER_ENTRY_REMOVED", - int32(LEDGER_ENTRY_STATE): "LEDGER_ENTRY_STATE", -} -var _XdrValues_LedgerEntryChangeType = map[string]int32{ - "LEDGER_ENTRY_CREATED": int32(LEDGER_ENTRY_CREATED), - "LEDGER_ENTRY_UPDATED": int32(LEDGER_ENTRY_UPDATED), - "LEDGER_ENTRY_REMOVED": int32(LEDGER_ENTRY_REMOVED), - "LEDGER_ENTRY_STATE": int32(LEDGER_ENTRY_STATE), -} - -func (LedgerEntryChangeType) XdrEnumNames() map[int32]string { - return _XdrNames_LedgerEntryChangeType -} -func (v LedgerEntryChangeType) String() string { - if s, ok := _XdrNames_LedgerEntryChangeType[int32(v)]; ok { - return s - } - return fmt.Sprintf("LedgerEntryChangeType#%d", v) -} -func (v *LedgerEntryChangeType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_LedgerEntryChangeType[stok]; ok { - *v = LedgerEntryChangeType(val) - return nil - } else if stok == "LedgerEntryChangeType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } - } - return XdrError(fmt.Sprintf("%s is not a valid LedgerEntryChangeType.", stok)) - } -} -func (v LedgerEntryChangeType) GetU32() uint32 { return uint32(v) } -func (v *LedgerEntryChangeType) SetU32(n uint32) { *v = LedgerEntryChangeType(n) } -func (v *LedgerEntryChangeType) XdrPointer() interface{} { return v } -func (LedgerEntryChangeType) XdrTypeName() string { return "LedgerEntryChangeType" } -func (v LedgerEntryChangeType) XdrValue() interface{} { return v } -func (v *LedgerEntryChangeType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_LedgerEntryChangeType = *LedgerEntryChangeType - -func XDR_LedgerEntryChangeType(v *LedgerEntryChangeType) *LedgerEntryChangeType { return v } - -var _XdrComments_LedgerEntryChangeType = map[int32]string{ - int32(LEDGER_ENTRY_CREATED): "entry was added to the ledger", - int32(LEDGER_ENTRY_UPDATED): "entry was modified in the ledger", - int32(LEDGER_ENTRY_REMOVED): "entry was removed from the ledger", - int32(LEDGER_ENTRY_STATE): "value of the entry", -} - -func (e LedgerEntryChangeType) XdrEnumComments() map[int32]string { - return _XdrComments_LedgerEntryChangeType -} - -var _XdrTags_LedgerEntryChange = map[int32]bool{ - XdrToI32(LEDGER_ENTRY_CREATED): true, - XdrToI32(LEDGER_ENTRY_UPDATED): true, - XdrToI32(LEDGER_ENTRY_REMOVED): true, - XdrToI32(LEDGER_ENTRY_STATE): true, -} - -func (_ LedgerEntryChange) XdrValidTags() map[int32]bool { - return _XdrTags_LedgerEntryChange -} -func (u *LedgerEntryChange) Created() *LedgerEntry { - switch u.Type { - case LEDGER_ENTRY_CREATED: - if v, ok := u._u.(*LedgerEntry); ok { - return v - } else { - var zero LedgerEntry - u._u = &zero - return &zero - } - default: - XdrPanic("LedgerEntryChange.Created accessed when Type == %v", u.Type) - return nil - } -} -func (u *LedgerEntryChange) Updated() *LedgerEntry { - switch u.Type { - case LEDGER_ENTRY_UPDATED: - if v, ok := u._u.(*LedgerEntry); ok { - return v - } else { - var zero LedgerEntry - u._u = &zero - return &zero - } - default: - XdrPanic("LedgerEntryChange.Updated accessed when Type == %v", u.Type) - return nil - } + XdrPanic("invalid V (%v) in GeneralizedTransactionSet", u.V) } -func (u *LedgerEntryChange) Removed() *LedgerKey { - switch u.Type { - case LEDGER_ENTRY_REMOVED: - if v, ok := u._u.(*LedgerKey); ok { - return v - } else { - var zero LedgerKey - u._u = &zero - return &zero - } +func (v *GeneralizedTransactionSet) XdrInitialize() { + var zero int32 + switch zero { + case 1: default: - XdrPanic("LedgerEntryChange.Removed accessed when Type == %v", u.Type) - return nil - } -} -func (u *LedgerEntryChange) State() *LedgerEntry { - switch u.Type { - case LEDGER_ENTRY_STATE: - if v, ok := u._u.(*LedgerEntry); ok { - return v - } else { - var zero LedgerEntry - u._u = &zero - return &zero + if v.V == zero { + v.V = 1 } - default: - XdrPanic("LedgerEntryChange.State accessed when Type == %v", u.Type) - return nil - } -} -func (u LedgerEntryChange) XdrValid() bool { - switch u.Type { - case LEDGER_ENTRY_CREATED, LEDGER_ENTRY_UPDATED, LEDGER_ENTRY_REMOVED, LEDGER_ENTRY_STATE: - return true - } - return false -} -func (u *LedgerEntryChange) XdrUnionTag() XdrNum32 { - return XDR_LedgerEntryChangeType(&u.Type) -} -func (u *LedgerEntryChange) XdrUnionTagName() string { - return "Type" -} -func (u *LedgerEntryChange) XdrUnionBody() XdrType { - switch u.Type { - case LEDGER_ENTRY_CREATED: - return XDR_LedgerEntry(u.Created()) - case LEDGER_ENTRY_UPDATED: - return XDR_LedgerEntry(u.Updated()) - case LEDGER_ENTRY_REMOVED: - return XDR_LedgerKey(u.Removed()) - case LEDGER_ENTRY_STATE: - return XDR_LedgerEntry(u.State()) - } - return nil -} -func (u *LedgerEntryChange) XdrUnionBodyName() string { - switch u.Type { - case LEDGER_ENTRY_CREATED: - return "Created" - case LEDGER_ENTRY_UPDATED: - return "Updated" - case LEDGER_ENTRY_REMOVED: - return "Removed" - case LEDGER_ENTRY_STATE: - return "State" } - return "" } +func XDR_GeneralizedTransactionSet(v *GeneralizedTransactionSet) *GeneralizedTransactionSet { return v } -type XdrType_LedgerEntryChange = *LedgerEntryChange +type XdrType_TransactionResultPair = *TransactionResultPair -func (v *LedgerEntryChange) XdrPointer() interface{} { return v } -func (LedgerEntryChange) XdrTypeName() string { return "LedgerEntryChange" } -func (v LedgerEntryChange) XdrValue() interface{} { return v } -func (v *LedgerEntryChange) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *LedgerEntryChange) XdrRecurse(x XDR, name string) { +func (v *TransactionResultPair) XdrPointer() interface{} { return v } +func (TransactionResultPair) XdrTypeName() string { return "TransactionResultPair" } +func (v TransactionResultPair) XdrValue() interface{} { return v } +func (v *TransactionResultPair) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TransactionResultPair) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_LedgerEntryChangeType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case LEDGER_ENTRY_CREATED: - x.Marshal(x.Sprintf("%screated", name), XDR_LedgerEntry(u.Created())) - return - case LEDGER_ENTRY_UPDATED: - x.Marshal(x.Sprintf("%supdated", name), XDR_LedgerEntry(u.Updated())) - return - case LEDGER_ENTRY_REMOVED: - x.Marshal(x.Sprintf("%sremoved", name), XDR_LedgerKey(u.Removed())) - return - case LEDGER_ENTRY_STATE: - x.Marshal(x.Sprintf("%sstate", name), XDR_LedgerEntry(u.State())) - return - } - XdrPanic("invalid Type (%v) in LedgerEntryChange", u.Type) + x.Marshal(x.Sprintf("%stransactionHash", name), XDR_Hash(&v.TransactionHash)) + x.Marshal(x.Sprintf("%sresult", name), XDR_TransactionResult(&v.Result)) } -func XDR_LedgerEntryChange(v *LedgerEntryChange) *LedgerEntryChange { return v } +func XDR_TransactionResultPair(v *TransactionResultPair) *TransactionResultPair { return v } -type _XdrVec_unbounded_LedgerEntryChange []LedgerEntryChange +type _XdrVec_unbounded_TransactionResultPair []TransactionResultPair -func (_XdrVec_unbounded_LedgerEntryChange) XdrBound() uint32 { +func (_XdrVec_unbounded_TransactionResultPair) XdrBound() uint32 { const bound uint32 = 4294967295 // Force error if not const or doesn't fit return bound } -func (_XdrVec_unbounded_LedgerEntryChange) XdrCheckLen(length uint32) { +func (_XdrVec_unbounded_TransactionResultPair) XdrCheckLen(length uint32) { if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_LedgerEntryChange length %d exceeds bound 4294967295", length) + XdrPanic("_XdrVec_unbounded_TransactionResultPair length %d exceeds bound 4294967295", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_LedgerEntryChange length %d exceeds max int", length) + XdrPanic("_XdrVec_unbounded_TransactionResultPair length %d exceeds max int", length) } } -func (v _XdrVec_unbounded_LedgerEntryChange) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_LedgerEntryChange) SetVecLen(length uint32) { +func (v _XdrVec_unbounded_TransactionResultPair) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_TransactionResultPair) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -11640,459 +11671,314 @@ func (v *_XdrVec_unbounded_LedgerEntryChange) SetVecLen(length uint32) { } newcap = int(bound) } - nv := make([]LedgerEntryChange, int(length), newcap) + nv := make([]TransactionResultPair, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_unbounded_LedgerEntryChange) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_unbounded_TransactionResultPair) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_LedgerEntryChange(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_TransactionResultPair(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_unbounded_LedgerEntryChange) XdrRecurse(x XDR, name string) { +func (v *_XdrVec_unbounded_TransactionResultPair) XdrRecurse(x XDR, name string) { size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_unbounded_LedgerEntryChange) XdrTypeName() string { return "LedgerEntryChange<>" } -func (v *_XdrVec_unbounded_LedgerEntryChange) XdrPointer() interface{} { - return (*[]LedgerEntryChange)(v) +func (_XdrVec_unbounded_TransactionResultPair) XdrTypeName() string { return "TransactionResultPair<>" } +func (v *_XdrVec_unbounded_TransactionResultPair) XdrPointer() interface{} { + return (*[]TransactionResultPair)(v) } -func (v _XdrVec_unbounded_LedgerEntryChange) XdrValue() interface{} { return ([]LedgerEntryChange)(v) } -func (v *_XdrVec_unbounded_LedgerEntryChange) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_LedgerEntryChanges struct { - *_XdrVec_unbounded_LedgerEntryChange +func (v _XdrVec_unbounded_TransactionResultPair) XdrValue() interface{} { + return ([]TransactionResultPair)(v) } +func (v *_XdrVec_unbounded_TransactionResultPair) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func XDR_LedgerEntryChanges(v *LedgerEntryChanges) XdrType_LedgerEntryChanges { - return XdrType_LedgerEntryChanges{(*_XdrVec_unbounded_LedgerEntryChange)(v)} -} -func (XdrType_LedgerEntryChanges) XdrTypeName() string { return "LedgerEntryChanges" } -func (v XdrType_LedgerEntryChanges) XdrUnwrap() XdrType { return v._XdrVec_unbounded_LedgerEntryChange } - -type XdrType_OperationMeta = *OperationMeta +type XdrType_TransactionResultSet = *TransactionResultSet -func (v *OperationMeta) XdrPointer() interface{} { return v } -func (OperationMeta) XdrTypeName() string { return "OperationMeta" } -func (v OperationMeta) XdrValue() interface{} { return v } -func (v *OperationMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *OperationMeta) XdrRecurse(x XDR, name string) { +func (v *TransactionResultSet) XdrPointer() interface{} { return v } +func (TransactionResultSet) XdrTypeName() string { return "TransactionResultSet" } +func (v TransactionResultSet) XdrValue() interface{} { return v } +func (v *TransactionResultSet) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TransactionResultSet) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%schanges", name), XDR_LedgerEntryChanges(&v.Changes)) + x.Marshal(x.Sprintf("%sresults", name), (*_XdrVec_unbounded_TransactionResultPair)(&v.Results)) } -func XDR_OperationMeta(v *OperationMeta) *OperationMeta { return v } - -type _XdrVec_unbounded_OperationMeta []OperationMeta +func XDR_TransactionResultSet(v *TransactionResultSet) *TransactionResultSet { return v } -func (_XdrVec_unbounded_OperationMeta) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound +var _XdrTags_XdrAnon_TransactionHistoryEntry_Ext = map[int32]bool{ + XdrToI32(0): true, + XdrToI32(1): true, } -func (_XdrVec_unbounded_OperationMeta) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_OperationMeta length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_OperationMeta length %d exceeds max int", length) - } + +func (_ XdrAnon_TransactionHistoryEntry_Ext) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_TransactionHistoryEntry_Ext } -func (v _XdrVec_unbounded_OperationMeta) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_OperationMeta) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 +func (u *XdrAnon_TransactionHistoryEntry_Ext) GeneralizedTxSet() *GeneralizedTransactionSet { + switch u.V { + case 1: + if v, ok := u._u.(*GeneralizedTransactionSet); ok { + return v + } else { + var zero GeneralizedTransactionSet + u._u = &zero + return &zero } - newcap = int(bound) + default: + XdrPanic("XdrAnon_TransactionHistoryEntry_Ext.GeneralizedTxSet accessed when V == %v", u.V) + return nil } - nv := make([]OperationMeta, int(length), newcap) - copy(nv, *v) - *v = nv } -func (v *_XdrVec_unbounded_OperationMeta) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) - } - XDR_OperationMeta(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) +func (u XdrAnon_TransactionHistoryEntry_Ext) XdrValid() bool { + switch u.V { + case 0, 1: + return true } - if int(n) < len(*v) { - *v = (*v)[:int(n)] + return false +} +func (u *XdrAnon_TransactionHistoryEntry_Ext) XdrUnionTag() XdrNum32 { + return XDR_int32(&u.V) +} +func (u *XdrAnon_TransactionHistoryEntry_Ext) XdrUnionTagName() string { + return "V" +} +func (u *XdrAnon_TransactionHistoryEntry_Ext) XdrUnionBody() XdrType { + switch u.V { + case 0: + return nil + case 1: + return XDR_GeneralizedTransactionSet(u.GeneralizedTxSet()) } + return nil } -func (v *_XdrVec_unbounded_OperationMeta) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) +func (u *XdrAnon_TransactionHistoryEntry_Ext) XdrUnionBodyName() string { + switch u.V { + case 0: + return "" + case 1: + return "GeneralizedTxSet" + } + return "" } -func (_XdrVec_unbounded_OperationMeta) XdrTypeName() string { return "OperationMeta<>" } -func (v *_XdrVec_unbounded_OperationMeta) XdrPointer() interface{} { return (*[]OperationMeta)(v) } -func (v _XdrVec_unbounded_OperationMeta) XdrValue() interface{} { return ([]OperationMeta)(v) } -func (v *_XdrVec_unbounded_OperationMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_TransactionMetaV1 = *TransactionMetaV1 +type XdrType_XdrAnon_TransactionHistoryEntry_Ext = *XdrAnon_TransactionHistoryEntry_Ext -func (v *TransactionMetaV1) XdrPointer() interface{} { return v } -func (TransactionMetaV1) XdrTypeName() string { return "TransactionMetaV1" } -func (v TransactionMetaV1) XdrValue() interface{} { return v } -func (v *TransactionMetaV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TransactionMetaV1) XdrRecurse(x XDR, name string) { +func (v *XdrAnon_TransactionHistoryEntry_Ext) XdrPointer() interface{} { return v } +func (XdrAnon_TransactionHistoryEntry_Ext) XdrTypeName() string { + return "XdrAnon_TransactionHistoryEntry_Ext" +} +func (v XdrAnon_TransactionHistoryEntry_Ext) XdrValue() interface{} { return v } +func (v *XdrAnon_TransactionHistoryEntry_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_TransactionHistoryEntry_Ext) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%stxChanges", name), XDR_LedgerEntryChanges(&v.TxChanges)) - x.Marshal(x.Sprintf("%soperations", name), (*_XdrVec_unbounded_OperationMeta)(&v.Operations)) + XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + switch u.V { + case 0: + return + case 1: + x.Marshal(x.Sprintf("%sgeneralizedTxSet", name), XDR_GeneralizedTransactionSet(u.GeneralizedTxSet())) + return + } + XdrPanic("invalid V (%v) in XdrAnon_TransactionHistoryEntry_Ext", u.V) +} +func XDR_XdrAnon_TransactionHistoryEntry_Ext(v *XdrAnon_TransactionHistoryEntry_Ext) *XdrAnon_TransactionHistoryEntry_Ext { + return v } -func XDR_TransactionMetaV1(v *TransactionMetaV1) *TransactionMetaV1 { return v } -type XdrType_TransactionMetaV2 = *TransactionMetaV2 +type XdrType_TransactionHistoryEntry = *TransactionHistoryEntry -func (v *TransactionMetaV2) XdrPointer() interface{} { return v } -func (TransactionMetaV2) XdrTypeName() string { return "TransactionMetaV2" } -func (v TransactionMetaV2) XdrValue() interface{} { return v } -func (v *TransactionMetaV2) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TransactionMetaV2) XdrRecurse(x XDR, name string) { +func (v *TransactionHistoryEntry) XdrPointer() interface{} { return v } +func (TransactionHistoryEntry) XdrTypeName() string { return "TransactionHistoryEntry" } +func (v TransactionHistoryEntry) XdrValue() interface{} { return v } +func (v *TransactionHistoryEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TransactionHistoryEntry) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%stxChangesBefore", name), XDR_LedgerEntryChanges(&v.TxChangesBefore)) - x.Marshal(x.Sprintf("%soperations", name), (*_XdrVec_unbounded_OperationMeta)(&v.Operations)) - x.Marshal(x.Sprintf("%stxChangesAfter", name), XDR_LedgerEntryChanges(&v.TxChangesAfter)) + x.Marshal(x.Sprintf("%sledgerSeq", name), XDR_Uint32(&v.LedgerSeq)) + x.Marshal(x.Sprintf("%stxSet", name), XDR_TransactionSet(&v.TxSet)) + x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_TransactionHistoryEntry_Ext(&v.Ext)) } -func XDR_TransactionMetaV2(v *TransactionMetaV2) *TransactionMetaV2 { return v } +func XDR_TransactionHistoryEntry(v *TransactionHistoryEntry) *TransactionHistoryEntry { return v } -var _XdrNames_ContractEventType = map[int32]string{ - int32(SYSTEM): "SYSTEM", - int32(CONTRACT): "CONTRACT", - int32(DIAGNOSTIC): "DIAGNOSTIC", -} -var _XdrValues_ContractEventType = map[string]int32{ - "SYSTEM": int32(SYSTEM), - "CONTRACT": int32(CONTRACT), - "DIAGNOSTIC": int32(DIAGNOSTIC), +var _XdrTags_XdrAnon_TransactionHistoryResultEntry_Ext = map[int32]bool{ + XdrToI32(0): true, } -func (ContractEventType) XdrEnumNames() map[int32]string { - return _XdrNames_ContractEventType +func (_ XdrAnon_TransactionHistoryResultEntry_Ext) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_TransactionHistoryResultEntry_Ext } -func (v ContractEventType) String() string { - if s, ok := _XdrNames_ContractEventType[int32(v)]; ok { - return s +func (u XdrAnon_TransactionHistoryResultEntry_Ext) XdrValid() bool { + switch u.V { + case 0: + return true } - return fmt.Sprintf("ContractEventType#%d", v) + return false } -func (v *ContractEventType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_ContractEventType[stok]; ok { - *v = ContractEventType(val) - return nil - } else if stok == "ContractEventType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } - } - return XdrError(fmt.Sprintf("%s is not a valid ContractEventType.", stok)) +func (u *XdrAnon_TransactionHistoryResultEntry_Ext) XdrUnionTag() XdrNum32 { + return XDR_int32(&u.V) +} +func (u *XdrAnon_TransactionHistoryResultEntry_Ext) XdrUnionTagName() string { + return "V" +} +func (u *XdrAnon_TransactionHistoryResultEntry_Ext) XdrUnionBody() XdrType { + switch u.V { + case 0: + return nil } + return nil +} +func (u *XdrAnon_TransactionHistoryResultEntry_Ext) XdrUnionBodyName() string { + switch u.V { + case 0: + return "" + } + return "" } -func (v ContractEventType) GetU32() uint32 { return uint32(v) } -func (v *ContractEventType) SetU32(n uint32) { *v = ContractEventType(n) } -func (v *ContractEventType) XdrPointer() interface{} { return v } -func (ContractEventType) XdrTypeName() string { return "ContractEventType" } -func (v ContractEventType) XdrValue() interface{} { return v } -func (v *ContractEventType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_ContractEventType = *ContractEventType - -func XDR_ContractEventType(v *ContractEventType) *ContractEventType { return v } -type _XdrVec_unbounded_SCVal []SCVal +type XdrType_XdrAnon_TransactionHistoryResultEntry_Ext = *XdrAnon_TransactionHistoryResultEntry_Ext -func (_XdrVec_unbounded_SCVal) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound +func (v *XdrAnon_TransactionHistoryResultEntry_Ext) XdrPointer() interface{} { return v } +func (XdrAnon_TransactionHistoryResultEntry_Ext) XdrTypeName() string { + return "XdrAnon_TransactionHistoryResultEntry_Ext" } -func (_XdrVec_unbounded_SCVal) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_SCVal length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_SCVal length %d exceeds max int", length) +func (v XdrAnon_TransactionHistoryResultEntry_Ext) XdrValue() interface{} { return v } +func (v *XdrAnon_TransactionHistoryResultEntry_Ext) XdrMarshal(x XDR, name string) { + x.Marshal(name, v) +} +func (u *XdrAnon_TransactionHistoryResultEntry_Ext) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + switch u.V { + case 0: + return } + XdrPanic("invalid V (%v) in XdrAnon_TransactionHistoryResultEntry_Ext", u.V) } -func (v _XdrVec_unbounded_SCVal) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_SCVal) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) - } - nv := make([]SCVal, int(length), newcap) - copy(nv, *v) - *v = nv -} -func (v *_XdrVec_unbounded_SCVal) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) - } - XDR_SCVal(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] - } -} -func (v *_XdrVec_unbounded_SCVal) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) +func XDR_XdrAnon_TransactionHistoryResultEntry_Ext(v *XdrAnon_TransactionHistoryResultEntry_Ext) *XdrAnon_TransactionHistoryResultEntry_Ext { + return v } -func (_XdrVec_unbounded_SCVal) XdrTypeName() string { return "SCVal<>" } -func (v *_XdrVec_unbounded_SCVal) XdrPointer() interface{} { return (*[]SCVal)(v) } -func (v _XdrVec_unbounded_SCVal) XdrValue() interface{} { return ([]SCVal)(v) } -func (v *_XdrVec_unbounded_SCVal) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_XdrAnon_ContractEvent_Body_V0 = *XdrAnon_ContractEvent_Body_V0 +type XdrType_TransactionHistoryResultEntry = *TransactionHistoryResultEntry -func (v *XdrAnon_ContractEvent_Body_V0) XdrPointer() interface{} { return v } -func (XdrAnon_ContractEvent_Body_V0) XdrTypeName() string { return "XdrAnon_ContractEvent_Body_V0" } -func (v XdrAnon_ContractEvent_Body_V0) XdrValue() interface{} { return v } -func (v *XdrAnon_ContractEvent_Body_V0) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *XdrAnon_ContractEvent_Body_V0) XdrRecurse(x XDR, name string) { +func (v *TransactionHistoryResultEntry) XdrPointer() interface{} { return v } +func (TransactionHistoryResultEntry) XdrTypeName() string { return "TransactionHistoryResultEntry" } +func (v TransactionHistoryResultEntry) XdrValue() interface{} { return v } +func (v *TransactionHistoryResultEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TransactionHistoryResultEntry) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%stopics", name), (*_XdrVec_unbounded_SCVal)(&v.Topics)) - x.Marshal(x.Sprintf("%sdata", name), XDR_SCVal(&v.Data)) + x.Marshal(x.Sprintf("%sledgerSeq", name), XDR_Uint32(&v.LedgerSeq)) + x.Marshal(x.Sprintf("%stxResultSet", name), XDR_TransactionResultSet(&v.TxResultSet)) + x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_TransactionHistoryResultEntry_Ext(&v.Ext)) } -func XDR_XdrAnon_ContractEvent_Body_V0(v *XdrAnon_ContractEvent_Body_V0) *XdrAnon_ContractEvent_Body_V0 { +func XDR_TransactionHistoryResultEntry(v *TransactionHistoryResultEntry) *TransactionHistoryResultEntry { return v } -var _XdrTags_XdrAnon_ContractEvent_Body = map[int32]bool{ +var _XdrTags_XdrAnon_LedgerHeaderHistoryEntry_Ext = map[int32]bool{ XdrToI32(0): true, } -func (_ XdrAnon_ContractEvent_Body) XdrValidTags() map[int32]bool { - return _XdrTags_XdrAnon_ContractEvent_Body -} -func (u *XdrAnon_ContractEvent_Body) V0() *XdrAnon_ContractEvent_Body_V0 { - switch u.V { - case 0: - if v, ok := u._u.(*XdrAnon_ContractEvent_Body_V0); ok { - return v - } else { - var zero XdrAnon_ContractEvent_Body_V0 - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_ContractEvent_Body.V0 accessed when V == %v", u.V) - return nil - } +func (_ XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_LedgerHeaderHistoryEntry_Ext } -func (u XdrAnon_ContractEvent_Body) XdrValid() bool { +func (u XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrValid() bool { switch u.V { case 0: return true } return false } -func (u *XdrAnon_ContractEvent_Body) XdrUnionTag() XdrNum32 { +func (u *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrUnionTag() XdrNum32 { return XDR_int32(&u.V) } -func (u *XdrAnon_ContractEvent_Body) XdrUnionTagName() string { +func (u *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrUnionTagName() string { return "V" } -func (u *XdrAnon_ContractEvent_Body) XdrUnionBody() XdrType { +func (u *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrUnionBody() XdrType { switch u.V { case 0: - return XDR_XdrAnon_ContractEvent_Body_V0(u.V0()) + return nil } return nil } -func (u *XdrAnon_ContractEvent_Body) XdrUnionBodyName() string { +func (u *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrUnionBodyName() string { switch u.V { case 0: - return "V0" + return "" } return "" } -type XdrType_XdrAnon_ContractEvent_Body = *XdrAnon_ContractEvent_Body +type XdrType_XdrAnon_LedgerHeaderHistoryEntry_Ext = *XdrAnon_LedgerHeaderHistoryEntry_Ext -func (v *XdrAnon_ContractEvent_Body) XdrPointer() interface{} { return v } -func (XdrAnon_ContractEvent_Body) XdrTypeName() string { return "XdrAnon_ContractEvent_Body" } -func (v XdrAnon_ContractEvent_Body) XdrValue() interface{} { return v } -func (v *XdrAnon_ContractEvent_Body) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *XdrAnon_ContractEvent_Body) XdrRecurse(x XDR, name string) { +func (v *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrPointer() interface{} { return v } +func (XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrTypeName() string { + return "XdrAnon_LedgerHeaderHistoryEntry_Ext" +} +func (v XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrValue() interface{} { return v } +func (v *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_LedgerHeaderHistoryEntry_Ext) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) switch u.V { case 0: - x.Marshal(x.Sprintf("%sv0", name), XDR_XdrAnon_ContractEvent_Body_V0(u.V0())) return } - XdrPanic("invalid V (%v) in XdrAnon_ContractEvent_Body", u.V) + XdrPanic("invalid V (%v) in XdrAnon_LedgerHeaderHistoryEntry_Ext", u.V) } -func XDR_XdrAnon_ContractEvent_Body(v *XdrAnon_ContractEvent_Body) *XdrAnon_ContractEvent_Body { +func XDR_XdrAnon_LedgerHeaderHistoryEntry_Ext(v *XdrAnon_LedgerHeaderHistoryEntry_Ext) *XdrAnon_LedgerHeaderHistoryEntry_Ext { return v } -type _XdrPtr_Hash struct { - p **Hash -} -type _ptrflag_Hash _XdrPtr_Hash - -func (v _ptrflag_Hash) String() string { - if *v.p == nil { - return "nil" - } - return "non-nil" -} -func (v _ptrflag_Hash) Scan(ss fmt.ScanState, r rune) error { - tok, err := ss.Token(true, func(c rune) bool { - return c == '-' || (c >= 'a' && c <= 'z') - }) - if err != nil { - return err - } - switch string(tok) { - case "nil": - v.SetU32(0) - case "non-nil": - v.SetU32(1) - default: - return XdrError("Hash flag should be \"nil\" or \"non-nil\"") - } - return nil -} -func (v _ptrflag_Hash) GetU32() uint32 { - if *v.p == nil { - return 0 - } - return 1 -} -func (v _ptrflag_Hash) SetU32(nv uint32) { - switch nv { - case 0: - *v.p = nil - case 1: - if *v.p == nil { - *v.p = new(Hash) - } - default: - XdrPanic("*Hash present flag value %d should be 0 or 1", nv) - } -} -func (_ptrflag_Hash) XdrTypeName() string { return "Hash?" } -func (v _ptrflag_Hash) XdrPointer() interface{} { return nil } -func (v _ptrflag_Hash) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_Hash) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_Hash) XdrBound() uint32 { return 1 } -func (v _XdrPtr_Hash) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_Hash) SetPresent(present bool) { - if !present { - *v.p = nil - } else if *v.p == nil { - *v.p = new(Hash) - } -} -func (v _XdrPtr_Hash) XdrMarshalValue(x XDR, name string) { - if *v.p != nil { - XDR_Hash(*v.p).XdrMarshal(x, name) - } -} -func (v _XdrPtr_Hash) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_Hash) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_Hash(v)) - v.XdrMarshalValue(x, name) -} -func (_XdrPtr_Hash) XdrTypeName() string { return "Hash*" } -func (v _XdrPtr_Hash) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_Hash) XdrValue() interface{} { return *v.p } - -type XdrType_ContractEvent = *ContractEvent - -func (v *ContractEvent) XdrPointer() interface{} { return v } -func (ContractEvent) XdrTypeName() string { return "ContractEvent" } -func (v ContractEvent) XdrValue() interface{} { return v } -func (v *ContractEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ContractEvent) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) - x.Marshal(x.Sprintf("%scontractID", name), _XdrPtr_Hash{&v.ContractID}) - x.Marshal(x.Sprintf("%stype", name), XDR_ContractEventType(&v.Type)) - x.Marshal(x.Sprintf("%sbody", name), XDR_XdrAnon_ContractEvent_Body(&v.Body)) -} -func XDR_ContractEvent(v *ContractEvent) *ContractEvent { return v } - -type XdrType_DiagnosticEvent = *DiagnosticEvent +type XdrType_LedgerHeaderHistoryEntry = *LedgerHeaderHistoryEntry -func (v *DiagnosticEvent) XdrPointer() interface{} { return v } -func (DiagnosticEvent) XdrTypeName() string { return "DiagnosticEvent" } -func (v DiagnosticEvent) XdrValue() interface{} { return v } -func (v *DiagnosticEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *DiagnosticEvent) XdrRecurse(x XDR, name string) { +func (v *LedgerHeaderHistoryEntry) XdrPointer() interface{} { return v } +func (LedgerHeaderHistoryEntry) XdrTypeName() string { return "LedgerHeaderHistoryEntry" } +func (v LedgerHeaderHistoryEntry) XdrValue() interface{} { return v } +func (v *LedgerHeaderHistoryEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerHeaderHistoryEntry) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sinSuccessfulContractCall", name), XDR_bool(&v.InSuccessfulContractCall)) - x.Marshal(x.Sprintf("%sevent", name), XDR_ContractEvent(&v.Event)) + x.Marshal(x.Sprintf("%shash", name), XDR_Hash(&v.Hash)) + x.Marshal(x.Sprintf("%sheader", name), XDR_LedgerHeader(&v.Header)) + x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_LedgerHeaderHistoryEntry_Ext(&v.Ext)) } -func XDR_DiagnosticEvent(v *DiagnosticEvent) *DiagnosticEvent { return v } +func XDR_LedgerHeaderHistoryEntry(v *LedgerHeaderHistoryEntry) *LedgerHeaderHistoryEntry { return v } -type _XdrVec_unbounded_DiagnosticEvent []DiagnosticEvent +type _XdrVec_unbounded_SCPEnvelope []SCPEnvelope -func (_XdrVec_unbounded_DiagnosticEvent) XdrBound() uint32 { +func (_XdrVec_unbounded_SCPEnvelope) XdrBound() uint32 { const bound uint32 = 4294967295 // Force error if not const or doesn't fit return bound } -func (_XdrVec_unbounded_DiagnosticEvent) XdrCheckLen(length uint32) { +func (_XdrVec_unbounded_SCPEnvelope) XdrCheckLen(length uint32) { if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_DiagnosticEvent length %d exceeds bound 4294967295", length) + XdrPanic("_XdrVec_unbounded_SCPEnvelope length %d exceeds bound 4294967295", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_DiagnosticEvent length %d exceeds max int", length) + XdrPanic("_XdrVec_unbounded_SCPEnvelope length %d exceeds max int", length) } } -func (v _XdrVec_unbounded_DiagnosticEvent) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_DiagnosticEvent) SetVecLen(length uint32) { +func (v _XdrVec_unbounded_SCPEnvelope) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_SCPEnvelope) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -12109,507 +11995,346 @@ func (v *_XdrVec_unbounded_DiagnosticEvent) SetVecLen(length uint32) { } newcap = int(bound) } - nv := make([]DiagnosticEvent, int(length), newcap) + nv := make([]SCPEnvelope, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_unbounded_DiagnosticEvent) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_unbounded_SCPEnvelope) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_DiagnosticEvent(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_SCPEnvelope(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_unbounded_DiagnosticEvent) XdrRecurse(x XDR, name string) { +func (v *_XdrVec_unbounded_SCPEnvelope) XdrRecurse(x XDR, name string) { size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_unbounded_DiagnosticEvent) XdrTypeName() string { return "DiagnosticEvent<>" } -func (v *_XdrVec_unbounded_DiagnosticEvent) XdrPointer() interface{} { return (*[]DiagnosticEvent)(v) } -func (v _XdrVec_unbounded_DiagnosticEvent) XdrValue() interface{} { return ([]DiagnosticEvent)(v) } -func (v *_XdrVec_unbounded_DiagnosticEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (_XdrVec_unbounded_SCPEnvelope) XdrTypeName() string { return "SCPEnvelope<>" } +func (v *_XdrVec_unbounded_SCPEnvelope) XdrPointer() interface{} { return (*[]SCPEnvelope)(v) } +func (v _XdrVec_unbounded_SCPEnvelope) XdrValue() interface{} { return ([]SCPEnvelope)(v) } +func (v *_XdrVec_unbounded_SCPEnvelope) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_DiagnosticEvents struct { - *_XdrVec_unbounded_DiagnosticEvent -} +type XdrType_LedgerSCPMessages = *LedgerSCPMessages -func XDR_DiagnosticEvents(v *DiagnosticEvents) XdrType_DiagnosticEvents { - return XdrType_DiagnosticEvents{(*_XdrVec_unbounded_DiagnosticEvent)(v)} +func (v *LedgerSCPMessages) XdrPointer() interface{} { return v } +func (LedgerSCPMessages) XdrTypeName() string { return "LedgerSCPMessages" } +func (v LedgerSCPMessages) XdrValue() interface{} { return v } +func (v *LedgerSCPMessages) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerSCPMessages) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sledgerSeq", name), XDR_Uint32(&v.LedgerSeq)) + x.Marshal(x.Sprintf("%smessages", name), (*_XdrVec_unbounded_SCPEnvelope)(&v.Messages)) } -func (XdrType_DiagnosticEvents) XdrTypeName() string { return "DiagnosticEvents" } -func (v XdrType_DiagnosticEvents) XdrUnwrap() XdrType { return v._XdrVec_unbounded_DiagnosticEvent } +func XDR_LedgerSCPMessages(v *LedgerSCPMessages) *LedgerSCPMessages { return v } -type XdrType_SorobanTransactionMetaExtV1 = *SorobanTransactionMetaExtV1 +type XdrType_SCPHistoryEntryV0 = *SCPHistoryEntryV0 -func (v *SorobanTransactionMetaExtV1) XdrPointer() interface{} { return v } -func (SorobanTransactionMetaExtV1) XdrTypeName() string { return "SorobanTransactionMetaExtV1" } -func (v SorobanTransactionMetaExtV1) XdrValue() interface{} { return v } -func (v *SorobanTransactionMetaExtV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SorobanTransactionMetaExtV1) XdrRecurse(x XDR, name string) { +func (v *SCPHistoryEntryV0) XdrPointer() interface{} { return v } +func (SCPHistoryEntryV0) XdrTypeName() string { return "SCPHistoryEntryV0" } +func (v SCPHistoryEntryV0) XdrValue() interface{} { return v } +func (v *SCPHistoryEntryV0) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SCPHistoryEntryV0) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) - x.Marshal(x.Sprintf("%stotalNonRefundableResourceFeeCharged", name), XDR_Int64(&v.TotalNonRefundableResourceFeeCharged)) - x.Marshal(x.Sprintf("%stotalRefundableResourceFeeCharged", name), XDR_Int64(&v.TotalRefundableResourceFeeCharged)) - x.Marshal(x.Sprintf("%srentFeeCharged", name), XDR_Int64(&v.RentFeeCharged)) -} -func XDR_SorobanTransactionMetaExtV1(v *SorobanTransactionMetaExtV1) *SorobanTransactionMetaExtV1 { - return v + x.Marshal(x.Sprintf("%squorumSets", name), (*_XdrVec_unbounded_SCPQuorumSet)(&v.QuorumSets)) + x.Marshal(x.Sprintf("%sledgerMessages", name), XDR_LedgerSCPMessages(&v.LedgerMessages)) } +func XDR_SCPHistoryEntryV0(v *SCPHistoryEntryV0) *SCPHistoryEntryV0 { return v } -var _XdrTags_SorobanTransactionMetaExt = map[int32]bool{ +var _XdrTags_SCPHistoryEntry = map[int32]bool{ XdrToI32(0): true, - XdrToI32(1): true, } -func (_ SorobanTransactionMetaExt) XdrValidTags() map[int32]bool { - return _XdrTags_SorobanTransactionMetaExt +func (_ SCPHistoryEntry) XdrValidTags() map[int32]bool { + return _XdrTags_SCPHistoryEntry } -func (u *SorobanTransactionMetaExt) V1() *SorobanTransactionMetaExtV1 { +func (u *SCPHistoryEntry) V0() *SCPHistoryEntryV0 { switch u.V { - case 1: - if v, ok := u._u.(*SorobanTransactionMetaExtV1); ok { + case 0: + if v, ok := u._u.(*SCPHistoryEntryV0); ok { return v } else { - var zero SorobanTransactionMetaExtV1 + var zero SCPHistoryEntryV0 u._u = &zero return &zero } default: - XdrPanic("SorobanTransactionMetaExt.V1 accessed when V == %v", u.V) + XdrPanic("SCPHistoryEntry.V0 accessed when V == %v", u.V) return nil } } -func (u SorobanTransactionMetaExt) XdrValid() bool { +func (u SCPHistoryEntry) XdrValid() bool { switch u.V { - case 0, 1: + case 0: return true } return false } -func (u *SorobanTransactionMetaExt) XdrUnionTag() XdrNum32 { +func (u *SCPHistoryEntry) XdrUnionTag() XdrNum32 { return XDR_int32(&u.V) } -func (u *SorobanTransactionMetaExt) XdrUnionTagName() string { +func (u *SCPHistoryEntry) XdrUnionTagName() string { return "V" } -func (u *SorobanTransactionMetaExt) XdrUnionBody() XdrType { +func (u *SCPHistoryEntry) XdrUnionBody() XdrType { switch u.V { case 0: - return nil - case 1: - return XDR_SorobanTransactionMetaExtV1(u.V1()) + return XDR_SCPHistoryEntryV0(u.V0()) } return nil } -func (u *SorobanTransactionMetaExt) XdrUnionBodyName() string { +func (u *SCPHistoryEntry) XdrUnionBodyName() string { switch u.V { case 0: - return "" - case 1: - return "V1" + return "V0" } return "" } -type XdrType_SorobanTransactionMetaExt = *SorobanTransactionMetaExt +type XdrType_SCPHistoryEntry = *SCPHistoryEntry -func (v *SorobanTransactionMetaExt) XdrPointer() interface{} { return v } -func (SorobanTransactionMetaExt) XdrTypeName() string { return "SorobanTransactionMetaExt" } -func (v SorobanTransactionMetaExt) XdrValue() interface{} { return v } -func (v *SorobanTransactionMetaExt) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *SorobanTransactionMetaExt) XdrRecurse(x XDR, name string) { +func (v *SCPHistoryEntry) XdrPointer() interface{} { return v } +func (SCPHistoryEntry) XdrTypeName() string { return "SCPHistoryEntry" } +func (v SCPHistoryEntry) XdrValue() interface{} { return v } +func (v *SCPHistoryEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *SCPHistoryEntry) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) switch u.V { case 0: - return - case 1: - x.Marshal(x.Sprintf("%sv1", name), XDR_SorobanTransactionMetaExtV1(u.V1())) + x.Marshal(x.Sprintf("%sv0", name), XDR_SCPHistoryEntryV0(u.V0())) return } - XdrPanic("invalid V (%v) in SorobanTransactionMetaExt", u.V) + XdrPanic("invalid V (%v) in SCPHistoryEntry", u.V) } -func XDR_SorobanTransactionMetaExt(v *SorobanTransactionMetaExt) *SorobanTransactionMetaExt { return v } - -type _XdrVec_unbounded_ContractEvent []ContractEvent +func XDR_SCPHistoryEntry(v *SCPHistoryEntry) *SCPHistoryEntry { return v } -func (_XdrVec_unbounded_ContractEvent) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound +var _XdrNames_LedgerEntryChangeType = map[int32]string{ + int32(LEDGER_ENTRY_CREATED): "LEDGER_ENTRY_CREATED", + int32(LEDGER_ENTRY_UPDATED): "LEDGER_ENTRY_UPDATED", + int32(LEDGER_ENTRY_REMOVED): "LEDGER_ENTRY_REMOVED", + int32(LEDGER_ENTRY_STATE): "LEDGER_ENTRY_STATE", } -func (_XdrVec_unbounded_ContractEvent) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_ContractEvent length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_ContractEvent length %d exceeds max int", length) - } +var _XdrValues_LedgerEntryChangeType = map[string]int32{ + "LEDGER_ENTRY_CREATED": int32(LEDGER_ENTRY_CREATED), + "LEDGER_ENTRY_UPDATED": int32(LEDGER_ENTRY_UPDATED), + "LEDGER_ENTRY_REMOVED": int32(LEDGER_ENTRY_REMOVED), + "LEDGER_ENTRY_STATE": int32(LEDGER_ENTRY_STATE), } -func (v _XdrVec_unbounded_ContractEvent) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_ContractEvent) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) + +func (LedgerEntryChangeType) XdrEnumNames() map[int32]string { + return _XdrNames_LedgerEntryChangeType +} +func (v LedgerEntryChangeType) String() string { + if s, ok := _XdrNames_LedgerEntryChangeType[int32(v)]; ok { + return s } - nv := make([]ContractEvent, int(length), newcap) - copy(nv, *v) - *v = nv + return fmt.Sprintf("LedgerEntryChangeType#%d", v) } -func (v *_XdrVec_unbounded_ContractEvent) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) +func (v *LedgerEntryChangeType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_LedgerEntryChangeType[stok]; ok { + *v = LedgerEntryChangeType(val) + return nil + } else if stok == "LedgerEntryChangeType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } } - XDR_ContractEvent(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] + return XdrError(fmt.Sprintf("%s is not a valid LedgerEntryChangeType.", stok)) } } -func (v *_XdrVec_unbounded_ContractEvent) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) -} -func (_XdrVec_unbounded_ContractEvent) XdrTypeName() string { return "ContractEvent<>" } -func (v *_XdrVec_unbounded_ContractEvent) XdrPointer() interface{} { return (*[]ContractEvent)(v) } -func (v _XdrVec_unbounded_ContractEvent) XdrValue() interface{} { return ([]ContractEvent)(v) } -func (v *_XdrVec_unbounded_ContractEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v LedgerEntryChangeType) GetU32() uint32 { return uint32(v) } +func (v *LedgerEntryChangeType) SetU32(n uint32) { *v = LedgerEntryChangeType(n) } +func (v *LedgerEntryChangeType) XdrPointer() interface{} { return v } +func (LedgerEntryChangeType) XdrTypeName() string { return "LedgerEntryChangeType" } +func (v LedgerEntryChangeType) XdrValue() interface{} { return v } +func (v *LedgerEntryChangeType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_SorobanTransactionMeta = *SorobanTransactionMeta +type XdrType_LedgerEntryChangeType = *LedgerEntryChangeType -func (v *SorobanTransactionMeta) XdrPointer() interface{} { return v } -func (SorobanTransactionMeta) XdrTypeName() string { return "SorobanTransactionMeta" } -func (v SorobanTransactionMeta) XdrValue() interface{} { return v } -func (v *SorobanTransactionMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SorobanTransactionMeta) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sext", name), XDR_SorobanTransactionMetaExt(&v.Ext)) - x.Marshal(x.Sprintf("%sevents", name), (*_XdrVec_unbounded_ContractEvent)(&v.Events)) - x.Marshal(x.Sprintf("%sreturnValue", name), XDR_SCVal(&v.ReturnValue)) - x.Marshal(x.Sprintf("%sdiagnosticEvents", name), (*_XdrVec_unbounded_DiagnosticEvent)(&v.DiagnosticEvents)) +func XDR_LedgerEntryChangeType(v *LedgerEntryChangeType) *LedgerEntryChangeType { return v } + +var _XdrComments_LedgerEntryChangeType = map[int32]string{ + int32(LEDGER_ENTRY_CREATED): "entry was added to the ledger", + int32(LEDGER_ENTRY_UPDATED): "entry was modified in the ledger", + int32(LEDGER_ENTRY_REMOVED): "entry was removed from the ledger", + int32(LEDGER_ENTRY_STATE): "value of the entry", } -func XDR_SorobanTransactionMeta(v *SorobanTransactionMeta) *SorobanTransactionMeta { return v } -type _XdrPtr_SorobanTransactionMeta struct { - p **SorobanTransactionMeta +func (e LedgerEntryChangeType) XdrEnumComments() map[int32]string { + return _XdrComments_LedgerEntryChangeType } -type _ptrflag_SorobanTransactionMeta _XdrPtr_SorobanTransactionMeta -func (v _ptrflag_SorobanTransactionMeta) String() string { - if *v.p == nil { - return "nil" - } - return "non-nil" +var _XdrTags_LedgerEntryChange = map[int32]bool{ + XdrToI32(LEDGER_ENTRY_CREATED): true, + XdrToI32(LEDGER_ENTRY_UPDATED): true, + XdrToI32(LEDGER_ENTRY_REMOVED): true, + XdrToI32(LEDGER_ENTRY_STATE): true, } -func (v _ptrflag_SorobanTransactionMeta) Scan(ss fmt.ScanState, r rune) error { - tok, err := ss.Token(true, func(c rune) bool { - return c == '-' || (c >= 'a' && c <= 'z') - }) - if err != nil { - return err - } - switch string(tok) { - case "nil": - v.SetU32(0) - case "non-nil": - v.SetU32(1) - default: - return XdrError("SorobanTransactionMeta flag should be \"nil\" or \"non-nil\"") - } - return nil + +func (_ LedgerEntryChange) XdrValidTags() map[int32]bool { + return _XdrTags_LedgerEntryChange } -func (v _ptrflag_SorobanTransactionMeta) GetU32() uint32 { - if *v.p == nil { - return 0 +func (u *LedgerEntryChange) Created() *LedgerEntry { + switch u.Type { + case LEDGER_ENTRY_CREATED: + if v, ok := u._u.(*LedgerEntry); ok { + return v + } else { + var zero LedgerEntry + u._u = &zero + return &zero + } + default: + XdrPanic("LedgerEntryChange.Created accessed when Type == %v", u.Type) + return nil } - return 1 } -func (v _ptrflag_SorobanTransactionMeta) SetU32(nv uint32) { - switch nv { - case 0: - *v.p = nil - case 1: - if *v.p == nil { - *v.p = new(SorobanTransactionMeta) - } - default: - XdrPanic("*SorobanTransactionMeta present flag value %d should be 0 or 1", nv) - } -} -func (_ptrflag_SorobanTransactionMeta) XdrTypeName() string { return "SorobanTransactionMeta?" } -func (v _ptrflag_SorobanTransactionMeta) XdrPointer() interface{} { return nil } -func (v _ptrflag_SorobanTransactionMeta) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_SorobanTransactionMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_SorobanTransactionMeta) XdrBound() uint32 { return 1 } -func (v _XdrPtr_SorobanTransactionMeta) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_SorobanTransactionMeta) SetPresent(present bool) { - if !present { - *v.p = nil - } else if *v.p == nil { - *v.p = new(SorobanTransactionMeta) - } -} -func (v _XdrPtr_SorobanTransactionMeta) XdrMarshalValue(x XDR, name string) { - if *v.p != nil { - XDR_SorobanTransactionMeta(*v.p).XdrMarshal(x, name) - } -} -func (v _XdrPtr_SorobanTransactionMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_SorobanTransactionMeta) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_SorobanTransactionMeta(v)) - v.XdrMarshalValue(x, name) -} -func (_XdrPtr_SorobanTransactionMeta) XdrTypeName() string { return "SorobanTransactionMeta*" } -func (v _XdrPtr_SorobanTransactionMeta) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_SorobanTransactionMeta) XdrValue() interface{} { return *v.p } - -type XdrType_TransactionMetaV3 = *TransactionMetaV3 - -func (v *TransactionMetaV3) XdrPointer() interface{} { return v } -func (TransactionMetaV3) XdrTypeName() string { return "TransactionMetaV3" } -func (v TransactionMetaV3) XdrValue() interface{} { return v } -func (v *TransactionMetaV3) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TransactionMetaV3) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) - x.Marshal(x.Sprintf("%stxChangesBefore", name), XDR_LedgerEntryChanges(&v.TxChangesBefore)) - x.Marshal(x.Sprintf("%soperations", name), (*_XdrVec_unbounded_OperationMeta)(&v.Operations)) - x.Marshal(x.Sprintf("%stxChangesAfter", name), XDR_LedgerEntryChanges(&v.TxChangesAfter)) - x.Marshal(x.Sprintf("%ssorobanMeta", name), _XdrPtr_SorobanTransactionMeta{&v.SorobanMeta}) -} -func XDR_TransactionMetaV3(v *TransactionMetaV3) *TransactionMetaV3 { return v } - -type XdrType_InvokeHostFunctionSuccessPreImage = *InvokeHostFunctionSuccessPreImage - -func (v *InvokeHostFunctionSuccessPreImage) XdrPointer() interface{} { return v } -func (InvokeHostFunctionSuccessPreImage) XdrTypeName() string { - return "InvokeHostFunctionSuccessPreImage" -} -func (v InvokeHostFunctionSuccessPreImage) XdrValue() interface{} { return v } -func (v *InvokeHostFunctionSuccessPreImage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *InvokeHostFunctionSuccessPreImage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sreturnValue", name), XDR_SCVal(&v.ReturnValue)) - x.Marshal(x.Sprintf("%sevents", name), (*_XdrVec_unbounded_ContractEvent)(&v.Events)) -} -func XDR_InvokeHostFunctionSuccessPreImage(v *InvokeHostFunctionSuccessPreImage) *InvokeHostFunctionSuccessPreImage { - return v -} - -var _XdrTags_TransactionMeta = map[int32]bool{ - XdrToI32(0): true, - XdrToI32(1): true, - XdrToI32(2): true, - XdrToI32(3): true, -} - -func (_ TransactionMeta) XdrValidTags() map[int32]bool { - return _XdrTags_TransactionMeta -} -func (u *TransactionMeta) Operations() *[]OperationMeta { - switch u.V { - case 0: - if v, ok := u._u.(*[]OperationMeta); ok { - return v - } else { - var zero []OperationMeta - u._u = &zero - return &zero - } - default: - XdrPanic("TransactionMeta.Operations accessed when V == %v", u.V) - return nil - } -} -func (u *TransactionMeta) V1() *TransactionMetaV1 { - switch u.V { - case 1: - if v, ok := u._u.(*TransactionMetaV1); ok { +func (u *LedgerEntryChange) Updated() *LedgerEntry { + switch u.Type { + case LEDGER_ENTRY_UPDATED: + if v, ok := u._u.(*LedgerEntry); ok { return v } else { - var zero TransactionMetaV1 + var zero LedgerEntry u._u = &zero return &zero } default: - XdrPanic("TransactionMeta.V1 accessed when V == %v", u.V) + XdrPanic("LedgerEntryChange.Updated accessed when Type == %v", u.Type) return nil } } -func (u *TransactionMeta) V2() *TransactionMetaV2 { - switch u.V { - case 2: - if v, ok := u._u.(*TransactionMetaV2); ok { +func (u *LedgerEntryChange) Removed() *LedgerKey { + switch u.Type { + case LEDGER_ENTRY_REMOVED: + if v, ok := u._u.(*LedgerKey); ok { return v } else { - var zero TransactionMetaV2 + var zero LedgerKey u._u = &zero return &zero } default: - XdrPanic("TransactionMeta.V2 accessed when V == %v", u.V) + XdrPanic("LedgerEntryChange.Removed accessed when Type == %v", u.Type) return nil } } -func (u *TransactionMeta) V3() *TransactionMetaV3 { - switch u.V { - case 3: - if v, ok := u._u.(*TransactionMetaV3); ok { +func (u *LedgerEntryChange) State() *LedgerEntry { + switch u.Type { + case LEDGER_ENTRY_STATE: + if v, ok := u._u.(*LedgerEntry); ok { return v } else { - var zero TransactionMetaV3 + var zero LedgerEntry u._u = &zero return &zero } default: - XdrPanic("TransactionMeta.V3 accessed when V == %v", u.V) + XdrPanic("LedgerEntryChange.State accessed when Type == %v", u.Type) return nil } } -func (u TransactionMeta) XdrValid() bool { - switch u.V { - case 0, 1, 2, 3: +func (u LedgerEntryChange) XdrValid() bool { + switch u.Type { + case LEDGER_ENTRY_CREATED, LEDGER_ENTRY_UPDATED, LEDGER_ENTRY_REMOVED, LEDGER_ENTRY_STATE: return true } return false } -func (u *TransactionMeta) XdrUnionTag() XdrNum32 { - return XDR_int32(&u.V) +func (u *LedgerEntryChange) XdrUnionTag() XdrNum32 { + return XDR_LedgerEntryChangeType(&u.Type) } -func (u *TransactionMeta) XdrUnionTagName() string { - return "V" +func (u *LedgerEntryChange) XdrUnionTagName() string { + return "Type" } -func (u *TransactionMeta) XdrUnionBody() XdrType { - switch u.V { - case 0: - return (*_XdrVec_unbounded_OperationMeta)(u.Operations()) - case 1: - return XDR_TransactionMetaV1(u.V1()) - case 2: - return XDR_TransactionMetaV2(u.V2()) - case 3: - return XDR_TransactionMetaV3(u.V3()) +func (u *LedgerEntryChange) XdrUnionBody() XdrType { + switch u.Type { + case LEDGER_ENTRY_CREATED: + return XDR_LedgerEntry(u.Created()) + case LEDGER_ENTRY_UPDATED: + return XDR_LedgerEntry(u.Updated()) + case LEDGER_ENTRY_REMOVED: + return XDR_LedgerKey(u.Removed()) + case LEDGER_ENTRY_STATE: + return XDR_LedgerEntry(u.State()) } return nil } -func (u *TransactionMeta) XdrUnionBodyName() string { - switch u.V { - case 0: - return "Operations" - case 1: - return "V1" - case 2: - return "V2" - case 3: - return "V3" +func (u *LedgerEntryChange) XdrUnionBodyName() string { + switch u.Type { + case LEDGER_ENTRY_CREATED: + return "Created" + case LEDGER_ENTRY_UPDATED: + return "Updated" + case LEDGER_ENTRY_REMOVED: + return "Removed" + case LEDGER_ENTRY_STATE: + return "State" } return "" } -type XdrType_TransactionMeta = *TransactionMeta +type XdrType_LedgerEntryChange = *LedgerEntryChange -func (v *TransactionMeta) XdrPointer() interface{} { return v } -func (TransactionMeta) XdrTypeName() string { return "TransactionMeta" } -func (v TransactionMeta) XdrValue() interface{} { return v } -func (v *TransactionMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *TransactionMeta) XdrRecurse(x XDR, name string) { +func (v *LedgerEntryChange) XdrPointer() interface{} { return v } +func (LedgerEntryChange) XdrTypeName() string { return "LedgerEntryChange" } +func (v LedgerEntryChange) XdrValue() interface{} { return v } +func (v *LedgerEntryChange) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *LedgerEntryChange) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) - switch u.V { - case 0: - x.Marshal(x.Sprintf("%soperations", name), (*_XdrVec_unbounded_OperationMeta)(u.Operations())) + XDR_LedgerEntryChangeType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case LEDGER_ENTRY_CREATED: + x.Marshal(x.Sprintf("%screated", name), XDR_LedgerEntry(u.Created())) return - case 1: - x.Marshal(x.Sprintf("%sv1", name), XDR_TransactionMetaV1(u.V1())) + case LEDGER_ENTRY_UPDATED: + x.Marshal(x.Sprintf("%supdated", name), XDR_LedgerEntry(u.Updated())) return - case 2: - x.Marshal(x.Sprintf("%sv2", name), XDR_TransactionMetaV2(u.V2())) + case LEDGER_ENTRY_REMOVED: + x.Marshal(x.Sprintf("%sremoved", name), XDR_LedgerKey(u.Removed())) return - case 3: - x.Marshal(x.Sprintf("%sv3", name), XDR_TransactionMetaV3(u.V3())) + case LEDGER_ENTRY_STATE: + x.Marshal(x.Sprintf("%sstate", name), XDR_LedgerEntry(u.State())) return } - XdrPanic("invalid V (%v) in TransactionMeta", u.V) + XdrPanic("invalid Type (%v) in LedgerEntryChange", u.Type) } -func XDR_TransactionMeta(v *TransactionMeta) *TransactionMeta { return v } +func XDR_LedgerEntryChange(v *LedgerEntryChange) *LedgerEntryChange { return v } -type XdrType_TransactionResultMeta = *TransactionResultMeta +type _XdrVec_unbounded_LedgerEntryChange []LedgerEntryChange -func (v *TransactionResultMeta) XdrPointer() interface{} { return v } -func (TransactionResultMeta) XdrTypeName() string { return "TransactionResultMeta" } -func (v TransactionResultMeta) XdrValue() interface{} { return v } -func (v *TransactionResultMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TransactionResultMeta) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (_XdrVec_unbounded_LedgerEntryChange) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound +} +func (_XdrVec_unbounded_LedgerEntryChange) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_LedgerEntryChange length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_LedgerEntryChange length %d exceeds max int", length) } - x.Marshal(x.Sprintf("%sresult", name), XDR_TransactionResultPair(&v.Result)) - x.Marshal(x.Sprintf("%sfeeProcessing", name), XDR_LedgerEntryChanges(&v.FeeProcessing)) - x.Marshal(x.Sprintf("%stxApplyProcessing", name), XDR_TransactionMeta(&v.TxApplyProcessing)) } -func XDR_TransactionResultMeta(v *TransactionResultMeta) *TransactionResultMeta { return v } - -type XdrType_UpgradeEntryMeta = *UpgradeEntryMeta - -func (v *UpgradeEntryMeta) XdrPointer() interface{} { return v } -func (UpgradeEntryMeta) XdrTypeName() string { return "UpgradeEntryMeta" } -func (v UpgradeEntryMeta) XdrValue() interface{} { return v } -func (v *UpgradeEntryMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *UpgradeEntryMeta) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%supgrade", name), XDR_LedgerUpgrade(&v.Upgrade)) - x.Marshal(x.Sprintf("%schanges", name), XDR_LedgerEntryChanges(&v.Changes)) -} -func XDR_UpgradeEntryMeta(v *UpgradeEntryMeta) *UpgradeEntryMeta { return v } - -type _XdrVec_unbounded_TransactionResultMeta []TransactionResultMeta - -func (_XdrVec_unbounded_TransactionResultMeta) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound -} -func (_XdrVec_unbounded_TransactionResultMeta) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_TransactionResultMeta length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_TransactionResultMeta length %d exceeds max int", length) - } -} -func (v _XdrVec_unbounded_TransactionResultMeta) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_TransactionResultMeta) SetVecLen(length uint32) { +func (v _XdrVec_unbounded_LedgerEntryChange) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_LedgerEntryChange) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -12626,51 +12351,73 @@ func (v *_XdrVec_unbounded_TransactionResultMeta) SetVecLen(length uint32) { } newcap = int(bound) } - nv := make([]TransactionResultMeta, int(length), newcap) + nv := make([]LedgerEntryChange, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_unbounded_TransactionResultMeta) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_unbounded_LedgerEntryChange) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_TransactionResultMeta(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_LedgerEntryChange(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_unbounded_TransactionResultMeta) XdrRecurse(x XDR, name string) { +func (v *_XdrVec_unbounded_LedgerEntryChange) XdrRecurse(x XDR, name string) { size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_unbounded_TransactionResultMeta) XdrTypeName() string { return "TransactionResultMeta<>" } -func (v *_XdrVec_unbounded_TransactionResultMeta) XdrPointer() interface{} { - return (*[]TransactionResultMeta)(v) +func (_XdrVec_unbounded_LedgerEntryChange) XdrTypeName() string { return "LedgerEntryChange<>" } +func (v *_XdrVec_unbounded_LedgerEntryChange) XdrPointer() interface{} { + return (*[]LedgerEntryChange)(v) } -func (v _XdrVec_unbounded_TransactionResultMeta) XdrValue() interface{} { - return ([]TransactionResultMeta)(v) +func (v _XdrVec_unbounded_LedgerEntryChange) XdrValue() interface{} { return ([]LedgerEntryChange)(v) } +func (v *_XdrVec_unbounded_LedgerEntryChange) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_LedgerEntryChanges struct { + *_XdrVec_unbounded_LedgerEntryChange } -func (v *_XdrVec_unbounded_TransactionResultMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type _XdrVec_unbounded_UpgradeEntryMeta []UpgradeEntryMeta +func XDR_LedgerEntryChanges(v *LedgerEntryChanges) XdrType_LedgerEntryChanges { + return XdrType_LedgerEntryChanges{(*_XdrVec_unbounded_LedgerEntryChange)(v)} +} +func (XdrType_LedgerEntryChanges) XdrTypeName() string { return "LedgerEntryChanges" } +func (v XdrType_LedgerEntryChanges) XdrUnwrap() XdrType { return v._XdrVec_unbounded_LedgerEntryChange } -func (_XdrVec_unbounded_UpgradeEntryMeta) XdrBound() uint32 { +type XdrType_OperationMeta = *OperationMeta + +func (v *OperationMeta) XdrPointer() interface{} { return v } +func (OperationMeta) XdrTypeName() string { return "OperationMeta" } +func (v OperationMeta) XdrValue() interface{} { return v } +func (v *OperationMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *OperationMeta) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%schanges", name), XDR_LedgerEntryChanges(&v.Changes)) +} +func XDR_OperationMeta(v *OperationMeta) *OperationMeta { return v } + +type _XdrVec_unbounded_OperationMeta []OperationMeta + +func (_XdrVec_unbounded_OperationMeta) XdrBound() uint32 { const bound uint32 = 4294967295 // Force error if not const or doesn't fit return bound } -func (_XdrVec_unbounded_UpgradeEntryMeta) XdrCheckLen(length uint32) { +func (_XdrVec_unbounded_OperationMeta) XdrCheckLen(length uint32) { if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_UpgradeEntryMeta length %d exceeds bound 4294967295", length) + XdrPanic("_XdrVec_unbounded_OperationMeta length %d exceeds bound 4294967295", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_UpgradeEntryMeta length %d exceeds max int", length) + XdrPanic("_XdrVec_unbounded_OperationMeta length %d exceeds max int", length) } } -func (v _XdrVec_unbounded_UpgradeEntryMeta) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_UpgradeEntryMeta) SetVecLen(length uint32) { +func (v _XdrVec_unbounded_OperationMeta) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_OperationMeta) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -12687,49 +12434,125 @@ func (v *_XdrVec_unbounded_UpgradeEntryMeta) SetVecLen(length uint32) { } newcap = int(bound) } - nv := make([]UpgradeEntryMeta, int(length), newcap) + nv := make([]OperationMeta, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_unbounded_UpgradeEntryMeta) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_unbounded_OperationMeta) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_UpgradeEntryMeta(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_OperationMeta(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_unbounded_UpgradeEntryMeta) XdrRecurse(x XDR, name string) { +func (v *_XdrVec_unbounded_OperationMeta) XdrRecurse(x XDR, name string) { size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_unbounded_UpgradeEntryMeta) XdrTypeName() string { return "UpgradeEntryMeta<>" } -func (v *_XdrVec_unbounded_UpgradeEntryMeta) XdrPointer() interface{} { - return (*[]UpgradeEntryMeta)(v) +func (_XdrVec_unbounded_OperationMeta) XdrTypeName() string { return "OperationMeta<>" } +func (v *_XdrVec_unbounded_OperationMeta) XdrPointer() interface{} { return (*[]OperationMeta)(v) } +func (v _XdrVec_unbounded_OperationMeta) XdrValue() interface{} { return ([]OperationMeta)(v) } +func (v *_XdrVec_unbounded_OperationMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_TransactionMetaV1 = *TransactionMetaV1 + +func (v *TransactionMetaV1) XdrPointer() interface{} { return v } +func (TransactionMetaV1) XdrTypeName() string { return "TransactionMetaV1" } +func (v TransactionMetaV1) XdrValue() interface{} { return v } +func (v *TransactionMetaV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TransactionMetaV1) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%stxChanges", name), XDR_LedgerEntryChanges(&v.TxChanges)) + x.Marshal(x.Sprintf("%soperations", name), (*_XdrVec_unbounded_OperationMeta)(&v.Operations)) } -func (v _XdrVec_unbounded_UpgradeEntryMeta) XdrValue() interface{} { return ([]UpgradeEntryMeta)(v) } -func (v *_XdrVec_unbounded_UpgradeEntryMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func XDR_TransactionMetaV1(v *TransactionMetaV1) *TransactionMetaV1 { return v } -type _XdrVec_unbounded_SCPHistoryEntry []SCPHistoryEntry +type XdrType_TransactionMetaV2 = *TransactionMetaV2 -func (_XdrVec_unbounded_SCPHistoryEntry) XdrBound() uint32 { +func (v *TransactionMetaV2) XdrPointer() interface{} { return v } +func (TransactionMetaV2) XdrTypeName() string { return "TransactionMetaV2" } +func (v TransactionMetaV2) XdrValue() interface{} { return v } +func (v *TransactionMetaV2) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TransactionMetaV2) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%stxChangesBefore", name), XDR_LedgerEntryChanges(&v.TxChangesBefore)) + x.Marshal(x.Sprintf("%soperations", name), (*_XdrVec_unbounded_OperationMeta)(&v.Operations)) + x.Marshal(x.Sprintf("%stxChangesAfter", name), XDR_LedgerEntryChanges(&v.TxChangesAfter)) +} +func XDR_TransactionMetaV2(v *TransactionMetaV2) *TransactionMetaV2 { return v } + +var _XdrNames_ContractEventType = map[int32]string{ + int32(SYSTEM): "SYSTEM", + int32(CONTRACT): "CONTRACT", + int32(DIAGNOSTIC): "DIAGNOSTIC", +} +var _XdrValues_ContractEventType = map[string]int32{ + "SYSTEM": int32(SYSTEM), + "CONTRACT": int32(CONTRACT), + "DIAGNOSTIC": int32(DIAGNOSTIC), +} + +func (ContractEventType) XdrEnumNames() map[int32]string { + return _XdrNames_ContractEventType +} +func (v ContractEventType) String() string { + if s, ok := _XdrNames_ContractEventType[int32(v)]; ok { + return s + } + return fmt.Sprintf("ContractEventType#%d", v) +} +func (v *ContractEventType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_ContractEventType[stok]; ok { + *v = ContractEventType(val) + return nil + } else if stok == "ContractEventType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } + } + return XdrError(fmt.Sprintf("%s is not a valid ContractEventType.", stok)) + } +} +func (v ContractEventType) GetU32() uint32 { return uint32(v) } +func (v *ContractEventType) SetU32(n uint32) { *v = ContractEventType(n) } +func (v *ContractEventType) XdrPointer() interface{} { return v } +func (ContractEventType) XdrTypeName() string { return "ContractEventType" } +func (v ContractEventType) XdrValue() interface{} { return v } +func (v *ContractEventType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_ContractEventType = *ContractEventType + +func XDR_ContractEventType(v *ContractEventType) *ContractEventType { return v } + +type _XdrVec_unbounded_SCVal []SCVal + +func (_XdrVec_unbounded_SCVal) XdrBound() uint32 { const bound uint32 = 4294967295 // Force error if not const or doesn't fit return bound } -func (_XdrVec_unbounded_SCPHistoryEntry) XdrCheckLen(length uint32) { +func (_XdrVec_unbounded_SCVal) XdrCheckLen(length uint32) { if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_SCPHistoryEntry length %d exceeds bound 4294967295", length) + XdrPanic("_XdrVec_unbounded_SCVal length %d exceeds bound 4294967295", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_SCPHistoryEntry length %d exceeds max int", length) + XdrPanic("_XdrVec_unbounded_SCVal length %d exceeds max int", length) } } -func (v _XdrVec_unbounded_SCPHistoryEntry) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_SCPHistoryEntry) SetVecLen(length uint32) { +func (v _XdrVec_unbounded_SCVal) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_SCVal) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -12746,214 +12569,241 @@ func (v *_XdrVec_unbounded_SCPHistoryEntry) SetVecLen(length uint32) { } newcap = int(bound) } - nv := make([]SCPHistoryEntry, int(length), newcap) + nv := make([]SCVal, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_unbounded_SCPHistoryEntry) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_unbounded_SCVal) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_SCPHistoryEntry(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_SCVal(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_unbounded_SCPHistoryEntry) XdrRecurse(x XDR, name string) { +func (v *_XdrVec_unbounded_SCVal) XdrRecurse(x XDR, name string) { size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_unbounded_SCPHistoryEntry) XdrTypeName() string { return "SCPHistoryEntry<>" } -func (v *_XdrVec_unbounded_SCPHistoryEntry) XdrPointer() interface{} { return (*[]SCPHistoryEntry)(v) } -func (v _XdrVec_unbounded_SCPHistoryEntry) XdrValue() interface{} { return ([]SCPHistoryEntry)(v) } -func (v *_XdrVec_unbounded_SCPHistoryEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (_XdrVec_unbounded_SCVal) XdrTypeName() string { return "SCVal<>" } +func (v *_XdrVec_unbounded_SCVal) XdrPointer() interface{} { return (*[]SCVal)(v) } +func (v _XdrVec_unbounded_SCVal) XdrValue() interface{} { return ([]SCVal)(v) } +func (v *_XdrVec_unbounded_SCVal) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_LedgerCloseMetaV0 = *LedgerCloseMetaV0 +type XdrType_XdrAnon_ContractEvent_Body_V0 = *XdrAnon_ContractEvent_Body_V0 -func (v *LedgerCloseMetaV0) XdrPointer() interface{} { return v } -func (LedgerCloseMetaV0) XdrTypeName() string { return "LedgerCloseMetaV0" } -func (v LedgerCloseMetaV0) XdrValue() interface{} { return v } -func (v *LedgerCloseMetaV0) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LedgerCloseMetaV0) XdrRecurse(x XDR, name string) { +func (v *XdrAnon_ContractEvent_Body_V0) XdrPointer() interface{} { return v } +func (XdrAnon_ContractEvent_Body_V0) XdrTypeName() string { return "XdrAnon_ContractEvent_Body_V0" } +func (v XdrAnon_ContractEvent_Body_V0) XdrValue() interface{} { return v } +func (v *XdrAnon_ContractEvent_Body_V0) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *XdrAnon_ContractEvent_Body_V0) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sledgerHeader", name), XDR_LedgerHeaderHistoryEntry(&v.LedgerHeader)) - x.Marshal(x.Sprintf("%stxSet", name), XDR_TransactionSet(&v.TxSet)) - x.Marshal(x.Sprintf("%stxProcessing", name), (*_XdrVec_unbounded_TransactionResultMeta)(&v.TxProcessing)) - x.Marshal(x.Sprintf("%supgradesProcessing", name), (*_XdrVec_unbounded_UpgradeEntryMeta)(&v.UpgradesProcessing)) - x.Marshal(x.Sprintf("%sscpInfo", name), (*_XdrVec_unbounded_SCPHistoryEntry)(&v.ScpInfo)) + x.Marshal(x.Sprintf("%stopics", name), (*_XdrVec_unbounded_SCVal)(&v.Topics)) + x.Marshal(x.Sprintf("%sdata", name), XDR_SCVal(&v.Data)) } -func XDR_LedgerCloseMetaV0(v *LedgerCloseMetaV0) *LedgerCloseMetaV0 { return v } - -type XdrType_LedgerCloseMetaExtV1 = *LedgerCloseMetaExtV1 - -func (v *LedgerCloseMetaExtV1) XdrPointer() interface{} { return v } -func (LedgerCloseMetaExtV1) XdrTypeName() string { return "LedgerCloseMetaExtV1" } -func (v LedgerCloseMetaExtV1) XdrValue() interface{} { return v } -func (v *LedgerCloseMetaExtV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LedgerCloseMetaExtV1) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) - x.Marshal(x.Sprintf("%ssorobanFeeWrite1KB", name), XDR_Int64(&v.SorobanFeeWrite1KB)) +func XDR_XdrAnon_ContractEvent_Body_V0(v *XdrAnon_ContractEvent_Body_V0) *XdrAnon_ContractEvent_Body_V0 { + return v } -func XDR_LedgerCloseMetaExtV1(v *LedgerCloseMetaExtV1) *LedgerCloseMetaExtV1 { return v } -var _XdrTags_LedgerCloseMetaExt = map[int32]bool{ +var _XdrTags_XdrAnon_ContractEvent_Body = map[int32]bool{ XdrToI32(0): true, - XdrToI32(1): true, } -func (_ LedgerCloseMetaExt) XdrValidTags() map[int32]bool { - return _XdrTags_LedgerCloseMetaExt +func (_ XdrAnon_ContractEvent_Body) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_ContractEvent_Body } -func (u *LedgerCloseMetaExt) V1() *LedgerCloseMetaExtV1 { +func (u *XdrAnon_ContractEvent_Body) V0() *XdrAnon_ContractEvent_Body_V0 { switch u.V { - case 1: - if v, ok := u._u.(*LedgerCloseMetaExtV1); ok { + case 0: + if v, ok := u._u.(*XdrAnon_ContractEvent_Body_V0); ok { return v } else { - var zero LedgerCloseMetaExtV1 + var zero XdrAnon_ContractEvent_Body_V0 u._u = &zero return &zero } default: - XdrPanic("LedgerCloseMetaExt.V1 accessed when V == %v", u.V) + XdrPanic("XdrAnon_ContractEvent_Body.V0 accessed when V == %v", u.V) return nil } } -func (u LedgerCloseMetaExt) XdrValid() bool { +func (u XdrAnon_ContractEvent_Body) XdrValid() bool { switch u.V { - case 0, 1: + case 0: return true } return false } -func (u *LedgerCloseMetaExt) XdrUnionTag() XdrNum32 { +func (u *XdrAnon_ContractEvent_Body) XdrUnionTag() XdrNum32 { return XDR_int32(&u.V) } -func (u *LedgerCloseMetaExt) XdrUnionTagName() string { +func (u *XdrAnon_ContractEvent_Body) XdrUnionTagName() string { return "V" } -func (u *LedgerCloseMetaExt) XdrUnionBody() XdrType { +func (u *XdrAnon_ContractEvent_Body) XdrUnionBody() XdrType { switch u.V { case 0: - return nil - case 1: - return XDR_LedgerCloseMetaExtV1(u.V1()) + return XDR_XdrAnon_ContractEvent_Body_V0(u.V0()) } return nil } -func (u *LedgerCloseMetaExt) XdrUnionBodyName() string { +func (u *XdrAnon_ContractEvent_Body) XdrUnionBodyName() string { switch u.V { case 0: - return "" - case 1: - return "V1" + return "V0" } return "" } -type XdrType_LedgerCloseMetaExt = *LedgerCloseMetaExt +type XdrType_XdrAnon_ContractEvent_Body = *XdrAnon_ContractEvent_Body -func (v *LedgerCloseMetaExt) XdrPointer() interface{} { return v } -func (LedgerCloseMetaExt) XdrTypeName() string { return "LedgerCloseMetaExt" } -func (v LedgerCloseMetaExt) XdrValue() interface{} { return v } -func (v *LedgerCloseMetaExt) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *LedgerCloseMetaExt) XdrRecurse(x XDR, name string) { +func (v *XdrAnon_ContractEvent_Body) XdrPointer() interface{} { return v } +func (XdrAnon_ContractEvent_Body) XdrTypeName() string { return "XdrAnon_ContractEvent_Body" } +func (v XdrAnon_ContractEvent_Body) XdrValue() interface{} { return v } +func (v *XdrAnon_ContractEvent_Body) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_ContractEvent_Body) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) switch u.V { case 0: - return - case 1: - x.Marshal(x.Sprintf("%sv1", name), XDR_LedgerCloseMetaExtV1(u.V1())) + x.Marshal(x.Sprintf("%sv0", name), XDR_XdrAnon_ContractEvent_Body_V0(u.V0())) return } - XdrPanic("invalid V (%v) in LedgerCloseMetaExt", u.V) + XdrPanic("invalid V (%v) in XdrAnon_ContractEvent_Body", u.V) +} +func XDR_XdrAnon_ContractEvent_Body(v *XdrAnon_ContractEvent_Body) *XdrAnon_ContractEvent_Body { + return v } -func XDR_LedgerCloseMetaExt(v *LedgerCloseMetaExt) *LedgerCloseMetaExt { return v } -type _XdrVec_unbounded_LedgerKey []LedgerKey +type _XdrPtr_Hash struct { + p **Hash +} +type _ptrflag_Hash _XdrPtr_Hash -func (_XdrVec_unbounded_LedgerKey) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound +func (v _ptrflag_Hash) String() string { + if *v.p == nil { + return "nil" + } + return "non-nil" } -func (_XdrVec_unbounded_LedgerKey) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_LedgerKey length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_LedgerKey length %d exceeds max int", length) +func (v _ptrflag_Hash) Scan(ss fmt.ScanState, r rune) error { + tok, err := ss.Token(true, func(c rune) bool { + return c == '-' || (c >= 'a' && c <= 'z') + }) + if err != nil { + return err + } + switch string(tok) { + case "nil": + v.SetU32(0) + case "non-nil": + v.SetU32(1) + default: + return XdrError("Hash flag should be \"nil\" or \"non-nil\"") } + return nil } -func (v _XdrVec_unbounded_LedgerKey) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_LedgerKey) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return +func (v _ptrflag_Hash) GetU32() uint32 { + if *v.p == nil { + return 0 } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 + return 1 +} +func (v _ptrflag_Hash) SetU32(nv uint32) { + switch nv { + case 0: + *v.p = nil + case 1: + if *v.p == nil { + *v.p = new(Hash) } - newcap = int(bound) + default: + XdrPanic("*Hash present flag value %d should be 0 or 1", nv) } - nv := make([]LedgerKey, int(length), newcap) - copy(nv, *v) - *v = nv } -func (v *_XdrVec_unbounded_LedgerKey) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) - } - XDR_LedgerKey(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) +func (_ptrflag_Hash) XdrTypeName() string { return "Hash?" } +func (v _ptrflag_Hash) XdrPointer() interface{} { return nil } +func (v _ptrflag_Hash) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_Hash) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_Hash) XdrBound() uint32 { return 1 } +func (v _XdrPtr_Hash) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_Hash) SetPresent(present bool) { + if !present { + *v.p = nil + } else if *v.p == nil { + *v.p = new(Hash) } - if int(n) < len(*v) { - *v = (*v)[:int(n)] +} +func (v _XdrPtr_Hash) XdrMarshalValue(x XDR, name string) { + if *v.p != nil { + XDR_Hash(*v.p).XdrMarshal(x, name) } } -func (v *_XdrVec_unbounded_LedgerKey) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) +func (v _XdrPtr_Hash) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_Hash) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_Hash(v)) + v.XdrMarshalValue(x, name) } -func (_XdrVec_unbounded_LedgerKey) XdrTypeName() string { return "LedgerKey<>" } -func (v *_XdrVec_unbounded_LedgerKey) XdrPointer() interface{} { return (*[]LedgerKey)(v) } -func (v _XdrVec_unbounded_LedgerKey) XdrValue() interface{} { return ([]LedgerKey)(v) } -func (v *_XdrVec_unbounded_LedgerKey) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (_XdrPtr_Hash) XdrTypeName() string { return "Hash*" } +func (v _XdrPtr_Hash) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_Hash) XdrValue() interface{} { return *v.p } -type _XdrVec_unbounded_LedgerEntry []LedgerEntry +type XdrType_ContractEvent = *ContractEvent -func (_XdrVec_unbounded_LedgerEntry) XdrBound() uint32 { +func (v *ContractEvent) XdrPointer() interface{} { return v } +func (ContractEvent) XdrTypeName() string { return "ContractEvent" } +func (v ContractEvent) XdrValue() interface{} { return v } +func (v *ContractEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ContractEvent) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%scontractID", name), _XdrPtr_Hash{&v.ContractID}) + x.Marshal(x.Sprintf("%stype", name), XDR_ContractEventType(&v.Type)) + x.Marshal(x.Sprintf("%sbody", name), XDR_XdrAnon_ContractEvent_Body(&v.Body)) +} +func XDR_ContractEvent(v *ContractEvent) *ContractEvent { return v } + +type XdrType_DiagnosticEvent = *DiagnosticEvent + +func (v *DiagnosticEvent) XdrPointer() interface{} { return v } +func (DiagnosticEvent) XdrTypeName() string { return "DiagnosticEvent" } +func (v DiagnosticEvent) XdrValue() interface{} { return v } +func (v *DiagnosticEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *DiagnosticEvent) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sinSuccessfulContractCall", name), XDR_bool(&v.InSuccessfulContractCall)) + x.Marshal(x.Sprintf("%sevent", name), XDR_ContractEvent(&v.Event)) +} +func XDR_DiagnosticEvent(v *DiagnosticEvent) *DiagnosticEvent { return v } + +type _XdrVec_unbounded_DiagnosticEvent []DiagnosticEvent + +func (_XdrVec_unbounded_DiagnosticEvent) XdrBound() uint32 { const bound uint32 = 4294967295 // Force error if not const or doesn't fit return bound } -func (_XdrVec_unbounded_LedgerEntry) XdrCheckLen(length uint32) { +func (_XdrVec_unbounded_DiagnosticEvent) XdrCheckLen(length uint32) { if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_LedgerEntry length %d exceeds bound 4294967295", length) + XdrPanic("_XdrVec_unbounded_DiagnosticEvent length %d exceeds bound 4294967295", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_LedgerEntry length %d exceeds max int", length) + XdrPanic("_XdrVec_unbounded_DiagnosticEvent length %d exceeds max int", length) } } -func (v _XdrVec_unbounded_LedgerEntry) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_LedgerEntry) SetVecLen(length uint32) { +func (v _XdrVec_unbounded_DiagnosticEvent) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_DiagnosticEvent) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -12970,963 +12820,851 @@ func (v *_XdrVec_unbounded_LedgerEntry) SetVecLen(length uint32) { } newcap = int(bound) } - nv := make([]LedgerEntry, int(length), newcap) + nv := make([]DiagnosticEvent, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_unbounded_LedgerEntry) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_unbounded_DiagnosticEvent) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_LedgerEntry(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_DiagnosticEvent(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_unbounded_LedgerEntry) XdrRecurse(x XDR, name string) { +func (v *_XdrVec_unbounded_DiagnosticEvent) XdrRecurse(x XDR, name string) { size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_unbounded_LedgerEntry) XdrTypeName() string { return "LedgerEntry<>" } -func (v *_XdrVec_unbounded_LedgerEntry) XdrPointer() interface{} { return (*[]LedgerEntry)(v) } -func (v _XdrVec_unbounded_LedgerEntry) XdrValue() interface{} { return ([]LedgerEntry)(v) } -func (v *_XdrVec_unbounded_LedgerEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (_XdrVec_unbounded_DiagnosticEvent) XdrTypeName() string { return "DiagnosticEvent<>" } +func (v *_XdrVec_unbounded_DiagnosticEvent) XdrPointer() interface{} { return (*[]DiagnosticEvent)(v) } +func (v _XdrVec_unbounded_DiagnosticEvent) XdrValue() interface{} { return ([]DiagnosticEvent)(v) } +func (v *_XdrVec_unbounded_DiagnosticEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_LedgerCloseMetaV1 = *LedgerCloseMetaV1 +type XdrType_DiagnosticEvents struct { + *_XdrVec_unbounded_DiagnosticEvent +} -func (v *LedgerCloseMetaV1) XdrPointer() interface{} { return v } -func (LedgerCloseMetaV1) XdrTypeName() string { return "LedgerCloseMetaV1" } -func (v LedgerCloseMetaV1) XdrValue() interface{} { return v } -func (v *LedgerCloseMetaV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LedgerCloseMetaV1) XdrRecurse(x XDR, name string) { +func XDR_DiagnosticEvents(v *DiagnosticEvents) XdrType_DiagnosticEvents { + return XdrType_DiagnosticEvents{(*_XdrVec_unbounded_DiagnosticEvent)(v)} +} +func (XdrType_DiagnosticEvents) XdrTypeName() string { return "DiagnosticEvents" } +func (v XdrType_DiagnosticEvents) XdrUnwrap() XdrType { return v._XdrVec_unbounded_DiagnosticEvent } + +type XdrType_SorobanTransactionMetaExtV1 = *SorobanTransactionMetaExtV1 + +func (v *SorobanTransactionMetaExtV1) XdrPointer() interface{} { return v } +func (SorobanTransactionMetaExtV1) XdrTypeName() string { return "SorobanTransactionMetaExtV1" } +func (v SorobanTransactionMetaExtV1) XdrValue() interface{} { return v } +func (v *SorobanTransactionMetaExtV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SorobanTransactionMetaExtV1) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sext", name), XDR_LedgerCloseMetaExt(&v.Ext)) - x.Marshal(x.Sprintf("%sledgerHeader", name), XDR_LedgerHeaderHistoryEntry(&v.LedgerHeader)) - x.Marshal(x.Sprintf("%stxSet", name), XDR_GeneralizedTransactionSet(&v.TxSet)) - x.Marshal(x.Sprintf("%stxProcessing", name), (*_XdrVec_unbounded_TransactionResultMeta)(&v.TxProcessing)) - x.Marshal(x.Sprintf("%supgradesProcessing", name), (*_XdrVec_unbounded_UpgradeEntryMeta)(&v.UpgradesProcessing)) - x.Marshal(x.Sprintf("%sscpInfo", name), (*_XdrVec_unbounded_SCPHistoryEntry)(&v.ScpInfo)) - x.Marshal(x.Sprintf("%stotalByteSizeOfBucketList", name), XDR_Uint64(&v.TotalByteSizeOfBucketList)) - x.Marshal(x.Sprintf("%sevictedTemporaryLedgerKeys", name), (*_XdrVec_unbounded_LedgerKey)(&v.EvictedTemporaryLedgerKeys)) - x.Marshal(x.Sprintf("%sevictedPersistentLedgerEntries", name), (*_XdrVec_unbounded_LedgerEntry)(&v.EvictedPersistentLedgerEntries)) + x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%stotalNonRefundableResourceFeeCharged", name), XDR_Int64(&v.TotalNonRefundableResourceFeeCharged)) + x.Marshal(x.Sprintf("%stotalRefundableResourceFeeCharged", name), XDR_Int64(&v.TotalRefundableResourceFeeCharged)) + x.Marshal(x.Sprintf("%srentFeeCharged", name), XDR_Int64(&v.RentFeeCharged)) +} +func XDR_SorobanTransactionMetaExtV1(v *SorobanTransactionMetaExtV1) *SorobanTransactionMetaExtV1 { + return v } -func XDR_LedgerCloseMetaV1(v *LedgerCloseMetaV1) *LedgerCloseMetaV1 { return v } -var _XdrTags_LedgerCloseMeta = map[int32]bool{ +var _XdrTags_SorobanTransactionMetaExt = map[int32]bool{ XdrToI32(0): true, XdrToI32(1): true, } -func (_ LedgerCloseMeta) XdrValidTags() map[int32]bool { - return _XdrTags_LedgerCloseMeta +func (_ SorobanTransactionMetaExt) XdrValidTags() map[int32]bool { + return _XdrTags_SorobanTransactionMetaExt } -func (u *LedgerCloseMeta) V0() *LedgerCloseMetaV0 { - switch u.V { - case 0: - if v, ok := u._u.(*LedgerCloseMetaV0); ok { - return v - } else { - var zero LedgerCloseMetaV0 - u._u = &zero - return &zero - } - default: - XdrPanic("LedgerCloseMeta.V0 accessed when V == %v", u.V) - return nil - } -} -func (u *LedgerCloseMeta) V1() *LedgerCloseMetaV1 { +func (u *SorobanTransactionMetaExt) V1() *SorobanTransactionMetaExtV1 { switch u.V { case 1: - if v, ok := u._u.(*LedgerCloseMetaV1); ok { + if v, ok := u._u.(*SorobanTransactionMetaExtV1); ok { return v } else { - var zero LedgerCloseMetaV1 + var zero SorobanTransactionMetaExtV1 u._u = &zero return &zero } default: - XdrPanic("LedgerCloseMeta.V1 accessed when V == %v", u.V) + XdrPanic("SorobanTransactionMetaExt.V1 accessed when V == %v", u.V) return nil } } -func (u LedgerCloseMeta) XdrValid() bool { +func (u SorobanTransactionMetaExt) XdrValid() bool { switch u.V { case 0, 1: return true } return false } -func (u *LedgerCloseMeta) XdrUnionTag() XdrNum32 { +func (u *SorobanTransactionMetaExt) XdrUnionTag() XdrNum32 { return XDR_int32(&u.V) } -func (u *LedgerCloseMeta) XdrUnionTagName() string { +func (u *SorobanTransactionMetaExt) XdrUnionTagName() string { return "V" } -func (u *LedgerCloseMeta) XdrUnionBody() XdrType { +func (u *SorobanTransactionMetaExt) XdrUnionBody() XdrType { switch u.V { case 0: - return XDR_LedgerCloseMetaV0(u.V0()) + return nil case 1: - return XDR_LedgerCloseMetaV1(u.V1()) + return XDR_SorobanTransactionMetaExtV1(u.V1()) } return nil } -func (u *LedgerCloseMeta) XdrUnionBodyName() string { +func (u *SorobanTransactionMetaExt) XdrUnionBodyName() string { switch u.V { case 0: - return "V0" + return "" case 1: return "V1" } return "" } -type XdrType_LedgerCloseMeta = *LedgerCloseMeta +type XdrType_SorobanTransactionMetaExt = *SorobanTransactionMetaExt -func (v *LedgerCloseMeta) XdrPointer() interface{} { return v } -func (LedgerCloseMeta) XdrTypeName() string { return "LedgerCloseMeta" } -func (v LedgerCloseMeta) XdrValue() interface{} { return v } -func (v *LedgerCloseMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *LedgerCloseMeta) XdrRecurse(x XDR, name string) { +func (v *SorobanTransactionMetaExt) XdrPointer() interface{} { return v } +func (SorobanTransactionMetaExt) XdrTypeName() string { return "SorobanTransactionMetaExt" } +func (v SorobanTransactionMetaExt) XdrValue() interface{} { return v } +func (v *SorobanTransactionMetaExt) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *SorobanTransactionMetaExt) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) switch u.V { case 0: - x.Marshal(x.Sprintf("%sv0", name), XDR_LedgerCloseMetaV0(u.V0())) return case 1: - x.Marshal(x.Sprintf("%sv1", name), XDR_LedgerCloseMetaV1(u.V1())) + x.Marshal(x.Sprintf("%sv1", name), XDR_SorobanTransactionMetaExtV1(u.V1())) return } - XdrPanic("invalid V (%v) in LedgerCloseMeta", u.V) + XdrPanic("invalid V (%v) in SorobanTransactionMetaExt", u.V) } -func XDR_LedgerCloseMeta(v *LedgerCloseMeta) *LedgerCloseMeta { return v } +func XDR_SorobanTransactionMetaExt(v *SorobanTransactionMetaExt) *SorobanTransactionMetaExt { return v } -var _XdrNames_ErrorCode = map[int32]string{ - int32(ERR_MISC): "ERR_MISC", - int32(ERR_DATA): "ERR_DATA", - int32(ERR_CONF): "ERR_CONF", - int32(ERR_AUTH): "ERR_AUTH", - int32(ERR_LOAD): "ERR_LOAD", -} -var _XdrValues_ErrorCode = map[string]int32{ - "ERR_MISC": int32(ERR_MISC), - "ERR_DATA": int32(ERR_DATA), - "ERR_CONF": int32(ERR_CONF), - "ERR_AUTH": int32(ERR_AUTH), - "ERR_LOAD": int32(ERR_LOAD), -} +type _XdrVec_unbounded_ContractEvent []ContractEvent -func (ErrorCode) XdrEnumNames() map[int32]string { - return _XdrNames_ErrorCode +func (_XdrVec_unbounded_ContractEvent) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound } -func (v ErrorCode) String() string { - if s, ok := _XdrNames_ErrorCode[int32(v)]; ok { - return s +func (_XdrVec_unbounded_ContractEvent) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_ContractEvent length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_ContractEvent length %d exceeds max int", length) } - return fmt.Sprintf("ErrorCode#%d", v) } -func (v *ErrorCode) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_ErrorCode[stok]; ok { - *v = ErrorCode(val) - return nil - } else if stok == "ErrorCode" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } +func (v _XdrVec_unbounded_ContractEvent) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_ContractEvent) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] } - return XdrError(fmt.Sprintf("%s is not a valid ErrorCode.", stok)) + return + } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) } + nv := make([]ContractEvent, int(length), newcap) + copy(nv, *v) + *v = nv } -func (v ErrorCode) GetU32() uint32 { return uint32(v) } -func (v *ErrorCode) SetU32(n uint32) { *v = ErrorCode(n) } -func (v *ErrorCode) XdrPointer() interface{} { return v } -func (ErrorCode) XdrTypeName() string { return "ErrorCode" } -func (v ErrorCode) XdrValue() interface{} { return v } -func (v *ErrorCode) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_ErrorCode = *ErrorCode - -func XDR_ErrorCode(v *ErrorCode) *ErrorCode { return v } - -var _XdrComments_ErrorCode = map[int32]string{ - int32(ERR_MISC): "Unspecific error", - int32(ERR_DATA): "Malformed data", - int32(ERR_CONF): "Misconfiguration error", - int32(ERR_AUTH): "Authentication failure", - int32(ERR_LOAD): "System overloaded", +func (v *_XdrVec_unbounded_ContractEvent) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_ContractEvent(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] + } } - -func (e ErrorCode) XdrEnumComments() map[int32]string { - return _XdrComments_ErrorCode +func (v *_XdrVec_unbounded_ContractEvent) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } +func (_XdrVec_unbounded_ContractEvent) XdrTypeName() string { return "ContractEvent<>" } +func (v *_XdrVec_unbounded_ContractEvent) XdrPointer() interface{} { return (*[]ContractEvent)(v) } +func (v _XdrVec_unbounded_ContractEvent) XdrValue() interface{} { return ([]ContractEvent)(v) } +func (v *_XdrVec_unbounded_ContractEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_Error = *Error +type XdrType_SorobanTransactionMeta = *SorobanTransactionMeta -func (v *Error) XdrPointer() interface{} { return v } -func (Error) XdrTypeName() string { return "Error" } -func (v Error) XdrValue() interface{} { return v } -func (v *Error) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *Error) XdrRecurse(x XDR, name string) { +func (v *SorobanTransactionMeta) XdrPointer() interface{} { return v } +func (SorobanTransactionMeta) XdrTypeName() string { return "SorobanTransactionMeta" } +func (v SorobanTransactionMeta) XdrValue() interface{} { return v } +func (v *SorobanTransactionMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SorobanTransactionMeta) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%scode", name), XDR_ErrorCode(&v.Code)) - x.Marshal(x.Sprintf("%smsg", name), XdrString{&v.Msg, 100}) + x.Marshal(x.Sprintf("%sext", name), XDR_SorobanTransactionMetaExt(&v.Ext)) + x.Marshal(x.Sprintf("%sevents", name), (*_XdrVec_unbounded_ContractEvent)(&v.Events)) + x.Marshal(x.Sprintf("%sreturnValue", name), XDR_SCVal(&v.ReturnValue)) + x.Marshal(x.Sprintf("%sdiagnosticEvents", name), (*_XdrVec_unbounded_DiagnosticEvent)(&v.DiagnosticEvents)) } -func XDR_Error(v *Error) *Error { return v } - -type XdrType_SendMore = *SendMore +func XDR_SorobanTransactionMeta(v *SorobanTransactionMeta) *SorobanTransactionMeta { return v } -func (v *SendMore) XdrPointer() interface{} { return v } -func (SendMore) XdrTypeName() string { return "SendMore" } -func (v SendMore) XdrValue() interface{} { return v } -func (v *SendMore) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SendMore) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%snumMessages", name), XDR_Uint32(&v.NumMessages)) +type _XdrPtr_SorobanTransactionMeta struct { + p **SorobanTransactionMeta } -func XDR_SendMore(v *SendMore) *SendMore { return v } - -type XdrType_SendMoreExtended = *SendMoreExtended +type _ptrflag_SorobanTransactionMeta _XdrPtr_SorobanTransactionMeta -func (v *SendMoreExtended) XdrPointer() interface{} { return v } -func (SendMoreExtended) XdrTypeName() string { return "SendMoreExtended" } -func (v SendMoreExtended) XdrValue() interface{} { return v } -func (v *SendMoreExtended) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SendMoreExtended) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (v _ptrflag_SorobanTransactionMeta) String() string { + if *v.p == nil { + return "nil" } - x.Marshal(x.Sprintf("%snumMessages", name), XDR_Uint32(&v.NumMessages)) - x.Marshal(x.Sprintf("%snumBytes", name), XDR_Uint32(&v.NumBytes)) + return "non-nil" } -func XDR_SendMoreExtended(v *SendMoreExtended) *SendMoreExtended { return v } - -type XdrType_AuthCert = *AuthCert - -func (v *AuthCert) XdrPointer() interface{} { return v } -func (AuthCert) XdrTypeName() string { return "AuthCert" } -func (v AuthCert) XdrValue() interface{} { return v } -func (v *AuthCert) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *AuthCert) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (v _ptrflag_SorobanTransactionMeta) Scan(ss fmt.ScanState, r rune) error { + tok, err := ss.Token(true, func(c rune) bool { + return c == '-' || (c >= 'a' && c <= 'z') + }) + if err != nil { + return err } - x.Marshal(x.Sprintf("%spubkey", name), XDR_Curve25519Public(&v.Pubkey)) - x.Marshal(x.Sprintf("%sexpiration", name), XDR_Uint64(&v.Expiration)) - x.Marshal(x.Sprintf("%ssig", name), XDR_Signature(&v.Sig)) + switch string(tok) { + case "nil": + v.SetU32(0) + case "non-nil": + v.SetU32(1) + default: + return XdrError("SorobanTransactionMeta flag should be \"nil\" or \"non-nil\"") + } + return nil } -func XDR_AuthCert(v *AuthCert) *AuthCert { return v } - -type XdrType_Hello = *Hello - -func (v *Hello) XdrPointer() interface{} { return v } -func (Hello) XdrTypeName() string { return "Hello" } -func (v Hello) XdrValue() interface{} { return v } -func (v *Hello) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *Hello) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (v _ptrflag_SorobanTransactionMeta) GetU32() uint32 { + if *v.p == nil { + return 0 } - x.Marshal(x.Sprintf("%sledgerVersion", name), XDR_Uint32(&v.LedgerVersion)) - x.Marshal(x.Sprintf("%soverlayVersion", name), XDR_Uint32(&v.OverlayVersion)) - x.Marshal(x.Sprintf("%soverlayMinVersion", name), XDR_Uint32(&v.OverlayMinVersion)) - x.Marshal(x.Sprintf("%snetworkID", name), XDR_Hash(&v.NetworkID)) - x.Marshal(x.Sprintf("%sversionStr", name), XdrString{&v.VersionStr, 100}) - x.Marshal(x.Sprintf("%slisteningPort", name), XDR_int32(&v.ListeningPort)) - x.Marshal(x.Sprintf("%speerID", name), XDR_NodeID(&v.PeerID)) - x.Marshal(x.Sprintf("%scert", name), XDR_AuthCert(&v.Cert)) - x.Marshal(x.Sprintf("%snonce", name), XDR_Uint256(&v.Nonce)) + return 1 } -func XDR_Hello(v *Hello) *Hello { return v } +func (v _ptrflag_SorobanTransactionMeta) SetU32(nv uint32) { + switch nv { + case 0: + *v.p = nil + case 1: + if *v.p == nil { + *v.p = new(SorobanTransactionMeta) + } + default: + XdrPanic("*SorobanTransactionMeta present flag value %d should be 0 or 1", nv) + } +} +func (_ptrflag_SorobanTransactionMeta) XdrTypeName() string { return "SorobanTransactionMeta?" } +func (v _ptrflag_SorobanTransactionMeta) XdrPointer() interface{} { return nil } +func (v _ptrflag_SorobanTransactionMeta) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_SorobanTransactionMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_SorobanTransactionMeta) XdrBound() uint32 { return 1 } +func (v _XdrPtr_SorobanTransactionMeta) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_SorobanTransactionMeta) SetPresent(present bool) { + if !present { + *v.p = nil + } else if *v.p == nil { + *v.p = new(SorobanTransactionMeta) + } +} +func (v _XdrPtr_SorobanTransactionMeta) XdrMarshalValue(x XDR, name string) { + if *v.p != nil { + XDR_SorobanTransactionMeta(*v.p).XdrMarshal(x, name) + } +} +func (v _XdrPtr_SorobanTransactionMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_SorobanTransactionMeta) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_SorobanTransactionMeta(v)) + v.XdrMarshalValue(x, name) +} +func (_XdrPtr_SorobanTransactionMeta) XdrTypeName() string { return "SorobanTransactionMeta*" } +func (v _XdrPtr_SorobanTransactionMeta) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_SorobanTransactionMeta) XdrValue() interface{} { return *v.p } -type XdrType_Auth = *Auth +type XdrType_TransactionMetaV3 = *TransactionMetaV3 -func (v *Auth) XdrPointer() interface{} { return v } -func (Auth) XdrTypeName() string { return "Auth" } -func (v Auth) XdrValue() interface{} { return v } -func (v *Auth) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *Auth) XdrRecurse(x XDR, name string) { +func (v *TransactionMetaV3) XdrPointer() interface{} { return v } +func (TransactionMetaV3) XdrTypeName() string { return "TransactionMetaV3" } +func (v TransactionMetaV3) XdrValue() interface{} { return v } +func (v *TransactionMetaV3) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TransactionMetaV3) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sflags", name), XDR_int32(&v.Flags)) + x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%stxChangesBefore", name), XDR_LedgerEntryChanges(&v.TxChangesBefore)) + x.Marshal(x.Sprintf("%soperations", name), (*_XdrVec_unbounded_OperationMeta)(&v.Operations)) + x.Marshal(x.Sprintf("%stxChangesAfter", name), XDR_LedgerEntryChanges(&v.TxChangesAfter)) + x.Marshal(x.Sprintf("%ssorobanMeta", name), _XdrPtr_SorobanTransactionMeta{&v.SorobanMeta}) } -func XDR_Auth(v *Auth) *Auth { return v } +func XDR_TransactionMetaV3(v *TransactionMetaV3) *TransactionMetaV3 { return v } -var _XdrNames_IPAddrType = map[int32]string{ - int32(IPv4): "IPv4", - int32(IPv6): "IPv6", -} -var _XdrValues_IPAddrType = map[string]int32{ - "IPv4": int32(IPv4), - "IPv6": int32(IPv6), -} +type XdrType_InvokeHostFunctionSuccessPreImage = *InvokeHostFunctionSuccessPreImage -func (IPAddrType) XdrEnumNames() map[int32]string { - return _XdrNames_IPAddrType +func (v *InvokeHostFunctionSuccessPreImage) XdrPointer() interface{} { return v } +func (InvokeHostFunctionSuccessPreImage) XdrTypeName() string { + return "InvokeHostFunctionSuccessPreImage" } -func (v IPAddrType) String() string { - if s, ok := _XdrNames_IPAddrType[int32(v)]; ok { - return s +func (v InvokeHostFunctionSuccessPreImage) XdrValue() interface{} { return v } +func (v *InvokeHostFunctionSuccessPreImage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *InvokeHostFunctionSuccessPreImage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } - return fmt.Sprintf("IPAddrType#%d", v) + x.Marshal(x.Sprintf("%sreturnValue", name), XDR_SCVal(&v.ReturnValue)) + x.Marshal(x.Sprintf("%sevents", name), (*_XdrVec_unbounded_ContractEvent)(&v.Events)) } -func (v *IPAddrType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_IPAddrType[stok]; ok { - *v = IPAddrType(val) - return nil - } else if stok == "IPAddrType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } - } - return XdrError(fmt.Sprintf("%s is not a valid IPAddrType.", stok)) - } +func XDR_InvokeHostFunctionSuccessPreImage(v *InvokeHostFunctionSuccessPreImage) *InvokeHostFunctionSuccessPreImage { + return v } -func (v IPAddrType) GetU32() uint32 { return uint32(v) } -func (v *IPAddrType) SetU32(n uint32) { *v = IPAddrType(n) } -func (v *IPAddrType) XdrPointer() interface{} { return v } -func (IPAddrType) XdrTypeName() string { return "IPAddrType" } -func (v IPAddrType) XdrValue() interface{} { return v } -func (v *IPAddrType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_IPAddrType = *IPAddrType - -func XDR_IPAddrType(v *IPAddrType) *IPAddrType { return v } - -type _XdrArray_16_opaque [16]byte - -func (v *_XdrArray_16_opaque) GetByteSlice() []byte { return v[:] } -func (v *_XdrArray_16_opaque) XdrTypeName() string { return "opaque[]" } -func (v *_XdrArray_16_opaque) XdrValue() interface{} { return v[:] } -func (v *_XdrArray_16_opaque) XdrPointer() interface{} { return (*[16]byte)(v) } -func (v *_XdrArray_16_opaque) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *_XdrArray_16_opaque) String() string { return fmt.Sprintf("%x", v[:]) } -func (v *_XdrArray_16_opaque) Scan(ss fmt.ScanState, c rune) error { - return XdrArrayOpaqueScan(v[:], ss, c) -} -func (_XdrArray_16_opaque) XdrArraySize() uint32 { - const bound uint32 = 16 // Force error if not const or doesn't fit - return bound +var _XdrTags_TransactionMeta = map[int32]bool{ + XdrToI32(0): true, + XdrToI32(1): true, + XdrToI32(2): true, + XdrToI32(3): true, } -var _XdrTags_XdrAnon_PeerAddress_Ip = map[int32]bool{ - XdrToI32(IPv4): true, - XdrToI32(IPv6): true, +func (_ TransactionMeta) XdrValidTags() map[int32]bool { + return _XdrTags_TransactionMeta } - -func (_ XdrAnon_PeerAddress_Ip) XdrValidTags() map[int32]bool { - return _XdrTags_XdrAnon_PeerAddress_Ip +func (u *TransactionMeta) Operations() *[]OperationMeta { + switch u.V { + case 0: + if v, ok := u._u.(*[]OperationMeta); ok { + return v + } else { + var zero []OperationMeta + u._u = &zero + return &zero + } + default: + XdrPanic("TransactionMeta.Operations accessed when V == %v", u.V) + return nil + } } -func (u *XdrAnon_PeerAddress_Ip) Ipv4() *[4]byte { - switch u.Type { - case IPv4: - if v, ok := u._u.(*[4]byte); ok { +func (u *TransactionMeta) V1() *TransactionMetaV1 { + switch u.V { + case 1: + if v, ok := u._u.(*TransactionMetaV1); ok { return v } else { - var zero [4]byte + var zero TransactionMetaV1 u._u = &zero return &zero } default: - XdrPanic("XdrAnon_PeerAddress_Ip.Ipv4 accessed when Type == %v", u.Type) + XdrPanic("TransactionMeta.V1 accessed when V == %v", u.V) return nil } } -func (u *XdrAnon_PeerAddress_Ip) Ipv6() *[16]byte { - switch u.Type { - case IPv6: - if v, ok := u._u.(*[16]byte); ok { +func (u *TransactionMeta) V2() *TransactionMetaV2 { + switch u.V { + case 2: + if v, ok := u._u.(*TransactionMetaV2); ok { return v } else { - var zero [16]byte + var zero TransactionMetaV2 u._u = &zero return &zero } default: - XdrPanic("XdrAnon_PeerAddress_Ip.Ipv6 accessed when Type == %v", u.Type) + XdrPanic("TransactionMeta.V2 accessed when V == %v", u.V) return nil } } -func (u XdrAnon_PeerAddress_Ip) XdrValid() bool { - switch u.Type { - case IPv4, IPv6: +func (u *TransactionMeta) V3() *TransactionMetaV3 { + switch u.V { + case 3: + if v, ok := u._u.(*TransactionMetaV3); ok { + return v + } else { + var zero TransactionMetaV3 + u._u = &zero + return &zero + } + default: + XdrPanic("TransactionMeta.V3 accessed when V == %v", u.V) + return nil + } +} +func (u TransactionMeta) XdrValid() bool { + switch u.V { + case 0, 1, 2, 3: return true } return false } -func (u *XdrAnon_PeerAddress_Ip) XdrUnionTag() XdrNum32 { - return XDR_IPAddrType(&u.Type) +func (u *TransactionMeta) XdrUnionTag() XdrNum32 { + return XDR_int32(&u.V) } -func (u *XdrAnon_PeerAddress_Ip) XdrUnionTagName() string { - return "Type" +func (u *TransactionMeta) XdrUnionTagName() string { + return "V" } -func (u *XdrAnon_PeerAddress_Ip) XdrUnionBody() XdrType { - switch u.Type { - case IPv4: - return (*_XdrArray_4_opaque)(u.Ipv4()) - case IPv6: - return (*_XdrArray_16_opaque)(u.Ipv6()) +func (u *TransactionMeta) XdrUnionBody() XdrType { + switch u.V { + case 0: + return (*_XdrVec_unbounded_OperationMeta)(u.Operations()) + case 1: + return XDR_TransactionMetaV1(u.V1()) + case 2: + return XDR_TransactionMetaV2(u.V2()) + case 3: + return XDR_TransactionMetaV3(u.V3()) } return nil } -func (u *XdrAnon_PeerAddress_Ip) XdrUnionBodyName() string { - switch u.Type { - case IPv4: - return "Ipv4" - case IPv6: - return "Ipv6" +func (u *TransactionMeta) XdrUnionBodyName() string { + switch u.V { + case 0: + return "Operations" + case 1: + return "V1" + case 2: + return "V2" + case 3: + return "V3" } return "" } -type XdrType_XdrAnon_PeerAddress_Ip = *XdrAnon_PeerAddress_Ip +type XdrType_TransactionMeta = *TransactionMeta -func (v *XdrAnon_PeerAddress_Ip) XdrPointer() interface{} { return v } -func (XdrAnon_PeerAddress_Ip) XdrTypeName() string { return "XdrAnon_PeerAddress_Ip" } -func (v XdrAnon_PeerAddress_Ip) XdrValue() interface{} { return v } -func (v *XdrAnon_PeerAddress_Ip) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *XdrAnon_PeerAddress_Ip) XdrRecurse(x XDR, name string) { +func (v *TransactionMeta) XdrPointer() interface{} { return v } +func (TransactionMeta) XdrTypeName() string { return "TransactionMeta" } +func (v TransactionMeta) XdrValue() interface{} { return v } +func (v *TransactionMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *TransactionMeta) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_IPAddrType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case IPv4: - x.Marshal(x.Sprintf("%sipv4", name), (*_XdrArray_4_opaque)(u.Ipv4())) + XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + switch u.V { + case 0: + x.Marshal(x.Sprintf("%soperations", name), (*_XdrVec_unbounded_OperationMeta)(u.Operations())) return - case IPv6: - x.Marshal(x.Sprintf("%sipv6", name), (*_XdrArray_16_opaque)(u.Ipv6())) + case 1: + x.Marshal(x.Sprintf("%sv1", name), XDR_TransactionMetaV1(u.V1())) + return + case 2: + x.Marshal(x.Sprintf("%sv2", name), XDR_TransactionMetaV2(u.V2())) + return + case 3: + x.Marshal(x.Sprintf("%sv3", name), XDR_TransactionMetaV3(u.V3())) return } - XdrPanic("invalid Type (%v) in XdrAnon_PeerAddress_Ip", u.Type) + XdrPanic("invalid V (%v) in TransactionMeta", u.V) } -func XDR_XdrAnon_PeerAddress_Ip(v *XdrAnon_PeerAddress_Ip) *XdrAnon_PeerAddress_Ip { return v } +func XDR_TransactionMeta(v *TransactionMeta) *TransactionMeta { return v } -type XdrType_PeerAddress = *PeerAddress +type XdrType_TransactionResultMeta = *TransactionResultMeta -func (v *PeerAddress) XdrPointer() interface{} { return v } -func (PeerAddress) XdrTypeName() string { return "PeerAddress" } -func (v PeerAddress) XdrValue() interface{} { return v } -func (v *PeerAddress) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *PeerAddress) XdrRecurse(x XDR, name string) { +func (v *TransactionResultMeta) XdrPointer() interface{} { return v } +func (TransactionResultMeta) XdrTypeName() string { return "TransactionResultMeta" } +func (v TransactionResultMeta) XdrValue() interface{} { return v } +func (v *TransactionResultMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TransactionResultMeta) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sip", name), XDR_XdrAnon_PeerAddress_Ip(&v.Ip)) - x.Marshal(x.Sprintf("%sport", name), XDR_Uint32(&v.Port)) - x.Marshal(x.Sprintf("%snumFailures", name), XDR_Uint32(&v.NumFailures)) + x.Marshal(x.Sprintf("%sresult", name), XDR_TransactionResultPair(&v.Result)) + x.Marshal(x.Sprintf("%sfeeProcessing", name), XDR_LedgerEntryChanges(&v.FeeProcessing)) + x.Marshal(x.Sprintf("%stxApplyProcessing", name), XDR_TransactionMeta(&v.TxApplyProcessing)) } -func XDR_PeerAddress(v *PeerAddress) *PeerAddress { return v } +func XDR_TransactionResultMeta(v *TransactionResultMeta) *TransactionResultMeta { return v } -var _XdrNames_MessageType = map[int32]string{ - int32(ERROR_MSG): "ERROR_MSG", - int32(AUTH): "AUTH", - int32(DONT_HAVE): "DONT_HAVE", - int32(GET_PEERS): "GET_PEERS", - int32(PEERS): "PEERS", - int32(GET_TX_SET): "GET_TX_SET", - int32(TX_SET): "TX_SET", - int32(GENERALIZED_TX_SET): "GENERALIZED_TX_SET", - int32(TRANSACTION): "TRANSACTION", - int32(GET_SCP_QUORUMSET): "GET_SCP_QUORUMSET", - int32(SCP_QUORUMSET): "SCP_QUORUMSET", - int32(SCP_MESSAGE): "SCP_MESSAGE", - int32(GET_SCP_STATE): "GET_SCP_STATE", - int32(HELLO): "HELLO", - int32(SURVEY_REQUEST): "SURVEY_REQUEST", - int32(SURVEY_RESPONSE): "SURVEY_RESPONSE", - int32(SEND_MORE): "SEND_MORE", - int32(SEND_MORE_EXTENDED): "SEND_MORE_EXTENDED", - int32(FLOOD_ADVERT): "FLOOD_ADVERT", - int32(FLOOD_DEMAND): "FLOOD_DEMAND", - int32(TIME_SLICED_SURVEY_REQUEST): "TIME_SLICED_SURVEY_REQUEST", - int32(TIME_SLICED_SURVEY_RESPONSE): "TIME_SLICED_SURVEY_RESPONSE", - int32(TIME_SLICED_SURVEY_START_COLLECTING): "TIME_SLICED_SURVEY_START_COLLECTING", - int32(TIME_SLICED_SURVEY_STOP_COLLECTING): "TIME_SLICED_SURVEY_STOP_COLLECTING", -} -var _XdrValues_MessageType = map[string]int32{ - "ERROR_MSG": int32(ERROR_MSG), - "AUTH": int32(AUTH), - "DONT_HAVE": int32(DONT_HAVE), - "GET_PEERS": int32(GET_PEERS), - "PEERS": int32(PEERS), - "GET_TX_SET": int32(GET_TX_SET), - "TX_SET": int32(TX_SET), - "GENERALIZED_TX_SET": int32(GENERALIZED_TX_SET), - "TRANSACTION": int32(TRANSACTION), - "GET_SCP_QUORUMSET": int32(GET_SCP_QUORUMSET), - "SCP_QUORUMSET": int32(SCP_QUORUMSET), - "SCP_MESSAGE": int32(SCP_MESSAGE), - "GET_SCP_STATE": int32(GET_SCP_STATE), - "HELLO": int32(HELLO), - "SURVEY_REQUEST": int32(SURVEY_REQUEST), - "SURVEY_RESPONSE": int32(SURVEY_RESPONSE), - "SEND_MORE": int32(SEND_MORE), - "SEND_MORE_EXTENDED": int32(SEND_MORE_EXTENDED), - "FLOOD_ADVERT": int32(FLOOD_ADVERT), - "FLOOD_DEMAND": int32(FLOOD_DEMAND), - "TIME_SLICED_SURVEY_REQUEST": int32(TIME_SLICED_SURVEY_REQUEST), - "TIME_SLICED_SURVEY_RESPONSE": int32(TIME_SLICED_SURVEY_RESPONSE), - "TIME_SLICED_SURVEY_START_COLLECTING": int32(TIME_SLICED_SURVEY_START_COLLECTING), - "TIME_SLICED_SURVEY_STOP_COLLECTING": int32(TIME_SLICED_SURVEY_STOP_COLLECTING), +type XdrType_UpgradeEntryMeta = *UpgradeEntryMeta + +func (v *UpgradeEntryMeta) XdrPointer() interface{} { return v } +func (UpgradeEntryMeta) XdrTypeName() string { return "UpgradeEntryMeta" } +func (v UpgradeEntryMeta) XdrValue() interface{} { return v } +func (v *UpgradeEntryMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *UpgradeEntryMeta) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%supgrade", name), XDR_LedgerUpgrade(&v.Upgrade)) + x.Marshal(x.Sprintf("%schanges", name), XDR_LedgerEntryChanges(&v.Changes)) } +func XDR_UpgradeEntryMeta(v *UpgradeEntryMeta) *UpgradeEntryMeta { return v } -func (MessageType) XdrEnumNames() map[int32]string { - return _XdrNames_MessageType +type _XdrVec_unbounded_TransactionResultMeta []TransactionResultMeta + +func (_XdrVec_unbounded_TransactionResultMeta) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound } -func (v MessageType) String() string { - if s, ok := _XdrNames_MessageType[int32(v)]; ok { - return s +func (_XdrVec_unbounded_TransactionResultMeta) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_TransactionResultMeta length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_TransactionResultMeta length %d exceeds max int", length) } - return fmt.Sprintf("MessageType#%d", v) } -func (v *MessageType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_MessageType[stok]; ok { - *v = MessageType(val) - return nil - } else if stok == "MessageType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } +func (v _XdrVec_unbounded_TransactionResultMeta) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_TransactionResultMeta) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] } - return XdrError(fmt.Sprintf("%s is not a valid MessageType.", stok)) + return } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) + } + nv := make([]TransactionResultMeta, int(length), newcap) + copy(nv, *v) + *v = nv } -func (v MessageType) GetU32() uint32 { return uint32(v) } -func (v *MessageType) SetU32(n uint32) { *v = MessageType(n) } -func (v *MessageType) XdrPointer() interface{} { return v } -func (MessageType) XdrTypeName() string { return "MessageType" } -func (v MessageType) XdrValue() interface{} { return v } -func (v *MessageType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_MessageType = *MessageType - -func XDR_MessageType(v *MessageType) *MessageType { return v } - -var _XdrComments_MessageType = map[int32]string{ - int32(GET_PEERS): "gets a list of peers this guy knows about", - int32(GET_TX_SET): "gets a particular txset by hash", - int32(TRANSACTION): "pass on a tx you have heard about", - int32(GET_SCP_QUORUMSET): "SCP", - int32(HELLO): "new messages", -} - -func (e MessageType) XdrEnumComments() map[int32]string { - return _XdrComments_MessageType -} - -type XdrType_DontHave = *DontHave - -func (v *DontHave) XdrPointer() interface{} { return v } -func (DontHave) XdrTypeName() string { return "DontHave" } -func (v DontHave) XdrValue() interface{} { return v } -func (v *DontHave) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *DontHave) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (v *_XdrVec_unbounded_TransactionResultMeta) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_TransactionResultMeta(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] } - x.Marshal(x.Sprintf("%stype", name), XDR_MessageType(&v.Type)) - x.Marshal(x.Sprintf("%sreqHash", name), XDR_Uint256(&v.ReqHash)) } -func XDR_DontHave(v *DontHave) *DontHave { return v } - -var _XdrNames_SurveyMessageCommandType = map[int32]string{ - int32(SURVEY_TOPOLOGY): "SURVEY_TOPOLOGY", - int32(TIME_SLICED_SURVEY_TOPOLOGY): "TIME_SLICED_SURVEY_TOPOLOGY", +func (v *_XdrVec_unbounded_TransactionResultMeta) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } -var _XdrValues_SurveyMessageCommandType = map[string]int32{ - "SURVEY_TOPOLOGY": int32(SURVEY_TOPOLOGY), - "TIME_SLICED_SURVEY_TOPOLOGY": int32(TIME_SLICED_SURVEY_TOPOLOGY), +func (_XdrVec_unbounded_TransactionResultMeta) XdrTypeName() string { return "TransactionResultMeta<>" } +func (v *_XdrVec_unbounded_TransactionResultMeta) XdrPointer() interface{} { + return (*[]TransactionResultMeta)(v) +} +func (v _XdrVec_unbounded_TransactionResultMeta) XdrValue() interface{} { + return ([]TransactionResultMeta)(v) } +func (v *_XdrVec_unbounded_TransactionResultMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (SurveyMessageCommandType) XdrEnumNames() map[int32]string { - return _XdrNames_SurveyMessageCommandType +type _XdrVec_unbounded_UpgradeEntryMeta []UpgradeEntryMeta + +func (_XdrVec_unbounded_UpgradeEntryMeta) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound } -func (v SurveyMessageCommandType) String() string { - if s, ok := _XdrNames_SurveyMessageCommandType[int32(v)]; ok { - return s +func (_XdrVec_unbounded_UpgradeEntryMeta) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_UpgradeEntryMeta length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_UpgradeEntryMeta length %d exceeds max int", length) } - return fmt.Sprintf("SurveyMessageCommandType#%d", v) } -func (v *SurveyMessageCommandType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_SurveyMessageCommandType[stok]; ok { - *v = SurveyMessageCommandType(val) - return nil - } else if stok == "SurveyMessageCommandType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } +func (v _XdrVec_unbounded_UpgradeEntryMeta) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_UpgradeEntryMeta) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] } - return XdrError(fmt.Sprintf("%s is not a valid SurveyMessageCommandType.", stok)) + return } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) + } + nv := make([]UpgradeEntryMeta, int(length), newcap) + copy(nv, *v) + *v = nv } -func (v SurveyMessageCommandType) GetU32() uint32 { return uint32(v) } -func (v *SurveyMessageCommandType) SetU32(n uint32) { *v = SurveyMessageCommandType(n) } -func (v *SurveyMessageCommandType) XdrPointer() interface{} { return v } -func (SurveyMessageCommandType) XdrTypeName() string { return "SurveyMessageCommandType" } -func (v SurveyMessageCommandType) XdrValue() interface{} { return v } -func (v *SurveyMessageCommandType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_SurveyMessageCommandType = *SurveyMessageCommandType - -func XDR_SurveyMessageCommandType(v *SurveyMessageCommandType) *SurveyMessageCommandType { return v } - -var _XdrNames_SurveyMessageResponseType = map[int32]string{ - int32(SURVEY_TOPOLOGY_RESPONSE_V0): "SURVEY_TOPOLOGY_RESPONSE_V0", - int32(SURVEY_TOPOLOGY_RESPONSE_V1): "SURVEY_TOPOLOGY_RESPONSE_V1", - int32(SURVEY_TOPOLOGY_RESPONSE_V2): "SURVEY_TOPOLOGY_RESPONSE_V2", -} -var _XdrValues_SurveyMessageResponseType = map[string]int32{ - "SURVEY_TOPOLOGY_RESPONSE_V0": int32(SURVEY_TOPOLOGY_RESPONSE_V0), - "SURVEY_TOPOLOGY_RESPONSE_V1": int32(SURVEY_TOPOLOGY_RESPONSE_V1), - "SURVEY_TOPOLOGY_RESPONSE_V2": int32(SURVEY_TOPOLOGY_RESPONSE_V2), +func (v *_XdrVec_unbounded_UpgradeEntryMeta) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_UpgradeEntryMeta(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] + } +} +func (v *_XdrVec_unbounded_UpgradeEntryMeta) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) +} +func (_XdrVec_unbounded_UpgradeEntryMeta) XdrTypeName() string { return "UpgradeEntryMeta<>" } +func (v *_XdrVec_unbounded_UpgradeEntryMeta) XdrPointer() interface{} { + return (*[]UpgradeEntryMeta)(v) } +func (v _XdrVec_unbounded_UpgradeEntryMeta) XdrValue() interface{} { return ([]UpgradeEntryMeta)(v) } +func (v *_XdrVec_unbounded_UpgradeEntryMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (SurveyMessageResponseType) XdrEnumNames() map[int32]string { - return _XdrNames_SurveyMessageResponseType +type _XdrVec_unbounded_SCPHistoryEntry []SCPHistoryEntry + +func (_XdrVec_unbounded_SCPHistoryEntry) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound } -func (v SurveyMessageResponseType) String() string { - if s, ok := _XdrNames_SurveyMessageResponseType[int32(v)]; ok { - return s +func (_XdrVec_unbounded_SCPHistoryEntry) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_SCPHistoryEntry length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_SCPHistoryEntry length %d exceeds max int", length) } - return fmt.Sprintf("SurveyMessageResponseType#%d", v) } -func (v *SurveyMessageResponseType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_SurveyMessageResponseType[stok]; ok { - *v = SurveyMessageResponseType(val) - return nil - } else if stok == "SurveyMessageResponseType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } +func (v _XdrVec_unbounded_SCPHistoryEntry) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_SCPHistoryEntry) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] } - return XdrError(fmt.Sprintf("%s is not a valid SurveyMessageResponseType.", stok)) + return + } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) + } + nv := make([]SCPHistoryEntry, int(length), newcap) + copy(nv, *v) + *v = nv +} +func (v *_XdrVec_unbounded_SCPHistoryEntry) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_SCPHistoryEntry(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] } } -func (v SurveyMessageResponseType) GetU32() uint32 { return uint32(v) } -func (v *SurveyMessageResponseType) SetU32(n uint32) { *v = SurveyMessageResponseType(n) } -func (v *SurveyMessageResponseType) XdrPointer() interface{} { return v } -func (SurveyMessageResponseType) XdrTypeName() string { return "SurveyMessageResponseType" } -func (v SurveyMessageResponseType) XdrValue() interface{} { return v } -func (v *SurveyMessageResponseType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_SurveyMessageResponseType = *SurveyMessageResponseType - -func XDR_SurveyMessageResponseType(v *SurveyMessageResponseType) *SurveyMessageResponseType { return v } +func (v *_XdrVec_unbounded_SCPHistoryEntry) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) +} +func (_XdrVec_unbounded_SCPHistoryEntry) XdrTypeName() string { return "SCPHistoryEntry<>" } +func (v *_XdrVec_unbounded_SCPHistoryEntry) XdrPointer() interface{} { return (*[]SCPHistoryEntry)(v) } +func (v _XdrVec_unbounded_SCPHistoryEntry) XdrValue() interface{} { return ([]SCPHistoryEntry)(v) } +func (v *_XdrVec_unbounded_SCPHistoryEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_TimeSlicedSurveyStartCollectingMessage = *TimeSlicedSurveyStartCollectingMessage +type XdrType_LedgerCloseMetaV0 = *LedgerCloseMetaV0 -func (v *TimeSlicedSurveyStartCollectingMessage) XdrPointer() interface{} { return v } -func (TimeSlicedSurveyStartCollectingMessage) XdrTypeName() string { - return "TimeSlicedSurveyStartCollectingMessage" -} -func (v TimeSlicedSurveyStartCollectingMessage) XdrValue() interface{} { return v } -func (v *TimeSlicedSurveyStartCollectingMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TimeSlicedSurveyStartCollectingMessage) XdrRecurse(x XDR, name string) { +func (v *LedgerCloseMetaV0) XdrPointer() interface{} { return v } +func (LedgerCloseMetaV0) XdrTypeName() string { return "LedgerCloseMetaV0" } +func (v LedgerCloseMetaV0) XdrValue() interface{} { return v } +func (v *LedgerCloseMetaV0) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerCloseMetaV0) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%ssurveyorID", name), XDR_NodeID(&v.SurveyorID)) - x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) - x.Marshal(x.Sprintf("%sledgerNum", name), XDR_Uint32(&v.LedgerNum)) -} -func XDR_TimeSlicedSurveyStartCollectingMessage(v *TimeSlicedSurveyStartCollectingMessage) *TimeSlicedSurveyStartCollectingMessage { - return v + x.Marshal(x.Sprintf("%sledgerHeader", name), XDR_LedgerHeaderHistoryEntry(&v.LedgerHeader)) + x.Marshal(x.Sprintf("%stxSet", name), XDR_TransactionSet(&v.TxSet)) + x.Marshal(x.Sprintf("%stxProcessing", name), (*_XdrVec_unbounded_TransactionResultMeta)(&v.TxProcessing)) + x.Marshal(x.Sprintf("%supgradesProcessing", name), (*_XdrVec_unbounded_UpgradeEntryMeta)(&v.UpgradesProcessing)) + x.Marshal(x.Sprintf("%sscpInfo", name), (*_XdrVec_unbounded_SCPHistoryEntry)(&v.ScpInfo)) } +func XDR_LedgerCloseMetaV0(v *LedgerCloseMetaV0) *LedgerCloseMetaV0 { return v } -type XdrType_SignedTimeSlicedSurveyStartCollectingMessage = *SignedTimeSlicedSurveyStartCollectingMessage +type XdrType_LedgerCloseMetaExtV1 = *LedgerCloseMetaExtV1 -func (v *SignedTimeSlicedSurveyStartCollectingMessage) XdrPointer() interface{} { return v } -func (SignedTimeSlicedSurveyStartCollectingMessage) XdrTypeName() string { - return "SignedTimeSlicedSurveyStartCollectingMessage" -} -func (v SignedTimeSlicedSurveyStartCollectingMessage) XdrValue() interface{} { return v } -func (v *SignedTimeSlicedSurveyStartCollectingMessage) XdrMarshal(x XDR, name string) { - x.Marshal(name, v) -} -func (v *SignedTimeSlicedSurveyStartCollectingMessage) XdrRecurse(x XDR, name string) { +func (v *LedgerCloseMetaExtV1) XdrPointer() interface{} { return v } +func (LedgerCloseMetaExtV1) XdrTypeName() string { return "LedgerCloseMetaExtV1" } +func (v LedgerCloseMetaExtV1) XdrValue() interface{} { return v } +func (v *LedgerCloseMetaExtV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerCloseMetaExtV1) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%ssignature", name), XDR_Signature(&v.Signature)) - x.Marshal(x.Sprintf("%sstartCollecting", name), XDR_TimeSlicedSurveyStartCollectingMessage(&v.StartCollecting)) -} -func XDR_SignedTimeSlicedSurveyStartCollectingMessage(v *SignedTimeSlicedSurveyStartCollectingMessage) *SignedTimeSlicedSurveyStartCollectingMessage { - return v + x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%ssorobanFeeWrite1KB", name), XDR_Int64(&v.SorobanFeeWrite1KB)) } +func XDR_LedgerCloseMetaExtV1(v *LedgerCloseMetaExtV1) *LedgerCloseMetaExtV1 { return v } -type XdrType_TimeSlicedSurveyStopCollectingMessage = *TimeSlicedSurveyStopCollectingMessage +var _XdrTags_LedgerCloseMetaExt = map[int32]bool{ + XdrToI32(0): true, + XdrToI32(1): true, +} -func (v *TimeSlicedSurveyStopCollectingMessage) XdrPointer() interface{} { return v } -func (TimeSlicedSurveyStopCollectingMessage) XdrTypeName() string { - return "TimeSlicedSurveyStopCollectingMessage" +func (_ LedgerCloseMetaExt) XdrValidTags() map[int32]bool { + return _XdrTags_LedgerCloseMetaExt } -func (v TimeSlicedSurveyStopCollectingMessage) XdrValue() interface{} { return v } -func (v *TimeSlicedSurveyStopCollectingMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TimeSlicedSurveyStopCollectingMessage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (u *LedgerCloseMetaExt) V1() *LedgerCloseMetaExtV1 { + switch u.V { + case 1: + if v, ok := u._u.(*LedgerCloseMetaExtV1); ok { + return v + } else { + var zero LedgerCloseMetaExtV1 + u._u = &zero + return &zero + } + default: + XdrPanic("LedgerCloseMetaExt.V1 accessed when V == %v", u.V) + return nil } - x.Marshal(x.Sprintf("%ssurveyorID", name), XDR_NodeID(&v.SurveyorID)) - x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) - x.Marshal(x.Sprintf("%sledgerNum", name), XDR_Uint32(&v.LedgerNum)) } -func XDR_TimeSlicedSurveyStopCollectingMessage(v *TimeSlicedSurveyStopCollectingMessage) *TimeSlicedSurveyStopCollectingMessage { - return v +func (u LedgerCloseMetaExt) XdrValid() bool { + switch u.V { + case 0, 1: + return true + } + return false } - -type XdrType_SignedTimeSlicedSurveyStopCollectingMessage = *SignedTimeSlicedSurveyStopCollectingMessage - -func (v *SignedTimeSlicedSurveyStopCollectingMessage) XdrPointer() interface{} { return v } -func (SignedTimeSlicedSurveyStopCollectingMessage) XdrTypeName() string { - return "SignedTimeSlicedSurveyStopCollectingMessage" +func (u *LedgerCloseMetaExt) XdrUnionTag() XdrNum32 { + return XDR_int32(&u.V) } -func (v SignedTimeSlicedSurveyStopCollectingMessage) XdrValue() interface{} { return v } -func (v *SignedTimeSlicedSurveyStopCollectingMessage) XdrMarshal(x XDR, name string) { - x.Marshal(name, v) +func (u *LedgerCloseMetaExt) XdrUnionTagName() string { + return "V" } -func (v *SignedTimeSlicedSurveyStopCollectingMessage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (u *LedgerCloseMetaExt) XdrUnionBody() XdrType { + switch u.V { + case 0: + return nil + case 1: + return XDR_LedgerCloseMetaExtV1(u.V1()) } - x.Marshal(x.Sprintf("%ssignature", name), XDR_Signature(&v.Signature)) - x.Marshal(x.Sprintf("%sstopCollecting", name), XDR_TimeSlicedSurveyStopCollectingMessage(&v.StopCollecting)) + return nil } -func XDR_SignedTimeSlicedSurveyStopCollectingMessage(v *SignedTimeSlicedSurveyStopCollectingMessage) *SignedTimeSlicedSurveyStopCollectingMessage { - return v +func (u *LedgerCloseMetaExt) XdrUnionBodyName() string { + switch u.V { + case 0: + return "" + case 1: + return "V1" + } + return "" } -type XdrType_SurveyRequestMessage = *SurveyRequestMessage +type XdrType_LedgerCloseMetaExt = *LedgerCloseMetaExt -func (v *SurveyRequestMessage) XdrPointer() interface{} { return v } -func (SurveyRequestMessage) XdrTypeName() string { return "SurveyRequestMessage" } -func (v SurveyRequestMessage) XdrValue() interface{} { return v } -func (v *SurveyRequestMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SurveyRequestMessage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%ssurveyorPeerID", name), XDR_NodeID(&v.SurveyorPeerID)) - x.Marshal(x.Sprintf("%ssurveyedPeerID", name), XDR_NodeID(&v.SurveyedPeerID)) - x.Marshal(x.Sprintf("%sledgerNum", name), XDR_Uint32(&v.LedgerNum)) - x.Marshal(x.Sprintf("%sencryptionKey", name), XDR_Curve25519Public(&v.EncryptionKey)) - x.Marshal(x.Sprintf("%scommandType", name), XDR_SurveyMessageCommandType(&v.CommandType)) -} -func XDR_SurveyRequestMessage(v *SurveyRequestMessage) *SurveyRequestMessage { return v } - -type XdrType_TimeSlicedSurveyRequestMessage = *TimeSlicedSurveyRequestMessage - -func (v *TimeSlicedSurveyRequestMessage) XdrPointer() interface{} { return v } -func (TimeSlicedSurveyRequestMessage) XdrTypeName() string { return "TimeSlicedSurveyRequestMessage" } -func (v TimeSlicedSurveyRequestMessage) XdrValue() interface{} { return v } -func (v *TimeSlicedSurveyRequestMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TimeSlicedSurveyRequestMessage) XdrRecurse(x XDR, name string) { +func (v *LedgerCloseMetaExt) XdrPointer() interface{} { return v } +func (LedgerCloseMetaExt) XdrTypeName() string { return "LedgerCloseMetaExt" } +func (v LedgerCloseMetaExt) XdrValue() interface{} { return v } +func (v *LedgerCloseMetaExt) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *LedgerCloseMetaExt) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%srequest", name), XDR_SurveyRequestMessage(&v.Request)) - x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) - x.Marshal(x.Sprintf("%sinboundPeersIndex", name), XDR_Uint32(&v.InboundPeersIndex)) - x.Marshal(x.Sprintf("%soutboundPeersIndex", name), XDR_Uint32(&v.OutboundPeersIndex)) -} -func XDR_TimeSlicedSurveyRequestMessage(v *TimeSlicedSurveyRequestMessage) *TimeSlicedSurveyRequestMessage { - return v -} - -type XdrType_SignedSurveyRequestMessage = *SignedSurveyRequestMessage - -func (v *SignedSurveyRequestMessage) XdrPointer() interface{} { return v } -func (SignedSurveyRequestMessage) XdrTypeName() string { return "SignedSurveyRequestMessage" } -func (v SignedSurveyRequestMessage) XdrValue() interface{} { return v } -func (v *SignedSurveyRequestMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SignedSurveyRequestMessage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) + XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + switch u.V { + case 0: + return + case 1: + x.Marshal(x.Sprintf("%sv1", name), XDR_LedgerCloseMetaExtV1(u.V1())) + return } - x.Marshal(x.Sprintf("%srequestSignature", name), XDR_Signature(&v.RequestSignature)) - x.Marshal(x.Sprintf("%srequest", name), XDR_SurveyRequestMessage(&v.Request)) -} -func XDR_SignedSurveyRequestMessage(v *SignedSurveyRequestMessage) *SignedSurveyRequestMessage { - return v + XdrPanic("invalid V (%v) in LedgerCloseMetaExt", u.V) } +func XDR_LedgerCloseMetaExt(v *LedgerCloseMetaExt) *LedgerCloseMetaExt { return v } -type XdrType_SignedTimeSlicedSurveyRequestMessage = *SignedTimeSlicedSurveyRequestMessage +type _XdrVec_unbounded_LedgerKey []LedgerKey -func (v *SignedTimeSlicedSurveyRequestMessage) XdrPointer() interface{} { return v } -func (SignedTimeSlicedSurveyRequestMessage) XdrTypeName() string { - return "SignedTimeSlicedSurveyRequestMessage" +func (_XdrVec_unbounded_LedgerKey) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound } -func (v SignedTimeSlicedSurveyRequestMessage) XdrValue() interface{} { return v } -func (v *SignedTimeSlicedSurveyRequestMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SignedTimeSlicedSurveyRequestMessage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (_XdrVec_unbounded_LedgerKey) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_LedgerKey length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_LedgerKey length %d exceeds max int", length) } - x.Marshal(x.Sprintf("%srequestSignature", name), XDR_Signature(&v.RequestSignature)) - x.Marshal(x.Sprintf("%srequest", name), XDR_TimeSlicedSurveyRequestMessage(&v.Request)) -} -func XDR_SignedTimeSlicedSurveyRequestMessage(v *SignedTimeSlicedSurveyRequestMessage) *SignedTimeSlicedSurveyRequestMessage { - return v -} - -type XdrType_EncryptedBody struct { - XdrVecOpaque -} - -func XDR_EncryptedBody(v *EncryptedBody) XdrType_EncryptedBody { - return XdrType_EncryptedBody{XdrVecOpaque{v, 64000}} } -func (XdrType_EncryptedBody) XdrTypeName() string { return "EncryptedBody" } -func (v XdrType_EncryptedBody) XdrUnwrap() XdrType { return v.XdrVecOpaque } - -type XdrType_SurveyResponseMessage = *SurveyResponseMessage - -func (v *SurveyResponseMessage) XdrPointer() interface{} { return v } -func (SurveyResponseMessage) XdrTypeName() string { return "SurveyResponseMessage" } -func (v SurveyResponseMessage) XdrValue() interface{} { return v } -func (v *SurveyResponseMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SurveyResponseMessage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (v _XdrVec_unbounded_LedgerKey) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_LedgerKey) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] + } + return } - x.Marshal(x.Sprintf("%ssurveyorPeerID", name), XDR_NodeID(&v.SurveyorPeerID)) - x.Marshal(x.Sprintf("%ssurveyedPeerID", name), XDR_NodeID(&v.SurveyedPeerID)) - x.Marshal(x.Sprintf("%sledgerNum", name), XDR_Uint32(&v.LedgerNum)) - x.Marshal(x.Sprintf("%scommandType", name), XDR_SurveyMessageCommandType(&v.CommandType)) - x.Marshal(x.Sprintf("%sencryptedBody", name), XDR_EncryptedBody(&v.EncryptedBody)) -} -func XDR_SurveyResponseMessage(v *SurveyResponseMessage) *SurveyResponseMessage { return v } - -type XdrType_TimeSlicedSurveyResponseMessage = *TimeSlicedSurveyResponseMessage - -func (v *TimeSlicedSurveyResponseMessage) XdrPointer() interface{} { return v } -func (TimeSlicedSurveyResponseMessage) XdrTypeName() string { return "TimeSlicedSurveyResponseMessage" } -func (v TimeSlicedSurveyResponseMessage) XdrValue() interface{} { return v } -func (v *TimeSlicedSurveyResponseMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TimeSlicedSurveyResponseMessage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) } - x.Marshal(x.Sprintf("%sresponse", name), XDR_SurveyResponseMessage(&v.Response)) - x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) -} -func XDR_TimeSlicedSurveyResponseMessage(v *TimeSlicedSurveyResponseMessage) *TimeSlicedSurveyResponseMessage { - return v + nv := make([]LedgerKey, int(length), newcap) + copy(nv, *v) + *v = nv } - -type XdrType_SignedSurveyResponseMessage = *SignedSurveyResponseMessage - -func (v *SignedSurveyResponseMessage) XdrPointer() interface{} { return v } -func (SignedSurveyResponseMessage) XdrTypeName() string { return "SignedSurveyResponseMessage" } -func (v SignedSurveyResponseMessage) XdrValue() interface{} { return v } -func (v *SignedSurveyResponseMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SignedSurveyResponseMessage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (v *_XdrVec_unbounded_LedgerKey) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_LedgerKey(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } - x.Marshal(x.Sprintf("%sresponseSignature", name), XDR_Signature(&v.ResponseSignature)) - x.Marshal(x.Sprintf("%sresponse", name), XDR_SurveyResponseMessage(&v.Response)) -} -func XDR_SignedSurveyResponseMessage(v *SignedSurveyResponseMessage) *SignedSurveyResponseMessage { - return v -} - -type XdrType_SignedTimeSlicedSurveyResponseMessage = *SignedTimeSlicedSurveyResponseMessage - -func (v *SignedTimeSlicedSurveyResponseMessage) XdrPointer() interface{} { return v } -func (SignedTimeSlicedSurveyResponseMessage) XdrTypeName() string { - return "SignedTimeSlicedSurveyResponseMessage" -} -func (v SignedTimeSlicedSurveyResponseMessage) XdrValue() interface{} { return v } -func (v *SignedTimeSlicedSurveyResponseMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SignedTimeSlicedSurveyResponseMessage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) + if int(n) < len(*v) { + *v = (*v)[:int(n)] } - x.Marshal(x.Sprintf("%sresponseSignature", name), XDR_Signature(&v.ResponseSignature)) - x.Marshal(x.Sprintf("%sresponse", name), XDR_TimeSlicedSurveyResponseMessage(&v.Response)) -} -func XDR_SignedTimeSlicedSurveyResponseMessage(v *SignedTimeSlicedSurveyResponseMessage) *SignedTimeSlicedSurveyResponseMessage { - return v } - -type XdrType_PeerStats = *PeerStats - -func (v *PeerStats) XdrPointer() interface{} { return v } -func (PeerStats) XdrTypeName() string { return "PeerStats" } -func (v PeerStats) XdrValue() interface{} { return v } -func (v *PeerStats) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *PeerStats) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sid", name), XDR_NodeID(&v.Id)) - x.Marshal(x.Sprintf("%sversionStr", name), XdrString{&v.VersionStr, 100}) - x.Marshal(x.Sprintf("%smessagesRead", name), XDR_Uint64(&v.MessagesRead)) - x.Marshal(x.Sprintf("%smessagesWritten", name), XDR_Uint64(&v.MessagesWritten)) - x.Marshal(x.Sprintf("%sbytesRead", name), XDR_Uint64(&v.BytesRead)) - x.Marshal(x.Sprintf("%sbytesWritten", name), XDR_Uint64(&v.BytesWritten)) - x.Marshal(x.Sprintf("%ssecondsConnected", name), XDR_Uint64(&v.SecondsConnected)) - x.Marshal(x.Sprintf("%suniqueFloodBytesRecv", name), XDR_Uint64(&v.UniqueFloodBytesRecv)) - x.Marshal(x.Sprintf("%sduplicateFloodBytesRecv", name), XDR_Uint64(&v.DuplicateFloodBytesRecv)) - x.Marshal(x.Sprintf("%suniqueFetchBytesRecv", name), XDR_Uint64(&v.UniqueFetchBytesRecv)) - x.Marshal(x.Sprintf("%sduplicateFetchBytesRecv", name), XDR_Uint64(&v.DuplicateFetchBytesRecv)) - x.Marshal(x.Sprintf("%suniqueFloodMessageRecv", name), XDR_Uint64(&v.UniqueFloodMessageRecv)) - x.Marshal(x.Sprintf("%sduplicateFloodMessageRecv", name), XDR_Uint64(&v.DuplicateFloodMessageRecv)) - x.Marshal(x.Sprintf("%suniqueFetchMessageRecv", name), XDR_Uint64(&v.UniqueFetchMessageRecv)) - x.Marshal(x.Sprintf("%sduplicateFetchMessageRecv", name), XDR_Uint64(&v.DuplicateFetchMessageRecv)) +func (v *_XdrVec_unbounded_LedgerKey) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } -func XDR_PeerStats(v *PeerStats) *PeerStats { return v } +func (_XdrVec_unbounded_LedgerKey) XdrTypeName() string { return "LedgerKey<>" } +func (v *_XdrVec_unbounded_LedgerKey) XdrPointer() interface{} { return (*[]LedgerKey)(v) } +func (v _XdrVec_unbounded_LedgerKey) XdrValue() interface{} { return ([]LedgerKey)(v) } +func (v *_XdrVec_unbounded_LedgerKey) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type _XdrVec_25_PeerStats []PeerStats +type _XdrVec_unbounded_LedgerEntry []LedgerEntry -func (_XdrVec_25_PeerStats) XdrBound() uint32 { - const bound uint32 = 25 // Force error if not const or doesn't fit +func (_XdrVec_unbounded_LedgerEntry) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit return bound } -func (_XdrVec_25_PeerStats) XdrCheckLen(length uint32) { - if length > uint32(25) { - XdrPanic("_XdrVec_25_PeerStats length %d exceeds bound 25", length) +func (_XdrVec_unbounded_LedgerEntry) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_LedgerEntry length %d exceeds bound 4294967295", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_25_PeerStats length %d exceeds max int", length) + XdrPanic("_XdrVec_unbounded_LedgerEntry length %d exceeds max int", length) } } -func (v _XdrVec_25_PeerStats) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_25_PeerStats) SetVecLen(length uint32) { +func (v _XdrVec_unbounded_LedgerEntry) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_LedgerEntry) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -13937,1492 +13675,1074 @@ func (v *_XdrVec_25_PeerStats) SetVecLen(length uint32) { newcap := 2 * cap(*v) if newcap < int(length) { // also catches overflow where 2*cap < 0 newcap = int(length) - } else if bound := uint(25); uint(newcap) > bound { + } else if bound := uint(4294967295); uint(newcap) > bound { if int(bound) < 0 { bound = ^uint(0) >> 1 } newcap = int(bound) } - nv := make([]PeerStats, int(length), newcap) + nv := make([]LedgerEntry, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_25_PeerStats) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_unbounded_LedgerEntry) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_PeerStats(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_LedgerEntry(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_25_PeerStats) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 25} +func (v *_XdrVec_unbounded_LedgerEntry) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_25_PeerStats) XdrTypeName() string { return "PeerStats<>" } -func (v *_XdrVec_25_PeerStats) XdrPointer() interface{} { return (*[]PeerStats)(v) } -func (v _XdrVec_25_PeerStats) XdrValue() interface{} { return ([]PeerStats)(v) } -func (v *_XdrVec_25_PeerStats) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_PeerStatList struct { - *_XdrVec_25_PeerStats -} - -func XDR_PeerStatList(v *PeerStatList) XdrType_PeerStatList { - return XdrType_PeerStatList{(*_XdrVec_25_PeerStats)(v)} -} -func (XdrType_PeerStatList) XdrTypeName() string { return "PeerStatList" } -func (v XdrType_PeerStatList) XdrUnwrap() XdrType { return v._XdrVec_25_PeerStats } - -type XdrType_TimeSlicedNodeData = *TimeSlicedNodeData - -func (v *TimeSlicedNodeData) XdrPointer() interface{} { return v } -func (TimeSlicedNodeData) XdrTypeName() string { return "TimeSlicedNodeData" } -func (v TimeSlicedNodeData) XdrValue() interface{} { return v } -func (v *TimeSlicedNodeData) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TimeSlicedNodeData) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%saddedAuthenticatedPeers", name), XDR_Uint32(&v.AddedAuthenticatedPeers)) - x.Marshal(x.Sprintf("%sdroppedAuthenticatedPeers", name), XDR_Uint32(&v.DroppedAuthenticatedPeers)) - x.Marshal(x.Sprintf("%stotalInboundPeerCount", name), XDR_Uint32(&v.TotalInboundPeerCount)) - x.Marshal(x.Sprintf("%stotalOutboundPeerCount", name), XDR_Uint32(&v.TotalOutboundPeerCount)) - x.Marshal(x.Sprintf("%sp75SCPFirstToSelfLatencyMs", name), XDR_Uint32(&v.P75SCPFirstToSelfLatencyMs)) - x.Marshal(x.Sprintf("%sp75SCPSelfToOtherLatencyMs", name), XDR_Uint32(&v.P75SCPSelfToOtherLatencyMs)) - x.Marshal(x.Sprintf("%slostSyncCount", name), XDR_Uint32(&v.LostSyncCount)) - x.Marshal(x.Sprintf("%sisValidator", name), XDR_bool(&v.IsValidator)) - x.Marshal(x.Sprintf("%smaxInboundPeerCount", name), XDR_Uint32(&v.MaxInboundPeerCount)) - x.Marshal(x.Sprintf("%smaxOutboundPeerCount", name), XDR_Uint32(&v.MaxOutboundPeerCount)) -} -func XDR_TimeSlicedNodeData(v *TimeSlicedNodeData) *TimeSlicedNodeData { return v } - -type XdrType_TimeSlicedPeerData = *TimeSlicedPeerData - -func (v *TimeSlicedPeerData) XdrPointer() interface{} { return v } -func (TimeSlicedPeerData) XdrTypeName() string { return "TimeSlicedPeerData" } -func (v TimeSlicedPeerData) XdrValue() interface{} { return v } -func (v *TimeSlicedPeerData) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TimeSlicedPeerData) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%speerStats", name), XDR_PeerStats(&v.PeerStats)) - x.Marshal(x.Sprintf("%saverageLatencyMs", name), XDR_Uint32(&v.AverageLatencyMs)) -} -func XDR_TimeSlicedPeerData(v *TimeSlicedPeerData) *TimeSlicedPeerData { return v } - -type _XdrVec_25_TimeSlicedPeerData []TimeSlicedPeerData - -func (_XdrVec_25_TimeSlicedPeerData) XdrBound() uint32 { - const bound uint32 = 25 // Force error if not const or doesn't fit - return bound -} -func (_XdrVec_25_TimeSlicedPeerData) XdrCheckLen(length uint32) { - if length > uint32(25) { - XdrPanic("_XdrVec_25_TimeSlicedPeerData length %d exceeds bound 25", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_25_TimeSlicedPeerData length %d exceeds max int", length) - } -} -func (v _XdrVec_25_TimeSlicedPeerData) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_25_TimeSlicedPeerData) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(25); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) - } - nv := make([]TimeSlicedPeerData, int(length), newcap) - copy(nv, *v) - *v = nv -} -func (v *_XdrVec_25_TimeSlicedPeerData) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) - } - XDR_TimeSlicedPeerData(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] - } -} -func (v *_XdrVec_25_TimeSlicedPeerData) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 25} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) -} -func (_XdrVec_25_TimeSlicedPeerData) XdrTypeName() string { return "TimeSlicedPeerData<>" } -func (v *_XdrVec_25_TimeSlicedPeerData) XdrPointer() interface{} { return (*[]TimeSlicedPeerData)(v) } -func (v _XdrVec_25_TimeSlicedPeerData) XdrValue() interface{} { return ([]TimeSlicedPeerData)(v) } -func (v *_XdrVec_25_TimeSlicedPeerData) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_TimeSlicedPeerDataList struct { - *_XdrVec_25_TimeSlicedPeerData -} - -func XDR_TimeSlicedPeerDataList(v *TimeSlicedPeerDataList) XdrType_TimeSlicedPeerDataList { - return XdrType_TimeSlicedPeerDataList{(*_XdrVec_25_TimeSlicedPeerData)(v)} -} -func (XdrType_TimeSlicedPeerDataList) XdrTypeName() string { return "TimeSlicedPeerDataList" } -func (v XdrType_TimeSlicedPeerDataList) XdrUnwrap() XdrType { return v._XdrVec_25_TimeSlicedPeerData } - -type XdrType_TopologyResponseBodyV0 = *TopologyResponseBodyV0 - -func (v *TopologyResponseBodyV0) XdrPointer() interface{} { return v } -func (TopologyResponseBodyV0) XdrTypeName() string { return "TopologyResponseBodyV0" } -func (v TopologyResponseBodyV0) XdrValue() interface{} { return v } -func (v *TopologyResponseBodyV0) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TopologyResponseBodyV0) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sinboundPeers", name), XDR_PeerStatList(&v.InboundPeers)) - x.Marshal(x.Sprintf("%soutboundPeers", name), XDR_PeerStatList(&v.OutboundPeers)) - x.Marshal(x.Sprintf("%stotalInboundPeerCount", name), XDR_Uint32(&v.TotalInboundPeerCount)) - x.Marshal(x.Sprintf("%stotalOutboundPeerCount", name), XDR_Uint32(&v.TotalOutboundPeerCount)) -} -func XDR_TopologyResponseBodyV0(v *TopologyResponseBodyV0) *TopologyResponseBodyV0 { return v } - -type XdrType_TopologyResponseBodyV1 = *TopologyResponseBodyV1 - -func (v *TopologyResponseBodyV1) XdrPointer() interface{} { return v } -func (TopologyResponseBodyV1) XdrTypeName() string { return "TopologyResponseBodyV1" } -func (v TopologyResponseBodyV1) XdrValue() interface{} { return v } -func (v *TopologyResponseBodyV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TopologyResponseBodyV1) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sinboundPeers", name), XDR_PeerStatList(&v.InboundPeers)) - x.Marshal(x.Sprintf("%soutboundPeers", name), XDR_PeerStatList(&v.OutboundPeers)) - x.Marshal(x.Sprintf("%stotalInboundPeerCount", name), XDR_Uint32(&v.TotalInboundPeerCount)) - x.Marshal(x.Sprintf("%stotalOutboundPeerCount", name), XDR_Uint32(&v.TotalOutboundPeerCount)) - x.Marshal(x.Sprintf("%smaxInboundPeerCount", name), XDR_Uint32(&v.MaxInboundPeerCount)) - x.Marshal(x.Sprintf("%smaxOutboundPeerCount", name), XDR_Uint32(&v.MaxOutboundPeerCount)) -} -func XDR_TopologyResponseBodyV1(v *TopologyResponseBodyV1) *TopologyResponseBodyV1 { return v } +func (_XdrVec_unbounded_LedgerEntry) XdrTypeName() string { return "LedgerEntry<>" } +func (v *_XdrVec_unbounded_LedgerEntry) XdrPointer() interface{} { return (*[]LedgerEntry)(v) } +func (v _XdrVec_unbounded_LedgerEntry) XdrValue() interface{} { return ([]LedgerEntry)(v) } +func (v *_XdrVec_unbounded_LedgerEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_TopologyResponseBodyV2 = *TopologyResponseBodyV2 +type XdrType_LedgerCloseMetaV1 = *LedgerCloseMetaV1 -func (v *TopologyResponseBodyV2) XdrPointer() interface{} { return v } -func (TopologyResponseBodyV2) XdrTypeName() string { return "TopologyResponseBodyV2" } -func (v TopologyResponseBodyV2) XdrValue() interface{} { return v } -func (v *TopologyResponseBodyV2) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TopologyResponseBodyV2) XdrRecurse(x XDR, name string) { +func (v *LedgerCloseMetaV1) XdrPointer() interface{} { return v } +func (LedgerCloseMetaV1) XdrTypeName() string { return "LedgerCloseMetaV1" } +func (v LedgerCloseMetaV1) XdrValue() interface{} { return v } +func (v *LedgerCloseMetaV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerCloseMetaV1) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sinboundPeers", name), XDR_TimeSlicedPeerDataList(&v.InboundPeers)) - x.Marshal(x.Sprintf("%soutboundPeers", name), XDR_TimeSlicedPeerDataList(&v.OutboundPeers)) - x.Marshal(x.Sprintf("%snodeData", name), XDR_TimeSlicedNodeData(&v.NodeData)) + x.Marshal(x.Sprintf("%sext", name), XDR_LedgerCloseMetaExt(&v.Ext)) + x.Marshal(x.Sprintf("%sledgerHeader", name), XDR_LedgerHeaderHistoryEntry(&v.LedgerHeader)) + x.Marshal(x.Sprintf("%stxSet", name), XDR_GeneralizedTransactionSet(&v.TxSet)) + x.Marshal(x.Sprintf("%stxProcessing", name), (*_XdrVec_unbounded_TransactionResultMeta)(&v.TxProcessing)) + x.Marshal(x.Sprintf("%supgradesProcessing", name), (*_XdrVec_unbounded_UpgradeEntryMeta)(&v.UpgradesProcessing)) + x.Marshal(x.Sprintf("%sscpInfo", name), (*_XdrVec_unbounded_SCPHistoryEntry)(&v.ScpInfo)) + x.Marshal(x.Sprintf("%stotalByteSizeOfBucketList", name), XDR_Uint64(&v.TotalByteSizeOfBucketList)) + x.Marshal(x.Sprintf("%sevictedTemporaryLedgerKeys", name), (*_XdrVec_unbounded_LedgerKey)(&v.EvictedTemporaryLedgerKeys)) + x.Marshal(x.Sprintf("%sevictedPersistentLedgerEntries", name), (*_XdrVec_unbounded_LedgerEntry)(&v.EvictedPersistentLedgerEntries)) } -func XDR_TopologyResponseBodyV2(v *TopologyResponseBodyV2) *TopologyResponseBodyV2 { return v } +func XDR_LedgerCloseMetaV1(v *LedgerCloseMetaV1) *LedgerCloseMetaV1 { return v } -var _XdrTags_SurveyResponseBody = map[int32]bool{ - XdrToI32(SURVEY_TOPOLOGY_RESPONSE_V0): true, - XdrToI32(SURVEY_TOPOLOGY_RESPONSE_V1): true, - XdrToI32(SURVEY_TOPOLOGY_RESPONSE_V2): true, +var _XdrTags_LedgerCloseMeta = map[int32]bool{ + XdrToI32(0): true, + XdrToI32(1): true, } -func (_ SurveyResponseBody) XdrValidTags() map[int32]bool { - return _XdrTags_SurveyResponseBody -} -func (u *SurveyResponseBody) TopologyResponseBodyV0() *TopologyResponseBodyV0 { - switch u.Type { - case SURVEY_TOPOLOGY_RESPONSE_V0: - if v, ok := u._u.(*TopologyResponseBodyV0); ok { - return v - } else { - var zero TopologyResponseBodyV0 - u._u = &zero - return &zero - } - default: - XdrPanic("SurveyResponseBody.TopologyResponseBodyV0 accessed when Type == %v", u.Type) - return nil - } +func (_ LedgerCloseMeta) XdrValidTags() map[int32]bool { + return _XdrTags_LedgerCloseMeta } -func (u *SurveyResponseBody) TopologyResponseBodyV1() *TopologyResponseBodyV1 { - switch u.Type { - case SURVEY_TOPOLOGY_RESPONSE_V1: - if v, ok := u._u.(*TopologyResponseBodyV1); ok { +func (u *LedgerCloseMeta) V0() *LedgerCloseMetaV0 { + switch u.V { + case 0: + if v, ok := u._u.(*LedgerCloseMetaV0); ok { return v } else { - var zero TopologyResponseBodyV1 + var zero LedgerCloseMetaV0 u._u = &zero return &zero } default: - XdrPanic("SurveyResponseBody.TopologyResponseBodyV1 accessed when Type == %v", u.Type) + XdrPanic("LedgerCloseMeta.V0 accessed when V == %v", u.V) return nil } } -func (u *SurveyResponseBody) TopologyResponseBodyV2() *TopologyResponseBodyV2 { - switch u.Type { - case SURVEY_TOPOLOGY_RESPONSE_V2: - if v, ok := u._u.(*TopologyResponseBodyV2); ok { +func (u *LedgerCloseMeta) V1() *LedgerCloseMetaV1 { + switch u.V { + case 1: + if v, ok := u._u.(*LedgerCloseMetaV1); ok { return v } else { - var zero TopologyResponseBodyV2 + var zero LedgerCloseMetaV1 u._u = &zero return &zero } default: - XdrPanic("SurveyResponseBody.TopologyResponseBodyV2 accessed when Type == %v", u.Type) + XdrPanic("LedgerCloseMeta.V1 accessed when V == %v", u.V) return nil } } -func (u SurveyResponseBody) XdrValid() bool { - switch u.Type { - case SURVEY_TOPOLOGY_RESPONSE_V0, SURVEY_TOPOLOGY_RESPONSE_V1, SURVEY_TOPOLOGY_RESPONSE_V2: +func (u LedgerCloseMeta) XdrValid() bool { + switch u.V { + case 0, 1: return true } return false } -func (u *SurveyResponseBody) XdrUnionTag() XdrNum32 { - return XDR_SurveyMessageResponseType(&u.Type) +func (u *LedgerCloseMeta) XdrUnionTag() XdrNum32 { + return XDR_int32(&u.V) } -func (u *SurveyResponseBody) XdrUnionTagName() string { - return "Type" +func (u *LedgerCloseMeta) XdrUnionTagName() string { + return "V" } -func (u *SurveyResponseBody) XdrUnionBody() XdrType { - switch u.Type { - case SURVEY_TOPOLOGY_RESPONSE_V0: - return XDR_TopologyResponseBodyV0(u.TopologyResponseBodyV0()) - case SURVEY_TOPOLOGY_RESPONSE_V1: - return XDR_TopologyResponseBodyV1(u.TopologyResponseBodyV1()) - case SURVEY_TOPOLOGY_RESPONSE_V2: - return XDR_TopologyResponseBodyV2(u.TopologyResponseBodyV2()) +func (u *LedgerCloseMeta) XdrUnionBody() XdrType { + switch u.V { + case 0: + return XDR_LedgerCloseMetaV0(u.V0()) + case 1: + return XDR_LedgerCloseMetaV1(u.V1()) } return nil } -func (u *SurveyResponseBody) XdrUnionBodyName() string { - switch u.Type { - case SURVEY_TOPOLOGY_RESPONSE_V0: - return "TopologyResponseBodyV0" - case SURVEY_TOPOLOGY_RESPONSE_V1: - return "TopologyResponseBodyV1" - case SURVEY_TOPOLOGY_RESPONSE_V2: - return "TopologyResponseBodyV2" +func (u *LedgerCloseMeta) XdrUnionBodyName() string { + switch u.V { + case 0: + return "V0" + case 1: + return "V1" } return "" } -type XdrType_SurveyResponseBody = *SurveyResponseBody +type XdrType_LedgerCloseMeta = *LedgerCloseMeta -func (v *SurveyResponseBody) XdrPointer() interface{} { return v } -func (SurveyResponseBody) XdrTypeName() string { return "SurveyResponseBody" } -func (v SurveyResponseBody) XdrValue() interface{} { return v } -func (v *SurveyResponseBody) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *SurveyResponseBody) XdrRecurse(x XDR, name string) { +func (v *LedgerCloseMeta) XdrPointer() interface{} { return v } +func (LedgerCloseMeta) XdrTypeName() string { return "LedgerCloseMeta" } +func (v LedgerCloseMeta) XdrValue() interface{} { return v } +func (v *LedgerCloseMeta) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *LedgerCloseMeta) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_SurveyMessageResponseType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case SURVEY_TOPOLOGY_RESPONSE_V0: - x.Marshal(x.Sprintf("%stopologyResponseBodyV0", name), XDR_TopologyResponseBodyV0(u.TopologyResponseBodyV0())) - return - case SURVEY_TOPOLOGY_RESPONSE_V1: - x.Marshal(x.Sprintf("%stopologyResponseBodyV1", name), XDR_TopologyResponseBodyV1(u.TopologyResponseBodyV1())) + XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + switch u.V { + case 0: + x.Marshal(x.Sprintf("%sv0", name), XDR_LedgerCloseMetaV0(u.V0())) return - case SURVEY_TOPOLOGY_RESPONSE_V2: - x.Marshal(x.Sprintf("%stopologyResponseBodyV2", name), XDR_TopologyResponseBodyV2(u.TopologyResponseBodyV2())) + case 1: + x.Marshal(x.Sprintf("%sv1", name), XDR_LedgerCloseMetaV1(u.V1())) return } - XdrPanic("invalid Type (%v) in SurveyResponseBody", u.Type) + XdrPanic("invalid V (%v) in LedgerCloseMeta", u.V) } -func XDR_SurveyResponseBody(v *SurveyResponseBody) *SurveyResponseBody { return v } - -type _XdrVec_1000_Hash []Hash +func XDR_LedgerCloseMeta(v *LedgerCloseMeta) *LedgerCloseMeta { return v } -func (_XdrVec_1000_Hash) XdrBound() uint32 { - const bound uint32 = 1000 // Force error if not const or doesn't fit - return bound +var _XdrNames_ErrorCode = map[int32]string{ + int32(ERR_MISC): "ERR_MISC", + int32(ERR_DATA): "ERR_DATA", + int32(ERR_CONF): "ERR_CONF", + int32(ERR_AUTH): "ERR_AUTH", + int32(ERR_LOAD): "ERR_LOAD", } -func (_XdrVec_1000_Hash) XdrCheckLen(length uint32) { - if length > uint32(1000) { - XdrPanic("_XdrVec_1000_Hash length %d exceeds bound 1000", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_1000_Hash length %d exceeds max int", length) - } +var _XdrValues_ErrorCode = map[string]int32{ + "ERR_MISC": int32(ERR_MISC), + "ERR_DATA": int32(ERR_DATA), + "ERR_CONF": int32(ERR_CONF), + "ERR_AUTH": int32(ERR_AUTH), + "ERR_LOAD": int32(ERR_LOAD), } -func (v _XdrVec_1000_Hash) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_1000_Hash) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(1000); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) + +func (ErrorCode) XdrEnumNames() map[int32]string { + return _XdrNames_ErrorCode +} +func (v ErrorCode) String() string { + if s, ok := _XdrNames_ErrorCode[int32(v)]; ok { + return s } - nv := make([]Hash, int(length), newcap) - copy(nv, *v) - *v = nv + return fmt.Sprintf("ErrorCode#%d", v) } -func (v *_XdrVec_1000_Hash) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) +func (v *ErrorCode) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_ErrorCode[stok]; ok { + *v = ErrorCode(val) + return nil + } else if stok == "ErrorCode" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } } - XDR_Hash(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] + return XdrError(fmt.Sprintf("%s is not a valid ErrorCode.", stok)) } } -func (v *_XdrVec_1000_Hash) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 1000} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) -} -func (_XdrVec_1000_Hash) XdrTypeName() string { return "Hash<>" } -func (v *_XdrVec_1000_Hash) XdrPointer() interface{} { return (*[]Hash)(v) } -func (v _XdrVec_1000_Hash) XdrValue() interface{} { return ([]Hash)(v) } -func (v *_XdrVec_1000_Hash) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v ErrorCode) GetU32() uint32 { return uint32(v) } +func (v *ErrorCode) SetU32(n uint32) { *v = ErrorCode(n) } +func (v *ErrorCode) XdrPointer() interface{} { return v } +func (ErrorCode) XdrTypeName() string { return "ErrorCode" } +func (v ErrorCode) XdrValue() interface{} { return v } +func (v *ErrorCode) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_TxAdvertVector struct { - *_XdrVec_1000_Hash +type XdrType_ErrorCode = *ErrorCode + +func XDR_ErrorCode(v *ErrorCode) *ErrorCode { return v } + +var _XdrComments_ErrorCode = map[int32]string{ + int32(ERR_MISC): "Unspecific error", + int32(ERR_DATA): "Malformed data", + int32(ERR_CONF): "Misconfiguration error", + int32(ERR_AUTH): "Authentication failure", + int32(ERR_LOAD): "System overloaded", } -func XDR_TxAdvertVector(v *TxAdvertVector) XdrType_TxAdvertVector { - return XdrType_TxAdvertVector{(*_XdrVec_1000_Hash)(v)} +func (e ErrorCode) XdrEnumComments() map[int32]string { + return _XdrComments_ErrorCode } -func (XdrType_TxAdvertVector) XdrTypeName() string { return "TxAdvertVector" } -func (v XdrType_TxAdvertVector) XdrUnwrap() XdrType { return v._XdrVec_1000_Hash } -type XdrType_FloodAdvert = *FloodAdvert +type XdrType_Error = *Error -func (v *FloodAdvert) XdrPointer() interface{} { return v } -func (FloodAdvert) XdrTypeName() string { return "FloodAdvert" } -func (v FloodAdvert) XdrValue() interface{} { return v } -func (v *FloodAdvert) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *FloodAdvert) XdrRecurse(x XDR, name string) { +func (v *Error) XdrPointer() interface{} { return v } +func (Error) XdrTypeName() string { return "Error" } +func (v Error) XdrValue() interface{} { return v } +func (v *Error) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *Error) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%stxHashes", name), XDR_TxAdvertVector(&v.TxHashes)) + x.Marshal(x.Sprintf("%scode", name), XDR_ErrorCode(&v.Code)) + x.Marshal(x.Sprintf("%smsg", name), XdrString{&v.Msg, 100}) } -func XDR_FloodAdvert(v *FloodAdvert) *FloodAdvert { return v } +func XDR_Error(v *Error) *Error { return v } -type XdrType_TxDemandVector struct { - *_XdrVec_1000_Hash +type XdrType_SendMore = *SendMore + +func (v *SendMore) XdrPointer() interface{} { return v } +func (SendMore) XdrTypeName() string { return "SendMore" } +func (v SendMore) XdrValue() interface{} { return v } +func (v *SendMore) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SendMore) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%snumMessages", name), XDR_Uint32(&v.NumMessages)) } +func XDR_SendMore(v *SendMore) *SendMore { return v } -func XDR_TxDemandVector(v *TxDemandVector) XdrType_TxDemandVector { - return XdrType_TxDemandVector{(*_XdrVec_1000_Hash)(v)} +type XdrType_SendMoreExtended = *SendMoreExtended + +func (v *SendMoreExtended) XdrPointer() interface{} { return v } +func (SendMoreExtended) XdrTypeName() string { return "SendMoreExtended" } +func (v SendMoreExtended) XdrValue() interface{} { return v } +func (v *SendMoreExtended) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SendMoreExtended) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%snumMessages", name), XDR_Uint32(&v.NumMessages)) + x.Marshal(x.Sprintf("%snumBytes", name), XDR_Uint32(&v.NumBytes)) } -func (XdrType_TxDemandVector) XdrTypeName() string { return "TxDemandVector" } -func (v XdrType_TxDemandVector) XdrUnwrap() XdrType { return v._XdrVec_1000_Hash } +func XDR_SendMoreExtended(v *SendMoreExtended) *SendMoreExtended { return v } -type XdrType_FloodDemand = *FloodDemand +type XdrType_AuthCert = *AuthCert -func (v *FloodDemand) XdrPointer() interface{} { return v } -func (FloodDemand) XdrTypeName() string { return "FloodDemand" } -func (v FloodDemand) XdrValue() interface{} { return v } -func (v *FloodDemand) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *FloodDemand) XdrRecurse(x XDR, name string) { +func (v *AuthCert) XdrPointer() interface{} { return v } +func (AuthCert) XdrTypeName() string { return "AuthCert" } +func (v AuthCert) XdrValue() interface{} { return v } +func (v *AuthCert) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *AuthCert) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%stxHashes", name), XDR_TxDemandVector(&v.TxHashes)) + x.Marshal(x.Sprintf("%spubkey", name), XDR_Curve25519Public(&v.Pubkey)) + x.Marshal(x.Sprintf("%sexpiration", name), XDR_Uint64(&v.Expiration)) + x.Marshal(x.Sprintf("%ssig", name), XDR_Signature(&v.Sig)) } -func XDR_FloodDemand(v *FloodDemand) *FloodDemand { return v } +func XDR_AuthCert(v *AuthCert) *AuthCert { return v } -type _XdrVec_100_PeerAddress []PeerAddress +type XdrType_Hello = *Hello -func (_XdrVec_100_PeerAddress) XdrBound() uint32 { - const bound uint32 = 100 // Force error if not const or doesn't fit - return bound +func (v *Hello) XdrPointer() interface{} { return v } +func (Hello) XdrTypeName() string { return "Hello" } +func (v Hello) XdrValue() interface{} { return v } +func (v *Hello) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *Hello) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sledgerVersion", name), XDR_Uint32(&v.LedgerVersion)) + x.Marshal(x.Sprintf("%soverlayVersion", name), XDR_Uint32(&v.OverlayVersion)) + x.Marshal(x.Sprintf("%soverlayMinVersion", name), XDR_Uint32(&v.OverlayMinVersion)) + x.Marshal(x.Sprintf("%snetworkID", name), XDR_Hash(&v.NetworkID)) + x.Marshal(x.Sprintf("%sversionStr", name), XdrString{&v.VersionStr, 100}) + x.Marshal(x.Sprintf("%slisteningPort", name), XDR_int32(&v.ListeningPort)) + x.Marshal(x.Sprintf("%speerID", name), XDR_NodeID(&v.PeerID)) + x.Marshal(x.Sprintf("%scert", name), XDR_AuthCert(&v.Cert)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Uint256(&v.Nonce)) } -func (_XdrVec_100_PeerAddress) XdrCheckLen(length uint32) { - if length > uint32(100) { - XdrPanic("_XdrVec_100_PeerAddress length %d exceeds bound 100", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_100_PeerAddress length %d exceeds max int", length) +func XDR_Hello(v *Hello) *Hello { return v } + +type XdrType_Auth = *Auth + +func (v *Auth) XdrPointer() interface{} { return v } +func (Auth) XdrTypeName() string { return "Auth" } +func (v Auth) XdrValue() interface{} { return v } +func (v *Auth) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *Auth) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%sflags", name), XDR_int32(&v.Flags)) } -func (v _XdrVec_100_PeerAddress) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_100_PeerAddress) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(100); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) +func XDR_Auth(v *Auth) *Auth { return v } + +var _XdrNames_IPAddrType = map[int32]string{ + int32(IPv4): "IPv4", + int32(IPv6): "IPv6", +} +var _XdrValues_IPAddrType = map[string]int32{ + "IPv4": int32(IPv4), + "IPv6": int32(IPv6), +} + +func (IPAddrType) XdrEnumNames() map[int32]string { + return _XdrNames_IPAddrType +} +func (v IPAddrType) String() string { + if s, ok := _XdrNames_IPAddrType[int32(v)]; ok { + return s } - nv := make([]PeerAddress, int(length), newcap) - copy(nv, *v) - *v = nv + return fmt.Sprintf("IPAddrType#%d", v) } -func (v *_XdrVec_100_PeerAddress) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) +func (v *IPAddrType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_IPAddrType[stok]; ok { + *v = IPAddrType(val) + return nil + } else if stok == "IPAddrType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } } - XDR_PeerAddress(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] + return XdrError(fmt.Sprintf("%s is not a valid IPAddrType.", stok)) } } -func (v *_XdrVec_100_PeerAddress) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 100} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) +func (v IPAddrType) GetU32() uint32 { return uint32(v) } +func (v *IPAddrType) SetU32(n uint32) { *v = IPAddrType(n) } +func (v *IPAddrType) XdrPointer() interface{} { return v } +func (IPAddrType) XdrTypeName() string { return "IPAddrType" } +func (v IPAddrType) XdrValue() interface{} { return v } +func (v *IPAddrType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_IPAddrType = *IPAddrType + +func XDR_IPAddrType(v *IPAddrType) *IPAddrType { return v } + +type _XdrArray_16_opaque [16]byte + +func (v *_XdrArray_16_opaque) GetByteSlice() []byte { return v[:] } +func (v *_XdrArray_16_opaque) XdrTypeName() string { return "opaque[]" } +func (v *_XdrArray_16_opaque) XdrValue() interface{} { return v[:] } +func (v *_XdrArray_16_opaque) XdrPointer() interface{} { return (*[16]byte)(v) } +func (v *_XdrArray_16_opaque) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *_XdrArray_16_opaque) String() string { return fmt.Sprintf("%x", v[:]) } +func (v *_XdrArray_16_opaque) Scan(ss fmt.ScanState, c rune) error { + return XdrArrayOpaqueScan(v[:], ss, c) +} +func (_XdrArray_16_opaque) XdrArraySize() uint32 { + const bound uint32 = 16 // Force error if not const or doesn't fit + return bound } -func (_XdrVec_100_PeerAddress) XdrTypeName() string { return "PeerAddress<>" } -func (v *_XdrVec_100_PeerAddress) XdrPointer() interface{} { return (*[]PeerAddress)(v) } -func (v _XdrVec_100_PeerAddress) XdrValue() interface{} { return ([]PeerAddress)(v) } -func (v *_XdrVec_100_PeerAddress) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -var _XdrTags_StellarMessage = map[int32]bool{ - XdrToI32(ERROR_MSG): true, - XdrToI32(HELLO): true, - XdrToI32(AUTH): true, - XdrToI32(DONT_HAVE): true, - XdrToI32(GET_PEERS): true, - XdrToI32(PEERS): true, - XdrToI32(GET_TX_SET): true, - XdrToI32(TX_SET): true, - XdrToI32(GENERALIZED_TX_SET): true, - XdrToI32(TRANSACTION): true, - XdrToI32(SURVEY_REQUEST): true, - XdrToI32(SURVEY_RESPONSE): true, - XdrToI32(TIME_SLICED_SURVEY_REQUEST): true, - XdrToI32(TIME_SLICED_SURVEY_RESPONSE): true, - XdrToI32(TIME_SLICED_SURVEY_START_COLLECTING): true, - XdrToI32(TIME_SLICED_SURVEY_STOP_COLLECTING): true, - XdrToI32(GET_SCP_QUORUMSET): true, - XdrToI32(SCP_QUORUMSET): true, - XdrToI32(SCP_MESSAGE): true, - XdrToI32(GET_SCP_STATE): true, - XdrToI32(SEND_MORE): true, - XdrToI32(SEND_MORE_EXTENDED): true, - XdrToI32(FLOOD_ADVERT): true, - XdrToI32(FLOOD_DEMAND): true, +var _XdrTags_XdrAnon_PeerAddress_Ip = map[int32]bool{ + XdrToI32(IPv4): true, + XdrToI32(IPv6): true, } -func (_ StellarMessage) XdrValidTags() map[int32]bool { - return _XdrTags_StellarMessage +func (_ XdrAnon_PeerAddress_Ip) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_PeerAddress_Ip } -func (u *StellarMessage) Error() *Error { +func (u *XdrAnon_PeerAddress_Ip) Ipv4() *[4]byte { switch u.Type { - case ERROR_MSG: - if v, ok := u._u.(*Error); ok { + case IPv4: + if v, ok := u._u.(*[4]byte); ok { return v } else { - var zero Error + var zero [4]byte u._u = &zero return &zero } default: - XdrPanic("StellarMessage.Error accessed when Type == %v", u.Type) + XdrPanic("XdrAnon_PeerAddress_Ip.Ipv4 accessed when Type == %v", u.Type) return nil } } -func (u *StellarMessage) Hello() *Hello { +func (u *XdrAnon_PeerAddress_Ip) Ipv6() *[16]byte { switch u.Type { - case HELLO: - if v, ok := u._u.(*Hello); ok { + case IPv6: + if v, ok := u._u.(*[16]byte); ok { return v } else { - var zero Hello + var zero [16]byte u._u = &zero return &zero } default: - XdrPanic("StellarMessage.Hello accessed when Type == %v", u.Type) + XdrPanic("XdrAnon_PeerAddress_Ip.Ipv6 accessed when Type == %v", u.Type) return nil } } -func (u *StellarMessage) Auth() *Auth { +func (u XdrAnon_PeerAddress_Ip) XdrValid() bool { switch u.Type { - case AUTH: - if v, ok := u._u.(*Auth); ok { - return v - } else { - var zero Auth - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.Auth accessed when Type == %v", u.Type) - return nil + case IPv4, IPv6: + return true } + return false } -func (u *StellarMessage) DontHave() *DontHave { - switch u.Type { - case DONT_HAVE: - if v, ok := u._u.(*DontHave); ok { - return v - } else { - var zero DontHave - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.DontHave accessed when Type == %v", u.Type) - return nil - } +func (u *XdrAnon_PeerAddress_Ip) XdrUnionTag() XdrNum32 { + return XDR_IPAddrType(&u.Type) } -func (u *StellarMessage) Peers() *[]PeerAddress { - switch u.Type { - case PEERS: - if v, ok := u._u.(*[]PeerAddress); ok { - return v - } else { - var zero []PeerAddress - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.Peers accessed when Type == %v", u.Type) - return nil - } +func (u *XdrAnon_PeerAddress_Ip) XdrUnionTagName() string { + return "Type" } -func (u *StellarMessage) TxSetHash() *Uint256 { +func (u *XdrAnon_PeerAddress_Ip) XdrUnionBody() XdrType { switch u.Type { - case GET_TX_SET: - if v, ok := u._u.(*Uint256); ok { - return v - } else { - var zero Uint256 - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.TxSetHash accessed when Type == %v", u.Type) - return nil + case IPv4: + return (*_XdrArray_4_opaque)(u.Ipv4()) + case IPv6: + return (*_XdrArray_16_opaque)(u.Ipv6()) } + return nil } -func (u *StellarMessage) TxSet() *TransactionSet { +func (u *XdrAnon_PeerAddress_Ip) XdrUnionBodyName() string { switch u.Type { - case TX_SET: - if v, ok := u._u.(*TransactionSet); ok { - return v - } else { - var zero TransactionSet - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.TxSet accessed when Type == %v", u.Type) - return nil + case IPv4: + return "Ipv4" + case IPv6: + return "Ipv6" } + return "" } -func (u *StellarMessage) GeneralizedTxSet() *GeneralizedTransactionSet { - switch u.Type { - case GENERALIZED_TX_SET: - if v, ok := u._u.(*GeneralizedTransactionSet); ok { - return v - } else { - var zero GeneralizedTransactionSet - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.GeneralizedTxSet accessed when Type == %v", u.Type) - return nil + +type XdrType_XdrAnon_PeerAddress_Ip = *XdrAnon_PeerAddress_Ip + +func (v *XdrAnon_PeerAddress_Ip) XdrPointer() interface{} { return v } +func (XdrAnon_PeerAddress_Ip) XdrTypeName() string { return "XdrAnon_PeerAddress_Ip" } +func (v XdrAnon_PeerAddress_Ip) XdrValue() interface{} { return v } +func (v *XdrAnon_PeerAddress_Ip) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_PeerAddress_Ip) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } -} -func (u *StellarMessage) Transaction() *TransactionEnvelope { + XDR_IPAddrType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) switch u.Type { - case TRANSACTION: - if v, ok := u._u.(*TransactionEnvelope); ok { - return v - } else { - var zero TransactionEnvelope - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.Transaction accessed when Type == %v", u.Type) - return nil + case IPv4: + x.Marshal(x.Sprintf("%sipv4", name), (*_XdrArray_4_opaque)(u.Ipv4())) + return + case IPv6: + x.Marshal(x.Sprintf("%sipv6", name), (*_XdrArray_16_opaque)(u.Ipv6())) + return } + XdrPanic("invalid Type (%v) in XdrAnon_PeerAddress_Ip", u.Type) } -func (u *StellarMessage) SignedSurveyRequestMessage() *SignedSurveyRequestMessage { - switch u.Type { - case SURVEY_REQUEST: - if v, ok := u._u.(*SignedSurveyRequestMessage); ok { - return v - } else { - var zero SignedSurveyRequestMessage - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.SignedSurveyRequestMessage accessed when Type == %v", u.Type) - return nil +func XDR_XdrAnon_PeerAddress_Ip(v *XdrAnon_PeerAddress_Ip) *XdrAnon_PeerAddress_Ip { return v } + +type XdrType_PeerAddress = *PeerAddress + +func (v *PeerAddress) XdrPointer() interface{} { return v } +func (PeerAddress) XdrTypeName() string { return "PeerAddress" } +func (v PeerAddress) XdrValue() interface{} { return v } +func (v *PeerAddress) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *PeerAddress) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%sip", name), XDR_XdrAnon_PeerAddress_Ip(&v.Ip)) + x.Marshal(x.Sprintf("%sport", name), XDR_Uint32(&v.Port)) + x.Marshal(x.Sprintf("%snumFailures", name), XDR_Uint32(&v.NumFailures)) } -func (u *StellarMessage) SignedSurveyResponseMessage() *SignedSurveyResponseMessage { - switch u.Type { - case SURVEY_RESPONSE: - if v, ok := u._u.(*SignedSurveyResponseMessage); ok { - return v - } else { - var zero SignedSurveyResponseMessage - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.SignedSurveyResponseMessage accessed when Type == %v", u.Type) - return nil - } +func XDR_PeerAddress(v *PeerAddress) *PeerAddress { return v } + +var _XdrNames_MessageType = map[int32]string{ + int32(ERROR_MSG): "ERROR_MSG", + int32(AUTH): "AUTH", + int32(DONT_HAVE): "DONT_HAVE", + int32(GET_PEERS): "GET_PEERS", + int32(PEERS): "PEERS", + int32(GET_TX_SET): "GET_TX_SET", + int32(TX_SET): "TX_SET", + int32(GENERALIZED_TX_SET): "GENERALIZED_TX_SET", + int32(TRANSACTION): "TRANSACTION", + int32(GET_SCP_QUORUMSET): "GET_SCP_QUORUMSET", + int32(SCP_QUORUMSET): "SCP_QUORUMSET", + int32(SCP_MESSAGE): "SCP_MESSAGE", + int32(GET_SCP_STATE): "GET_SCP_STATE", + int32(HELLO): "HELLO", + int32(SURVEY_REQUEST): "SURVEY_REQUEST", + int32(SURVEY_RESPONSE): "SURVEY_RESPONSE", + int32(SEND_MORE): "SEND_MORE", + int32(SEND_MORE_EXTENDED): "SEND_MORE_EXTENDED", + int32(FLOOD_ADVERT): "FLOOD_ADVERT", + int32(FLOOD_DEMAND): "FLOOD_DEMAND", + int32(TIME_SLICED_SURVEY_REQUEST): "TIME_SLICED_SURVEY_REQUEST", + int32(TIME_SLICED_SURVEY_RESPONSE): "TIME_SLICED_SURVEY_RESPONSE", + int32(TIME_SLICED_SURVEY_START_COLLECTING): "TIME_SLICED_SURVEY_START_COLLECTING", + int32(TIME_SLICED_SURVEY_STOP_COLLECTING): "TIME_SLICED_SURVEY_STOP_COLLECTING", } -func (u *StellarMessage) SignedTimeSlicedSurveyRequestMessage() *SignedTimeSlicedSurveyRequestMessage { - switch u.Type { - case TIME_SLICED_SURVEY_REQUEST: - if v, ok := u._u.(*SignedTimeSlicedSurveyRequestMessage); ok { - return v - } else { - var zero SignedTimeSlicedSurveyRequestMessage - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.SignedTimeSlicedSurveyRequestMessage accessed when Type == %v", u.Type) - return nil - } +var _XdrValues_MessageType = map[string]int32{ + "ERROR_MSG": int32(ERROR_MSG), + "AUTH": int32(AUTH), + "DONT_HAVE": int32(DONT_HAVE), + "GET_PEERS": int32(GET_PEERS), + "PEERS": int32(PEERS), + "GET_TX_SET": int32(GET_TX_SET), + "TX_SET": int32(TX_SET), + "GENERALIZED_TX_SET": int32(GENERALIZED_TX_SET), + "TRANSACTION": int32(TRANSACTION), + "GET_SCP_QUORUMSET": int32(GET_SCP_QUORUMSET), + "SCP_QUORUMSET": int32(SCP_QUORUMSET), + "SCP_MESSAGE": int32(SCP_MESSAGE), + "GET_SCP_STATE": int32(GET_SCP_STATE), + "HELLO": int32(HELLO), + "SURVEY_REQUEST": int32(SURVEY_REQUEST), + "SURVEY_RESPONSE": int32(SURVEY_RESPONSE), + "SEND_MORE": int32(SEND_MORE), + "SEND_MORE_EXTENDED": int32(SEND_MORE_EXTENDED), + "FLOOD_ADVERT": int32(FLOOD_ADVERT), + "FLOOD_DEMAND": int32(FLOOD_DEMAND), + "TIME_SLICED_SURVEY_REQUEST": int32(TIME_SLICED_SURVEY_REQUEST), + "TIME_SLICED_SURVEY_RESPONSE": int32(TIME_SLICED_SURVEY_RESPONSE), + "TIME_SLICED_SURVEY_START_COLLECTING": int32(TIME_SLICED_SURVEY_START_COLLECTING), + "TIME_SLICED_SURVEY_STOP_COLLECTING": int32(TIME_SLICED_SURVEY_STOP_COLLECTING), } -func (u *StellarMessage) SignedTimeSlicedSurveyResponseMessage() *SignedTimeSlicedSurveyResponseMessage { - switch u.Type { - case TIME_SLICED_SURVEY_RESPONSE: - if v, ok := u._u.(*SignedTimeSlicedSurveyResponseMessage); ok { - return v - } else { - var zero SignedTimeSlicedSurveyResponseMessage - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.SignedTimeSlicedSurveyResponseMessage accessed when Type == %v", u.Type) - return nil - } + +func (MessageType) XdrEnumNames() map[int32]string { + return _XdrNames_MessageType } -func (u *StellarMessage) SignedTimeSlicedSurveyStartCollectingMessage() *SignedTimeSlicedSurveyStartCollectingMessage { - switch u.Type { - case TIME_SLICED_SURVEY_START_COLLECTING: - if v, ok := u._u.(*SignedTimeSlicedSurveyStartCollectingMessage); ok { - return v - } else { - var zero SignedTimeSlicedSurveyStartCollectingMessage - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.SignedTimeSlicedSurveyStartCollectingMessage accessed when Type == %v", u.Type) - return nil +func (v MessageType) String() string { + if s, ok := _XdrNames_MessageType[int32(v)]; ok { + return s } + return fmt.Sprintf("MessageType#%d", v) } -func (u *StellarMessage) SignedTimeSlicedSurveyStopCollectingMessage() *SignedTimeSlicedSurveyStopCollectingMessage { - switch u.Type { - case TIME_SLICED_SURVEY_STOP_COLLECTING: - if v, ok := u._u.(*SignedTimeSlicedSurveyStopCollectingMessage); ok { - return v - } else { - var zero SignedTimeSlicedSurveyStopCollectingMessage - u._u = &zero - return &zero +func (v *MessageType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_MessageType[stok]; ok { + *v = MessageType(val) + return nil + } else if stok == "MessageType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } } - default: - XdrPanic("StellarMessage.SignedTimeSlicedSurveyStopCollectingMessage accessed when Type == %v", u.Type) - return nil + return XdrError(fmt.Sprintf("%s is not a valid MessageType.", stok)) } } -func (u *StellarMessage) QSetHash() *Uint256 { - switch u.Type { - case GET_SCP_QUORUMSET: - if v, ok := u._u.(*Uint256); ok { - return v - } else { - var zero Uint256 - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.QSetHash accessed when Type == %v", u.Type) - return nil - } +func (v MessageType) GetU32() uint32 { return uint32(v) } +func (v *MessageType) SetU32(n uint32) { *v = MessageType(n) } +func (v *MessageType) XdrPointer() interface{} { return v } +func (MessageType) XdrTypeName() string { return "MessageType" } +func (v MessageType) XdrValue() interface{} { return v } +func (v *MessageType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_MessageType = *MessageType + +func XDR_MessageType(v *MessageType) *MessageType { return v } + +var _XdrComments_MessageType = map[int32]string{ + int32(GET_PEERS): "gets a list of peers this guy knows about", + int32(GET_TX_SET): "gets a particular txset by hash", + int32(TRANSACTION): "pass on a tx you have heard about", + int32(GET_SCP_QUORUMSET): "SCP", + int32(HELLO): "new messages", } -func (u *StellarMessage) QSet() *SCPQuorumSet { - switch u.Type { - case SCP_QUORUMSET: - if v, ok := u._u.(*SCPQuorumSet); ok { - return v - } else { - var zero SCPQuorumSet - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.QSet accessed when Type == %v", u.Type) - return nil - } + +func (e MessageType) XdrEnumComments() map[int32]string { + return _XdrComments_MessageType } -func (u *StellarMessage) Envelope() *SCPEnvelope { - switch u.Type { - case SCP_MESSAGE: - if v, ok := u._u.(*SCPEnvelope); ok { - return v - } else { - var zero SCPEnvelope - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.Envelope accessed when Type == %v", u.Type) - return nil + +type XdrType_DontHave = *DontHave + +func (v *DontHave) XdrPointer() interface{} { return v } +func (DontHave) XdrTypeName() string { return "DontHave" } +func (v DontHave) XdrValue() interface{} { return v } +func (v *DontHave) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *DontHave) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%stype", name), XDR_MessageType(&v.Type)) + x.Marshal(x.Sprintf("%sreqHash", name), XDR_Uint256(&v.ReqHash)) } +func XDR_DontHave(v *DontHave) *DontHave { return v } -// ledger seq requested ; if 0, requests the latest -func (u *StellarMessage) GetSCPLedgerSeq() *Uint32 { - switch u.Type { - case GET_SCP_STATE: - if v, ok := u._u.(*Uint32); ok { - return v - } else { - var zero Uint32 - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.GetSCPLedgerSeq accessed when Type == %v", u.Type) - return nil +var _XdrNames_SurveyMessageCommandType = map[int32]string{ + int32(SURVEY_TOPOLOGY): "SURVEY_TOPOLOGY", + int32(TIME_SLICED_SURVEY_TOPOLOGY): "TIME_SLICED_SURVEY_TOPOLOGY", +} +var _XdrValues_SurveyMessageCommandType = map[string]int32{ + "SURVEY_TOPOLOGY": int32(SURVEY_TOPOLOGY), + "TIME_SLICED_SURVEY_TOPOLOGY": int32(TIME_SLICED_SURVEY_TOPOLOGY), +} + +func (SurveyMessageCommandType) XdrEnumNames() map[int32]string { + return _XdrNames_SurveyMessageCommandType +} +func (v SurveyMessageCommandType) String() string { + if s, ok := _XdrNames_SurveyMessageCommandType[int32(v)]; ok { + return s } + return fmt.Sprintf("SurveyMessageCommandType#%d", v) } -func (u *StellarMessage) SendMoreMessage() *SendMore { - switch u.Type { - case SEND_MORE: - if v, ok := u._u.(*SendMore); ok { - return v - } else { - var zero SendMore - u._u = &zero - return &zero +func (v *SurveyMessageCommandType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_SurveyMessageCommandType[stok]; ok { + *v = SurveyMessageCommandType(val) + return nil + } else if stok == "SurveyMessageCommandType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } } - default: - XdrPanic("StellarMessage.SendMoreMessage accessed when Type == %v", u.Type) - return nil + return XdrError(fmt.Sprintf("%s is not a valid SurveyMessageCommandType.", stok)) } } -func (u *StellarMessage) SendMoreExtendedMessage() *SendMoreExtended { - switch u.Type { - case SEND_MORE_EXTENDED: - if v, ok := u._u.(*SendMoreExtended); ok { - return v - } else { - var zero SendMoreExtended - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.SendMoreExtendedMessage accessed when Type == %v", u.Type) - return nil +func (v SurveyMessageCommandType) GetU32() uint32 { return uint32(v) } +func (v *SurveyMessageCommandType) SetU32(n uint32) { *v = SurveyMessageCommandType(n) } +func (v *SurveyMessageCommandType) XdrPointer() interface{} { return v } +func (SurveyMessageCommandType) XdrTypeName() string { return "SurveyMessageCommandType" } +func (v SurveyMessageCommandType) XdrValue() interface{} { return v } +func (v *SurveyMessageCommandType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_SurveyMessageCommandType = *SurveyMessageCommandType + +func XDR_SurveyMessageCommandType(v *SurveyMessageCommandType) *SurveyMessageCommandType { return v } + +var _XdrNames_SurveyMessageResponseType = map[int32]string{ + int32(SURVEY_TOPOLOGY_RESPONSE_V0): "SURVEY_TOPOLOGY_RESPONSE_V0", + int32(SURVEY_TOPOLOGY_RESPONSE_V1): "SURVEY_TOPOLOGY_RESPONSE_V1", + int32(SURVEY_TOPOLOGY_RESPONSE_V2): "SURVEY_TOPOLOGY_RESPONSE_V2", +} +var _XdrValues_SurveyMessageResponseType = map[string]int32{ + "SURVEY_TOPOLOGY_RESPONSE_V0": int32(SURVEY_TOPOLOGY_RESPONSE_V0), + "SURVEY_TOPOLOGY_RESPONSE_V1": int32(SURVEY_TOPOLOGY_RESPONSE_V1), + "SURVEY_TOPOLOGY_RESPONSE_V2": int32(SURVEY_TOPOLOGY_RESPONSE_V2), +} + +func (SurveyMessageResponseType) XdrEnumNames() map[int32]string { + return _XdrNames_SurveyMessageResponseType +} +func (v SurveyMessageResponseType) String() string { + if s, ok := _XdrNames_SurveyMessageResponseType[int32(v)]; ok { + return s } + return fmt.Sprintf("SurveyMessageResponseType#%d", v) } -func (u *StellarMessage) FloodAdvert() *FloodAdvert { - switch u.Type { - case FLOOD_ADVERT: - if v, ok := u._u.(*FloodAdvert); ok { - return v - } else { - var zero FloodAdvert - u._u = &zero - return &zero +func (v *SurveyMessageResponseType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_SurveyMessageResponseType[stok]; ok { + *v = SurveyMessageResponseType(val) + return nil + } else if stok == "SurveyMessageResponseType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } } - default: - XdrPanic("StellarMessage.FloodAdvert accessed when Type == %v", u.Type) - return nil + return XdrError(fmt.Sprintf("%s is not a valid SurveyMessageResponseType.", stok)) } } -func (u *StellarMessage) FloodDemand() *FloodDemand { - switch u.Type { - case FLOOD_DEMAND: - if v, ok := u._u.(*FloodDemand); ok { - return v - } else { - var zero FloodDemand - u._u = &zero - return &zero - } - default: - XdrPanic("StellarMessage.FloodDemand accessed when Type == %v", u.Type) - return nil +func (v SurveyMessageResponseType) GetU32() uint32 { return uint32(v) } +func (v *SurveyMessageResponseType) SetU32(n uint32) { *v = SurveyMessageResponseType(n) } +func (v *SurveyMessageResponseType) XdrPointer() interface{} { return v } +func (SurveyMessageResponseType) XdrTypeName() string { return "SurveyMessageResponseType" } +func (v SurveyMessageResponseType) XdrValue() interface{} { return v } +func (v *SurveyMessageResponseType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_SurveyMessageResponseType = *SurveyMessageResponseType + +func XDR_SurveyMessageResponseType(v *SurveyMessageResponseType) *SurveyMessageResponseType { return v } + +type XdrType_TimeSlicedSurveyStartCollectingMessage = *TimeSlicedSurveyStartCollectingMessage + +func (v *TimeSlicedSurveyStartCollectingMessage) XdrPointer() interface{} { return v } +func (TimeSlicedSurveyStartCollectingMessage) XdrTypeName() string { + return "TimeSlicedSurveyStartCollectingMessage" +} +func (v TimeSlicedSurveyStartCollectingMessage) XdrValue() interface{} { return v } +func (v *TimeSlicedSurveyStartCollectingMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedSurveyStartCollectingMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%ssurveyorID", name), XDR_NodeID(&v.SurveyorID)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) + x.Marshal(x.Sprintf("%sledgerNum", name), XDR_Uint32(&v.LedgerNum)) } -func (u StellarMessage) XdrValid() bool { - switch u.Type { - case ERROR_MSG, HELLO, AUTH, DONT_HAVE, GET_PEERS, PEERS, GET_TX_SET, TX_SET, GENERALIZED_TX_SET, TRANSACTION, SURVEY_REQUEST, SURVEY_RESPONSE, TIME_SLICED_SURVEY_REQUEST, TIME_SLICED_SURVEY_RESPONSE, TIME_SLICED_SURVEY_START_COLLECTING, TIME_SLICED_SURVEY_STOP_COLLECTING, GET_SCP_QUORUMSET, SCP_QUORUMSET, SCP_MESSAGE, GET_SCP_STATE, SEND_MORE, SEND_MORE_EXTENDED, FLOOD_ADVERT, FLOOD_DEMAND: - return true +func XDR_TimeSlicedSurveyStartCollectingMessage(v *TimeSlicedSurveyStartCollectingMessage) *TimeSlicedSurveyStartCollectingMessage { + return v +} + +type XdrType_SignedTimeSlicedSurveyStartCollectingMessage = *SignedTimeSlicedSurveyStartCollectingMessage + +func (v *SignedTimeSlicedSurveyStartCollectingMessage) XdrPointer() interface{} { return v } +func (SignedTimeSlicedSurveyStartCollectingMessage) XdrTypeName() string { + return "SignedTimeSlicedSurveyStartCollectingMessage" +} +func (v SignedTimeSlicedSurveyStartCollectingMessage) XdrValue() interface{} { return v } +func (v *SignedTimeSlicedSurveyStartCollectingMessage) XdrMarshal(x XDR, name string) { + x.Marshal(name, v) +} +func (v *SignedTimeSlicedSurveyStartCollectingMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } - return false + x.Marshal(x.Sprintf("%ssignature", name), XDR_Signature(&v.Signature)) + x.Marshal(x.Sprintf("%sstartCollecting", name), XDR_TimeSlicedSurveyStartCollectingMessage(&v.StartCollecting)) } -func (u *StellarMessage) XdrUnionTag() XdrNum32 { - return XDR_MessageType(&u.Type) +func XDR_SignedTimeSlicedSurveyStartCollectingMessage(v *SignedTimeSlicedSurveyStartCollectingMessage) *SignedTimeSlicedSurveyStartCollectingMessage { + return v } -func (u *StellarMessage) XdrUnionTagName() string { - return "Type" + +type XdrType_TimeSlicedSurveyStopCollectingMessage = *TimeSlicedSurveyStopCollectingMessage + +func (v *TimeSlicedSurveyStopCollectingMessage) XdrPointer() interface{} { return v } +func (TimeSlicedSurveyStopCollectingMessage) XdrTypeName() string { + return "TimeSlicedSurveyStopCollectingMessage" } -func (u *StellarMessage) XdrUnionBody() XdrType { - switch u.Type { - case ERROR_MSG: - return XDR_Error(u.Error()) - case HELLO: - return XDR_Hello(u.Hello()) - case AUTH: - return XDR_Auth(u.Auth()) - case DONT_HAVE: - return XDR_DontHave(u.DontHave()) - case GET_PEERS: - return nil - case PEERS: - return (*_XdrVec_100_PeerAddress)(u.Peers()) - case GET_TX_SET: - return XDR_Uint256(u.TxSetHash()) - case TX_SET: - return XDR_TransactionSet(u.TxSet()) - case GENERALIZED_TX_SET: - return XDR_GeneralizedTransactionSet(u.GeneralizedTxSet()) - case TRANSACTION: - return XDR_TransactionEnvelope(u.Transaction()) - case SURVEY_REQUEST: - return XDR_SignedSurveyRequestMessage(u.SignedSurveyRequestMessage()) - case SURVEY_RESPONSE: - return XDR_SignedSurveyResponseMessage(u.SignedSurveyResponseMessage()) - case TIME_SLICED_SURVEY_REQUEST: - return XDR_SignedTimeSlicedSurveyRequestMessage(u.SignedTimeSlicedSurveyRequestMessage()) - case TIME_SLICED_SURVEY_RESPONSE: - return XDR_SignedTimeSlicedSurveyResponseMessage(u.SignedTimeSlicedSurveyResponseMessage()) - case TIME_SLICED_SURVEY_START_COLLECTING: - return XDR_SignedTimeSlicedSurveyStartCollectingMessage(u.SignedTimeSlicedSurveyStartCollectingMessage()) - case TIME_SLICED_SURVEY_STOP_COLLECTING: - return XDR_SignedTimeSlicedSurveyStopCollectingMessage(u.SignedTimeSlicedSurveyStopCollectingMessage()) - case GET_SCP_QUORUMSET: - return XDR_Uint256(u.QSetHash()) - case SCP_QUORUMSET: - return XDR_SCPQuorumSet(u.QSet()) - case SCP_MESSAGE: - return XDR_SCPEnvelope(u.Envelope()) - case GET_SCP_STATE: - return XDR_Uint32(u.GetSCPLedgerSeq()) - case SEND_MORE: - return XDR_SendMore(u.SendMoreMessage()) - case SEND_MORE_EXTENDED: - return XDR_SendMoreExtended(u.SendMoreExtendedMessage()) - case FLOOD_ADVERT: - return XDR_FloodAdvert(u.FloodAdvert()) - case FLOOD_DEMAND: - return XDR_FloodDemand(u.FloodDemand()) +func (v TimeSlicedSurveyStopCollectingMessage) XdrValue() interface{} { return v } +func (v *TimeSlicedSurveyStopCollectingMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedSurveyStopCollectingMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } - return nil + x.Marshal(x.Sprintf("%ssurveyorID", name), XDR_NodeID(&v.SurveyorID)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) + x.Marshal(x.Sprintf("%sledgerNum", name), XDR_Uint32(&v.LedgerNum)) } -func (u *StellarMessage) XdrUnionBodyName() string { - switch u.Type { - case ERROR_MSG: - return "Error" - case HELLO: - return "Hello" - case AUTH: - return "Auth" - case DONT_HAVE: - return "DontHave" - case GET_PEERS: - return "" - case PEERS: - return "Peers" - case GET_TX_SET: - return "TxSetHash" - case TX_SET: - return "TxSet" - case GENERALIZED_TX_SET: - return "GeneralizedTxSet" - case TRANSACTION: - return "Transaction" - case SURVEY_REQUEST: - return "SignedSurveyRequestMessage" - case SURVEY_RESPONSE: - return "SignedSurveyResponseMessage" - case TIME_SLICED_SURVEY_REQUEST: - return "SignedTimeSlicedSurveyRequestMessage" - case TIME_SLICED_SURVEY_RESPONSE: - return "SignedTimeSlicedSurveyResponseMessage" - case TIME_SLICED_SURVEY_START_COLLECTING: - return "SignedTimeSlicedSurveyStartCollectingMessage" - case TIME_SLICED_SURVEY_STOP_COLLECTING: - return "SignedTimeSlicedSurveyStopCollectingMessage" - case GET_SCP_QUORUMSET: - return "QSetHash" - case SCP_QUORUMSET: - return "QSet" - case SCP_MESSAGE: - return "Envelope" - case GET_SCP_STATE: - return "GetSCPLedgerSeq" - case SEND_MORE: - return "SendMoreMessage" - case SEND_MORE_EXTENDED: - return "SendMoreExtendedMessage" - case FLOOD_ADVERT: - return "FloodAdvert" - case FLOOD_DEMAND: - return "FloodDemand" - } - return "" +func XDR_TimeSlicedSurveyStopCollectingMessage(v *TimeSlicedSurveyStopCollectingMessage) *TimeSlicedSurveyStopCollectingMessage { + return v } -type XdrType_StellarMessage = *StellarMessage +type XdrType_SignedTimeSlicedSurveyStopCollectingMessage = *SignedTimeSlicedSurveyStopCollectingMessage -func (v *StellarMessage) XdrPointer() interface{} { return v } -func (StellarMessage) XdrTypeName() string { return "StellarMessage" } -func (v StellarMessage) XdrValue() interface{} { return v } -func (v *StellarMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *StellarMessage) XdrRecurse(x XDR, name string) { +func (v *SignedTimeSlicedSurveyStopCollectingMessage) XdrPointer() interface{} { return v } +func (SignedTimeSlicedSurveyStopCollectingMessage) XdrTypeName() string { + return "SignedTimeSlicedSurveyStopCollectingMessage" +} +func (v SignedTimeSlicedSurveyStopCollectingMessage) XdrValue() interface{} { return v } +func (v *SignedTimeSlicedSurveyStopCollectingMessage) XdrMarshal(x XDR, name string) { + x.Marshal(name, v) +} +func (v *SignedTimeSlicedSurveyStopCollectingMessage) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_MessageType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case ERROR_MSG: - x.Marshal(x.Sprintf("%serror", name), XDR_Error(u.Error())) - return - case HELLO: - x.Marshal(x.Sprintf("%shello", name), XDR_Hello(u.Hello())) - return - case AUTH: - x.Marshal(x.Sprintf("%sauth", name), XDR_Auth(u.Auth())) - return - case DONT_HAVE: - x.Marshal(x.Sprintf("%sdontHave", name), XDR_DontHave(u.DontHave())) - return - case GET_PEERS: - return - case PEERS: - x.Marshal(x.Sprintf("%speers", name), (*_XdrVec_100_PeerAddress)(u.Peers())) - return - case GET_TX_SET: - x.Marshal(x.Sprintf("%stxSetHash", name), XDR_Uint256(u.TxSetHash())) - return - case TX_SET: - x.Marshal(x.Sprintf("%stxSet", name), XDR_TransactionSet(u.TxSet())) - return - case GENERALIZED_TX_SET: - x.Marshal(x.Sprintf("%sgeneralizedTxSet", name), XDR_GeneralizedTransactionSet(u.GeneralizedTxSet())) - return - case TRANSACTION: - x.Marshal(x.Sprintf("%stransaction", name), XDR_TransactionEnvelope(u.Transaction())) - return - case SURVEY_REQUEST: - x.Marshal(x.Sprintf("%ssignedSurveyRequestMessage", name), XDR_SignedSurveyRequestMessage(u.SignedSurveyRequestMessage())) - return - case SURVEY_RESPONSE: - x.Marshal(x.Sprintf("%ssignedSurveyResponseMessage", name), XDR_SignedSurveyResponseMessage(u.SignedSurveyResponseMessage())) - return - case TIME_SLICED_SURVEY_REQUEST: - x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyRequestMessage", name), XDR_SignedTimeSlicedSurveyRequestMessage(u.SignedTimeSlicedSurveyRequestMessage())) - return - case TIME_SLICED_SURVEY_RESPONSE: - x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyResponseMessage", name), XDR_SignedTimeSlicedSurveyResponseMessage(u.SignedTimeSlicedSurveyResponseMessage())) - return - case TIME_SLICED_SURVEY_START_COLLECTING: - x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyStartCollectingMessage", name), XDR_SignedTimeSlicedSurveyStartCollectingMessage(u.SignedTimeSlicedSurveyStartCollectingMessage())) - return - case TIME_SLICED_SURVEY_STOP_COLLECTING: - x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyStopCollectingMessage", name), XDR_SignedTimeSlicedSurveyStopCollectingMessage(u.SignedTimeSlicedSurveyStopCollectingMessage())) - return - case GET_SCP_QUORUMSET: - x.Marshal(x.Sprintf("%sqSetHash", name), XDR_Uint256(u.QSetHash())) - return - case SCP_QUORUMSET: - x.Marshal(x.Sprintf("%sqSet", name), XDR_SCPQuorumSet(u.QSet())) - return - case SCP_MESSAGE: - x.Marshal(x.Sprintf("%senvelope", name), XDR_SCPEnvelope(u.Envelope())) - return - case GET_SCP_STATE: - x.Marshal(x.Sprintf("%sgetSCPLedgerSeq", name), XDR_Uint32(u.GetSCPLedgerSeq())) - return - case SEND_MORE: - x.Marshal(x.Sprintf("%ssendMoreMessage", name), XDR_SendMore(u.SendMoreMessage())) - return - case SEND_MORE_EXTENDED: - x.Marshal(x.Sprintf("%ssendMoreExtendedMessage", name), XDR_SendMoreExtended(u.SendMoreExtendedMessage())) - return - case FLOOD_ADVERT: - x.Marshal(x.Sprintf("%sfloodAdvert", name), XDR_FloodAdvert(u.FloodAdvert())) - return - case FLOOD_DEMAND: - x.Marshal(x.Sprintf("%sfloodDemand", name), XDR_FloodDemand(u.FloodDemand())) - return + x.Marshal(x.Sprintf("%ssignature", name), XDR_Signature(&v.Signature)) + x.Marshal(x.Sprintf("%sstopCollecting", name), XDR_TimeSlicedSurveyStopCollectingMessage(&v.StopCollecting)) +} +func XDR_SignedTimeSlicedSurveyStopCollectingMessage(v *SignedTimeSlicedSurveyStopCollectingMessage) *SignedTimeSlicedSurveyStopCollectingMessage { + return v +} + +type XdrType_SurveyRequestMessage = *SurveyRequestMessage + +func (v *SurveyRequestMessage) XdrPointer() interface{} { return v } +func (SurveyRequestMessage) XdrTypeName() string { return "SurveyRequestMessage" } +func (v SurveyRequestMessage) XdrValue() interface{} { return v } +func (v *SurveyRequestMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SurveyRequestMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } - XdrPanic("invalid Type (%v) in StellarMessage", u.Type) + x.Marshal(x.Sprintf("%ssurveyorPeerID", name), XDR_NodeID(&v.SurveyorPeerID)) + x.Marshal(x.Sprintf("%ssurveyedPeerID", name), XDR_NodeID(&v.SurveyedPeerID)) + x.Marshal(x.Sprintf("%sledgerNum", name), XDR_Uint32(&v.LedgerNum)) + x.Marshal(x.Sprintf("%sencryptionKey", name), XDR_Curve25519Public(&v.EncryptionKey)) + x.Marshal(x.Sprintf("%scommandType", name), XDR_SurveyMessageCommandType(&v.CommandType)) } -func XDR_StellarMessage(v *StellarMessage) *StellarMessage { return v } +func XDR_SurveyRequestMessage(v *SurveyRequestMessage) *SurveyRequestMessage { return v } -type XdrType_XdrAnon_AuthenticatedMessage_V0 = *XdrAnon_AuthenticatedMessage_V0 +type XdrType_TimeSlicedSurveyRequestMessage = *TimeSlicedSurveyRequestMessage -func (v *XdrAnon_AuthenticatedMessage_V0) XdrPointer() interface{} { return v } -func (XdrAnon_AuthenticatedMessage_V0) XdrTypeName() string { return "XdrAnon_AuthenticatedMessage_V0" } -func (v XdrAnon_AuthenticatedMessage_V0) XdrValue() interface{} { return v } -func (v *XdrAnon_AuthenticatedMessage_V0) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *XdrAnon_AuthenticatedMessage_V0) XdrRecurse(x XDR, name string) { +func (v *TimeSlicedSurveyRequestMessage) XdrPointer() interface{} { return v } +func (TimeSlicedSurveyRequestMessage) XdrTypeName() string { return "TimeSlicedSurveyRequestMessage" } +func (v TimeSlicedSurveyRequestMessage) XdrValue() interface{} { return v } +func (v *TimeSlicedSurveyRequestMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedSurveyRequestMessage) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%ssequence", name), XDR_Uint64(&v.Sequence)) - x.Marshal(x.Sprintf("%smessage", name), XDR_StellarMessage(&v.Message)) - x.Marshal(x.Sprintf("%smac", name), XDR_HmacSha256Mac(&v.Mac)) + x.Marshal(x.Sprintf("%srequest", name), XDR_SurveyRequestMessage(&v.Request)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) + x.Marshal(x.Sprintf("%sinboundPeersIndex", name), XDR_Uint32(&v.InboundPeersIndex)) + x.Marshal(x.Sprintf("%soutboundPeersIndex", name), XDR_Uint32(&v.OutboundPeersIndex)) } -func XDR_XdrAnon_AuthenticatedMessage_V0(v *XdrAnon_AuthenticatedMessage_V0) *XdrAnon_AuthenticatedMessage_V0 { +func XDR_TimeSlicedSurveyRequestMessage(v *TimeSlicedSurveyRequestMessage) *TimeSlicedSurveyRequestMessage { return v } -var _XdrTags_AuthenticatedMessage = map[int32]bool{ - XdrToI32(0): true, -} +type XdrType_SignedSurveyRequestMessage = *SignedSurveyRequestMessage -func (_ AuthenticatedMessage) XdrValidTags() map[int32]bool { - return _XdrTags_AuthenticatedMessage -} -func (u *AuthenticatedMessage) V0() *XdrAnon_AuthenticatedMessage_V0 { - switch u.V { - case 0: - if v, ok := u._u.(*XdrAnon_AuthenticatedMessage_V0); ok { - return v - } else { - var zero XdrAnon_AuthenticatedMessage_V0 - u._u = &zero - return &zero - } - default: - XdrPanic("AuthenticatedMessage.V0 accessed when V == %v", u.V) - return nil - } -} -func (u AuthenticatedMessage) XdrValid() bool { - switch u.V { - case 0: - return true +func (v *SignedSurveyRequestMessage) XdrPointer() interface{} { return v } +func (SignedSurveyRequestMessage) XdrTypeName() string { return "SignedSurveyRequestMessage" } +func (v SignedSurveyRequestMessage) XdrValue() interface{} { return v } +func (v *SignedSurveyRequestMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SignedSurveyRequestMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } - return false + x.Marshal(x.Sprintf("%srequestSignature", name), XDR_Signature(&v.RequestSignature)) + x.Marshal(x.Sprintf("%srequest", name), XDR_SurveyRequestMessage(&v.Request)) } -func (u *AuthenticatedMessage) XdrUnionTag() XdrNum32 { - return XDR_Uint32(&u.V) +func XDR_SignedSurveyRequestMessage(v *SignedSurveyRequestMessage) *SignedSurveyRequestMessage { + return v } -func (u *AuthenticatedMessage) XdrUnionTagName() string { - return "V" + +type XdrType_SignedTimeSlicedSurveyRequestMessage = *SignedTimeSlicedSurveyRequestMessage + +func (v *SignedTimeSlicedSurveyRequestMessage) XdrPointer() interface{} { return v } +func (SignedTimeSlicedSurveyRequestMessage) XdrTypeName() string { + return "SignedTimeSlicedSurveyRequestMessage" } -func (u *AuthenticatedMessage) XdrUnionBody() XdrType { - switch u.V { - case 0: - return XDR_XdrAnon_AuthenticatedMessage_V0(u.V0()) +func (v SignedTimeSlicedSurveyRequestMessage) XdrValue() interface{} { return v } +func (v *SignedTimeSlicedSurveyRequestMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SignedTimeSlicedSurveyRequestMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } - return nil + x.Marshal(x.Sprintf("%srequestSignature", name), XDR_Signature(&v.RequestSignature)) + x.Marshal(x.Sprintf("%srequest", name), XDR_TimeSlicedSurveyRequestMessage(&v.Request)) } -func (u *AuthenticatedMessage) XdrUnionBodyName() string { - switch u.V { - case 0: - return "V0" - } - return "" +func XDR_SignedTimeSlicedSurveyRequestMessage(v *SignedTimeSlicedSurveyRequestMessage) *SignedTimeSlicedSurveyRequestMessage { + return v } -type XdrType_AuthenticatedMessage = *AuthenticatedMessage +type XdrType_EncryptedBody struct { + XdrVecOpaque +} -func (v *AuthenticatedMessage) XdrPointer() interface{} { return v } -func (AuthenticatedMessage) XdrTypeName() string { return "AuthenticatedMessage" } -func (v AuthenticatedMessage) XdrValue() interface{} { return v } -func (v *AuthenticatedMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *AuthenticatedMessage) XdrRecurse(x XDR, name string) { +func XDR_EncryptedBody(v *EncryptedBody) XdrType_EncryptedBody { + return XdrType_EncryptedBody{XdrVecOpaque{v, 64000}} +} +func (XdrType_EncryptedBody) XdrTypeName() string { return "EncryptedBody" } +func (v XdrType_EncryptedBody) XdrUnwrap() XdrType { return v.XdrVecOpaque } + +type XdrType_SurveyResponseMessage = *SurveyResponseMessage + +func (v *SurveyResponseMessage) XdrPointer() interface{} { return v } +func (SurveyResponseMessage) XdrTypeName() string { return "SurveyResponseMessage" } +func (v SurveyResponseMessage) XdrValue() interface{} { return v } +func (v *SurveyResponseMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SurveyResponseMessage) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_Uint32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) - switch u.V { - case 0: - x.Marshal(x.Sprintf("%sv0", name), XDR_XdrAnon_AuthenticatedMessage_V0(u.V0())) - return - } - XdrPanic("invalid V (%v) in AuthenticatedMessage", u.V) + x.Marshal(x.Sprintf("%ssurveyorPeerID", name), XDR_NodeID(&v.SurveyorPeerID)) + x.Marshal(x.Sprintf("%ssurveyedPeerID", name), XDR_NodeID(&v.SurveyedPeerID)) + x.Marshal(x.Sprintf("%sledgerNum", name), XDR_Uint32(&v.LedgerNum)) + x.Marshal(x.Sprintf("%scommandType", name), XDR_SurveyMessageCommandType(&v.CommandType)) + x.Marshal(x.Sprintf("%sencryptedBody", name), XDR_EncryptedBody(&v.EncryptedBody)) } -func XDR_AuthenticatedMessage(v *AuthenticatedMessage) *AuthenticatedMessage { return v } +func XDR_SurveyResponseMessage(v *SurveyResponseMessage) *SurveyResponseMessage { return v } -var _XdrTags_LiquidityPoolParameters = map[int32]bool{ - XdrToI32(LIQUIDITY_POOL_CONSTANT_PRODUCT): true, -} +type XdrType_TimeSlicedSurveyResponseMessage = *TimeSlicedSurveyResponseMessage -func (_ LiquidityPoolParameters) XdrValidTags() map[int32]bool { - return _XdrTags_LiquidityPoolParameters -} -func (u *LiquidityPoolParameters) ConstantProduct() *LiquidityPoolConstantProductParameters { - switch u.Type { - case LIQUIDITY_POOL_CONSTANT_PRODUCT: - if v, ok := u._u.(*LiquidityPoolConstantProductParameters); ok { - return v - } else { - var zero LiquidityPoolConstantProductParameters - u._u = &zero - return &zero - } - default: - XdrPanic("LiquidityPoolParameters.ConstantProduct accessed when Type == %v", u.Type) - return nil - } -} -func (u LiquidityPoolParameters) XdrValid() bool { - switch u.Type { - case LIQUIDITY_POOL_CONSTANT_PRODUCT: - return true - } - return false -} -func (u *LiquidityPoolParameters) XdrUnionTag() XdrNum32 { - return XDR_LiquidityPoolType(&u.Type) -} -func (u *LiquidityPoolParameters) XdrUnionTagName() string { - return "Type" -} -func (u *LiquidityPoolParameters) XdrUnionBody() XdrType { - switch u.Type { - case LIQUIDITY_POOL_CONSTANT_PRODUCT: - return XDR_LiquidityPoolConstantProductParameters(u.ConstantProduct()) +func (v *TimeSlicedSurveyResponseMessage) XdrPointer() interface{} { return v } +func (TimeSlicedSurveyResponseMessage) XdrTypeName() string { return "TimeSlicedSurveyResponseMessage" } +func (v TimeSlicedSurveyResponseMessage) XdrValue() interface{} { return v } +func (v *TimeSlicedSurveyResponseMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedSurveyResponseMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } - return nil + x.Marshal(x.Sprintf("%sresponse", name), XDR_SurveyResponseMessage(&v.Response)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) } -func (u *LiquidityPoolParameters) XdrUnionBodyName() string { - switch u.Type { - case LIQUIDITY_POOL_CONSTANT_PRODUCT: - return "ConstantProduct" - } - return "" +func XDR_TimeSlicedSurveyResponseMessage(v *TimeSlicedSurveyResponseMessage) *TimeSlicedSurveyResponseMessage { + return v } -type XdrType_LiquidityPoolParameters = *LiquidityPoolParameters +type XdrType_SignedSurveyResponseMessage = *SignedSurveyResponseMessage -func (v *LiquidityPoolParameters) XdrPointer() interface{} { return v } -func (LiquidityPoolParameters) XdrTypeName() string { return "LiquidityPoolParameters" } -func (v LiquidityPoolParameters) XdrValue() interface{} { return v } -func (v *LiquidityPoolParameters) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *LiquidityPoolParameters) XdrRecurse(x XDR, name string) { +func (v *SignedSurveyResponseMessage) XdrPointer() interface{} { return v } +func (SignedSurveyResponseMessage) XdrTypeName() string { return "SignedSurveyResponseMessage" } +func (v SignedSurveyResponseMessage) XdrValue() interface{} { return v } +func (v *SignedSurveyResponseMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SignedSurveyResponseMessage) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_LiquidityPoolType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case LIQUIDITY_POOL_CONSTANT_PRODUCT: - x.Marshal(x.Sprintf("%sconstantProduct", name), XDR_LiquidityPoolConstantProductParameters(u.ConstantProduct())) - return - } - XdrPanic("invalid Type (%v) in LiquidityPoolParameters", u.Type) + x.Marshal(x.Sprintf("%sresponseSignature", name), XDR_Signature(&v.ResponseSignature)) + x.Marshal(x.Sprintf("%sresponse", name), XDR_SurveyResponseMessage(&v.Response)) +} +func XDR_SignedSurveyResponseMessage(v *SignedSurveyResponseMessage) *SignedSurveyResponseMessage { + return v } -func XDR_LiquidityPoolParameters(v *LiquidityPoolParameters) *LiquidityPoolParameters { return v } -type XdrType_XdrAnon_MuxedAccount_Med25519 = *XdrAnon_MuxedAccount_Med25519 +type XdrType_SignedTimeSlicedSurveyResponseMessage = *SignedTimeSlicedSurveyResponseMessage -func (v *XdrAnon_MuxedAccount_Med25519) XdrPointer() interface{} { return v } -func (XdrAnon_MuxedAccount_Med25519) XdrTypeName() string { return "XdrAnon_MuxedAccount_Med25519" } -func (v XdrAnon_MuxedAccount_Med25519) XdrValue() interface{} { return v } -func (v *XdrAnon_MuxedAccount_Med25519) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *XdrAnon_MuxedAccount_Med25519) XdrRecurse(x XDR, name string) { +func (v *SignedTimeSlicedSurveyResponseMessage) XdrPointer() interface{} { return v } +func (SignedTimeSlicedSurveyResponseMessage) XdrTypeName() string { + return "SignedTimeSlicedSurveyResponseMessage" +} +func (v SignedTimeSlicedSurveyResponseMessage) XdrValue() interface{} { return v } +func (v *SignedTimeSlicedSurveyResponseMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SignedTimeSlicedSurveyResponseMessage) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sid", name), XDR_Uint64(&v.Id)) - x.Marshal(x.Sprintf("%sed25519", name), XDR_Uint256(&v.Ed25519)) + x.Marshal(x.Sprintf("%sresponseSignature", name), XDR_Signature(&v.ResponseSignature)) + x.Marshal(x.Sprintf("%sresponse", name), XDR_TimeSlicedSurveyResponseMessage(&v.Response)) } -func XDR_XdrAnon_MuxedAccount_Med25519(v *XdrAnon_MuxedAccount_Med25519) *XdrAnon_MuxedAccount_Med25519 { +func XDR_SignedTimeSlicedSurveyResponseMessage(v *SignedTimeSlicedSurveyResponseMessage) *SignedTimeSlicedSurveyResponseMessage { return v } -var _XdrTags_MuxedAccount = map[int32]bool{ - XdrToI32(KEY_TYPE_ED25519): true, - XdrToI32(KEY_TYPE_MUXED_ED25519): true, +type XdrType_PeerStats = *PeerStats + +func (v *PeerStats) XdrPointer() interface{} { return v } +func (PeerStats) XdrTypeName() string { return "PeerStats" } +func (v PeerStats) XdrValue() interface{} { return v } +func (v *PeerStats) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *PeerStats) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sid", name), XDR_NodeID(&v.Id)) + x.Marshal(x.Sprintf("%sversionStr", name), XdrString{&v.VersionStr, 100}) + x.Marshal(x.Sprintf("%smessagesRead", name), XDR_Uint64(&v.MessagesRead)) + x.Marshal(x.Sprintf("%smessagesWritten", name), XDR_Uint64(&v.MessagesWritten)) + x.Marshal(x.Sprintf("%sbytesRead", name), XDR_Uint64(&v.BytesRead)) + x.Marshal(x.Sprintf("%sbytesWritten", name), XDR_Uint64(&v.BytesWritten)) + x.Marshal(x.Sprintf("%ssecondsConnected", name), XDR_Uint64(&v.SecondsConnected)) + x.Marshal(x.Sprintf("%suniqueFloodBytesRecv", name), XDR_Uint64(&v.UniqueFloodBytesRecv)) + x.Marshal(x.Sprintf("%sduplicateFloodBytesRecv", name), XDR_Uint64(&v.DuplicateFloodBytesRecv)) + x.Marshal(x.Sprintf("%suniqueFetchBytesRecv", name), XDR_Uint64(&v.UniqueFetchBytesRecv)) + x.Marshal(x.Sprintf("%sduplicateFetchBytesRecv", name), XDR_Uint64(&v.DuplicateFetchBytesRecv)) + x.Marshal(x.Sprintf("%suniqueFloodMessageRecv", name), XDR_Uint64(&v.UniqueFloodMessageRecv)) + x.Marshal(x.Sprintf("%sduplicateFloodMessageRecv", name), XDR_Uint64(&v.DuplicateFloodMessageRecv)) + x.Marshal(x.Sprintf("%suniqueFetchMessageRecv", name), XDR_Uint64(&v.UniqueFetchMessageRecv)) + x.Marshal(x.Sprintf("%sduplicateFetchMessageRecv", name), XDR_Uint64(&v.DuplicateFetchMessageRecv)) } +func XDR_PeerStats(v *PeerStats) *PeerStats { return v } -func (_ MuxedAccount) XdrValidTags() map[int32]bool { - return _XdrTags_MuxedAccount +type _XdrVec_25_PeerStats []PeerStats + +func (_XdrVec_25_PeerStats) XdrBound() uint32 { + const bound uint32 = 25 // Force error if not const or doesn't fit + return bound } -func (u *MuxedAccount) Ed25519() *Uint256 { - switch u.Type { - case KEY_TYPE_ED25519: - if v, ok := u._u.(*Uint256); ok { - return v - } else { - var zero Uint256 - u._u = &zero - return &zero - } - default: - XdrPanic("MuxedAccount.Ed25519 accessed when Type == %v", u.Type) - return nil +func (_XdrVec_25_PeerStats) XdrCheckLen(length uint32) { + if length > uint32(25) { + XdrPanic("_XdrVec_25_PeerStats length %d exceeds bound 25", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_25_PeerStats length %d exceeds max int", length) } } -func (u *MuxedAccount) Med25519() *XdrAnon_MuxedAccount_Med25519 { - switch u.Type { - case KEY_TYPE_MUXED_ED25519: - if v, ok := u._u.(*XdrAnon_MuxedAccount_Med25519); ok { - return v - } else { - var zero XdrAnon_MuxedAccount_Med25519 - u._u = &zero - return &zero +func (v _XdrVec_25_PeerStats) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_25_PeerStats) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] } - default: - XdrPanic("MuxedAccount.Med25519 accessed when Type == %v", u.Type) - return nil + return + } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(25); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) } + nv := make([]PeerStats, int(length), newcap) + copy(nv, *v) + *v = nv } -func (u MuxedAccount) XdrValid() bool { - switch u.Type { - case KEY_TYPE_ED25519, KEY_TYPE_MUXED_ED25519: - return true +func (v *_XdrVec_25_PeerStats) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_PeerStats(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] } - return false } -func (u *MuxedAccount) XdrUnionTag() XdrNum32 { - return XDR_CryptoKeyType(&u.Type) +func (v *_XdrVec_25_PeerStats) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 25} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } -func (u *MuxedAccount) XdrUnionTagName() string { - return "Type" -} -func (u *MuxedAccount) XdrUnionBody() XdrType { - switch u.Type { - case KEY_TYPE_ED25519: - return XDR_Uint256(u.Ed25519()) - case KEY_TYPE_MUXED_ED25519: - return XDR_XdrAnon_MuxedAccount_Med25519(u.Med25519()) - } - return nil -} -func (u *MuxedAccount) XdrUnionBodyName() string { - switch u.Type { - case KEY_TYPE_ED25519: - return "Ed25519" - case KEY_TYPE_MUXED_ED25519: - return "Med25519" - } - return "" -} - -type XdrType_MuxedAccount = *MuxedAccount - -func (v *MuxedAccount) XdrPointer() interface{} { return v } -func (MuxedAccount) XdrTypeName() string { return "MuxedAccount" } -func (v MuxedAccount) XdrValue() interface{} { return v } -func (v *MuxedAccount) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *MuxedAccount) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - XDR_CryptoKeyType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case KEY_TYPE_ED25519: - x.Marshal(x.Sprintf("%sed25519", name), XDR_Uint256(u.Ed25519())) - return - case KEY_TYPE_MUXED_ED25519: - x.Marshal(x.Sprintf("%smed25519", name), XDR_XdrAnon_MuxedAccount_Med25519(u.Med25519())) - return - } - XdrPanic("invalid Type (%v) in MuxedAccount", u.Type) -} -func XDR_MuxedAccount(v *MuxedAccount) *MuxedAccount { return v } - -type XdrType_DecoratedSignature = *DecoratedSignature - -func (v *DecoratedSignature) XdrPointer() interface{} { return v } -func (DecoratedSignature) XdrTypeName() string { return "DecoratedSignature" } -func (v DecoratedSignature) XdrValue() interface{} { return v } -func (v *DecoratedSignature) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *DecoratedSignature) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%shint", name), XDR_SignatureHint(&v.Hint)) - x.Marshal(x.Sprintf("%ssignature", name), XDR_Signature(&v.Signature)) -} -func XDR_DecoratedSignature(v *DecoratedSignature) *DecoratedSignature { return v } - -var _XdrNames_OperationType = map[int32]string{ - int32(CREATE_ACCOUNT): "CREATE_ACCOUNT", - int32(PAYMENT): "PAYMENT", - int32(PATH_PAYMENT_STRICT_RECEIVE): "PATH_PAYMENT_STRICT_RECEIVE", - int32(MANAGE_SELL_OFFER): "MANAGE_SELL_OFFER", - int32(CREATE_PASSIVE_SELL_OFFER): "CREATE_PASSIVE_SELL_OFFER", - int32(SET_OPTIONS): "SET_OPTIONS", - int32(CHANGE_TRUST): "CHANGE_TRUST", - int32(ALLOW_TRUST): "ALLOW_TRUST", - int32(ACCOUNT_MERGE): "ACCOUNT_MERGE", - int32(INFLATION): "INFLATION", - int32(MANAGE_DATA): "MANAGE_DATA", - int32(BUMP_SEQUENCE): "BUMP_SEQUENCE", - int32(MANAGE_BUY_OFFER): "MANAGE_BUY_OFFER", - int32(PATH_PAYMENT_STRICT_SEND): "PATH_PAYMENT_STRICT_SEND", - int32(CREATE_CLAIMABLE_BALANCE): "CREATE_CLAIMABLE_BALANCE", - int32(CLAIM_CLAIMABLE_BALANCE): "CLAIM_CLAIMABLE_BALANCE", - int32(BEGIN_SPONSORING_FUTURE_RESERVES): "BEGIN_SPONSORING_FUTURE_RESERVES", - int32(END_SPONSORING_FUTURE_RESERVES): "END_SPONSORING_FUTURE_RESERVES", - int32(REVOKE_SPONSORSHIP): "REVOKE_SPONSORSHIP", - int32(CLAWBACK): "CLAWBACK", - int32(CLAWBACK_CLAIMABLE_BALANCE): "CLAWBACK_CLAIMABLE_BALANCE", - int32(SET_TRUST_LINE_FLAGS): "SET_TRUST_LINE_FLAGS", - int32(LIQUIDITY_POOL_DEPOSIT): "LIQUIDITY_POOL_DEPOSIT", - int32(LIQUIDITY_POOL_WITHDRAW): "LIQUIDITY_POOL_WITHDRAW", - int32(INVOKE_HOST_FUNCTION): "INVOKE_HOST_FUNCTION", - int32(EXTEND_FOOTPRINT_TTL): "EXTEND_FOOTPRINT_TTL", - int32(RESTORE_FOOTPRINT): "RESTORE_FOOTPRINT", -} -var _XdrValues_OperationType = map[string]int32{ - "CREATE_ACCOUNT": int32(CREATE_ACCOUNT), - "PAYMENT": int32(PAYMENT), - "PATH_PAYMENT_STRICT_RECEIVE": int32(PATH_PAYMENT_STRICT_RECEIVE), - "MANAGE_SELL_OFFER": int32(MANAGE_SELL_OFFER), - "CREATE_PASSIVE_SELL_OFFER": int32(CREATE_PASSIVE_SELL_OFFER), - "SET_OPTIONS": int32(SET_OPTIONS), - "CHANGE_TRUST": int32(CHANGE_TRUST), - "ALLOW_TRUST": int32(ALLOW_TRUST), - "ACCOUNT_MERGE": int32(ACCOUNT_MERGE), - "INFLATION": int32(INFLATION), - "MANAGE_DATA": int32(MANAGE_DATA), - "BUMP_SEQUENCE": int32(BUMP_SEQUENCE), - "MANAGE_BUY_OFFER": int32(MANAGE_BUY_OFFER), - "PATH_PAYMENT_STRICT_SEND": int32(PATH_PAYMENT_STRICT_SEND), - "CREATE_CLAIMABLE_BALANCE": int32(CREATE_CLAIMABLE_BALANCE), - "CLAIM_CLAIMABLE_BALANCE": int32(CLAIM_CLAIMABLE_BALANCE), - "BEGIN_SPONSORING_FUTURE_RESERVES": int32(BEGIN_SPONSORING_FUTURE_RESERVES), - "END_SPONSORING_FUTURE_RESERVES": int32(END_SPONSORING_FUTURE_RESERVES), - "REVOKE_SPONSORSHIP": int32(REVOKE_SPONSORSHIP), - "CLAWBACK": int32(CLAWBACK), - "CLAWBACK_CLAIMABLE_BALANCE": int32(CLAWBACK_CLAIMABLE_BALANCE), - "SET_TRUST_LINE_FLAGS": int32(SET_TRUST_LINE_FLAGS), - "LIQUIDITY_POOL_DEPOSIT": int32(LIQUIDITY_POOL_DEPOSIT), - "LIQUIDITY_POOL_WITHDRAW": int32(LIQUIDITY_POOL_WITHDRAW), - "INVOKE_HOST_FUNCTION": int32(INVOKE_HOST_FUNCTION), - "EXTEND_FOOTPRINT_TTL": int32(EXTEND_FOOTPRINT_TTL), - "RESTORE_FOOTPRINT": int32(RESTORE_FOOTPRINT), +func (_XdrVec_25_PeerStats) XdrTypeName() string { return "PeerStats<>" } +func (v *_XdrVec_25_PeerStats) XdrPointer() interface{} { return (*[]PeerStats)(v) } +func (v _XdrVec_25_PeerStats) XdrValue() interface{} { return ([]PeerStats)(v) } +func (v *_XdrVec_25_PeerStats) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_PeerStatList struct { + *_XdrVec_25_PeerStats } -func (OperationType) XdrEnumNames() map[int32]string { - return _XdrNames_OperationType -} -func (v OperationType) String() string { - if s, ok := _XdrNames_OperationType[int32(v)]; ok { - return s - } - return fmt.Sprintf("OperationType#%d", v) -} -func (v *OperationType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_OperationType[stok]; ok { - *v = OperationType(val) - return nil - } else if stok == "OperationType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } - } - return XdrError(fmt.Sprintf("%s is not a valid OperationType.", stok)) - } +func XDR_PeerStatList(v *PeerStatList) XdrType_PeerStatList { + return XdrType_PeerStatList{(*_XdrVec_25_PeerStats)(v)} } -func (v OperationType) GetU32() uint32 { return uint32(v) } -func (v *OperationType) SetU32(n uint32) { *v = OperationType(n) } -func (v *OperationType) XdrPointer() interface{} { return v } -func (OperationType) XdrTypeName() string { return "OperationType" } -func (v OperationType) XdrValue() interface{} { return v } -func (v *OperationType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_OperationType = *OperationType - -func XDR_OperationType(v *OperationType) *OperationType { return v } +func (XdrType_PeerStatList) XdrTypeName() string { return "PeerStatList" } +func (v XdrType_PeerStatList) XdrUnwrap() XdrType { return v._XdrVec_25_PeerStats } -type XdrType_CreateAccountOp = *CreateAccountOp +type XdrType_TimeSlicedNodeData = *TimeSlicedNodeData -func (v *CreateAccountOp) XdrPointer() interface{} { return v } -func (CreateAccountOp) XdrTypeName() string { return "CreateAccountOp" } -func (v CreateAccountOp) XdrValue() interface{} { return v } -func (v *CreateAccountOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *CreateAccountOp) XdrRecurse(x XDR, name string) { +func (v *TimeSlicedNodeData) XdrPointer() interface{} { return v } +func (TimeSlicedNodeData) XdrTypeName() string { return "TimeSlicedNodeData" } +func (v TimeSlicedNodeData) XdrValue() interface{} { return v } +func (v *TimeSlicedNodeData) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedNodeData) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sdestination", name), XDR_AccountID(&v.Destination)) - x.Marshal(x.Sprintf("%sstartingBalance", name), XDR_Int64(&v.StartingBalance)) + x.Marshal(x.Sprintf("%saddedAuthenticatedPeers", name), XDR_Uint32(&v.AddedAuthenticatedPeers)) + x.Marshal(x.Sprintf("%sdroppedAuthenticatedPeers", name), XDR_Uint32(&v.DroppedAuthenticatedPeers)) + x.Marshal(x.Sprintf("%stotalInboundPeerCount", name), XDR_Uint32(&v.TotalInboundPeerCount)) + x.Marshal(x.Sprintf("%stotalOutboundPeerCount", name), XDR_Uint32(&v.TotalOutboundPeerCount)) + x.Marshal(x.Sprintf("%sp75SCPFirstToSelfLatencyMs", name), XDR_Uint32(&v.P75SCPFirstToSelfLatencyMs)) + x.Marshal(x.Sprintf("%sp75SCPSelfToOtherLatencyMs", name), XDR_Uint32(&v.P75SCPSelfToOtherLatencyMs)) + x.Marshal(x.Sprintf("%slostSyncCount", name), XDR_Uint32(&v.LostSyncCount)) + x.Marshal(x.Sprintf("%sisValidator", name), XDR_bool(&v.IsValidator)) + x.Marshal(x.Sprintf("%smaxInboundPeerCount", name), XDR_Uint32(&v.MaxInboundPeerCount)) + x.Marshal(x.Sprintf("%smaxOutboundPeerCount", name), XDR_Uint32(&v.MaxOutboundPeerCount)) } -func XDR_CreateAccountOp(v *CreateAccountOp) *CreateAccountOp { return v } +func XDR_TimeSlicedNodeData(v *TimeSlicedNodeData) *TimeSlicedNodeData { return v } -type XdrType_PaymentOp = *PaymentOp +type XdrType_TimeSlicedPeerData = *TimeSlicedPeerData -func (v *PaymentOp) XdrPointer() interface{} { return v } -func (PaymentOp) XdrTypeName() string { return "PaymentOp" } -func (v PaymentOp) XdrValue() interface{} { return v } -func (v *PaymentOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *PaymentOp) XdrRecurse(x XDR, name string) { +func (v *TimeSlicedPeerData) XdrPointer() interface{} { return v } +func (TimeSlicedPeerData) XdrTypeName() string { return "TimeSlicedPeerData" } +func (v TimeSlicedPeerData) XdrValue() interface{} { return v } +func (v *TimeSlicedPeerData) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedPeerData) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sdestination", name), XDR_MuxedAccount(&v.Destination)) - x.Marshal(x.Sprintf("%sasset", name), XDR_Asset(&v.Asset)) - x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) + x.Marshal(x.Sprintf("%speerStats", name), XDR_PeerStats(&v.PeerStats)) + x.Marshal(x.Sprintf("%saverageLatencyMs", name), XDR_Uint32(&v.AverageLatencyMs)) } -func XDR_PaymentOp(v *PaymentOp) *PaymentOp { return v } +func XDR_TimeSlicedPeerData(v *TimeSlicedPeerData) *TimeSlicedPeerData { return v } -type _XdrVec_5_Asset []Asset +type _XdrVec_25_TimeSlicedPeerData []TimeSlicedPeerData -func (_XdrVec_5_Asset) XdrBound() uint32 { - const bound uint32 = 5 // Force error if not const or doesn't fit +func (_XdrVec_25_TimeSlicedPeerData) XdrBound() uint32 { + const bound uint32 = 25 // Force error if not const or doesn't fit return bound } -func (_XdrVec_5_Asset) XdrCheckLen(length uint32) { - if length > uint32(5) { - XdrPanic("_XdrVec_5_Asset length %d exceeds bound 5", length) +func (_XdrVec_25_TimeSlicedPeerData) XdrCheckLen(length uint32) { + if length > uint32(25) { + XdrPanic("_XdrVec_25_TimeSlicedPeerData length %d exceeds bound 25", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_5_Asset length %d exceeds max int", length) + XdrPanic("_XdrVec_25_TimeSlicedPeerData length %d exceeds max int", length) } } -func (v _XdrVec_5_Asset) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_5_Asset) SetVecLen(length uint32) { +func (v _XdrVec_25_TimeSlicedPeerData) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_25_TimeSlicedPeerData) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -15433,1657 +14753,1387 @@ func (v *_XdrVec_5_Asset) SetVecLen(length uint32) { newcap := 2 * cap(*v) if newcap < int(length) { // also catches overflow where 2*cap < 0 newcap = int(length) - } else if bound := uint(5); uint(newcap) > bound { + } else if bound := uint(25); uint(newcap) > bound { if int(bound) < 0 { bound = ^uint(0) >> 1 } newcap = int(bound) } - nv := make([]Asset, int(length), newcap) + nv := make([]TimeSlicedPeerData, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_5_Asset) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_25_TimeSlicedPeerData) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_Asset(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_TimeSlicedPeerData(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_5_Asset) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 5} +func (v *_XdrVec_25_TimeSlicedPeerData) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 25} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_5_Asset) XdrTypeName() string { return "Asset<>" } -func (v *_XdrVec_5_Asset) XdrPointer() interface{} { return (*[]Asset)(v) } -func (v _XdrVec_5_Asset) XdrValue() interface{} { return ([]Asset)(v) } -func (v *_XdrVec_5_Asset) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (_XdrVec_25_TimeSlicedPeerData) XdrTypeName() string { return "TimeSlicedPeerData<>" } +func (v *_XdrVec_25_TimeSlicedPeerData) XdrPointer() interface{} { return (*[]TimeSlicedPeerData)(v) } +func (v _XdrVec_25_TimeSlicedPeerData) XdrValue() interface{} { return ([]TimeSlicedPeerData)(v) } +func (v *_XdrVec_25_TimeSlicedPeerData) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_PathPaymentStrictReceiveOp = *PathPaymentStrictReceiveOp +type XdrType_TimeSlicedPeerDataList struct { + *_XdrVec_25_TimeSlicedPeerData +} -func (v *PathPaymentStrictReceiveOp) XdrPointer() interface{} { return v } -func (PathPaymentStrictReceiveOp) XdrTypeName() string { return "PathPaymentStrictReceiveOp" } -func (v PathPaymentStrictReceiveOp) XdrValue() interface{} { return v } -func (v *PathPaymentStrictReceiveOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *PathPaymentStrictReceiveOp) XdrRecurse(x XDR, name string) { +func XDR_TimeSlicedPeerDataList(v *TimeSlicedPeerDataList) XdrType_TimeSlicedPeerDataList { + return XdrType_TimeSlicedPeerDataList{(*_XdrVec_25_TimeSlicedPeerData)(v)} +} +func (XdrType_TimeSlicedPeerDataList) XdrTypeName() string { return "TimeSlicedPeerDataList" } +func (v XdrType_TimeSlicedPeerDataList) XdrUnwrap() XdrType { return v._XdrVec_25_TimeSlicedPeerData } + +type XdrType_TopologyResponseBodyV0 = *TopologyResponseBodyV0 + +func (v *TopologyResponseBodyV0) XdrPointer() interface{} { return v } +func (TopologyResponseBodyV0) XdrTypeName() string { return "TopologyResponseBodyV0" } +func (v TopologyResponseBodyV0) XdrValue() interface{} { return v } +func (v *TopologyResponseBodyV0) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TopologyResponseBodyV0) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%ssendAsset", name), XDR_Asset(&v.SendAsset)) - x.Marshal(x.Sprintf("%ssendMax", name), XDR_Int64(&v.SendMax)) - x.Marshal(x.Sprintf("%sdestination", name), XDR_MuxedAccount(&v.Destination)) - x.Marshal(x.Sprintf("%sdestAsset", name), XDR_Asset(&v.DestAsset)) - x.Marshal(x.Sprintf("%sdestAmount", name), XDR_Int64(&v.DestAmount)) - x.Marshal(x.Sprintf("%spath", name), (*_XdrVec_5_Asset)(&v.Path)) -} -func XDR_PathPaymentStrictReceiveOp(v *PathPaymentStrictReceiveOp) *PathPaymentStrictReceiveOp { - return v -} - -type XdrType_PathPaymentStrictSendOp = *PathPaymentStrictSendOp - -func (v *PathPaymentStrictSendOp) XdrPointer() interface{} { return v } -func (PathPaymentStrictSendOp) XdrTypeName() string { return "PathPaymentStrictSendOp" } -func (v PathPaymentStrictSendOp) XdrValue() interface{} { return v } -func (v *PathPaymentStrictSendOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *PathPaymentStrictSendOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%ssendAsset", name), XDR_Asset(&v.SendAsset)) - x.Marshal(x.Sprintf("%ssendAmount", name), XDR_Int64(&v.SendAmount)) - x.Marshal(x.Sprintf("%sdestination", name), XDR_MuxedAccount(&v.Destination)) - x.Marshal(x.Sprintf("%sdestAsset", name), XDR_Asset(&v.DestAsset)) - x.Marshal(x.Sprintf("%sdestMin", name), XDR_Int64(&v.DestMin)) - x.Marshal(x.Sprintf("%spath", name), (*_XdrVec_5_Asset)(&v.Path)) -} -func XDR_PathPaymentStrictSendOp(v *PathPaymentStrictSendOp) *PathPaymentStrictSendOp { return v } - -type XdrType_ManageSellOfferOp = *ManageSellOfferOp - -func (v *ManageSellOfferOp) XdrPointer() interface{} { return v } -func (ManageSellOfferOp) XdrTypeName() string { return "ManageSellOfferOp" } -func (v ManageSellOfferOp) XdrValue() interface{} { return v } -func (v *ManageSellOfferOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ManageSellOfferOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sselling", name), XDR_Asset(&v.Selling)) - x.Marshal(x.Sprintf("%sbuying", name), XDR_Asset(&v.Buying)) - x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) - x.Marshal(x.Sprintf("%sprice", name), XDR_Price(&v.Price)) - x.Marshal(x.Sprintf("%sofferID", name), XDR_Int64(&v.OfferID)) + x.Marshal(x.Sprintf("%sinboundPeers", name), XDR_PeerStatList(&v.InboundPeers)) + x.Marshal(x.Sprintf("%soutboundPeers", name), XDR_PeerStatList(&v.OutboundPeers)) + x.Marshal(x.Sprintf("%stotalInboundPeerCount", name), XDR_Uint32(&v.TotalInboundPeerCount)) + x.Marshal(x.Sprintf("%stotalOutboundPeerCount", name), XDR_Uint32(&v.TotalOutboundPeerCount)) } -func XDR_ManageSellOfferOp(v *ManageSellOfferOp) *ManageSellOfferOp { return v } +func XDR_TopologyResponseBodyV0(v *TopologyResponseBodyV0) *TopologyResponseBodyV0 { return v } -type XdrType_ManageBuyOfferOp = *ManageBuyOfferOp +type XdrType_TopologyResponseBodyV1 = *TopologyResponseBodyV1 -func (v *ManageBuyOfferOp) XdrPointer() interface{} { return v } -func (ManageBuyOfferOp) XdrTypeName() string { return "ManageBuyOfferOp" } -func (v ManageBuyOfferOp) XdrValue() interface{} { return v } -func (v *ManageBuyOfferOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ManageBuyOfferOp) XdrRecurse(x XDR, name string) { +func (v *TopologyResponseBodyV1) XdrPointer() interface{} { return v } +func (TopologyResponseBodyV1) XdrTypeName() string { return "TopologyResponseBodyV1" } +func (v TopologyResponseBodyV1) XdrValue() interface{} { return v } +func (v *TopologyResponseBodyV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TopologyResponseBodyV1) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sselling", name), XDR_Asset(&v.Selling)) - x.Marshal(x.Sprintf("%sbuying", name), XDR_Asset(&v.Buying)) - x.Marshal(x.Sprintf("%sbuyAmount", name), XDR_Int64(&v.BuyAmount)) - x.Marshal(x.Sprintf("%sprice", name), XDR_Price(&v.Price)) - x.Marshal(x.Sprintf("%sofferID", name), XDR_Int64(&v.OfferID)) + x.Marshal(x.Sprintf("%sinboundPeers", name), XDR_PeerStatList(&v.InboundPeers)) + x.Marshal(x.Sprintf("%soutboundPeers", name), XDR_PeerStatList(&v.OutboundPeers)) + x.Marshal(x.Sprintf("%stotalInboundPeerCount", name), XDR_Uint32(&v.TotalInboundPeerCount)) + x.Marshal(x.Sprintf("%stotalOutboundPeerCount", name), XDR_Uint32(&v.TotalOutboundPeerCount)) + x.Marshal(x.Sprintf("%smaxInboundPeerCount", name), XDR_Uint32(&v.MaxInboundPeerCount)) + x.Marshal(x.Sprintf("%smaxOutboundPeerCount", name), XDR_Uint32(&v.MaxOutboundPeerCount)) } -func XDR_ManageBuyOfferOp(v *ManageBuyOfferOp) *ManageBuyOfferOp { return v } +func XDR_TopologyResponseBodyV1(v *TopologyResponseBodyV1) *TopologyResponseBodyV1 { return v } -type XdrType_CreatePassiveSellOfferOp = *CreatePassiveSellOfferOp +type XdrType_TopologyResponseBodyV2 = *TopologyResponseBodyV2 -func (v *CreatePassiveSellOfferOp) XdrPointer() interface{} { return v } -func (CreatePassiveSellOfferOp) XdrTypeName() string { return "CreatePassiveSellOfferOp" } -func (v CreatePassiveSellOfferOp) XdrValue() interface{} { return v } -func (v *CreatePassiveSellOfferOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *CreatePassiveSellOfferOp) XdrRecurse(x XDR, name string) { +func (v *TopologyResponseBodyV2) XdrPointer() interface{} { return v } +func (TopologyResponseBodyV2) XdrTypeName() string { return "TopologyResponseBodyV2" } +func (v TopologyResponseBodyV2) XdrValue() interface{} { return v } +func (v *TopologyResponseBodyV2) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TopologyResponseBodyV2) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sselling", name), XDR_Asset(&v.Selling)) - x.Marshal(x.Sprintf("%sbuying", name), XDR_Asset(&v.Buying)) - x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) - x.Marshal(x.Sprintf("%sprice", name), XDR_Price(&v.Price)) + x.Marshal(x.Sprintf("%sinboundPeers", name), XDR_TimeSlicedPeerDataList(&v.InboundPeers)) + x.Marshal(x.Sprintf("%soutboundPeers", name), XDR_TimeSlicedPeerDataList(&v.OutboundPeers)) + x.Marshal(x.Sprintf("%snodeData", name), XDR_TimeSlicedNodeData(&v.NodeData)) } -func XDR_CreatePassiveSellOfferOp(v *CreatePassiveSellOfferOp) *CreatePassiveSellOfferOp { return v } +func XDR_TopologyResponseBodyV2(v *TopologyResponseBodyV2) *TopologyResponseBodyV2 { return v } -type _XdrPtr_Uint32 struct { - p **Uint32 +var _XdrTags_SurveyResponseBody = map[int32]bool{ + XdrToI32(SURVEY_TOPOLOGY_RESPONSE_V0): true, + XdrToI32(SURVEY_TOPOLOGY_RESPONSE_V1): true, + XdrToI32(SURVEY_TOPOLOGY_RESPONSE_V2): true, } -type _ptrflag_Uint32 _XdrPtr_Uint32 -func (v _ptrflag_Uint32) String() string { - if *v.p == nil { - return "nil" - } - return "non-nil" +func (_ SurveyResponseBody) XdrValidTags() map[int32]bool { + return _XdrTags_SurveyResponseBody } -func (v _ptrflag_Uint32) Scan(ss fmt.ScanState, r rune) error { - tok, err := ss.Token(true, func(c rune) bool { - return c == '-' || (c >= 'a' && c <= 'z') - }) - if err != nil { - return err - } - switch string(tok) { - case "nil": - v.SetU32(0) - case "non-nil": - v.SetU32(1) +func (u *SurveyResponseBody) TopologyResponseBodyV0() *TopologyResponseBodyV0 { + switch u.Type { + case SURVEY_TOPOLOGY_RESPONSE_V0: + if v, ok := u._u.(*TopologyResponseBodyV0); ok { + return v + } else { + var zero TopologyResponseBodyV0 + u._u = &zero + return &zero + } default: - return XdrError("Uint32 flag should be \"nil\" or \"non-nil\"") - } - return nil -} -func (v _ptrflag_Uint32) GetU32() uint32 { - if *v.p == nil { - return 0 + XdrPanic("SurveyResponseBody.TopologyResponseBodyV0 accessed when Type == %v", u.Type) + return nil } - return 1 } -func (v _ptrflag_Uint32) SetU32(nv uint32) { - switch nv { - case 0: - *v.p = nil - case 1: - if *v.p == nil { - *v.p = new(Uint32) +func (u *SurveyResponseBody) TopologyResponseBodyV1() *TopologyResponseBodyV1 { + switch u.Type { + case SURVEY_TOPOLOGY_RESPONSE_V1: + if v, ok := u._u.(*TopologyResponseBodyV1); ok { + return v + } else { + var zero TopologyResponseBodyV1 + u._u = &zero + return &zero } default: - XdrPanic("*Uint32 present flag value %d should be 0 or 1", nv) + XdrPanic("SurveyResponseBody.TopologyResponseBodyV1 accessed when Type == %v", u.Type) + return nil } } -func (_ptrflag_Uint32) XdrTypeName() string { return "Uint32?" } -func (v _ptrflag_Uint32) XdrPointer() interface{} { return nil } -func (v _ptrflag_Uint32) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_Uint32) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_Uint32) XdrBound() uint32 { return 1 } -func (v _XdrPtr_Uint32) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_Uint32) SetPresent(present bool) { - if !present { - *v.p = nil - } else if *v.p == nil { - *v.p = new(Uint32) +func (u *SurveyResponseBody) TopologyResponseBodyV2() *TopologyResponseBodyV2 { + switch u.Type { + case SURVEY_TOPOLOGY_RESPONSE_V2: + if v, ok := u._u.(*TopologyResponseBodyV2); ok { + return v + } else { + var zero TopologyResponseBodyV2 + u._u = &zero + return &zero + } + default: + XdrPanic("SurveyResponseBody.TopologyResponseBodyV2 accessed when Type == %v", u.Type) + return nil } } -func (v _XdrPtr_Uint32) XdrMarshalValue(x XDR, name string) { - if *v.p != nil { - XDR_Uint32(*v.p).XdrMarshal(x, name) +func (u SurveyResponseBody) XdrValid() bool { + switch u.Type { + case SURVEY_TOPOLOGY_RESPONSE_V0, SURVEY_TOPOLOGY_RESPONSE_V1, SURVEY_TOPOLOGY_RESPONSE_V2: + return true } + return false } -func (v _XdrPtr_Uint32) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_Uint32) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_Uint32(v)) - v.XdrMarshalValue(x, name) -} -func (_XdrPtr_Uint32) XdrTypeName() string { return "Uint32*" } -func (v _XdrPtr_Uint32) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_Uint32) XdrValue() interface{} { return *v.p } - -type _XdrPtr_String32 struct { - p **String32 +func (u *SurveyResponseBody) XdrUnionTag() XdrNum32 { + return XDR_SurveyMessageResponseType(&u.Type) } -type _ptrflag_String32 _XdrPtr_String32 - -func (v _ptrflag_String32) String() string { - if *v.p == nil { - return "nil" - } - return "non-nil" +func (u *SurveyResponseBody) XdrUnionTagName() string { + return "Type" } -func (v _ptrflag_String32) Scan(ss fmt.ScanState, r rune) error { - tok, err := ss.Token(true, func(c rune) bool { - return c == '-' || (c >= 'a' && c <= 'z') - }) - if err != nil { - return err - } - switch string(tok) { - case "nil": - v.SetU32(0) - case "non-nil": - v.SetU32(1) - default: - return XdrError("String32 flag should be \"nil\" or \"non-nil\"") +func (u *SurveyResponseBody) XdrUnionBody() XdrType { + switch u.Type { + case SURVEY_TOPOLOGY_RESPONSE_V0: + return XDR_TopologyResponseBodyV0(u.TopologyResponseBodyV0()) + case SURVEY_TOPOLOGY_RESPONSE_V1: + return XDR_TopologyResponseBodyV1(u.TopologyResponseBodyV1()) + case SURVEY_TOPOLOGY_RESPONSE_V2: + return XDR_TopologyResponseBodyV2(u.TopologyResponseBodyV2()) } return nil } -func (v _ptrflag_String32) GetU32() uint32 { - if *v.p == nil { - return 0 +func (u *SurveyResponseBody) XdrUnionBodyName() string { + switch u.Type { + case SURVEY_TOPOLOGY_RESPONSE_V0: + return "TopologyResponseBodyV0" + case SURVEY_TOPOLOGY_RESPONSE_V1: + return "TopologyResponseBodyV1" + case SURVEY_TOPOLOGY_RESPONSE_V2: + return "TopologyResponseBodyV2" } - return 1 + return "" } -func (v _ptrflag_String32) SetU32(nv uint32) { - switch nv { - case 0: - *v.p = nil - case 1: - if *v.p == nil { - *v.p = new(String32) - } - default: - XdrPanic("*String32 present flag value %d should be 0 or 1", nv) - } -} -func (_ptrflag_String32) XdrTypeName() string { return "String32?" } -func (v _ptrflag_String32) XdrPointer() interface{} { return nil } -func (v _ptrflag_String32) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_String32) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_String32) XdrBound() uint32 { return 1 } -func (v _XdrPtr_String32) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_String32) SetPresent(present bool) { - if !present { - *v.p = nil - } else if *v.p == nil { - *v.p = new(String32) + +type XdrType_SurveyResponseBody = *SurveyResponseBody + +func (v *SurveyResponseBody) XdrPointer() interface{} { return v } +func (SurveyResponseBody) XdrTypeName() string { return "SurveyResponseBody" } +func (v SurveyResponseBody) XdrValue() interface{} { return v } +func (v *SurveyResponseBody) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *SurveyResponseBody) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } -} -func (v _XdrPtr_String32) XdrMarshalValue(x XDR, name string) { - if *v.p != nil { - XDR_String32(*v.p).XdrMarshal(x, name) + XDR_SurveyMessageResponseType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case SURVEY_TOPOLOGY_RESPONSE_V0: + x.Marshal(x.Sprintf("%stopologyResponseBodyV0", name), XDR_TopologyResponseBodyV0(u.TopologyResponseBodyV0())) + return + case SURVEY_TOPOLOGY_RESPONSE_V1: + x.Marshal(x.Sprintf("%stopologyResponseBodyV1", name), XDR_TopologyResponseBodyV1(u.TopologyResponseBodyV1())) + return + case SURVEY_TOPOLOGY_RESPONSE_V2: + x.Marshal(x.Sprintf("%stopologyResponseBodyV2", name), XDR_TopologyResponseBodyV2(u.TopologyResponseBodyV2())) + return } + XdrPanic("invalid Type (%v) in SurveyResponseBody", u.Type) } -func (v _XdrPtr_String32) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_String32) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_String32(v)) - v.XdrMarshalValue(x, name) -} -func (_XdrPtr_String32) XdrTypeName() string { return "String32*" } -func (v _XdrPtr_String32) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_String32) XdrValue() interface{} { return *v.p } +func XDR_SurveyResponseBody(v *SurveyResponseBody) *SurveyResponseBody { return v } -type _XdrPtr_Signer struct { - p **Signer -} -type _ptrflag_Signer _XdrPtr_Signer +type _XdrVec_1000_Hash []Hash -func (v _ptrflag_Signer) String() string { - if *v.p == nil { - return "nil" - } - return "non-nil" +func (_XdrVec_1000_Hash) XdrBound() uint32 { + const bound uint32 = 1000 // Force error if not const or doesn't fit + return bound } -func (v _ptrflag_Signer) Scan(ss fmt.ScanState, r rune) error { - tok, err := ss.Token(true, func(c rune) bool { - return c == '-' || (c >= 'a' && c <= 'z') - }) - if err != nil { - return err - } - switch string(tok) { - case "nil": - v.SetU32(0) - case "non-nil": - v.SetU32(1) - default: - return XdrError("Signer flag should be \"nil\" or \"non-nil\"") +func (_XdrVec_1000_Hash) XdrCheckLen(length uint32) { + if length > uint32(1000) { + XdrPanic("_XdrVec_1000_Hash length %d exceeds bound 1000", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_1000_Hash length %d exceeds max int", length) } - return nil } -func (v _ptrflag_Signer) GetU32() uint32 { - if *v.p == nil { - return 0 +func (v _XdrVec_1000_Hash) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_1000_Hash) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] + } + return } - return 1 -} -func (v _ptrflag_Signer) SetU32(nv uint32) { - switch nv { - case 0: - *v.p = nil - case 1: - if *v.p == nil { - *v.p = new(Signer) + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(1000); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 } - default: - XdrPanic("*Signer present flag value %d should be 0 or 1", nv) + newcap = int(bound) } + nv := make([]Hash, int(length), newcap) + copy(nv, *v) + *v = nv } -func (_ptrflag_Signer) XdrTypeName() string { return "Signer?" } -func (v _ptrflag_Signer) XdrPointer() interface{} { return nil } -func (v _ptrflag_Signer) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_Signer) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_Signer) XdrBound() uint32 { return 1 } -func (v _XdrPtr_Signer) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_Signer) SetPresent(present bool) { - if !present { - *v.p = nil - } else if *v.p == nil { - *v.p = new(Signer) +func (v *_XdrVec_1000_Hash) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_Hash(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } -} -func (v _XdrPtr_Signer) XdrMarshalValue(x XDR, name string) { - if *v.p != nil { - XDR_Signer(*v.p).XdrMarshal(x, name) + if int(n) < len(*v) { + *v = (*v)[:int(n)] } } -func (v _XdrPtr_Signer) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_Signer) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_Signer(v)) - v.XdrMarshalValue(x, name) +func (v *_XdrVec_1000_Hash) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 1000} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } -func (_XdrPtr_Signer) XdrTypeName() string { return "Signer*" } -func (v _XdrPtr_Signer) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_Signer) XdrValue() interface{} { return *v.p } +func (_XdrVec_1000_Hash) XdrTypeName() string { return "Hash<>" } +func (v *_XdrVec_1000_Hash) XdrPointer() interface{} { return (*[]Hash)(v) } +func (v _XdrVec_1000_Hash) XdrValue() interface{} { return ([]Hash)(v) } +func (v *_XdrVec_1000_Hash) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_SetOptionsOp = *SetOptionsOp +type XdrType_TxAdvertVector struct { + *_XdrVec_1000_Hash +} -func (v *SetOptionsOp) XdrPointer() interface{} { return v } -func (SetOptionsOp) XdrTypeName() string { return "SetOptionsOp" } -func (v SetOptionsOp) XdrValue() interface{} { return v } -func (v *SetOptionsOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SetOptionsOp) XdrRecurse(x XDR, name string) { +func XDR_TxAdvertVector(v *TxAdvertVector) XdrType_TxAdvertVector { + return XdrType_TxAdvertVector{(*_XdrVec_1000_Hash)(v)} +} +func (XdrType_TxAdvertVector) XdrTypeName() string { return "TxAdvertVector" } +func (v XdrType_TxAdvertVector) XdrUnwrap() XdrType { return v._XdrVec_1000_Hash } + +type XdrType_FloodAdvert = *FloodAdvert + +func (v *FloodAdvert) XdrPointer() interface{} { return v } +func (FloodAdvert) XdrTypeName() string { return "FloodAdvert" } +func (v FloodAdvert) XdrValue() interface{} { return v } +func (v *FloodAdvert) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *FloodAdvert) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sinflationDest", name), _XdrPtr_AccountID{&v.InflationDest}) - x.Marshal(x.Sprintf("%sclearFlags", name), _XdrPtr_Uint32{&v.ClearFlags}) - x.Marshal(x.Sprintf("%ssetFlags", name), _XdrPtr_Uint32{&v.SetFlags}) - x.Marshal(x.Sprintf("%smasterWeight", name), _XdrPtr_Uint32{&v.MasterWeight}) - x.Marshal(x.Sprintf("%slowThreshold", name), _XdrPtr_Uint32{&v.LowThreshold}) - x.Marshal(x.Sprintf("%smedThreshold", name), _XdrPtr_Uint32{&v.MedThreshold}) - x.Marshal(x.Sprintf("%shighThreshold", name), _XdrPtr_Uint32{&v.HighThreshold}) - x.Marshal(x.Sprintf("%shomeDomain", name), _XdrPtr_String32{&v.HomeDomain}) - x.Marshal(x.Sprintf("%ssigner", name), _XdrPtr_Signer{&v.Signer}) + x.Marshal(x.Sprintf("%stxHashes", name), XDR_TxAdvertVector(&v.TxHashes)) } -func XDR_SetOptionsOp(v *SetOptionsOp) *SetOptionsOp { return v } +func XDR_FloodAdvert(v *FloodAdvert) *FloodAdvert { return v } -var _XdrTags_ChangeTrustAsset = map[int32]bool{ - XdrToI32(ASSET_TYPE_NATIVE): true, - XdrToI32(ASSET_TYPE_CREDIT_ALPHANUM4): true, - XdrToI32(ASSET_TYPE_CREDIT_ALPHANUM12): true, - XdrToI32(ASSET_TYPE_POOL_SHARE): true, +type XdrType_TxDemandVector struct { + *_XdrVec_1000_Hash } -func (_ ChangeTrustAsset) XdrValidTags() map[int32]bool { - return _XdrTags_ChangeTrustAsset +func XDR_TxDemandVector(v *TxDemandVector) XdrType_TxDemandVector { + return XdrType_TxDemandVector{(*_XdrVec_1000_Hash)(v)} } -func (u *ChangeTrustAsset) AlphaNum4() *AlphaNum4 { - switch u.Type { - case ASSET_TYPE_CREDIT_ALPHANUM4: - if v, ok := u._u.(*AlphaNum4); ok { - return v - } else { - var zero AlphaNum4 - u._u = &zero - return &zero - } - default: - XdrPanic("ChangeTrustAsset.AlphaNum4 accessed when Type == %v", u.Type) - return nil +func (XdrType_TxDemandVector) XdrTypeName() string { return "TxDemandVector" } +func (v XdrType_TxDemandVector) XdrUnwrap() XdrType { return v._XdrVec_1000_Hash } + +type XdrType_FloodDemand = *FloodDemand + +func (v *FloodDemand) XdrPointer() interface{} { return v } +func (FloodDemand) XdrTypeName() string { return "FloodDemand" } +func (v FloodDemand) XdrValue() interface{} { return v } +func (v *FloodDemand) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *FloodDemand) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%stxHashes", name), XDR_TxDemandVector(&v.TxHashes)) } -func (u *ChangeTrustAsset) AlphaNum12() *AlphaNum12 { - switch u.Type { - case ASSET_TYPE_CREDIT_ALPHANUM12: - if v, ok := u._u.(*AlphaNum12); ok { - return v - } else { - var zero AlphaNum12 - u._u = &zero - return &zero - } - default: - XdrPanic("ChangeTrustAsset.AlphaNum12 accessed when Type == %v", u.Type) - return nil +func XDR_FloodDemand(v *FloodDemand) *FloodDemand { return v } + +type _XdrVec_100_PeerAddress []PeerAddress + +func (_XdrVec_100_PeerAddress) XdrBound() uint32 { + const bound uint32 = 100 // Force error if not const or doesn't fit + return bound +} +func (_XdrVec_100_PeerAddress) XdrCheckLen(length uint32) { + if length > uint32(100) { + XdrPanic("_XdrVec_100_PeerAddress length %d exceeds bound 100", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_100_PeerAddress length %d exceeds max int", length) } } -func (u *ChangeTrustAsset) LiquidityPool() *LiquidityPoolParameters { - switch u.Type { - case ASSET_TYPE_POOL_SHARE: - if v, ok := u._u.(*LiquidityPoolParameters); ok { +func (v _XdrVec_100_PeerAddress) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_100_PeerAddress) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] + } + return + } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(100); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) + } + nv := make([]PeerAddress, int(length), newcap) + copy(nv, *v) + *v = nv +} +func (v *_XdrVec_100_PeerAddress) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_PeerAddress(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] + } +} +func (v *_XdrVec_100_PeerAddress) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 100} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) +} +func (_XdrVec_100_PeerAddress) XdrTypeName() string { return "PeerAddress<>" } +func (v *_XdrVec_100_PeerAddress) XdrPointer() interface{} { return (*[]PeerAddress)(v) } +func (v _XdrVec_100_PeerAddress) XdrValue() interface{} { return ([]PeerAddress)(v) } +func (v *_XdrVec_100_PeerAddress) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +var _XdrTags_StellarMessage = map[int32]bool{ + XdrToI32(ERROR_MSG): true, + XdrToI32(HELLO): true, + XdrToI32(AUTH): true, + XdrToI32(DONT_HAVE): true, + XdrToI32(GET_PEERS): true, + XdrToI32(PEERS): true, + XdrToI32(GET_TX_SET): true, + XdrToI32(TX_SET): true, + XdrToI32(GENERALIZED_TX_SET): true, + XdrToI32(TRANSACTION): true, + XdrToI32(SURVEY_REQUEST): true, + XdrToI32(SURVEY_RESPONSE): true, + XdrToI32(TIME_SLICED_SURVEY_REQUEST): true, + XdrToI32(TIME_SLICED_SURVEY_RESPONSE): true, + XdrToI32(TIME_SLICED_SURVEY_START_COLLECTING): true, + XdrToI32(TIME_SLICED_SURVEY_STOP_COLLECTING): true, + XdrToI32(GET_SCP_QUORUMSET): true, + XdrToI32(SCP_QUORUMSET): true, + XdrToI32(SCP_MESSAGE): true, + XdrToI32(GET_SCP_STATE): true, + XdrToI32(SEND_MORE): true, + XdrToI32(SEND_MORE_EXTENDED): true, + XdrToI32(FLOOD_ADVERT): true, + XdrToI32(FLOOD_DEMAND): true, +} + +func (_ StellarMessage) XdrValidTags() map[int32]bool { + return _XdrTags_StellarMessage +} +func (u *StellarMessage) Error() *Error { + switch u.Type { + case ERROR_MSG: + if v, ok := u._u.(*Error); ok { return v } else { - var zero LiquidityPoolParameters + var zero Error u._u = &zero return &zero } default: - XdrPanic("ChangeTrustAsset.LiquidityPool accessed when Type == %v", u.Type) + XdrPanic("StellarMessage.Error accessed when Type == %v", u.Type) return nil } } -func (u ChangeTrustAsset) XdrValid() bool { +func (u *StellarMessage) Hello() *Hello { switch u.Type { - case ASSET_TYPE_NATIVE, ASSET_TYPE_CREDIT_ALPHANUM4, ASSET_TYPE_CREDIT_ALPHANUM12, ASSET_TYPE_POOL_SHARE: - return true + case HELLO: + if v, ok := u._u.(*Hello); ok { + return v + } else { + var zero Hello + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.Hello accessed when Type == %v", u.Type) + return nil } - return false -} -func (u *ChangeTrustAsset) XdrUnionTag() XdrNum32 { - return XDR_AssetType(&u.Type) -} -func (u *ChangeTrustAsset) XdrUnionTagName() string { - return "Type" } -func (u *ChangeTrustAsset) XdrUnionBody() XdrType { +func (u *StellarMessage) Auth() *Auth { switch u.Type { - case ASSET_TYPE_NATIVE: + case AUTH: + if v, ok := u._u.(*Auth); ok { + return v + } else { + var zero Auth + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.Auth accessed when Type == %v", u.Type) return nil - case ASSET_TYPE_CREDIT_ALPHANUM4: - return XDR_AlphaNum4(u.AlphaNum4()) - case ASSET_TYPE_CREDIT_ALPHANUM12: - return XDR_AlphaNum12(u.AlphaNum12()) - case ASSET_TYPE_POOL_SHARE: - return XDR_LiquidityPoolParameters(u.LiquidityPool()) } - return nil } -func (u *ChangeTrustAsset) XdrUnionBodyName() string { +func (u *StellarMessage) DontHave() *DontHave { switch u.Type { - case ASSET_TYPE_NATIVE: - return "" - case ASSET_TYPE_CREDIT_ALPHANUM4: - return "AlphaNum4" - case ASSET_TYPE_CREDIT_ALPHANUM12: - return "AlphaNum12" - case ASSET_TYPE_POOL_SHARE: - return "LiquidityPool" + case DONT_HAVE: + if v, ok := u._u.(*DontHave); ok { + return v + } else { + var zero DontHave + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.DontHave accessed when Type == %v", u.Type) + return nil } - return "" } - -type XdrType_ChangeTrustAsset = *ChangeTrustAsset - -func (v *ChangeTrustAsset) XdrPointer() interface{} { return v } -func (ChangeTrustAsset) XdrTypeName() string { return "ChangeTrustAsset" } -func (v ChangeTrustAsset) XdrValue() interface{} { return v } -func (v *ChangeTrustAsset) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *ChangeTrustAsset) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - XDR_AssetType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) +func (u *StellarMessage) Peers() *[]PeerAddress { switch u.Type { - case ASSET_TYPE_NATIVE: - return - case ASSET_TYPE_CREDIT_ALPHANUM4: - x.Marshal(x.Sprintf("%salphaNum4", name), XDR_AlphaNum4(u.AlphaNum4())) - return - case ASSET_TYPE_CREDIT_ALPHANUM12: - x.Marshal(x.Sprintf("%salphaNum12", name), XDR_AlphaNum12(u.AlphaNum12())) - return - case ASSET_TYPE_POOL_SHARE: - x.Marshal(x.Sprintf("%sliquidityPool", name), XDR_LiquidityPoolParameters(u.LiquidityPool())) - return + case PEERS: + if v, ok := u._u.(*[]PeerAddress); ok { + return v + } else { + var zero []PeerAddress + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.Peers accessed when Type == %v", u.Type) + return nil } - XdrPanic("invalid Type (%v) in ChangeTrustAsset", u.Type) } -func XDR_ChangeTrustAsset(v *ChangeTrustAsset) *ChangeTrustAsset { return v } - -type XdrType_ChangeTrustOp = *ChangeTrustOp - -func (v *ChangeTrustOp) XdrPointer() interface{} { return v } -func (ChangeTrustOp) XdrTypeName() string { return "ChangeTrustOp" } -func (v ChangeTrustOp) XdrValue() interface{} { return v } -func (v *ChangeTrustOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ChangeTrustOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (u *StellarMessage) TxSetHash() *Uint256 { + switch u.Type { + case GET_TX_SET: + if v, ok := u._u.(*Uint256); ok { + return v + } else { + var zero Uint256 + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.TxSetHash accessed when Type == %v", u.Type) + return nil } - x.Marshal(x.Sprintf("%sline", name), XDR_ChangeTrustAsset(&v.Line)) - x.Marshal(x.Sprintf("%slimit", name), XDR_Int64(&v.Limit)) } -func XDR_ChangeTrustOp(v *ChangeTrustOp) *ChangeTrustOp { return v } - -type XdrType_AllowTrustOp = *AllowTrustOp - -func (v *AllowTrustOp) XdrPointer() interface{} { return v } -func (AllowTrustOp) XdrTypeName() string { return "AllowTrustOp" } -func (v AllowTrustOp) XdrValue() interface{} { return v } -func (v *AllowTrustOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *AllowTrustOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (u *StellarMessage) TxSet() *TransactionSet { + switch u.Type { + case TX_SET: + if v, ok := u._u.(*TransactionSet); ok { + return v + } else { + var zero TransactionSet + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.TxSet accessed when Type == %v", u.Type) + return nil } - x.Marshal(x.Sprintf("%strustor", name), XDR_AccountID(&v.Trustor)) - x.Marshal(x.Sprintf("%sasset", name), XDR_AssetCode(&v.Asset)) - x.Marshal(x.Sprintf("%sauthorize", name), XDR_Uint32(&v.Authorize)) } -func XDR_AllowTrustOp(v *AllowTrustOp) *AllowTrustOp { return v } - -type _XdrPtr_DataValue struct { - p **DataValue +func (u *StellarMessage) GeneralizedTxSet() *GeneralizedTransactionSet { + switch u.Type { + case GENERALIZED_TX_SET: + if v, ok := u._u.(*GeneralizedTransactionSet); ok { + return v + } else { + var zero GeneralizedTransactionSet + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.GeneralizedTxSet accessed when Type == %v", u.Type) + return nil + } } -type _ptrflag_DataValue _XdrPtr_DataValue - -func (v _ptrflag_DataValue) String() string { - if *v.p == nil { - return "nil" - } - return "non-nil" -} -func (v _ptrflag_DataValue) Scan(ss fmt.ScanState, r rune) error { - tok, err := ss.Token(true, func(c rune) bool { - return c == '-' || (c >= 'a' && c <= 'z') - }) - if err != nil { - return err - } - switch string(tok) { - case "nil": - v.SetU32(0) - case "non-nil": - v.SetU32(1) - default: - return XdrError("DataValue flag should be \"nil\" or \"non-nil\"") - } - return nil -} -func (v _ptrflag_DataValue) GetU32() uint32 { - if *v.p == nil { - return 0 - } - return 1 -} -func (v _ptrflag_DataValue) SetU32(nv uint32) { - switch nv { - case 0: - *v.p = nil - case 1: - if *v.p == nil { - *v.p = new(DataValue) +func (u *StellarMessage) Transaction() *TransactionEnvelope { + switch u.Type { + case TRANSACTION: + if v, ok := u._u.(*TransactionEnvelope); ok { + return v + } else { + var zero TransactionEnvelope + u._u = &zero + return &zero } default: - XdrPanic("*DataValue present flag value %d should be 0 or 1", nv) - } -} -func (_ptrflag_DataValue) XdrTypeName() string { return "DataValue?" } -func (v _ptrflag_DataValue) XdrPointer() interface{} { return nil } -func (v _ptrflag_DataValue) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_DataValue) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_DataValue) XdrBound() uint32 { return 1 } -func (v _XdrPtr_DataValue) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_DataValue) SetPresent(present bool) { - if !present { - *v.p = nil - } else if *v.p == nil { - *v.p = new(DataValue) - } -} -func (v _XdrPtr_DataValue) XdrMarshalValue(x XDR, name string) { - if *v.p != nil { - XDR_DataValue(*v.p).XdrMarshal(x, name) - } -} -func (v _XdrPtr_DataValue) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_DataValue) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_DataValue(v)) - v.XdrMarshalValue(x, name) -} -func (_XdrPtr_DataValue) XdrTypeName() string { return "DataValue*" } -func (v _XdrPtr_DataValue) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_DataValue) XdrValue() interface{} { return *v.p } - -type XdrType_ManageDataOp = *ManageDataOp - -func (v *ManageDataOp) XdrPointer() interface{} { return v } -func (ManageDataOp) XdrTypeName() string { return "ManageDataOp" } -func (v ManageDataOp) XdrValue() interface{} { return v } -func (v *ManageDataOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ManageDataOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sdataName", name), XDR_String64(&v.DataName)) - x.Marshal(x.Sprintf("%sdataValue", name), _XdrPtr_DataValue{&v.DataValue}) -} -func XDR_ManageDataOp(v *ManageDataOp) *ManageDataOp { return v } - -type XdrType_BumpSequenceOp = *BumpSequenceOp - -func (v *BumpSequenceOp) XdrPointer() interface{} { return v } -func (BumpSequenceOp) XdrTypeName() string { return "BumpSequenceOp" } -func (v BumpSequenceOp) XdrValue() interface{} { return v } -func (v *BumpSequenceOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *BumpSequenceOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sbumpTo", name), XDR_SequenceNumber(&v.BumpTo)) -} -func XDR_BumpSequenceOp(v *BumpSequenceOp) *BumpSequenceOp { return v } - -type XdrType_CreateClaimableBalanceOp = *CreateClaimableBalanceOp - -func (v *CreateClaimableBalanceOp) XdrPointer() interface{} { return v } -func (CreateClaimableBalanceOp) XdrTypeName() string { return "CreateClaimableBalanceOp" } -func (v CreateClaimableBalanceOp) XdrValue() interface{} { return v } -func (v *CreateClaimableBalanceOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *CreateClaimableBalanceOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sasset", name), XDR_Asset(&v.Asset)) - x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) - x.Marshal(x.Sprintf("%sclaimants", name), (*_XdrVec_10_Claimant)(&v.Claimants)) -} -func XDR_CreateClaimableBalanceOp(v *CreateClaimableBalanceOp) *CreateClaimableBalanceOp { return v } - -type XdrType_ClaimClaimableBalanceOp = *ClaimClaimableBalanceOp - -func (v *ClaimClaimableBalanceOp) XdrPointer() interface{} { return v } -func (ClaimClaimableBalanceOp) XdrTypeName() string { return "ClaimClaimableBalanceOp" } -func (v ClaimClaimableBalanceOp) XdrValue() interface{} { return v } -func (v *ClaimClaimableBalanceOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ClaimClaimableBalanceOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sbalanceID", name), XDR_ClaimableBalanceID(&v.BalanceID)) -} -func XDR_ClaimClaimableBalanceOp(v *ClaimClaimableBalanceOp) *ClaimClaimableBalanceOp { return v } - -type XdrType_BeginSponsoringFutureReservesOp = *BeginSponsoringFutureReservesOp - -func (v *BeginSponsoringFutureReservesOp) XdrPointer() interface{} { return v } -func (BeginSponsoringFutureReservesOp) XdrTypeName() string { return "BeginSponsoringFutureReservesOp" } -func (v BeginSponsoringFutureReservesOp) XdrValue() interface{} { return v } -func (v *BeginSponsoringFutureReservesOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *BeginSponsoringFutureReservesOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%ssponsoredID", name), XDR_AccountID(&v.SponsoredID)) -} -func XDR_BeginSponsoringFutureReservesOp(v *BeginSponsoringFutureReservesOp) *BeginSponsoringFutureReservesOp { - return v -} - -var _XdrNames_RevokeSponsorshipType = map[int32]string{ - int32(REVOKE_SPONSORSHIP_LEDGER_ENTRY): "REVOKE_SPONSORSHIP_LEDGER_ENTRY", - int32(REVOKE_SPONSORSHIP_SIGNER): "REVOKE_SPONSORSHIP_SIGNER", -} -var _XdrValues_RevokeSponsorshipType = map[string]int32{ - "REVOKE_SPONSORSHIP_LEDGER_ENTRY": int32(REVOKE_SPONSORSHIP_LEDGER_ENTRY), - "REVOKE_SPONSORSHIP_SIGNER": int32(REVOKE_SPONSORSHIP_SIGNER), -} - -func (RevokeSponsorshipType) XdrEnumNames() map[int32]string { - return _XdrNames_RevokeSponsorshipType -} -func (v RevokeSponsorshipType) String() string { - if s, ok := _XdrNames_RevokeSponsorshipType[int32(v)]; ok { - return s + XdrPanic("StellarMessage.Transaction accessed when Type == %v", u.Type) + return nil } - return fmt.Sprintf("RevokeSponsorshipType#%d", v) } -func (v *RevokeSponsorshipType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_RevokeSponsorshipType[stok]; ok { - *v = RevokeSponsorshipType(val) - return nil - } else if stok == "RevokeSponsorshipType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } +func (u *StellarMessage) SignedSurveyRequestMessage() *SignedSurveyRequestMessage { + switch u.Type { + case SURVEY_REQUEST: + if v, ok := u._u.(*SignedSurveyRequestMessage); ok { + return v + } else { + var zero SignedSurveyRequestMessage + u._u = &zero + return &zero } - return XdrError(fmt.Sprintf("%s is not a valid RevokeSponsorshipType.", stok)) - } -} -func (v RevokeSponsorshipType) GetU32() uint32 { return uint32(v) } -func (v *RevokeSponsorshipType) SetU32(n uint32) { *v = RevokeSponsorshipType(n) } -func (v *RevokeSponsorshipType) XdrPointer() interface{} { return v } -func (RevokeSponsorshipType) XdrTypeName() string { return "RevokeSponsorshipType" } -func (v RevokeSponsorshipType) XdrValue() interface{} { return v } -func (v *RevokeSponsorshipType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_RevokeSponsorshipType = *RevokeSponsorshipType - -func XDR_RevokeSponsorshipType(v *RevokeSponsorshipType) *RevokeSponsorshipType { return v } - -type XdrType_XdrAnon_RevokeSponsorshipOp_Signer = *XdrAnon_RevokeSponsorshipOp_Signer - -func (v *XdrAnon_RevokeSponsorshipOp_Signer) XdrPointer() interface{} { return v } -func (XdrAnon_RevokeSponsorshipOp_Signer) XdrTypeName() string { - return "XdrAnon_RevokeSponsorshipOp_Signer" -} -func (v XdrAnon_RevokeSponsorshipOp_Signer) XdrValue() interface{} { return v } -func (v *XdrAnon_RevokeSponsorshipOp_Signer) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *XdrAnon_RevokeSponsorshipOp_Signer) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) + default: + XdrPanic("StellarMessage.SignedSurveyRequestMessage accessed when Type == %v", u.Type) + return nil } - x.Marshal(x.Sprintf("%saccountID", name), XDR_AccountID(&v.AccountID)) - x.Marshal(x.Sprintf("%ssignerKey", name), XDR_SignerKey(&v.SignerKey)) -} -func XDR_XdrAnon_RevokeSponsorshipOp_Signer(v *XdrAnon_RevokeSponsorshipOp_Signer) *XdrAnon_RevokeSponsorshipOp_Signer { - return v -} - -var _XdrTags_RevokeSponsorshipOp = map[int32]bool{ - XdrToI32(REVOKE_SPONSORSHIP_LEDGER_ENTRY): true, - XdrToI32(REVOKE_SPONSORSHIP_SIGNER): true, -} - -func (_ RevokeSponsorshipOp) XdrValidTags() map[int32]bool { - return _XdrTags_RevokeSponsorshipOp } -func (u *RevokeSponsorshipOp) LedgerKey() *LedgerKey { +func (u *StellarMessage) SignedSurveyResponseMessage() *SignedSurveyResponseMessage { switch u.Type { - case REVOKE_SPONSORSHIP_LEDGER_ENTRY: - if v, ok := u._u.(*LedgerKey); ok { + case SURVEY_RESPONSE: + if v, ok := u._u.(*SignedSurveyResponseMessage); ok { return v } else { - var zero LedgerKey + var zero SignedSurveyResponseMessage u._u = &zero return &zero } default: - XdrPanic("RevokeSponsorshipOp.LedgerKey accessed when Type == %v", u.Type) + XdrPanic("StellarMessage.SignedSurveyResponseMessage accessed when Type == %v", u.Type) return nil } } -func (u *RevokeSponsorshipOp) Signer() *XdrAnon_RevokeSponsorshipOp_Signer { +func (u *StellarMessage) SignedTimeSlicedSurveyRequestMessage() *SignedTimeSlicedSurveyRequestMessage { switch u.Type { - case REVOKE_SPONSORSHIP_SIGNER: - if v, ok := u._u.(*XdrAnon_RevokeSponsorshipOp_Signer); ok { + case TIME_SLICED_SURVEY_REQUEST: + if v, ok := u._u.(*SignedTimeSlicedSurveyRequestMessage); ok { return v } else { - var zero XdrAnon_RevokeSponsorshipOp_Signer + var zero SignedTimeSlicedSurveyRequestMessage u._u = &zero return &zero } default: - XdrPanic("RevokeSponsorshipOp.Signer accessed when Type == %v", u.Type) + XdrPanic("StellarMessage.SignedTimeSlicedSurveyRequestMessage accessed when Type == %v", u.Type) return nil } } -func (u RevokeSponsorshipOp) XdrValid() bool { +func (u *StellarMessage) SignedTimeSlicedSurveyResponseMessage() *SignedTimeSlicedSurveyResponseMessage { switch u.Type { - case REVOKE_SPONSORSHIP_LEDGER_ENTRY, REVOKE_SPONSORSHIP_SIGNER: - return true - } - return false -} -func (u *RevokeSponsorshipOp) XdrUnionTag() XdrNum32 { - return XDR_RevokeSponsorshipType(&u.Type) + case TIME_SLICED_SURVEY_RESPONSE: + if v, ok := u._u.(*SignedTimeSlicedSurveyResponseMessage); ok { + return v + } else { + var zero SignedTimeSlicedSurveyResponseMessage + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.SignedTimeSlicedSurveyResponseMessage accessed when Type == %v", u.Type) + return nil + } } -func (u *RevokeSponsorshipOp) XdrUnionTagName() string { - return "Type" +func (u *StellarMessage) SignedTimeSlicedSurveyStartCollectingMessage() *SignedTimeSlicedSurveyStartCollectingMessage { + switch u.Type { + case TIME_SLICED_SURVEY_START_COLLECTING: + if v, ok := u._u.(*SignedTimeSlicedSurveyStartCollectingMessage); ok { + return v + } else { + var zero SignedTimeSlicedSurveyStartCollectingMessage + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.SignedTimeSlicedSurveyStartCollectingMessage accessed when Type == %v", u.Type) + return nil + } } -func (u *RevokeSponsorshipOp) XdrUnionBody() XdrType { +func (u *StellarMessage) SignedTimeSlicedSurveyStopCollectingMessage() *SignedTimeSlicedSurveyStopCollectingMessage { switch u.Type { - case REVOKE_SPONSORSHIP_LEDGER_ENTRY: - return XDR_LedgerKey(u.LedgerKey()) - case REVOKE_SPONSORSHIP_SIGNER: - return XDR_XdrAnon_RevokeSponsorshipOp_Signer(u.Signer()) + case TIME_SLICED_SURVEY_STOP_COLLECTING: + if v, ok := u._u.(*SignedTimeSlicedSurveyStopCollectingMessage); ok { + return v + } else { + var zero SignedTimeSlicedSurveyStopCollectingMessage + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.SignedTimeSlicedSurveyStopCollectingMessage accessed when Type == %v", u.Type) + return nil } - return nil } -func (u *RevokeSponsorshipOp) XdrUnionBodyName() string { +func (u *StellarMessage) QSetHash() *Uint256 { switch u.Type { - case REVOKE_SPONSORSHIP_LEDGER_ENTRY: - return "LedgerKey" - case REVOKE_SPONSORSHIP_SIGNER: - return "Signer" + case GET_SCP_QUORUMSET: + if v, ok := u._u.(*Uint256); ok { + return v + } else { + var zero Uint256 + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.QSetHash accessed when Type == %v", u.Type) + return nil } - return "" } - -type XdrType_RevokeSponsorshipOp = *RevokeSponsorshipOp - -func (v *RevokeSponsorshipOp) XdrPointer() interface{} { return v } -func (RevokeSponsorshipOp) XdrTypeName() string { return "RevokeSponsorshipOp" } -func (v RevokeSponsorshipOp) XdrValue() interface{} { return v } -func (v *RevokeSponsorshipOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *RevokeSponsorshipOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (u *StellarMessage) QSet() *SCPQuorumSet { + switch u.Type { + case SCP_QUORUMSET: + if v, ok := u._u.(*SCPQuorumSet); ok { + return v + } else { + var zero SCPQuorumSet + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.QSet accessed when Type == %v", u.Type) + return nil } - XDR_RevokeSponsorshipType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) +} +func (u *StellarMessage) Envelope() *SCPEnvelope { switch u.Type { - case REVOKE_SPONSORSHIP_LEDGER_ENTRY: - x.Marshal(x.Sprintf("%sledgerKey", name), XDR_LedgerKey(u.LedgerKey())) - return - case REVOKE_SPONSORSHIP_SIGNER: - x.Marshal(x.Sprintf("%ssigner", name), XDR_XdrAnon_RevokeSponsorshipOp_Signer(u.Signer())) - return + case SCP_MESSAGE: + if v, ok := u._u.(*SCPEnvelope); ok { + return v + } else { + var zero SCPEnvelope + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.Envelope accessed when Type == %v", u.Type) + return nil } - XdrPanic("invalid Type (%v) in RevokeSponsorshipOp", u.Type) } -func XDR_RevokeSponsorshipOp(v *RevokeSponsorshipOp) *RevokeSponsorshipOp { return v } - -type XdrType_ClawbackOp = *ClawbackOp -func (v *ClawbackOp) XdrPointer() interface{} { return v } -func (ClawbackOp) XdrTypeName() string { return "ClawbackOp" } -func (v ClawbackOp) XdrValue() interface{} { return v } -func (v *ClawbackOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ClawbackOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +// ledger seq requested ; if 0, requests the latest +func (u *StellarMessage) GetSCPLedgerSeq() *Uint32 { + switch u.Type { + case GET_SCP_STATE: + if v, ok := u._u.(*Uint32); ok { + return v + } else { + var zero Uint32 + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.GetSCPLedgerSeq accessed when Type == %v", u.Type) + return nil } - x.Marshal(x.Sprintf("%sasset", name), XDR_Asset(&v.Asset)) - x.Marshal(x.Sprintf("%sfrom", name), XDR_MuxedAccount(&v.From)) - x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) } -func XDR_ClawbackOp(v *ClawbackOp) *ClawbackOp { return v } - -type XdrType_ClawbackClaimableBalanceOp = *ClawbackClaimableBalanceOp - -func (v *ClawbackClaimableBalanceOp) XdrPointer() interface{} { return v } -func (ClawbackClaimableBalanceOp) XdrTypeName() string { return "ClawbackClaimableBalanceOp" } -func (v ClawbackClaimableBalanceOp) XdrValue() interface{} { return v } -func (v *ClawbackClaimableBalanceOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ClawbackClaimableBalanceOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (u *StellarMessage) SendMoreMessage() *SendMore { + switch u.Type { + case SEND_MORE: + if v, ok := u._u.(*SendMore); ok { + return v + } else { + var zero SendMore + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.SendMoreMessage accessed when Type == %v", u.Type) + return nil } - x.Marshal(x.Sprintf("%sbalanceID", name), XDR_ClaimableBalanceID(&v.BalanceID)) } -func XDR_ClawbackClaimableBalanceOp(v *ClawbackClaimableBalanceOp) *ClawbackClaimableBalanceOp { - return v +func (u *StellarMessage) SendMoreExtendedMessage() *SendMoreExtended { + switch u.Type { + case SEND_MORE_EXTENDED: + if v, ok := u._u.(*SendMoreExtended); ok { + return v + } else { + var zero SendMoreExtended + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.SendMoreExtendedMessage accessed when Type == %v", u.Type) + return nil + } } - -type XdrType_SetTrustLineFlagsOp = *SetTrustLineFlagsOp - -func (v *SetTrustLineFlagsOp) XdrPointer() interface{} { return v } -func (SetTrustLineFlagsOp) XdrTypeName() string { return "SetTrustLineFlagsOp" } -func (v SetTrustLineFlagsOp) XdrValue() interface{} { return v } -func (v *SetTrustLineFlagsOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SetTrustLineFlagsOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (u *StellarMessage) FloodAdvert() *FloodAdvert { + switch u.Type { + case FLOOD_ADVERT: + if v, ok := u._u.(*FloodAdvert); ok { + return v + } else { + var zero FloodAdvert + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.FloodAdvert accessed when Type == %v", u.Type) + return nil } - x.Marshal(x.Sprintf("%strustor", name), XDR_AccountID(&v.Trustor)) - x.Marshal(x.Sprintf("%sasset", name), XDR_Asset(&v.Asset)) - x.Marshal(x.Sprintf("%sclearFlags", name), XDR_Uint32(&v.ClearFlags)) - x.Marshal(x.Sprintf("%ssetFlags", name), XDR_Uint32(&v.SetFlags)) } -func XDR_SetTrustLineFlagsOp(v *SetTrustLineFlagsOp) *SetTrustLineFlagsOp { return v } - -type XdrType_LiquidityPoolDepositOp = *LiquidityPoolDepositOp - -func (v *LiquidityPoolDepositOp) XdrPointer() interface{} { return v } -func (LiquidityPoolDepositOp) XdrTypeName() string { return "LiquidityPoolDepositOp" } -func (v LiquidityPoolDepositOp) XdrValue() interface{} { return v } -func (v *LiquidityPoolDepositOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LiquidityPoolDepositOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (u *StellarMessage) FloodDemand() *FloodDemand { + switch u.Type { + case FLOOD_DEMAND: + if v, ok := u._u.(*FloodDemand); ok { + return v + } else { + var zero FloodDemand + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.FloodDemand accessed when Type == %v", u.Type) + return nil } - x.Marshal(x.Sprintf("%sliquidityPoolID", name), XDR_PoolID(&v.LiquidityPoolID)) - x.Marshal(x.Sprintf("%smaxAmountA", name), XDR_Int64(&v.MaxAmountA)) - x.Marshal(x.Sprintf("%smaxAmountB", name), XDR_Int64(&v.MaxAmountB)) - x.Marshal(x.Sprintf("%sminPrice", name), XDR_Price(&v.MinPrice)) - x.Marshal(x.Sprintf("%smaxPrice", name), XDR_Price(&v.MaxPrice)) } -func XDR_LiquidityPoolDepositOp(v *LiquidityPoolDepositOp) *LiquidityPoolDepositOp { return v } - -type XdrType_LiquidityPoolWithdrawOp = *LiquidityPoolWithdrawOp - -func (v *LiquidityPoolWithdrawOp) XdrPointer() interface{} { return v } -func (LiquidityPoolWithdrawOp) XdrTypeName() string { return "LiquidityPoolWithdrawOp" } -func (v LiquidityPoolWithdrawOp) XdrValue() interface{} { return v } -func (v *LiquidityPoolWithdrawOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LiquidityPoolWithdrawOp) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) +func (u StellarMessage) XdrValid() bool { + switch u.Type { + case ERROR_MSG, HELLO, AUTH, DONT_HAVE, GET_PEERS, PEERS, GET_TX_SET, TX_SET, GENERALIZED_TX_SET, TRANSACTION, SURVEY_REQUEST, SURVEY_RESPONSE, TIME_SLICED_SURVEY_REQUEST, TIME_SLICED_SURVEY_RESPONSE, TIME_SLICED_SURVEY_START_COLLECTING, TIME_SLICED_SURVEY_STOP_COLLECTING, GET_SCP_QUORUMSET, SCP_QUORUMSET, SCP_MESSAGE, GET_SCP_STATE, SEND_MORE, SEND_MORE_EXTENDED, FLOOD_ADVERT, FLOOD_DEMAND: + return true } - x.Marshal(x.Sprintf("%sliquidityPoolID", name), XDR_PoolID(&v.LiquidityPoolID)) - x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) - x.Marshal(x.Sprintf("%sminAmountA", name), XDR_Int64(&v.MinAmountA)) - x.Marshal(x.Sprintf("%sminAmountB", name), XDR_Int64(&v.MinAmountB)) + return false } -func XDR_LiquidityPoolWithdrawOp(v *LiquidityPoolWithdrawOp) *LiquidityPoolWithdrawOp { return v } - -var _XdrNames_HostFunctionType = map[int32]string{ - int32(HOST_FUNCTION_TYPE_INVOKE_CONTRACT): "HOST_FUNCTION_TYPE_INVOKE_CONTRACT", - int32(HOST_FUNCTION_TYPE_CREATE_CONTRACT): "HOST_FUNCTION_TYPE_CREATE_CONTRACT", - int32(HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM): "HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM", -} -var _XdrValues_HostFunctionType = map[string]int32{ - "HOST_FUNCTION_TYPE_INVOKE_CONTRACT": int32(HOST_FUNCTION_TYPE_INVOKE_CONTRACT), - "HOST_FUNCTION_TYPE_CREATE_CONTRACT": int32(HOST_FUNCTION_TYPE_CREATE_CONTRACT), - "HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM": int32(HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM), -} - -func (HostFunctionType) XdrEnumNames() map[int32]string { - return _XdrNames_HostFunctionType -} -func (v HostFunctionType) String() string { - if s, ok := _XdrNames_HostFunctionType[int32(v)]; ok { - return s - } - return fmt.Sprintf("HostFunctionType#%d", v) -} -func (v *HostFunctionType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_HostFunctionType[stok]; ok { - *v = HostFunctionType(val) - return nil - } else if stok == "HostFunctionType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } - } - return XdrError(fmt.Sprintf("%s is not a valid HostFunctionType.", stok)) - } -} -func (v HostFunctionType) GetU32() uint32 { return uint32(v) } -func (v *HostFunctionType) SetU32(n uint32) { *v = HostFunctionType(n) } -func (v *HostFunctionType) XdrPointer() interface{} { return v } -func (HostFunctionType) XdrTypeName() string { return "HostFunctionType" } -func (v HostFunctionType) XdrValue() interface{} { return v } -func (v *HostFunctionType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_HostFunctionType = *HostFunctionType - -func XDR_HostFunctionType(v *HostFunctionType) *HostFunctionType { return v } - -var _XdrNames_ContractIDPreimageType = map[int32]string{ - int32(CONTRACT_ID_PREIMAGE_FROM_ADDRESS): "CONTRACT_ID_PREIMAGE_FROM_ADDRESS", - int32(CONTRACT_ID_PREIMAGE_FROM_ASSET): "CONTRACT_ID_PREIMAGE_FROM_ASSET", -} -var _XdrValues_ContractIDPreimageType = map[string]int32{ - "CONTRACT_ID_PREIMAGE_FROM_ADDRESS": int32(CONTRACT_ID_PREIMAGE_FROM_ADDRESS), - "CONTRACT_ID_PREIMAGE_FROM_ASSET": int32(CONTRACT_ID_PREIMAGE_FROM_ASSET), +func (u *StellarMessage) XdrUnionTag() XdrNum32 { + return XDR_MessageType(&u.Type) } - -func (ContractIDPreimageType) XdrEnumNames() map[int32]string { - return _XdrNames_ContractIDPreimageType +func (u *StellarMessage) XdrUnionTagName() string { + return "Type" } -func (v ContractIDPreimageType) String() string { - if s, ok := _XdrNames_ContractIDPreimageType[int32(v)]; ok { - return s +func (u *StellarMessage) XdrUnionBody() XdrType { + switch u.Type { + case ERROR_MSG: + return XDR_Error(u.Error()) + case HELLO: + return XDR_Hello(u.Hello()) + case AUTH: + return XDR_Auth(u.Auth()) + case DONT_HAVE: + return XDR_DontHave(u.DontHave()) + case GET_PEERS: + return nil + case PEERS: + return (*_XdrVec_100_PeerAddress)(u.Peers()) + case GET_TX_SET: + return XDR_Uint256(u.TxSetHash()) + case TX_SET: + return XDR_TransactionSet(u.TxSet()) + case GENERALIZED_TX_SET: + return XDR_GeneralizedTransactionSet(u.GeneralizedTxSet()) + case TRANSACTION: + return XDR_TransactionEnvelope(u.Transaction()) + case SURVEY_REQUEST: + return XDR_SignedSurveyRequestMessage(u.SignedSurveyRequestMessage()) + case SURVEY_RESPONSE: + return XDR_SignedSurveyResponseMessage(u.SignedSurveyResponseMessage()) + case TIME_SLICED_SURVEY_REQUEST: + return XDR_SignedTimeSlicedSurveyRequestMessage(u.SignedTimeSlicedSurveyRequestMessage()) + case TIME_SLICED_SURVEY_RESPONSE: + return XDR_SignedTimeSlicedSurveyResponseMessage(u.SignedTimeSlicedSurveyResponseMessage()) + case TIME_SLICED_SURVEY_START_COLLECTING: + return XDR_SignedTimeSlicedSurveyStartCollectingMessage(u.SignedTimeSlicedSurveyStartCollectingMessage()) + case TIME_SLICED_SURVEY_STOP_COLLECTING: + return XDR_SignedTimeSlicedSurveyStopCollectingMessage(u.SignedTimeSlicedSurveyStopCollectingMessage()) + case GET_SCP_QUORUMSET: + return XDR_Uint256(u.QSetHash()) + case SCP_QUORUMSET: + return XDR_SCPQuorumSet(u.QSet()) + case SCP_MESSAGE: + return XDR_SCPEnvelope(u.Envelope()) + case GET_SCP_STATE: + return XDR_Uint32(u.GetSCPLedgerSeq()) + case SEND_MORE: + return XDR_SendMore(u.SendMoreMessage()) + case SEND_MORE_EXTENDED: + return XDR_SendMoreExtended(u.SendMoreExtendedMessage()) + case FLOOD_ADVERT: + return XDR_FloodAdvert(u.FloodAdvert()) + case FLOOD_DEMAND: + return XDR_FloodDemand(u.FloodDemand()) } - return fmt.Sprintf("ContractIDPreimageType#%d", v) + return nil } -func (v *ContractIDPreimageType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_ContractIDPreimageType[stok]; ok { - *v = ContractIDPreimageType(val) - return nil - } else if stok == "ContractIDPreimageType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } - } - return XdrError(fmt.Sprintf("%s is not a valid ContractIDPreimageType.", stok)) +func (u *StellarMessage) XdrUnionBodyName() string { + switch u.Type { + case ERROR_MSG: + return "Error" + case HELLO: + return "Hello" + case AUTH: + return "Auth" + case DONT_HAVE: + return "DontHave" + case GET_PEERS: + return "" + case PEERS: + return "Peers" + case GET_TX_SET: + return "TxSetHash" + case TX_SET: + return "TxSet" + case GENERALIZED_TX_SET: + return "GeneralizedTxSet" + case TRANSACTION: + return "Transaction" + case SURVEY_REQUEST: + return "SignedSurveyRequestMessage" + case SURVEY_RESPONSE: + return "SignedSurveyResponseMessage" + case TIME_SLICED_SURVEY_REQUEST: + return "SignedTimeSlicedSurveyRequestMessage" + case TIME_SLICED_SURVEY_RESPONSE: + return "SignedTimeSlicedSurveyResponseMessage" + case TIME_SLICED_SURVEY_START_COLLECTING: + return "SignedTimeSlicedSurveyStartCollectingMessage" + case TIME_SLICED_SURVEY_STOP_COLLECTING: + return "SignedTimeSlicedSurveyStopCollectingMessage" + case GET_SCP_QUORUMSET: + return "QSetHash" + case SCP_QUORUMSET: + return "QSet" + case SCP_MESSAGE: + return "Envelope" + case GET_SCP_STATE: + return "GetSCPLedgerSeq" + case SEND_MORE: + return "SendMoreMessage" + case SEND_MORE_EXTENDED: + return "SendMoreExtendedMessage" + case FLOOD_ADVERT: + return "FloodAdvert" + case FLOOD_DEMAND: + return "FloodDemand" } + return "" } -func (v ContractIDPreimageType) GetU32() uint32 { return uint32(v) } -func (v *ContractIDPreimageType) SetU32(n uint32) { *v = ContractIDPreimageType(n) } -func (v *ContractIDPreimageType) XdrPointer() interface{} { return v } -func (ContractIDPreimageType) XdrTypeName() string { return "ContractIDPreimageType" } -func (v ContractIDPreimageType) XdrValue() interface{} { return v } -func (v *ContractIDPreimageType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_ContractIDPreimageType = *ContractIDPreimageType - -func XDR_ContractIDPreimageType(v *ContractIDPreimageType) *ContractIDPreimageType { return v } -type XdrType_XdrAnon_ContractIDPreimage_FromAddress = *XdrAnon_ContractIDPreimage_FromAddress +type XdrType_StellarMessage = *StellarMessage -func (v *XdrAnon_ContractIDPreimage_FromAddress) XdrPointer() interface{} { return v } -func (XdrAnon_ContractIDPreimage_FromAddress) XdrTypeName() string { - return "XdrAnon_ContractIDPreimage_FromAddress" -} -func (v XdrAnon_ContractIDPreimage_FromAddress) XdrValue() interface{} { return v } -func (v *XdrAnon_ContractIDPreimage_FromAddress) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *XdrAnon_ContractIDPreimage_FromAddress) XdrRecurse(x XDR, name string) { +func (v *StellarMessage) XdrPointer() interface{} { return v } +func (StellarMessage) XdrTypeName() string { return "StellarMessage" } +func (v StellarMessage) XdrValue() interface{} { return v } +func (v *StellarMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *StellarMessage) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%saddress", name), XDR_SCAddress(&v.Address)) - x.Marshal(x.Sprintf("%ssalt", name), XDR_Uint256(&v.Salt)) -} -func XDR_XdrAnon_ContractIDPreimage_FromAddress(v *XdrAnon_ContractIDPreimage_FromAddress) *XdrAnon_ContractIDPreimage_FromAddress { - return v -} - -var _XdrTags_ContractIDPreimage = map[int32]bool{ - XdrToI32(CONTRACT_ID_PREIMAGE_FROM_ADDRESS): true, - XdrToI32(CONTRACT_ID_PREIMAGE_FROM_ASSET): true, -} - -func (_ ContractIDPreimage) XdrValidTags() map[int32]bool { - return _XdrTags_ContractIDPreimage -} -func (u *ContractIDPreimage) FromAddress() *XdrAnon_ContractIDPreimage_FromAddress { - switch u.Type { - case CONTRACT_ID_PREIMAGE_FROM_ADDRESS: - if v, ok := u._u.(*XdrAnon_ContractIDPreimage_FromAddress); ok { - return v - } else { - var zero XdrAnon_ContractIDPreimage_FromAddress - u._u = &zero - return &zero - } - default: - XdrPanic("ContractIDPreimage.FromAddress accessed when Type == %v", u.Type) - return nil - } -} -func (u *ContractIDPreimage) FromAsset() *Asset { - switch u.Type { - case CONTRACT_ID_PREIMAGE_FROM_ASSET: - if v, ok := u._u.(*Asset); ok { - return v - } else { - var zero Asset - u._u = &zero - return &zero - } - default: - XdrPanic("ContractIDPreimage.FromAsset accessed when Type == %v", u.Type) - return nil - } -} -func (u ContractIDPreimage) XdrValid() bool { + XDR_MessageType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) switch u.Type { - case CONTRACT_ID_PREIMAGE_FROM_ADDRESS, CONTRACT_ID_PREIMAGE_FROM_ASSET: - return true - } - return false -} -func (u *ContractIDPreimage) XdrUnionTag() XdrNum32 { - return XDR_ContractIDPreimageType(&u.Type) -} -func (u *ContractIDPreimage) XdrUnionTagName() string { - return "Type" -} -func (u *ContractIDPreimage) XdrUnionBody() XdrType { - switch u.Type { - case CONTRACT_ID_PREIMAGE_FROM_ADDRESS: - return XDR_XdrAnon_ContractIDPreimage_FromAddress(u.FromAddress()) - case CONTRACT_ID_PREIMAGE_FROM_ASSET: - return XDR_Asset(u.FromAsset()) - } - return nil -} -func (u *ContractIDPreimage) XdrUnionBodyName() string { - switch u.Type { - case CONTRACT_ID_PREIMAGE_FROM_ADDRESS: - return "FromAddress" - case CONTRACT_ID_PREIMAGE_FROM_ASSET: - return "FromAsset" - } - return "" -} - -type XdrType_ContractIDPreimage = *ContractIDPreimage - -func (v *ContractIDPreimage) XdrPointer() interface{} { return v } -func (ContractIDPreimage) XdrTypeName() string { return "ContractIDPreimage" } -func (v ContractIDPreimage) XdrValue() interface{} { return v } -func (v *ContractIDPreimage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *ContractIDPreimage) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - XDR_ContractIDPreimageType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case CONTRACT_ID_PREIMAGE_FROM_ADDRESS: - x.Marshal(x.Sprintf("%sfromAddress", name), XDR_XdrAnon_ContractIDPreimage_FromAddress(u.FromAddress())) + case ERROR_MSG: + x.Marshal(x.Sprintf("%serror", name), XDR_Error(u.Error())) return - case CONTRACT_ID_PREIMAGE_FROM_ASSET: - x.Marshal(x.Sprintf("%sfromAsset", name), XDR_Asset(u.FromAsset())) + case HELLO: + x.Marshal(x.Sprintf("%shello", name), XDR_Hello(u.Hello())) + return + case AUTH: + x.Marshal(x.Sprintf("%sauth", name), XDR_Auth(u.Auth())) + return + case DONT_HAVE: + x.Marshal(x.Sprintf("%sdontHave", name), XDR_DontHave(u.DontHave())) + return + case GET_PEERS: + return + case PEERS: + x.Marshal(x.Sprintf("%speers", name), (*_XdrVec_100_PeerAddress)(u.Peers())) + return + case GET_TX_SET: + x.Marshal(x.Sprintf("%stxSetHash", name), XDR_Uint256(u.TxSetHash())) + return + case TX_SET: + x.Marshal(x.Sprintf("%stxSet", name), XDR_TransactionSet(u.TxSet())) + return + case GENERALIZED_TX_SET: + x.Marshal(x.Sprintf("%sgeneralizedTxSet", name), XDR_GeneralizedTransactionSet(u.GeneralizedTxSet())) + return + case TRANSACTION: + x.Marshal(x.Sprintf("%stransaction", name), XDR_TransactionEnvelope(u.Transaction())) + return + case SURVEY_REQUEST: + x.Marshal(x.Sprintf("%ssignedSurveyRequestMessage", name), XDR_SignedSurveyRequestMessage(u.SignedSurveyRequestMessage())) + return + case SURVEY_RESPONSE: + x.Marshal(x.Sprintf("%ssignedSurveyResponseMessage", name), XDR_SignedSurveyResponseMessage(u.SignedSurveyResponseMessage())) + return + case TIME_SLICED_SURVEY_REQUEST: + x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyRequestMessage", name), XDR_SignedTimeSlicedSurveyRequestMessage(u.SignedTimeSlicedSurveyRequestMessage())) + return + case TIME_SLICED_SURVEY_RESPONSE: + x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyResponseMessage", name), XDR_SignedTimeSlicedSurveyResponseMessage(u.SignedTimeSlicedSurveyResponseMessage())) + return + case TIME_SLICED_SURVEY_START_COLLECTING: + x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyStartCollectingMessage", name), XDR_SignedTimeSlicedSurveyStartCollectingMessage(u.SignedTimeSlicedSurveyStartCollectingMessage())) + return + case TIME_SLICED_SURVEY_STOP_COLLECTING: + x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyStopCollectingMessage", name), XDR_SignedTimeSlicedSurveyStopCollectingMessage(u.SignedTimeSlicedSurveyStopCollectingMessage())) + return + case GET_SCP_QUORUMSET: + x.Marshal(x.Sprintf("%sqSetHash", name), XDR_Uint256(u.QSetHash())) + return + case SCP_QUORUMSET: + x.Marshal(x.Sprintf("%sqSet", name), XDR_SCPQuorumSet(u.QSet())) + return + case SCP_MESSAGE: + x.Marshal(x.Sprintf("%senvelope", name), XDR_SCPEnvelope(u.Envelope())) + return + case GET_SCP_STATE: + x.Marshal(x.Sprintf("%sgetSCPLedgerSeq", name), XDR_Uint32(u.GetSCPLedgerSeq())) + return + case SEND_MORE: + x.Marshal(x.Sprintf("%ssendMoreMessage", name), XDR_SendMore(u.SendMoreMessage())) + return + case SEND_MORE_EXTENDED: + x.Marshal(x.Sprintf("%ssendMoreExtendedMessage", name), XDR_SendMoreExtended(u.SendMoreExtendedMessage())) + return + case FLOOD_ADVERT: + x.Marshal(x.Sprintf("%sfloodAdvert", name), XDR_FloodAdvert(u.FloodAdvert())) + return + case FLOOD_DEMAND: + x.Marshal(x.Sprintf("%sfloodDemand", name), XDR_FloodDemand(u.FloodDemand())) return } - XdrPanic("invalid Type (%v) in ContractIDPreimage", u.Type) + XdrPanic("invalid Type (%v) in StellarMessage", u.Type) } -func XDR_ContractIDPreimage(v *ContractIDPreimage) *ContractIDPreimage { return v } +func XDR_StellarMessage(v *StellarMessage) *StellarMessage { return v } -type XdrType_CreateContractArgs = *CreateContractArgs +type XdrType_XdrAnon_AuthenticatedMessage_V0 = *XdrAnon_AuthenticatedMessage_V0 -func (v *CreateContractArgs) XdrPointer() interface{} { return v } -func (CreateContractArgs) XdrTypeName() string { return "CreateContractArgs" } -func (v CreateContractArgs) XdrValue() interface{} { return v } -func (v *CreateContractArgs) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *CreateContractArgs) XdrRecurse(x XDR, name string) { +func (v *XdrAnon_AuthenticatedMessage_V0) XdrPointer() interface{} { return v } +func (XdrAnon_AuthenticatedMessage_V0) XdrTypeName() string { return "XdrAnon_AuthenticatedMessage_V0" } +func (v XdrAnon_AuthenticatedMessage_V0) XdrValue() interface{} { return v } +func (v *XdrAnon_AuthenticatedMessage_V0) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *XdrAnon_AuthenticatedMessage_V0) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%scontractIDPreimage", name), XDR_ContractIDPreimage(&v.ContractIDPreimage)) - x.Marshal(x.Sprintf("%sexecutable", name), XDR_ContractExecutable(&v.Executable)) + x.Marshal(x.Sprintf("%ssequence", name), XDR_Uint64(&v.Sequence)) + x.Marshal(x.Sprintf("%smessage", name), XDR_StellarMessage(&v.Message)) + x.Marshal(x.Sprintf("%smac", name), XDR_HmacSha256Mac(&v.Mac)) } -func XDR_CreateContractArgs(v *CreateContractArgs) *CreateContractArgs { return v } - -type XdrType_InvokeContractArgs = *InvokeContractArgs - -func (v *InvokeContractArgs) XdrPointer() interface{} { return v } -func (InvokeContractArgs) XdrTypeName() string { return "InvokeContractArgs" } -func (v InvokeContractArgs) XdrValue() interface{} { return v } -func (v *InvokeContractArgs) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *InvokeContractArgs) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%scontractAddress", name), XDR_SCAddress(&v.ContractAddress)) - x.Marshal(x.Sprintf("%sfunctionName", name), XDR_SCSymbol(&v.FunctionName)) - x.Marshal(x.Sprintf("%sargs", name), (*_XdrVec_unbounded_SCVal)(&v.Args)) +func XDR_XdrAnon_AuthenticatedMessage_V0(v *XdrAnon_AuthenticatedMessage_V0) *XdrAnon_AuthenticatedMessage_V0 { + return v } -func XDR_InvokeContractArgs(v *InvokeContractArgs) *InvokeContractArgs { return v } -var _XdrTags_HostFunction = map[int32]bool{ - XdrToI32(HOST_FUNCTION_TYPE_INVOKE_CONTRACT): true, - XdrToI32(HOST_FUNCTION_TYPE_CREATE_CONTRACT): true, - XdrToI32(HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM): true, +var _XdrTags_AuthenticatedMessage = map[int32]bool{ + XdrToI32(0): true, } -func (_ HostFunction) XdrValidTags() map[int32]bool { - return _XdrTags_HostFunction -} -func (u *HostFunction) InvokeContract() *InvokeContractArgs { - switch u.Type { - case HOST_FUNCTION_TYPE_INVOKE_CONTRACT: - if v, ok := u._u.(*InvokeContractArgs); ok { - return v - } else { - var zero InvokeContractArgs - u._u = &zero - return &zero - } - default: - XdrPanic("HostFunction.InvokeContract accessed when Type == %v", u.Type) - return nil - } -} -func (u *HostFunction) CreateContract() *CreateContractArgs { - switch u.Type { - case HOST_FUNCTION_TYPE_CREATE_CONTRACT: - if v, ok := u._u.(*CreateContractArgs); ok { - return v - } else { - var zero CreateContractArgs - u._u = &zero - return &zero - } - default: - XdrPanic("HostFunction.CreateContract accessed when Type == %v", u.Type) - return nil - } +func (_ AuthenticatedMessage) XdrValidTags() map[int32]bool { + return _XdrTags_AuthenticatedMessage } -func (u *HostFunction) Wasm() *[]byte { - switch u.Type { - case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: - if v, ok := u._u.(*[]byte); ok { +func (u *AuthenticatedMessage) V0() *XdrAnon_AuthenticatedMessage_V0 { + switch u.V { + case 0: + if v, ok := u._u.(*XdrAnon_AuthenticatedMessage_V0); ok { return v } else { - var zero []byte + var zero XdrAnon_AuthenticatedMessage_V0 u._u = &zero return &zero } default: - XdrPanic("HostFunction.Wasm accessed when Type == %v", u.Type) + XdrPanic("AuthenticatedMessage.V0 accessed when V == %v", u.V) return nil } } -func (u HostFunction) XdrValid() bool { - switch u.Type { - case HOST_FUNCTION_TYPE_INVOKE_CONTRACT, HOST_FUNCTION_TYPE_CREATE_CONTRACT, HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: +func (u AuthenticatedMessage) XdrValid() bool { + switch u.V { + case 0: return true } return false } -func (u *HostFunction) XdrUnionTag() XdrNum32 { - return XDR_HostFunctionType(&u.Type) +func (u *AuthenticatedMessage) XdrUnionTag() XdrNum32 { + return XDR_Uint32(&u.V) } -func (u *HostFunction) XdrUnionTagName() string { - return "Type" +func (u *AuthenticatedMessage) XdrUnionTagName() string { + return "V" } -func (u *HostFunction) XdrUnionBody() XdrType { - switch u.Type { - case HOST_FUNCTION_TYPE_INVOKE_CONTRACT: - return XDR_InvokeContractArgs(u.InvokeContract()) - case HOST_FUNCTION_TYPE_CREATE_CONTRACT: - return XDR_CreateContractArgs(u.CreateContract()) - case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: - return XdrVecOpaque{u.Wasm(), 0xffffffff} +func (u *AuthenticatedMessage) XdrUnionBody() XdrType { + switch u.V { + case 0: + return XDR_XdrAnon_AuthenticatedMessage_V0(u.V0()) } return nil } -func (u *HostFunction) XdrUnionBodyName() string { - switch u.Type { - case HOST_FUNCTION_TYPE_INVOKE_CONTRACT: - return "InvokeContract" - case HOST_FUNCTION_TYPE_CREATE_CONTRACT: - return "CreateContract" - case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: - return "Wasm" +func (u *AuthenticatedMessage) XdrUnionBodyName() string { + switch u.V { + case 0: + return "V0" } return "" } -type XdrType_HostFunction = *HostFunction +type XdrType_AuthenticatedMessage = *AuthenticatedMessage -func (v *HostFunction) XdrPointer() interface{} { return v } -func (HostFunction) XdrTypeName() string { return "HostFunction" } -func (v HostFunction) XdrValue() interface{} { return v } -func (v *HostFunction) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *HostFunction) XdrRecurse(x XDR, name string) { +func (v *AuthenticatedMessage) XdrPointer() interface{} { return v } +func (AuthenticatedMessage) XdrTypeName() string { return "AuthenticatedMessage" } +func (v AuthenticatedMessage) XdrValue() interface{} { return v } +func (v *AuthenticatedMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *AuthenticatedMessage) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_HostFunctionType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case HOST_FUNCTION_TYPE_INVOKE_CONTRACT: - x.Marshal(x.Sprintf("%sinvokeContract", name), XDR_InvokeContractArgs(u.InvokeContract())) - return - case HOST_FUNCTION_TYPE_CREATE_CONTRACT: - x.Marshal(x.Sprintf("%screateContract", name), XDR_CreateContractArgs(u.CreateContract())) - return - case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: - x.Marshal(x.Sprintf("%swasm", name), XdrVecOpaque{u.Wasm(), 0xffffffff}) + XDR_Uint32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + switch u.V { + case 0: + x.Marshal(x.Sprintf("%sv0", name), XDR_XdrAnon_AuthenticatedMessage_V0(u.V0())) return } - XdrPanic("invalid Type (%v) in HostFunction", u.Type) + XdrPanic("invalid V (%v) in AuthenticatedMessage", u.V) } -func XDR_HostFunction(v *HostFunction) *HostFunction { return v } +func XDR_AuthenticatedMessage(v *AuthenticatedMessage) *AuthenticatedMessage { return v } -var _XdrNames_SorobanAuthorizedFunctionType = map[int32]string{ - int32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN): "SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN", - int32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN): "SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN", -} -var _XdrValues_SorobanAuthorizedFunctionType = map[string]int32{ - "SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN": int32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN), - "SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN": int32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN), +var _XdrTags_LiquidityPoolParameters = map[int32]bool{ + XdrToI32(LIQUIDITY_POOL_CONSTANT_PRODUCT): true, } -func (SorobanAuthorizedFunctionType) XdrEnumNames() map[int32]string { - return _XdrNames_SorobanAuthorizedFunctionType +func (_ LiquidityPoolParameters) XdrValidTags() map[int32]bool { + return _XdrTags_LiquidityPoolParameters } -func (v SorobanAuthorizedFunctionType) String() string { - if s, ok := _XdrNames_SorobanAuthorizedFunctionType[int32(v)]; ok { - return s +func (u *LiquidityPoolParameters) ConstantProduct() *LiquidityPoolConstantProductParameters { + switch u.Type { + case LIQUIDITY_POOL_CONSTANT_PRODUCT: + if v, ok := u._u.(*LiquidityPoolConstantProductParameters); ok { + return v + } else { + var zero LiquidityPoolConstantProductParameters + u._u = &zero + return &zero + } + default: + XdrPanic("LiquidityPoolParameters.ConstantProduct accessed when Type == %v", u.Type) + return nil } - return fmt.Sprintf("SorobanAuthorizedFunctionType#%d", v) } -func (v *SorobanAuthorizedFunctionType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_SorobanAuthorizedFunctionType[stok]; ok { - *v = SorobanAuthorizedFunctionType(val) - return nil - } else if stok == "SorobanAuthorizedFunctionType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } - } - return XdrError(fmt.Sprintf("%s is not a valid SorobanAuthorizedFunctionType.", stok)) +func (u LiquidityPoolParameters) XdrValid() bool { + switch u.Type { + case LIQUIDITY_POOL_CONSTANT_PRODUCT: + return true } + return false +} +func (u *LiquidityPoolParameters) XdrUnionTag() XdrNum32 { + return XDR_LiquidityPoolType(&u.Type) +} +func (u *LiquidityPoolParameters) XdrUnionTagName() string { + return "Type" +} +func (u *LiquidityPoolParameters) XdrUnionBody() XdrType { + switch u.Type { + case LIQUIDITY_POOL_CONSTANT_PRODUCT: + return XDR_LiquidityPoolConstantProductParameters(u.ConstantProduct()) + } + return nil +} +func (u *LiquidityPoolParameters) XdrUnionBodyName() string { + switch u.Type { + case LIQUIDITY_POOL_CONSTANT_PRODUCT: + return "ConstantProduct" + } + return "" } -func (v SorobanAuthorizedFunctionType) GetU32() uint32 { return uint32(v) } -func (v *SorobanAuthorizedFunctionType) SetU32(n uint32) { *v = SorobanAuthorizedFunctionType(n) } -func (v *SorobanAuthorizedFunctionType) XdrPointer() interface{} { return v } -func (SorobanAuthorizedFunctionType) XdrTypeName() string { return "SorobanAuthorizedFunctionType" } -func (v SorobanAuthorizedFunctionType) XdrValue() interface{} { return v } -func (v *SorobanAuthorizedFunctionType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_SorobanAuthorizedFunctionType = *SorobanAuthorizedFunctionType +type XdrType_LiquidityPoolParameters = *LiquidityPoolParameters -func XDR_SorobanAuthorizedFunctionType(v *SorobanAuthorizedFunctionType) *SorobanAuthorizedFunctionType { +func (v *LiquidityPoolParameters) XdrPointer() interface{} { return v } +func (LiquidityPoolParameters) XdrTypeName() string { return "LiquidityPoolParameters" } +func (v LiquidityPoolParameters) XdrValue() interface{} { return v } +func (v *LiquidityPoolParameters) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *LiquidityPoolParameters) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_LiquidityPoolType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case LIQUIDITY_POOL_CONSTANT_PRODUCT: + x.Marshal(x.Sprintf("%sconstantProduct", name), XDR_LiquidityPoolConstantProductParameters(u.ConstantProduct())) + return + } + XdrPanic("invalid Type (%v) in LiquidityPoolParameters", u.Type) +} +func XDR_LiquidityPoolParameters(v *LiquidityPoolParameters) *LiquidityPoolParameters { return v } + +type XdrType_XdrAnon_MuxedAccount_Med25519 = *XdrAnon_MuxedAccount_Med25519 + +func (v *XdrAnon_MuxedAccount_Med25519) XdrPointer() interface{} { return v } +func (XdrAnon_MuxedAccount_Med25519) XdrTypeName() string { return "XdrAnon_MuxedAccount_Med25519" } +func (v XdrAnon_MuxedAccount_Med25519) XdrValue() interface{} { return v } +func (v *XdrAnon_MuxedAccount_Med25519) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *XdrAnon_MuxedAccount_Med25519) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sid", name), XDR_Uint64(&v.Id)) + x.Marshal(x.Sprintf("%sed25519", name), XDR_Uint256(&v.Ed25519)) +} +func XDR_XdrAnon_MuxedAccount_Med25519(v *XdrAnon_MuxedAccount_Med25519) *XdrAnon_MuxedAccount_Med25519 { return v } -var _XdrTags_SorobanAuthorizedFunction = map[int32]bool{ - XdrToI32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN): true, - XdrToI32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN): true, +var _XdrTags_MuxedAccount = map[int32]bool{ + XdrToI32(KEY_TYPE_ED25519): true, + XdrToI32(KEY_TYPE_MUXED_ED25519): true, } -func (_ SorobanAuthorizedFunction) XdrValidTags() map[int32]bool { - return _XdrTags_SorobanAuthorizedFunction +func (_ MuxedAccount) XdrValidTags() map[int32]bool { + return _XdrTags_MuxedAccount } -func (u *SorobanAuthorizedFunction) ContractFn() *InvokeContractArgs { +func (u *MuxedAccount) Ed25519() *Uint256 { switch u.Type { - case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: - if v, ok := u._u.(*InvokeContractArgs); ok { + case KEY_TYPE_ED25519: + if v, ok := u._u.(*Uint256); ok { return v } else { - var zero InvokeContractArgs + var zero Uint256 u._u = &zero return &zero } default: - XdrPanic("SorobanAuthorizedFunction.ContractFn accessed when Type == %v", u.Type) + XdrPanic("MuxedAccount.Ed25519 accessed when Type == %v", u.Type) return nil } } -func (u *SorobanAuthorizedFunction) CreateContractHostFn() *CreateContractArgs { +func (u *MuxedAccount) Med25519() *XdrAnon_MuxedAccount_Med25519 { switch u.Type { - case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: - if v, ok := u._u.(*CreateContractArgs); ok { + case KEY_TYPE_MUXED_ED25519: + if v, ok := u._u.(*XdrAnon_MuxedAccount_Med25519); ok { return v } else { - var zero CreateContractArgs + var zero XdrAnon_MuxedAccount_Med25519 u._u = &zero return &zero } default: - XdrPanic("SorobanAuthorizedFunction.CreateContractHostFn accessed when Type == %v", u.Type) + XdrPanic("MuxedAccount.Med25519 accessed when Type == %v", u.Type) return nil } } -func (u SorobanAuthorizedFunction) XdrValid() bool { +func (u MuxedAccount) XdrValid() bool { switch u.Type { - case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN, SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: + case KEY_TYPE_ED25519, KEY_TYPE_MUXED_ED25519: return true } return false } -func (u *SorobanAuthorizedFunction) XdrUnionTag() XdrNum32 { - return XDR_SorobanAuthorizedFunctionType(&u.Type) +func (u *MuxedAccount) XdrUnionTag() XdrNum32 { + return XDR_CryptoKeyType(&u.Type) } -func (u *SorobanAuthorizedFunction) XdrUnionTagName() string { +func (u *MuxedAccount) XdrUnionTagName() string { return "Type" } -func (u *SorobanAuthorizedFunction) XdrUnionBody() XdrType { +func (u *MuxedAccount) XdrUnionBody() XdrType { switch u.Type { - case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: - return XDR_InvokeContractArgs(u.ContractFn()) - case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: - return XDR_CreateContractArgs(u.CreateContractHostFn()) + case KEY_TYPE_ED25519: + return XDR_Uint256(u.Ed25519()) + case KEY_TYPE_MUXED_ED25519: + return XDR_XdrAnon_MuxedAccount_Med25519(u.Med25519()) } return nil } -func (u *SorobanAuthorizedFunction) XdrUnionBodyName() string { +func (u *MuxedAccount) XdrUnionBodyName() string { switch u.Type { - case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: - return "ContractFn" - case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: - return "CreateContractHostFn" + case KEY_TYPE_ED25519: + return "Ed25519" + case KEY_TYPE_MUXED_ED25519: + return "Med25519" } return "" } -type XdrType_SorobanAuthorizedFunction = *SorobanAuthorizedFunction +type XdrType_MuxedAccount = *MuxedAccount -func (v *SorobanAuthorizedFunction) XdrPointer() interface{} { return v } -func (SorobanAuthorizedFunction) XdrTypeName() string { return "SorobanAuthorizedFunction" } -func (v SorobanAuthorizedFunction) XdrValue() interface{} { return v } -func (v *SorobanAuthorizedFunction) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *SorobanAuthorizedFunction) XdrRecurse(x XDR, name string) { +func (v *MuxedAccount) XdrPointer() interface{} { return v } +func (MuxedAccount) XdrTypeName() string { return "MuxedAccount" } +func (v MuxedAccount) XdrValue() interface{} { return v } +func (v *MuxedAccount) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *MuxedAccount) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_SorobanAuthorizedFunctionType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + XDR_CryptoKeyType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) switch u.Type { - case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: - x.Marshal(x.Sprintf("%scontractFn", name), XDR_InvokeContractArgs(u.ContractFn())) + case KEY_TYPE_ED25519: + x.Marshal(x.Sprintf("%sed25519", name), XDR_Uint256(u.Ed25519())) return - case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: - x.Marshal(x.Sprintf("%screateContractHostFn", name), XDR_CreateContractArgs(u.CreateContractHostFn())) + case KEY_TYPE_MUXED_ED25519: + x.Marshal(x.Sprintf("%smed25519", name), XDR_XdrAnon_MuxedAccount_Med25519(u.Med25519())) return } - XdrPanic("invalid Type (%v) in SorobanAuthorizedFunction", u.Type) + XdrPanic("invalid Type (%v) in MuxedAccount", u.Type) } -func XDR_SorobanAuthorizedFunction(v *SorobanAuthorizedFunction) *SorobanAuthorizedFunction { return v } +func XDR_MuxedAccount(v *MuxedAccount) *MuxedAccount { return v } -type _XdrVec_unbounded_SorobanAuthorizedInvocation []SorobanAuthorizedInvocation +type XdrType_DecoratedSignature = *DecoratedSignature -func (_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound -} -func (_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_SorobanAuthorizedInvocation length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_SorobanAuthorizedInvocation length %d exceeds max int", length) - } -} -func (v _XdrVec_unbounded_SorobanAuthorizedInvocation) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_SorobanAuthorizedInvocation) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) +func (v *DecoratedSignature) XdrPointer() interface{} { return v } +func (DecoratedSignature) XdrTypeName() string { return "DecoratedSignature" } +func (v DecoratedSignature) XdrValue() interface{} { return v } +func (v *DecoratedSignature) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *DecoratedSignature) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } - nv := make([]SorobanAuthorizedInvocation, int(length), newcap) - copy(nv, *v) - *v = nv + x.Marshal(x.Sprintf("%shint", name), XDR_SignatureHint(&v.Hint)) + x.Marshal(x.Sprintf("%ssignature", name), XDR_Signature(&v.Signature)) } -func (v *_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) - } - XDR_SorobanAuthorizedInvocation(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] - } -} -func (v *_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) -} -func (_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrTypeName() string { - return "SorobanAuthorizedInvocation<>" -} -func (v *_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrPointer() interface{} { - return (*[]SorobanAuthorizedInvocation)(v) -} -func (v _XdrVec_unbounded_SorobanAuthorizedInvocation) XdrValue() interface{} { - return ([]SorobanAuthorizedInvocation)(v) -} -func (v *_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrMarshal(x XDR, name string) { - x.Marshal(name, v) -} - -type XdrType_SorobanAuthorizedInvocation = *SorobanAuthorizedInvocation - -func (v *SorobanAuthorizedInvocation) XdrPointer() interface{} { return v } -func (SorobanAuthorizedInvocation) XdrTypeName() string { return "SorobanAuthorizedInvocation" } -func (v SorobanAuthorizedInvocation) XdrValue() interface{} { return v } -func (v *SorobanAuthorizedInvocation) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SorobanAuthorizedInvocation) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sfunction", name), XDR_SorobanAuthorizedFunction(&v.Function)) - x.Marshal(x.Sprintf("%ssubInvocations", name), (*_XdrVec_unbounded_SorobanAuthorizedInvocation)(&v.SubInvocations)) -} -func XDR_SorobanAuthorizedInvocation(v *SorobanAuthorizedInvocation) *SorobanAuthorizedInvocation { - return v -} - -type XdrType_SorobanAddressCredentials = *SorobanAddressCredentials - -func (v *SorobanAddressCredentials) XdrPointer() interface{} { return v } -func (SorobanAddressCredentials) XdrTypeName() string { return "SorobanAddressCredentials" } -func (v SorobanAddressCredentials) XdrValue() interface{} { return v } -func (v *SorobanAddressCredentials) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SorobanAddressCredentials) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%saddress", name), XDR_SCAddress(&v.Address)) - x.Marshal(x.Sprintf("%snonce", name), XDR_Int64(&v.Nonce)) - x.Marshal(x.Sprintf("%ssignatureExpirationLedger", name), XDR_Uint32(&v.SignatureExpirationLedger)) - x.Marshal(x.Sprintf("%ssignature", name), XDR_SCVal(&v.Signature)) -} -func XDR_SorobanAddressCredentials(v *SorobanAddressCredentials) *SorobanAddressCredentials { return v } +func XDR_DecoratedSignature(v *DecoratedSignature) *DecoratedSignature { return v } -var _XdrNames_SorobanCredentialsType = map[int32]string{ - int32(SOROBAN_CREDENTIALS_SOURCE_ACCOUNT): "SOROBAN_CREDENTIALS_SOURCE_ACCOUNT", - int32(SOROBAN_CREDENTIALS_ADDRESS): "SOROBAN_CREDENTIALS_ADDRESS", +var _XdrNames_OperationType = map[int32]string{ + int32(CREATE_ACCOUNT): "CREATE_ACCOUNT", + int32(PAYMENT): "PAYMENT", + int32(PATH_PAYMENT_STRICT_RECEIVE): "PATH_PAYMENT_STRICT_RECEIVE", + int32(MANAGE_SELL_OFFER): "MANAGE_SELL_OFFER", + int32(CREATE_PASSIVE_SELL_OFFER): "CREATE_PASSIVE_SELL_OFFER", + int32(SET_OPTIONS): "SET_OPTIONS", + int32(CHANGE_TRUST): "CHANGE_TRUST", + int32(ALLOW_TRUST): "ALLOW_TRUST", + int32(ACCOUNT_MERGE): "ACCOUNT_MERGE", + int32(INFLATION): "INFLATION", + int32(MANAGE_DATA): "MANAGE_DATA", + int32(BUMP_SEQUENCE): "BUMP_SEQUENCE", + int32(MANAGE_BUY_OFFER): "MANAGE_BUY_OFFER", + int32(PATH_PAYMENT_STRICT_SEND): "PATH_PAYMENT_STRICT_SEND", + int32(CREATE_CLAIMABLE_BALANCE): "CREATE_CLAIMABLE_BALANCE", + int32(CLAIM_CLAIMABLE_BALANCE): "CLAIM_CLAIMABLE_BALANCE", + int32(BEGIN_SPONSORING_FUTURE_RESERVES): "BEGIN_SPONSORING_FUTURE_RESERVES", + int32(END_SPONSORING_FUTURE_RESERVES): "END_SPONSORING_FUTURE_RESERVES", + int32(REVOKE_SPONSORSHIP): "REVOKE_SPONSORSHIP", + int32(CLAWBACK): "CLAWBACK", + int32(CLAWBACK_CLAIMABLE_BALANCE): "CLAWBACK_CLAIMABLE_BALANCE", + int32(SET_TRUST_LINE_FLAGS): "SET_TRUST_LINE_FLAGS", + int32(LIQUIDITY_POOL_DEPOSIT): "LIQUIDITY_POOL_DEPOSIT", + int32(LIQUIDITY_POOL_WITHDRAW): "LIQUIDITY_POOL_WITHDRAW", + int32(INVOKE_HOST_FUNCTION): "INVOKE_HOST_FUNCTION", + int32(EXTEND_FOOTPRINT_TTL): "EXTEND_FOOTPRINT_TTL", + int32(RESTORE_FOOTPRINT): "RESTORE_FOOTPRINT", } -var _XdrValues_SorobanCredentialsType = map[string]int32{ - "SOROBAN_CREDENTIALS_SOURCE_ACCOUNT": int32(SOROBAN_CREDENTIALS_SOURCE_ACCOUNT), - "SOROBAN_CREDENTIALS_ADDRESS": int32(SOROBAN_CREDENTIALS_ADDRESS), +var _XdrValues_OperationType = map[string]int32{ + "CREATE_ACCOUNT": int32(CREATE_ACCOUNT), + "PAYMENT": int32(PAYMENT), + "PATH_PAYMENT_STRICT_RECEIVE": int32(PATH_PAYMENT_STRICT_RECEIVE), + "MANAGE_SELL_OFFER": int32(MANAGE_SELL_OFFER), + "CREATE_PASSIVE_SELL_OFFER": int32(CREATE_PASSIVE_SELL_OFFER), + "SET_OPTIONS": int32(SET_OPTIONS), + "CHANGE_TRUST": int32(CHANGE_TRUST), + "ALLOW_TRUST": int32(ALLOW_TRUST), + "ACCOUNT_MERGE": int32(ACCOUNT_MERGE), + "INFLATION": int32(INFLATION), + "MANAGE_DATA": int32(MANAGE_DATA), + "BUMP_SEQUENCE": int32(BUMP_SEQUENCE), + "MANAGE_BUY_OFFER": int32(MANAGE_BUY_OFFER), + "PATH_PAYMENT_STRICT_SEND": int32(PATH_PAYMENT_STRICT_SEND), + "CREATE_CLAIMABLE_BALANCE": int32(CREATE_CLAIMABLE_BALANCE), + "CLAIM_CLAIMABLE_BALANCE": int32(CLAIM_CLAIMABLE_BALANCE), + "BEGIN_SPONSORING_FUTURE_RESERVES": int32(BEGIN_SPONSORING_FUTURE_RESERVES), + "END_SPONSORING_FUTURE_RESERVES": int32(END_SPONSORING_FUTURE_RESERVES), + "REVOKE_SPONSORSHIP": int32(REVOKE_SPONSORSHIP), + "CLAWBACK": int32(CLAWBACK), + "CLAWBACK_CLAIMABLE_BALANCE": int32(CLAWBACK_CLAIMABLE_BALANCE), + "SET_TRUST_LINE_FLAGS": int32(SET_TRUST_LINE_FLAGS), + "LIQUIDITY_POOL_DEPOSIT": int32(LIQUIDITY_POOL_DEPOSIT), + "LIQUIDITY_POOL_WITHDRAW": int32(LIQUIDITY_POOL_WITHDRAW), + "INVOKE_HOST_FUNCTION": int32(INVOKE_HOST_FUNCTION), + "EXTEND_FOOTPRINT_TTL": int32(EXTEND_FOOTPRINT_TTL), + "RESTORE_FOOTPRINT": int32(RESTORE_FOOTPRINT), } -func (SorobanCredentialsType) XdrEnumNames() map[int32]string { - return _XdrNames_SorobanCredentialsType +func (OperationType) XdrEnumNames() map[int32]string { + return _XdrNames_OperationType } -func (v SorobanCredentialsType) String() string { - if s, ok := _XdrNames_SorobanCredentialsType[int32(v)]; ok { +func (v OperationType) String() string { + if s, ok := _XdrNames_OperationType[int32(v)]; ok { return s } - return fmt.Sprintf("SorobanCredentialsType#%d", v) + return fmt.Sprintf("OperationType#%d", v) } -func (v *SorobanCredentialsType) Scan(ss fmt.ScanState, _ rune) error { +func (v *OperationType) Scan(ss fmt.ScanState, _ rune) error { if tok, err := ss.Token(true, XdrSymChar); err != nil { return err } else { stok := string(tok) - if val, ok := _XdrValues_SorobanCredentialsType[stok]; ok { - *v = SorobanCredentialsType(val) + if val, ok := _XdrValues_OperationType[stok]; ok { + *v = OperationType(val) return nil - } else if stok == "SorobanCredentialsType" { + } else if stok == "OperationType" { if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { return nil } } - return XdrError(fmt.Sprintf("%s is not a valid SorobanCredentialsType.", stok)) + return XdrError(fmt.Sprintf("%s is not a valid OperationType.", stok)) } } -func (v SorobanCredentialsType) GetU32() uint32 { return uint32(v) } -func (v *SorobanCredentialsType) SetU32(n uint32) { *v = SorobanCredentialsType(n) } -func (v *SorobanCredentialsType) XdrPointer() interface{} { return v } -func (SorobanCredentialsType) XdrTypeName() string { return "SorobanCredentialsType" } -func (v SorobanCredentialsType) XdrValue() interface{} { return v } -func (v *SorobanCredentialsType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_SorobanCredentialsType = *SorobanCredentialsType - -func XDR_SorobanCredentialsType(v *SorobanCredentialsType) *SorobanCredentialsType { return v } +func (v OperationType) GetU32() uint32 { return uint32(v) } +func (v *OperationType) SetU32(n uint32) { *v = OperationType(n) } +func (v *OperationType) XdrPointer() interface{} { return v } +func (OperationType) XdrTypeName() string { return "OperationType" } +func (v OperationType) XdrValue() interface{} { return v } +func (v *OperationType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -var _XdrTags_SorobanCredentials = map[int32]bool{ - XdrToI32(SOROBAN_CREDENTIALS_SOURCE_ACCOUNT): true, - XdrToI32(SOROBAN_CREDENTIALS_ADDRESS): true, -} +type XdrType_OperationType = *OperationType -func (_ SorobanCredentials) XdrValidTags() map[int32]bool { - return _XdrTags_SorobanCredentials -} -func (u *SorobanCredentials) Address() *SorobanAddressCredentials { - switch u.Type { - case SOROBAN_CREDENTIALS_ADDRESS: - if v, ok := u._u.(*SorobanAddressCredentials); ok { - return v - } else { - var zero SorobanAddressCredentials - u._u = &zero - return &zero - } - default: - XdrPanic("SorobanCredentials.Address accessed when Type == %v", u.Type) - return nil - } -} -func (u SorobanCredentials) XdrValid() bool { - switch u.Type { - case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT, SOROBAN_CREDENTIALS_ADDRESS: - return true - } - return false -} -func (u *SorobanCredentials) XdrUnionTag() XdrNum32 { - return XDR_SorobanCredentialsType(&u.Type) -} -func (u *SorobanCredentials) XdrUnionTagName() string { - return "Type" -} -func (u *SorobanCredentials) XdrUnionBody() XdrType { - switch u.Type { - case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: - return nil - case SOROBAN_CREDENTIALS_ADDRESS: - return XDR_SorobanAddressCredentials(u.Address()) - } - return nil -} -func (u *SorobanCredentials) XdrUnionBodyName() string { - switch u.Type { - case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: - return "" - case SOROBAN_CREDENTIALS_ADDRESS: - return "Address" - } - return "" -} +func XDR_OperationType(v *OperationType) *OperationType { return v } -type XdrType_SorobanCredentials = *SorobanCredentials +type XdrType_CreateAccountOp = *CreateAccountOp -func (v *SorobanCredentials) XdrPointer() interface{} { return v } -func (SorobanCredentials) XdrTypeName() string { return "SorobanCredentials" } -func (v SorobanCredentials) XdrValue() interface{} { return v } -func (v *SorobanCredentials) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *SorobanCredentials) XdrRecurse(x XDR, name string) { +func (v *CreateAccountOp) XdrPointer() interface{} { return v } +func (CreateAccountOp) XdrTypeName() string { return "CreateAccountOp" } +func (v CreateAccountOp) XdrValue() interface{} { return v } +func (v *CreateAccountOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *CreateAccountOp) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_SorobanCredentialsType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: - return - case SOROBAN_CREDENTIALS_ADDRESS: - x.Marshal(x.Sprintf("%saddress", name), XDR_SorobanAddressCredentials(u.Address())) - return - } - XdrPanic("invalid Type (%v) in SorobanCredentials", u.Type) + x.Marshal(x.Sprintf("%sdestination", name), XDR_AccountID(&v.Destination)) + x.Marshal(x.Sprintf("%sstartingBalance", name), XDR_Int64(&v.StartingBalance)) } -func XDR_SorobanCredentials(v *SorobanCredentials) *SorobanCredentials { return v } +func XDR_CreateAccountOp(v *CreateAccountOp) *CreateAccountOp { return v } -type XdrType_SorobanAuthorizationEntry = *SorobanAuthorizationEntry +type XdrType_PaymentOp = *PaymentOp -func (v *SorobanAuthorizationEntry) XdrPointer() interface{} { return v } -func (SorobanAuthorizationEntry) XdrTypeName() string { return "SorobanAuthorizationEntry" } -func (v SorobanAuthorizationEntry) XdrValue() interface{} { return v } -func (v *SorobanAuthorizationEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *SorobanAuthorizationEntry) XdrRecurse(x XDR, name string) { +func (v *PaymentOp) XdrPointer() interface{} { return v } +func (PaymentOp) XdrTypeName() string { return "PaymentOp" } +func (v PaymentOp) XdrValue() interface{} { return v } +func (v *PaymentOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *PaymentOp) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%scredentials", name), XDR_SorobanCredentials(&v.Credentials)) - x.Marshal(x.Sprintf("%srootInvocation", name), XDR_SorobanAuthorizedInvocation(&v.RootInvocation)) + x.Marshal(x.Sprintf("%sdestination", name), XDR_MuxedAccount(&v.Destination)) + x.Marshal(x.Sprintf("%sasset", name), XDR_Asset(&v.Asset)) + x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) } -func XDR_SorobanAuthorizationEntry(v *SorobanAuthorizationEntry) *SorobanAuthorizationEntry { return v } +func XDR_PaymentOp(v *PaymentOp) *PaymentOp { return v } -type _XdrVec_unbounded_SorobanAuthorizationEntry []SorobanAuthorizationEntry +type _XdrVec_5_Asset []Asset -func (_XdrVec_unbounded_SorobanAuthorizationEntry) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound +func (_XdrVec_5_Asset) XdrBound() uint32 { + const bound uint32 = 5 // Force error if not const or doesn't fit + return bound } -func (_XdrVec_unbounded_SorobanAuthorizationEntry) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_SorobanAuthorizationEntry length %d exceeds bound 4294967295", length) +func (_XdrVec_5_Asset) XdrCheckLen(length uint32) { + if length > uint32(5) { + XdrPanic("_XdrVec_5_Asset length %d exceeds bound 5", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_SorobanAuthorizationEntry length %d exceeds max int", length) + XdrPanic("_XdrVec_5_Asset length %d exceeds max int", length) } } -func (v _XdrVec_unbounded_SorobanAuthorizationEntry) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) SetVecLen(length uint32) { +func (v _XdrVec_5_Asset) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_5_Asset) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -17094,738 +16144,3161 @@ func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) SetVecLen(length uint32) { newcap := 2 * cap(*v) if newcap < int(length) { // also catches overflow where 2*cap < 0 newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { + } else if bound := uint(5); uint(newcap) > bound { if int(bound) < 0 { bound = ^uint(0) >> 1 } newcap = int(bound) } - nv := make([]SorobanAuthorizationEntry, int(length), newcap) + nv := make([]Asset, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_5_Asset) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_SorobanAuthorizationEntry(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_Asset(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} +func (v *_XdrVec_5_Asset) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 5} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_unbounded_SorobanAuthorizationEntry) XdrTypeName() string { - return "SorobanAuthorizationEntry<>" -} -func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) XdrPointer() interface{} { - return (*[]SorobanAuthorizationEntry)(v) -} -func (v _XdrVec_unbounded_SorobanAuthorizationEntry) XdrValue() interface{} { - return ([]SorobanAuthorizationEntry)(v) +func (_XdrVec_5_Asset) XdrTypeName() string { return "Asset<>" } +func (v *_XdrVec_5_Asset) XdrPointer() interface{} { return (*[]Asset)(v) } +func (v _XdrVec_5_Asset) XdrValue() interface{} { return ([]Asset)(v) } +func (v *_XdrVec_5_Asset) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_PathPaymentStrictReceiveOp = *PathPaymentStrictReceiveOp + +func (v *PathPaymentStrictReceiveOp) XdrPointer() interface{} { return v } +func (PathPaymentStrictReceiveOp) XdrTypeName() string { return "PathPaymentStrictReceiveOp" } +func (v PathPaymentStrictReceiveOp) XdrValue() interface{} { return v } +func (v *PathPaymentStrictReceiveOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *PathPaymentStrictReceiveOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%ssendAsset", name), XDR_Asset(&v.SendAsset)) + x.Marshal(x.Sprintf("%ssendMax", name), XDR_Int64(&v.SendMax)) + x.Marshal(x.Sprintf("%sdestination", name), XDR_MuxedAccount(&v.Destination)) + x.Marshal(x.Sprintf("%sdestAsset", name), XDR_Asset(&v.DestAsset)) + x.Marshal(x.Sprintf("%sdestAmount", name), XDR_Int64(&v.DestAmount)) + x.Marshal(x.Sprintf("%spath", name), (*_XdrVec_5_Asset)(&v.Path)) } -func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) XdrMarshal(x XDR, name string) { - x.Marshal(name, v) +func XDR_PathPaymentStrictReceiveOp(v *PathPaymentStrictReceiveOp) *PathPaymentStrictReceiveOp { + return v } -type XdrType_InvokeHostFunctionOp = *InvokeHostFunctionOp +type XdrType_PathPaymentStrictSendOp = *PathPaymentStrictSendOp -func (v *InvokeHostFunctionOp) XdrPointer() interface{} { return v } -func (InvokeHostFunctionOp) XdrTypeName() string { return "InvokeHostFunctionOp" } -func (v InvokeHostFunctionOp) XdrValue() interface{} { return v } -func (v *InvokeHostFunctionOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *InvokeHostFunctionOp) XdrRecurse(x XDR, name string) { +func (v *PathPaymentStrictSendOp) XdrPointer() interface{} { return v } +func (PathPaymentStrictSendOp) XdrTypeName() string { return "PathPaymentStrictSendOp" } +func (v PathPaymentStrictSendOp) XdrValue() interface{} { return v } +func (v *PathPaymentStrictSendOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *PathPaymentStrictSendOp) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%shostFunction", name), XDR_HostFunction(&v.HostFunction)) - x.Marshal(x.Sprintf("%sauth", name), (*_XdrVec_unbounded_SorobanAuthorizationEntry)(&v.Auth)) + x.Marshal(x.Sprintf("%ssendAsset", name), XDR_Asset(&v.SendAsset)) + x.Marshal(x.Sprintf("%ssendAmount", name), XDR_Int64(&v.SendAmount)) + x.Marshal(x.Sprintf("%sdestination", name), XDR_MuxedAccount(&v.Destination)) + x.Marshal(x.Sprintf("%sdestAsset", name), XDR_Asset(&v.DestAsset)) + x.Marshal(x.Sprintf("%sdestMin", name), XDR_Int64(&v.DestMin)) + x.Marshal(x.Sprintf("%spath", name), (*_XdrVec_5_Asset)(&v.Path)) } -func XDR_InvokeHostFunctionOp(v *InvokeHostFunctionOp) *InvokeHostFunctionOp { return v } +func XDR_PathPaymentStrictSendOp(v *PathPaymentStrictSendOp) *PathPaymentStrictSendOp { return v } -type XdrType_ExtendFootprintTTLOp = *ExtendFootprintTTLOp +type XdrType_ManageSellOfferOp = *ManageSellOfferOp -func (v *ExtendFootprintTTLOp) XdrPointer() interface{} { return v } -func (ExtendFootprintTTLOp) XdrTypeName() string { return "ExtendFootprintTTLOp" } -func (v ExtendFootprintTTLOp) XdrValue() interface{} { return v } -func (v *ExtendFootprintTTLOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *ExtendFootprintTTLOp) XdrRecurse(x XDR, name string) { +func (v *ManageSellOfferOp) XdrPointer() interface{} { return v } +func (ManageSellOfferOp) XdrTypeName() string { return "ManageSellOfferOp" } +func (v ManageSellOfferOp) XdrValue() interface{} { return v } +func (v *ManageSellOfferOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ManageSellOfferOp) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) - x.Marshal(x.Sprintf("%sextendTo", name), XDR_Uint32(&v.ExtendTo)) + x.Marshal(x.Sprintf("%sselling", name), XDR_Asset(&v.Selling)) + x.Marshal(x.Sprintf("%sbuying", name), XDR_Asset(&v.Buying)) + x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) + x.Marshal(x.Sprintf("%sprice", name), XDR_Price(&v.Price)) + x.Marshal(x.Sprintf("%sofferID", name), XDR_Int64(&v.OfferID)) } -func XDR_ExtendFootprintTTLOp(v *ExtendFootprintTTLOp) *ExtendFootprintTTLOp { return v } +func XDR_ManageSellOfferOp(v *ManageSellOfferOp) *ManageSellOfferOp { return v } -type XdrType_RestoreFootprintOp = *RestoreFootprintOp +type XdrType_ManageBuyOfferOp = *ManageBuyOfferOp -func (v *RestoreFootprintOp) XdrPointer() interface{} { return v } -func (RestoreFootprintOp) XdrTypeName() string { return "RestoreFootprintOp" } -func (v RestoreFootprintOp) XdrValue() interface{} { return v } -func (v *RestoreFootprintOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *RestoreFootprintOp) XdrRecurse(x XDR, name string) { +func (v *ManageBuyOfferOp) XdrPointer() interface{} { return v } +func (ManageBuyOfferOp) XdrTypeName() string { return "ManageBuyOfferOp" } +func (v ManageBuyOfferOp) XdrValue() interface{} { return v } +func (v *ManageBuyOfferOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ManageBuyOfferOp) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%sselling", name), XDR_Asset(&v.Selling)) + x.Marshal(x.Sprintf("%sbuying", name), XDR_Asset(&v.Buying)) + x.Marshal(x.Sprintf("%sbuyAmount", name), XDR_Int64(&v.BuyAmount)) + x.Marshal(x.Sprintf("%sprice", name), XDR_Price(&v.Price)) + x.Marshal(x.Sprintf("%sofferID", name), XDR_Int64(&v.OfferID)) } -func XDR_RestoreFootprintOp(v *RestoreFootprintOp) *RestoreFootprintOp { return v } +func XDR_ManageBuyOfferOp(v *ManageBuyOfferOp) *ManageBuyOfferOp { return v } -var _XdrTags_XdrAnon_Operation_Body = map[int32]bool{ - XdrToI32(CREATE_ACCOUNT): true, - XdrToI32(PAYMENT): true, - XdrToI32(PATH_PAYMENT_STRICT_RECEIVE): true, - XdrToI32(MANAGE_SELL_OFFER): true, - XdrToI32(CREATE_PASSIVE_SELL_OFFER): true, - XdrToI32(SET_OPTIONS): true, - XdrToI32(CHANGE_TRUST): true, - XdrToI32(ALLOW_TRUST): true, - XdrToI32(ACCOUNT_MERGE): true, - XdrToI32(INFLATION): true, - XdrToI32(MANAGE_DATA): true, - XdrToI32(BUMP_SEQUENCE): true, - XdrToI32(MANAGE_BUY_OFFER): true, - XdrToI32(PATH_PAYMENT_STRICT_SEND): true, - XdrToI32(CREATE_CLAIMABLE_BALANCE): true, - XdrToI32(CLAIM_CLAIMABLE_BALANCE): true, - XdrToI32(BEGIN_SPONSORING_FUTURE_RESERVES): true, - XdrToI32(END_SPONSORING_FUTURE_RESERVES): true, - XdrToI32(REVOKE_SPONSORSHIP): true, - XdrToI32(CLAWBACK): true, - XdrToI32(CLAWBACK_CLAIMABLE_BALANCE): true, - XdrToI32(SET_TRUST_LINE_FLAGS): true, - XdrToI32(LIQUIDITY_POOL_DEPOSIT): true, - XdrToI32(LIQUIDITY_POOL_WITHDRAW): true, - XdrToI32(INVOKE_HOST_FUNCTION): true, - XdrToI32(EXTEND_FOOTPRINT_TTL): true, - XdrToI32(RESTORE_FOOTPRINT): true, +type XdrType_CreatePassiveSellOfferOp = *CreatePassiveSellOfferOp + +func (v *CreatePassiveSellOfferOp) XdrPointer() interface{} { return v } +func (CreatePassiveSellOfferOp) XdrTypeName() string { return "CreatePassiveSellOfferOp" } +func (v CreatePassiveSellOfferOp) XdrValue() interface{} { return v } +func (v *CreatePassiveSellOfferOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *CreatePassiveSellOfferOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sselling", name), XDR_Asset(&v.Selling)) + x.Marshal(x.Sprintf("%sbuying", name), XDR_Asset(&v.Buying)) + x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) + x.Marshal(x.Sprintf("%sprice", name), XDR_Price(&v.Price)) } +func XDR_CreatePassiveSellOfferOp(v *CreatePassiveSellOfferOp) *CreatePassiveSellOfferOp { return v } -func (_ XdrAnon_Operation_Body) XdrValidTags() map[int32]bool { - return _XdrTags_XdrAnon_Operation_Body +type _XdrPtr_Uint32 struct { + p **Uint32 } -func (u *XdrAnon_Operation_Body) CreateAccountOp() *CreateAccountOp { - switch u.Type { - case CREATE_ACCOUNT: - if v, ok := u._u.(*CreateAccountOp); ok { - return v - } else { - var zero CreateAccountOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.CreateAccountOp accessed when Type == %v", u.Type) - return nil +type _ptrflag_Uint32 _XdrPtr_Uint32 + +func (v _ptrflag_Uint32) String() string { + if *v.p == nil { + return "nil" } + return "non-nil" } -func (u *XdrAnon_Operation_Body) PaymentOp() *PaymentOp { - switch u.Type { - case PAYMENT: - if v, ok := u._u.(*PaymentOp); ok { - return v - } else { - var zero PaymentOp - u._u = &zero - return &zero - } +func (v _ptrflag_Uint32) Scan(ss fmt.ScanState, r rune) error { + tok, err := ss.Token(true, func(c rune) bool { + return c == '-' || (c >= 'a' && c <= 'z') + }) + if err != nil { + return err + } + switch string(tok) { + case "nil": + v.SetU32(0) + case "non-nil": + v.SetU32(1) default: - XdrPanic("XdrAnon_Operation_Body.PaymentOp accessed when Type == %v", u.Type) - return nil + return XdrError("Uint32 flag should be \"nil\" or \"non-nil\"") } + return nil } -func (u *XdrAnon_Operation_Body) PathPaymentStrictReceiveOp() *PathPaymentStrictReceiveOp { - switch u.Type { - case PATH_PAYMENT_STRICT_RECEIVE: - if v, ok := u._u.(*PathPaymentStrictReceiveOp); ok { - return v - } else { - var zero PathPaymentStrictReceiveOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.PathPaymentStrictReceiveOp accessed when Type == %v", u.Type) - return nil +func (v _ptrflag_Uint32) GetU32() uint32 { + if *v.p == nil { + return 0 } + return 1 } -func (u *XdrAnon_Operation_Body) ManageSellOfferOp() *ManageSellOfferOp { - switch u.Type { - case MANAGE_SELL_OFFER: - if v, ok := u._u.(*ManageSellOfferOp); ok { - return v - } else { - var zero ManageSellOfferOp - u._u = &zero - return &zero +func (v _ptrflag_Uint32) SetU32(nv uint32) { + switch nv { + case 0: + *v.p = nil + case 1: + if *v.p == nil { + *v.p = new(Uint32) } default: - XdrPanic("XdrAnon_Operation_Body.ManageSellOfferOp accessed when Type == %v", u.Type) - return nil + XdrPanic("*Uint32 present flag value %d should be 0 or 1", nv) } } -func (u *XdrAnon_Operation_Body) CreatePassiveSellOfferOp() *CreatePassiveSellOfferOp { - switch u.Type { - case CREATE_PASSIVE_SELL_OFFER: - if v, ok := u._u.(*CreatePassiveSellOfferOp); ok { - return v - } else { - var zero CreatePassiveSellOfferOp - u._u = &zero - return &zero - } +func (_ptrflag_Uint32) XdrTypeName() string { return "Uint32?" } +func (v _ptrflag_Uint32) XdrPointer() interface{} { return nil } +func (v _ptrflag_Uint32) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_Uint32) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_Uint32) XdrBound() uint32 { return 1 } +func (v _XdrPtr_Uint32) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_Uint32) SetPresent(present bool) { + if !present { + *v.p = nil + } else if *v.p == nil { + *v.p = new(Uint32) + } +} +func (v _XdrPtr_Uint32) XdrMarshalValue(x XDR, name string) { + if *v.p != nil { + XDR_Uint32(*v.p).XdrMarshal(x, name) + } +} +func (v _XdrPtr_Uint32) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_Uint32) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_Uint32(v)) + v.XdrMarshalValue(x, name) +} +func (_XdrPtr_Uint32) XdrTypeName() string { return "Uint32*" } +func (v _XdrPtr_Uint32) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_Uint32) XdrValue() interface{} { return *v.p } + +type _XdrPtr_String32 struct { + p **String32 +} +type _ptrflag_String32 _XdrPtr_String32 + +func (v _ptrflag_String32) String() string { + if *v.p == nil { + return "nil" + } + return "non-nil" +} +func (v _ptrflag_String32) Scan(ss fmt.ScanState, r rune) error { + tok, err := ss.Token(true, func(c rune) bool { + return c == '-' || (c >= 'a' && c <= 'z') + }) + if err != nil { + return err + } + switch string(tok) { + case "nil": + v.SetU32(0) + case "non-nil": + v.SetU32(1) default: - XdrPanic("XdrAnon_Operation_Body.CreatePassiveSellOfferOp accessed when Type == %v", u.Type) - return nil + return XdrError("String32 flag should be \"nil\" or \"non-nil\"") } + return nil } -func (u *XdrAnon_Operation_Body) SetOptionsOp() *SetOptionsOp { - switch u.Type { - case SET_OPTIONS: - if v, ok := u._u.(*SetOptionsOp); ok { - return v - } else { - var zero SetOptionsOp - u._u = &zero - return &zero +func (v _ptrflag_String32) GetU32() uint32 { + if *v.p == nil { + return 0 + } + return 1 +} +func (v _ptrflag_String32) SetU32(nv uint32) { + switch nv { + case 0: + *v.p = nil + case 1: + if *v.p == nil { + *v.p = new(String32) } default: - XdrPanic("XdrAnon_Operation_Body.SetOptionsOp accessed when Type == %v", u.Type) - return nil + XdrPanic("*String32 present flag value %d should be 0 or 1", nv) } } -func (u *XdrAnon_Operation_Body) ChangeTrustOp() *ChangeTrustOp { - switch u.Type { - case CHANGE_TRUST: - if v, ok := u._u.(*ChangeTrustOp); ok { - return v - } else { - var zero ChangeTrustOp - u._u = &zero - return &zero +func (_ptrflag_String32) XdrTypeName() string { return "String32?" } +func (v _ptrflag_String32) XdrPointer() interface{} { return nil } +func (v _ptrflag_String32) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_String32) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_String32) XdrBound() uint32 { return 1 } +func (v _XdrPtr_String32) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_String32) SetPresent(present bool) { + if !present { + *v.p = nil + } else if *v.p == nil { + *v.p = new(String32) + } +} +func (v _XdrPtr_String32) XdrMarshalValue(x XDR, name string) { + if *v.p != nil { + XDR_String32(*v.p).XdrMarshal(x, name) + } +} +func (v _XdrPtr_String32) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_String32) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_String32(v)) + v.XdrMarshalValue(x, name) +} +func (_XdrPtr_String32) XdrTypeName() string { return "String32*" } +func (v _XdrPtr_String32) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_String32) XdrValue() interface{} { return *v.p } + +type _XdrPtr_Signer struct { + p **Signer +} +type _ptrflag_Signer _XdrPtr_Signer + +func (v _ptrflag_Signer) String() string { + if *v.p == nil { + return "nil" + } + return "non-nil" +} +func (v _ptrflag_Signer) Scan(ss fmt.ScanState, r rune) error { + tok, err := ss.Token(true, func(c rune) bool { + return c == '-' || (c >= 'a' && c <= 'z') + }) + if err != nil { + return err + } + switch string(tok) { + case "nil": + v.SetU32(0) + case "non-nil": + v.SetU32(1) + default: + return XdrError("Signer flag should be \"nil\" or \"non-nil\"") + } + return nil +} +func (v _ptrflag_Signer) GetU32() uint32 { + if *v.p == nil { + return 0 + } + return 1 +} +func (v _ptrflag_Signer) SetU32(nv uint32) { + switch nv { + case 0: + *v.p = nil + case 1: + if *v.p == nil { + *v.p = new(Signer) } default: - XdrPanic("XdrAnon_Operation_Body.ChangeTrustOp accessed when Type == %v", u.Type) - return nil + XdrPanic("*Signer present flag value %d should be 0 or 1", nv) } } -func (u *XdrAnon_Operation_Body) AllowTrustOp() *AllowTrustOp { +func (_ptrflag_Signer) XdrTypeName() string { return "Signer?" } +func (v _ptrflag_Signer) XdrPointer() interface{} { return nil } +func (v _ptrflag_Signer) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_Signer) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_Signer) XdrBound() uint32 { return 1 } +func (v _XdrPtr_Signer) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_Signer) SetPresent(present bool) { + if !present { + *v.p = nil + } else if *v.p == nil { + *v.p = new(Signer) + } +} +func (v _XdrPtr_Signer) XdrMarshalValue(x XDR, name string) { + if *v.p != nil { + XDR_Signer(*v.p).XdrMarshal(x, name) + } +} +func (v _XdrPtr_Signer) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_Signer) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_Signer(v)) + v.XdrMarshalValue(x, name) +} +func (_XdrPtr_Signer) XdrTypeName() string { return "Signer*" } +func (v _XdrPtr_Signer) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_Signer) XdrValue() interface{} { return *v.p } + +type XdrType_SetOptionsOp = *SetOptionsOp + +func (v *SetOptionsOp) XdrPointer() interface{} { return v } +func (SetOptionsOp) XdrTypeName() string { return "SetOptionsOp" } +func (v SetOptionsOp) XdrValue() interface{} { return v } +func (v *SetOptionsOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SetOptionsOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sinflationDest", name), _XdrPtr_AccountID{&v.InflationDest}) + x.Marshal(x.Sprintf("%sclearFlags", name), _XdrPtr_Uint32{&v.ClearFlags}) + x.Marshal(x.Sprintf("%ssetFlags", name), _XdrPtr_Uint32{&v.SetFlags}) + x.Marshal(x.Sprintf("%smasterWeight", name), _XdrPtr_Uint32{&v.MasterWeight}) + x.Marshal(x.Sprintf("%slowThreshold", name), _XdrPtr_Uint32{&v.LowThreshold}) + x.Marshal(x.Sprintf("%smedThreshold", name), _XdrPtr_Uint32{&v.MedThreshold}) + x.Marshal(x.Sprintf("%shighThreshold", name), _XdrPtr_Uint32{&v.HighThreshold}) + x.Marshal(x.Sprintf("%shomeDomain", name), _XdrPtr_String32{&v.HomeDomain}) + x.Marshal(x.Sprintf("%ssigner", name), _XdrPtr_Signer{&v.Signer}) +} +func XDR_SetOptionsOp(v *SetOptionsOp) *SetOptionsOp { return v } + +var _XdrTags_ChangeTrustAsset = map[int32]bool{ + XdrToI32(ASSET_TYPE_NATIVE): true, + XdrToI32(ASSET_TYPE_CREDIT_ALPHANUM4): true, + XdrToI32(ASSET_TYPE_CREDIT_ALPHANUM12): true, + XdrToI32(ASSET_TYPE_POOL_SHARE): true, +} + +func (_ ChangeTrustAsset) XdrValidTags() map[int32]bool { + return _XdrTags_ChangeTrustAsset +} +func (u *ChangeTrustAsset) AlphaNum4() *AlphaNum4 { switch u.Type { - case ALLOW_TRUST: - if v, ok := u._u.(*AllowTrustOp); ok { + case ASSET_TYPE_CREDIT_ALPHANUM4: + if v, ok := u._u.(*AlphaNum4); ok { return v } else { - var zero AllowTrustOp + var zero AlphaNum4 u._u = &zero return &zero } default: - XdrPanic("XdrAnon_Operation_Body.AllowTrustOp accessed when Type == %v", u.Type) + XdrPanic("ChangeTrustAsset.AlphaNum4 accessed when Type == %v", u.Type) return nil } } -func (u *XdrAnon_Operation_Body) Destination() *MuxedAccount { +func (u *ChangeTrustAsset) AlphaNum12() *AlphaNum12 { switch u.Type { - case ACCOUNT_MERGE: - if v, ok := u._u.(*MuxedAccount); ok { + case ASSET_TYPE_CREDIT_ALPHANUM12: + if v, ok := u._u.(*AlphaNum12); ok { return v } else { - var zero MuxedAccount + var zero AlphaNum12 u._u = &zero return &zero } default: - XdrPanic("XdrAnon_Operation_Body.Destination accessed when Type == %v", u.Type) + XdrPanic("ChangeTrustAsset.AlphaNum12 accessed when Type == %v", u.Type) return nil } } -func (u *XdrAnon_Operation_Body) ManageDataOp() *ManageDataOp { +func (u *ChangeTrustAsset) LiquidityPool() *LiquidityPoolParameters { switch u.Type { - case MANAGE_DATA: - if v, ok := u._u.(*ManageDataOp); ok { + case ASSET_TYPE_POOL_SHARE: + if v, ok := u._u.(*LiquidityPoolParameters); ok { return v } else { - var zero ManageDataOp + var zero LiquidityPoolParameters u._u = &zero return &zero } default: - XdrPanic("XdrAnon_Operation_Body.ManageDataOp accessed when Type == %v", u.Type) + XdrPanic("ChangeTrustAsset.LiquidityPool accessed when Type == %v", u.Type) return nil } } -func (u *XdrAnon_Operation_Body) BumpSequenceOp() *BumpSequenceOp { +func (u ChangeTrustAsset) XdrValid() bool { switch u.Type { - case BUMP_SEQUENCE: - if v, ok := u._u.(*BumpSequenceOp); ok { - return v - } else { - var zero BumpSequenceOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.BumpSequenceOp accessed when Type == %v", u.Type) - return nil + case ASSET_TYPE_NATIVE, ASSET_TYPE_CREDIT_ALPHANUM4, ASSET_TYPE_CREDIT_ALPHANUM12, ASSET_TYPE_POOL_SHARE: + return true } + return false } -func (u *XdrAnon_Operation_Body) ManageBuyOfferOp() *ManageBuyOfferOp { - switch u.Type { - case MANAGE_BUY_OFFER: - if v, ok := u._u.(*ManageBuyOfferOp); ok { - return v - } else { - var zero ManageBuyOfferOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.ManageBuyOfferOp accessed when Type == %v", u.Type) - return nil - } +func (u *ChangeTrustAsset) XdrUnionTag() XdrNum32 { + return XDR_AssetType(&u.Type) } -func (u *XdrAnon_Operation_Body) PathPaymentStrictSendOp() *PathPaymentStrictSendOp { +func (u *ChangeTrustAsset) XdrUnionTagName() string { + return "Type" +} +func (u *ChangeTrustAsset) XdrUnionBody() XdrType { switch u.Type { - case PATH_PAYMENT_STRICT_SEND: - if v, ok := u._u.(*PathPaymentStrictSendOp); ok { - return v - } else { - var zero PathPaymentStrictSendOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.PathPaymentStrictSendOp accessed when Type == %v", u.Type) + case ASSET_TYPE_NATIVE: return nil + case ASSET_TYPE_CREDIT_ALPHANUM4: + return XDR_AlphaNum4(u.AlphaNum4()) + case ASSET_TYPE_CREDIT_ALPHANUM12: + return XDR_AlphaNum12(u.AlphaNum12()) + case ASSET_TYPE_POOL_SHARE: + return XDR_LiquidityPoolParameters(u.LiquidityPool()) } + return nil } -func (u *XdrAnon_Operation_Body) CreateClaimableBalanceOp() *CreateClaimableBalanceOp { +func (u *ChangeTrustAsset) XdrUnionBodyName() string { switch u.Type { - case CREATE_CLAIMABLE_BALANCE: - if v, ok := u._u.(*CreateClaimableBalanceOp); ok { - return v - } else { - var zero CreateClaimableBalanceOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.CreateClaimableBalanceOp accessed when Type == %v", u.Type) - return nil + case ASSET_TYPE_NATIVE: + return "" + case ASSET_TYPE_CREDIT_ALPHANUM4: + return "AlphaNum4" + case ASSET_TYPE_CREDIT_ALPHANUM12: + return "AlphaNum12" + case ASSET_TYPE_POOL_SHARE: + return "LiquidityPool" } + return "" } -func (u *XdrAnon_Operation_Body) ClaimClaimableBalanceOp() *ClaimClaimableBalanceOp { + +type XdrType_ChangeTrustAsset = *ChangeTrustAsset + +func (v *ChangeTrustAsset) XdrPointer() interface{} { return v } +func (ChangeTrustAsset) XdrTypeName() string { return "ChangeTrustAsset" } +func (v ChangeTrustAsset) XdrValue() interface{} { return v } +func (v *ChangeTrustAsset) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *ChangeTrustAsset) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_AssetType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) switch u.Type { - case CLAIM_CLAIMABLE_BALANCE: - if v, ok := u._u.(*ClaimClaimableBalanceOp); ok { - return v - } else { - var zero ClaimClaimableBalanceOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.ClaimClaimableBalanceOp accessed when Type == %v", u.Type) - return nil + case ASSET_TYPE_NATIVE: + return + case ASSET_TYPE_CREDIT_ALPHANUM4: + x.Marshal(x.Sprintf("%salphaNum4", name), XDR_AlphaNum4(u.AlphaNum4())) + return + case ASSET_TYPE_CREDIT_ALPHANUM12: + x.Marshal(x.Sprintf("%salphaNum12", name), XDR_AlphaNum12(u.AlphaNum12())) + return + case ASSET_TYPE_POOL_SHARE: + x.Marshal(x.Sprintf("%sliquidityPool", name), XDR_LiquidityPoolParameters(u.LiquidityPool())) + return } + XdrPanic("invalid Type (%v) in ChangeTrustAsset", u.Type) } -func (u *XdrAnon_Operation_Body) BeginSponsoringFutureReservesOp() *BeginSponsoringFutureReservesOp { - switch u.Type { - case BEGIN_SPONSORING_FUTURE_RESERVES: - if v, ok := u._u.(*BeginSponsoringFutureReservesOp); ok { - return v - } else { - var zero BeginSponsoringFutureReservesOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.BeginSponsoringFutureReservesOp accessed when Type == %v", u.Type) - return nil +func XDR_ChangeTrustAsset(v *ChangeTrustAsset) *ChangeTrustAsset { return v } + +type XdrType_ChangeTrustOp = *ChangeTrustOp + +func (v *ChangeTrustOp) XdrPointer() interface{} { return v } +func (ChangeTrustOp) XdrTypeName() string { return "ChangeTrustOp" } +func (v ChangeTrustOp) XdrValue() interface{} { return v } +func (v *ChangeTrustOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ChangeTrustOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%sline", name), XDR_ChangeTrustAsset(&v.Line)) + x.Marshal(x.Sprintf("%slimit", name), XDR_Int64(&v.Limit)) } -func (u *XdrAnon_Operation_Body) RevokeSponsorshipOp() *RevokeSponsorshipOp { - switch u.Type { - case REVOKE_SPONSORSHIP: - if v, ok := u._u.(*RevokeSponsorshipOp); ok { - return v - } else { - var zero RevokeSponsorshipOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.RevokeSponsorshipOp accessed when Type == %v", u.Type) - return nil +func XDR_ChangeTrustOp(v *ChangeTrustOp) *ChangeTrustOp { return v } + +type XdrType_AllowTrustOp = *AllowTrustOp + +func (v *AllowTrustOp) XdrPointer() interface{} { return v } +func (AllowTrustOp) XdrTypeName() string { return "AllowTrustOp" } +func (v AllowTrustOp) XdrValue() interface{} { return v } +func (v *AllowTrustOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *AllowTrustOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%strustor", name), XDR_AccountID(&v.Trustor)) + x.Marshal(x.Sprintf("%sasset", name), XDR_AssetCode(&v.Asset)) + x.Marshal(x.Sprintf("%sauthorize", name), XDR_Uint32(&v.Authorize)) } -func (u *XdrAnon_Operation_Body) ClawbackOp() *ClawbackOp { - switch u.Type { - case CLAWBACK: - if v, ok := u._u.(*ClawbackOp); ok { - return v - } else { - var zero ClawbackOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.ClawbackOp accessed when Type == %v", u.Type) - return nil +func XDR_AllowTrustOp(v *AllowTrustOp) *AllowTrustOp { return v } + +type _XdrPtr_DataValue struct { + p **DataValue +} +type _ptrflag_DataValue _XdrPtr_DataValue + +func (v _ptrflag_DataValue) String() string { + if *v.p == nil { + return "nil" } + return "non-nil" } -func (u *XdrAnon_Operation_Body) ClawbackClaimableBalanceOp() *ClawbackClaimableBalanceOp { - switch u.Type { - case CLAWBACK_CLAIMABLE_BALANCE: - if v, ok := u._u.(*ClawbackClaimableBalanceOp); ok { - return v - } else { - var zero ClawbackClaimableBalanceOp - u._u = &zero - return &zero - } +func (v _ptrflag_DataValue) Scan(ss fmt.ScanState, r rune) error { + tok, err := ss.Token(true, func(c rune) bool { + return c == '-' || (c >= 'a' && c <= 'z') + }) + if err != nil { + return err + } + switch string(tok) { + case "nil": + v.SetU32(0) + case "non-nil": + v.SetU32(1) default: - XdrPanic("XdrAnon_Operation_Body.ClawbackClaimableBalanceOp accessed when Type == %v", u.Type) - return nil + return XdrError("DataValue flag should be \"nil\" or \"non-nil\"") } + return nil } -func (u *XdrAnon_Operation_Body) SetTrustLineFlagsOp() *SetTrustLineFlagsOp { - switch u.Type { - case SET_TRUST_LINE_FLAGS: - if v, ok := u._u.(*SetTrustLineFlagsOp); ok { - return v - } else { - var zero SetTrustLineFlagsOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.SetTrustLineFlagsOp accessed when Type == %v", u.Type) - return nil +func (v _ptrflag_DataValue) GetU32() uint32 { + if *v.p == nil { + return 0 } + return 1 } -func (u *XdrAnon_Operation_Body) LiquidityPoolDepositOp() *LiquidityPoolDepositOp { - switch u.Type { - case LIQUIDITY_POOL_DEPOSIT: - if v, ok := u._u.(*LiquidityPoolDepositOp); ok { - return v - } else { - var zero LiquidityPoolDepositOp - u._u = &zero - return &zero +func (v _ptrflag_DataValue) SetU32(nv uint32) { + switch nv { + case 0: + *v.p = nil + case 1: + if *v.p == nil { + *v.p = new(DataValue) } default: - XdrPanic("XdrAnon_Operation_Body.LiquidityPoolDepositOp accessed when Type == %v", u.Type) - return nil + XdrPanic("*DataValue present flag value %d should be 0 or 1", nv) } } -func (u *XdrAnon_Operation_Body) LiquidityPoolWithdrawOp() *LiquidityPoolWithdrawOp { - switch u.Type { - case LIQUIDITY_POOL_WITHDRAW: - if v, ok := u._u.(*LiquidityPoolWithdrawOp); ok { - return v - } else { - var zero LiquidityPoolWithdrawOp - u._u = &zero - return &zero - } - default: - XdrPanic("XdrAnon_Operation_Body.LiquidityPoolWithdrawOp accessed when Type == %v", u.Type) - return nil +func (_ptrflag_DataValue) XdrTypeName() string { return "DataValue?" } +func (v _ptrflag_DataValue) XdrPointer() interface{} { return nil } +func (v _ptrflag_DataValue) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_DataValue) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_DataValue) XdrBound() uint32 { return 1 } +func (v _XdrPtr_DataValue) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_DataValue) SetPresent(present bool) { + if !present { + *v.p = nil + } else if *v.p == nil { + *v.p = new(DataValue) } } -func (u *XdrAnon_Operation_Body) InvokeHostFunctionOp() *InvokeHostFunctionOp { - switch u.Type { - case INVOKE_HOST_FUNCTION: - if v, ok := u._u.(*InvokeHostFunctionOp); ok { - return v - } else { - var zero InvokeHostFunctionOp - u._u = &zero - return &zero +func (v _XdrPtr_DataValue) XdrMarshalValue(x XDR, name string) { + if *v.p != nil { + XDR_DataValue(*v.p).XdrMarshal(x, name) + } +} +func (v _XdrPtr_DataValue) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_DataValue) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_DataValue(v)) + v.XdrMarshalValue(x, name) +} +func (_XdrPtr_DataValue) XdrTypeName() string { return "DataValue*" } +func (v _XdrPtr_DataValue) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_DataValue) XdrValue() interface{} { return *v.p } + +type XdrType_ManageDataOp = *ManageDataOp + +func (v *ManageDataOp) XdrPointer() interface{} { return v } +func (ManageDataOp) XdrTypeName() string { return "ManageDataOp" } +func (v ManageDataOp) XdrValue() interface{} { return v } +func (v *ManageDataOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ManageDataOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sdataName", name), XDR_String64(&v.DataName)) + x.Marshal(x.Sprintf("%sdataValue", name), _XdrPtr_DataValue{&v.DataValue}) +} +func XDR_ManageDataOp(v *ManageDataOp) *ManageDataOp { return v } + +type XdrType_BumpSequenceOp = *BumpSequenceOp + +func (v *BumpSequenceOp) XdrPointer() interface{} { return v } +func (BumpSequenceOp) XdrTypeName() string { return "BumpSequenceOp" } +func (v BumpSequenceOp) XdrValue() interface{} { return v } +func (v *BumpSequenceOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *BumpSequenceOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sbumpTo", name), XDR_SequenceNumber(&v.BumpTo)) +} +func XDR_BumpSequenceOp(v *BumpSequenceOp) *BumpSequenceOp { return v } + +type XdrType_CreateClaimableBalanceOp = *CreateClaimableBalanceOp + +func (v *CreateClaimableBalanceOp) XdrPointer() interface{} { return v } +func (CreateClaimableBalanceOp) XdrTypeName() string { return "CreateClaimableBalanceOp" } +func (v CreateClaimableBalanceOp) XdrValue() interface{} { return v } +func (v *CreateClaimableBalanceOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *CreateClaimableBalanceOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sasset", name), XDR_Asset(&v.Asset)) + x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) + x.Marshal(x.Sprintf("%sclaimants", name), (*_XdrVec_10_Claimant)(&v.Claimants)) +} +func XDR_CreateClaimableBalanceOp(v *CreateClaimableBalanceOp) *CreateClaimableBalanceOp { return v } + +type XdrType_ClaimClaimableBalanceOp = *ClaimClaimableBalanceOp + +func (v *ClaimClaimableBalanceOp) XdrPointer() interface{} { return v } +func (ClaimClaimableBalanceOp) XdrTypeName() string { return "ClaimClaimableBalanceOp" } +func (v ClaimClaimableBalanceOp) XdrValue() interface{} { return v } +func (v *ClaimClaimableBalanceOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ClaimClaimableBalanceOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sbalanceID", name), XDR_ClaimableBalanceID(&v.BalanceID)) +} +func XDR_ClaimClaimableBalanceOp(v *ClaimClaimableBalanceOp) *ClaimClaimableBalanceOp { return v } + +type XdrType_BeginSponsoringFutureReservesOp = *BeginSponsoringFutureReservesOp + +func (v *BeginSponsoringFutureReservesOp) XdrPointer() interface{} { return v } +func (BeginSponsoringFutureReservesOp) XdrTypeName() string { return "BeginSponsoringFutureReservesOp" } +func (v BeginSponsoringFutureReservesOp) XdrValue() interface{} { return v } +func (v *BeginSponsoringFutureReservesOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *BeginSponsoringFutureReservesOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%ssponsoredID", name), XDR_AccountID(&v.SponsoredID)) +} +func XDR_BeginSponsoringFutureReservesOp(v *BeginSponsoringFutureReservesOp) *BeginSponsoringFutureReservesOp { + return v +} + +var _XdrNames_RevokeSponsorshipType = map[int32]string{ + int32(REVOKE_SPONSORSHIP_LEDGER_ENTRY): "REVOKE_SPONSORSHIP_LEDGER_ENTRY", + int32(REVOKE_SPONSORSHIP_SIGNER): "REVOKE_SPONSORSHIP_SIGNER", +} +var _XdrValues_RevokeSponsorshipType = map[string]int32{ + "REVOKE_SPONSORSHIP_LEDGER_ENTRY": int32(REVOKE_SPONSORSHIP_LEDGER_ENTRY), + "REVOKE_SPONSORSHIP_SIGNER": int32(REVOKE_SPONSORSHIP_SIGNER), +} + +func (RevokeSponsorshipType) XdrEnumNames() map[int32]string { + return _XdrNames_RevokeSponsorshipType +} +func (v RevokeSponsorshipType) String() string { + if s, ok := _XdrNames_RevokeSponsorshipType[int32(v)]; ok { + return s + } + return fmt.Sprintf("RevokeSponsorshipType#%d", v) +} +func (v *RevokeSponsorshipType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_RevokeSponsorshipType[stok]; ok { + *v = RevokeSponsorshipType(val) + return nil + } else if stok == "RevokeSponsorshipType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } } - default: - XdrPanic("XdrAnon_Operation_Body.InvokeHostFunctionOp accessed when Type == %v", u.Type) - return nil + return XdrError(fmt.Sprintf("%s is not a valid RevokeSponsorshipType.", stok)) } } -func (u *XdrAnon_Operation_Body) ExtendFootprintTTLOp() *ExtendFootprintTTLOp { +func (v RevokeSponsorshipType) GetU32() uint32 { return uint32(v) } +func (v *RevokeSponsorshipType) SetU32(n uint32) { *v = RevokeSponsorshipType(n) } +func (v *RevokeSponsorshipType) XdrPointer() interface{} { return v } +func (RevokeSponsorshipType) XdrTypeName() string { return "RevokeSponsorshipType" } +func (v RevokeSponsorshipType) XdrValue() interface{} { return v } +func (v *RevokeSponsorshipType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_RevokeSponsorshipType = *RevokeSponsorshipType + +func XDR_RevokeSponsorshipType(v *RevokeSponsorshipType) *RevokeSponsorshipType { return v } + +type XdrType_XdrAnon_RevokeSponsorshipOp_Signer = *XdrAnon_RevokeSponsorshipOp_Signer + +func (v *XdrAnon_RevokeSponsorshipOp_Signer) XdrPointer() interface{} { return v } +func (XdrAnon_RevokeSponsorshipOp_Signer) XdrTypeName() string { + return "XdrAnon_RevokeSponsorshipOp_Signer" +} +func (v XdrAnon_RevokeSponsorshipOp_Signer) XdrValue() interface{} { return v } +func (v *XdrAnon_RevokeSponsorshipOp_Signer) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *XdrAnon_RevokeSponsorshipOp_Signer) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%saccountID", name), XDR_AccountID(&v.AccountID)) + x.Marshal(x.Sprintf("%ssignerKey", name), XDR_SignerKey(&v.SignerKey)) +} +func XDR_XdrAnon_RevokeSponsorshipOp_Signer(v *XdrAnon_RevokeSponsorshipOp_Signer) *XdrAnon_RevokeSponsorshipOp_Signer { + return v +} + +var _XdrTags_RevokeSponsorshipOp = map[int32]bool{ + XdrToI32(REVOKE_SPONSORSHIP_LEDGER_ENTRY): true, + XdrToI32(REVOKE_SPONSORSHIP_SIGNER): true, +} + +func (_ RevokeSponsorshipOp) XdrValidTags() map[int32]bool { + return _XdrTags_RevokeSponsorshipOp +} +func (u *RevokeSponsorshipOp) LedgerKey() *LedgerKey { switch u.Type { - case EXTEND_FOOTPRINT_TTL: - if v, ok := u._u.(*ExtendFootprintTTLOp); ok { + case REVOKE_SPONSORSHIP_LEDGER_ENTRY: + if v, ok := u._u.(*LedgerKey); ok { return v } else { - var zero ExtendFootprintTTLOp + var zero LedgerKey u._u = &zero return &zero } default: - XdrPanic("XdrAnon_Operation_Body.ExtendFootprintTTLOp accessed when Type == %v", u.Type) + XdrPanic("RevokeSponsorshipOp.LedgerKey accessed when Type == %v", u.Type) return nil } } -func (u *XdrAnon_Operation_Body) RestoreFootprintOp() *RestoreFootprintOp { +func (u *RevokeSponsorshipOp) Signer() *XdrAnon_RevokeSponsorshipOp_Signer { switch u.Type { - case RESTORE_FOOTPRINT: - if v, ok := u._u.(*RestoreFootprintOp); ok { + case REVOKE_SPONSORSHIP_SIGNER: + if v, ok := u._u.(*XdrAnon_RevokeSponsorshipOp_Signer); ok { return v } else { - var zero RestoreFootprintOp + var zero XdrAnon_RevokeSponsorshipOp_Signer u._u = &zero return &zero } default: - XdrPanic("XdrAnon_Operation_Body.RestoreFootprintOp accessed when Type == %v", u.Type) + XdrPanic("RevokeSponsorshipOp.Signer accessed when Type == %v", u.Type) return nil } } -func (u XdrAnon_Operation_Body) XdrValid() bool { +func (u RevokeSponsorshipOp) XdrValid() bool { switch u.Type { - case CREATE_ACCOUNT, PAYMENT, PATH_PAYMENT_STRICT_RECEIVE, MANAGE_SELL_OFFER, CREATE_PASSIVE_SELL_OFFER, SET_OPTIONS, CHANGE_TRUST, ALLOW_TRUST, ACCOUNT_MERGE, INFLATION, MANAGE_DATA, BUMP_SEQUENCE, MANAGE_BUY_OFFER, PATH_PAYMENT_STRICT_SEND, CREATE_CLAIMABLE_BALANCE, CLAIM_CLAIMABLE_BALANCE, BEGIN_SPONSORING_FUTURE_RESERVES, END_SPONSORING_FUTURE_RESERVES, REVOKE_SPONSORSHIP, CLAWBACK, CLAWBACK_CLAIMABLE_BALANCE, SET_TRUST_LINE_FLAGS, LIQUIDITY_POOL_DEPOSIT, LIQUIDITY_POOL_WITHDRAW, INVOKE_HOST_FUNCTION, EXTEND_FOOTPRINT_TTL, RESTORE_FOOTPRINT: + case REVOKE_SPONSORSHIP_LEDGER_ENTRY, REVOKE_SPONSORSHIP_SIGNER: return true } return false } -func (u *XdrAnon_Operation_Body) XdrUnionTag() XdrNum32 { - return XDR_OperationType(&u.Type) +func (u *RevokeSponsorshipOp) XdrUnionTag() XdrNum32 { + return XDR_RevokeSponsorshipType(&u.Type) } -func (u *XdrAnon_Operation_Body) XdrUnionTagName() string { +func (u *RevokeSponsorshipOp) XdrUnionTagName() string { return "Type" } -func (u *XdrAnon_Operation_Body) XdrUnionBody() XdrType { +func (u *RevokeSponsorshipOp) XdrUnionBody() XdrType { switch u.Type { - case CREATE_ACCOUNT: - return XDR_CreateAccountOp(u.CreateAccountOp()) - case PAYMENT: - return XDR_PaymentOp(u.PaymentOp()) - case PATH_PAYMENT_STRICT_RECEIVE: - return XDR_PathPaymentStrictReceiveOp(u.PathPaymentStrictReceiveOp()) - case MANAGE_SELL_OFFER: - return XDR_ManageSellOfferOp(u.ManageSellOfferOp()) - case CREATE_PASSIVE_SELL_OFFER: - return XDR_CreatePassiveSellOfferOp(u.CreatePassiveSellOfferOp()) - case SET_OPTIONS: - return XDR_SetOptionsOp(u.SetOptionsOp()) - case CHANGE_TRUST: - return XDR_ChangeTrustOp(u.ChangeTrustOp()) - case ALLOW_TRUST: - return XDR_AllowTrustOp(u.AllowTrustOp()) - case ACCOUNT_MERGE: - return XDR_MuxedAccount(u.Destination()) - case INFLATION: - return nil - case MANAGE_DATA: - return XDR_ManageDataOp(u.ManageDataOp()) - case BUMP_SEQUENCE: - return XDR_BumpSequenceOp(u.BumpSequenceOp()) - case MANAGE_BUY_OFFER: - return XDR_ManageBuyOfferOp(u.ManageBuyOfferOp()) - case PATH_PAYMENT_STRICT_SEND: - return XDR_PathPaymentStrictSendOp(u.PathPaymentStrictSendOp()) - case CREATE_CLAIMABLE_BALANCE: - return XDR_CreateClaimableBalanceOp(u.CreateClaimableBalanceOp()) - case CLAIM_CLAIMABLE_BALANCE: - return XDR_ClaimClaimableBalanceOp(u.ClaimClaimableBalanceOp()) - case BEGIN_SPONSORING_FUTURE_RESERVES: - return XDR_BeginSponsoringFutureReservesOp(u.BeginSponsoringFutureReservesOp()) - case END_SPONSORING_FUTURE_RESERVES: - return nil - case REVOKE_SPONSORSHIP: - return XDR_RevokeSponsorshipOp(u.RevokeSponsorshipOp()) - case CLAWBACK: - return XDR_ClawbackOp(u.ClawbackOp()) - case CLAWBACK_CLAIMABLE_BALANCE: - return XDR_ClawbackClaimableBalanceOp(u.ClawbackClaimableBalanceOp()) - case SET_TRUST_LINE_FLAGS: - return XDR_SetTrustLineFlagsOp(u.SetTrustLineFlagsOp()) - case LIQUIDITY_POOL_DEPOSIT: - return XDR_LiquidityPoolDepositOp(u.LiquidityPoolDepositOp()) - case LIQUIDITY_POOL_WITHDRAW: - return XDR_LiquidityPoolWithdrawOp(u.LiquidityPoolWithdrawOp()) - case INVOKE_HOST_FUNCTION: - return XDR_InvokeHostFunctionOp(u.InvokeHostFunctionOp()) - case EXTEND_FOOTPRINT_TTL: - return XDR_ExtendFootprintTTLOp(u.ExtendFootprintTTLOp()) - case RESTORE_FOOTPRINT: - return XDR_RestoreFootprintOp(u.RestoreFootprintOp()) + case REVOKE_SPONSORSHIP_LEDGER_ENTRY: + return XDR_LedgerKey(u.LedgerKey()) + case REVOKE_SPONSORSHIP_SIGNER: + return XDR_XdrAnon_RevokeSponsorshipOp_Signer(u.Signer()) } return nil } -func (u *XdrAnon_Operation_Body) XdrUnionBodyName() string { +func (u *RevokeSponsorshipOp) XdrUnionBodyName() string { switch u.Type { - case CREATE_ACCOUNT: - return "CreateAccountOp" - case PAYMENT: - return "PaymentOp" - case PATH_PAYMENT_STRICT_RECEIVE: - return "PathPaymentStrictReceiveOp" - case MANAGE_SELL_OFFER: - return "ManageSellOfferOp" - case CREATE_PASSIVE_SELL_OFFER: - return "CreatePassiveSellOfferOp" - case SET_OPTIONS: - return "SetOptionsOp" - case CHANGE_TRUST: - return "ChangeTrustOp" - case ALLOW_TRUST: - return "AllowTrustOp" - case ACCOUNT_MERGE: - return "Destination" - case INFLATION: - return "" - case MANAGE_DATA: - return "ManageDataOp" - case BUMP_SEQUENCE: - return "BumpSequenceOp" - case MANAGE_BUY_OFFER: - return "ManageBuyOfferOp" - case PATH_PAYMENT_STRICT_SEND: - return "PathPaymentStrictSendOp" - case CREATE_CLAIMABLE_BALANCE: - return "CreateClaimableBalanceOp" - case CLAIM_CLAIMABLE_BALANCE: - return "ClaimClaimableBalanceOp" - case BEGIN_SPONSORING_FUTURE_RESERVES: - return "BeginSponsoringFutureReservesOp" - case END_SPONSORING_FUTURE_RESERVES: - return "" - case REVOKE_SPONSORSHIP: - return "RevokeSponsorshipOp" - case CLAWBACK: - return "ClawbackOp" - case CLAWBACK_CLAIMABLE_BALANCE: - return "ClawbackClaimableBalanceOp" - case SET_TRUST_LINE_FLAGS: - return "SetTrustLineFlagsOp" - case LIQUIDITY_POOL_DEPOSIT: - return "LiquidityPoolDepositOp" - case LIQUIDITY_POOL_WITHDRAW: - return "LiquidityPoolWithdrawOp" - case INVOKE_HOST_FUNCTION: - return "InvokeHostFunctionOp" - case EXTEND_FOOTPRINT_TTL: - return "ExtendFootprintTTLOp" - case RESTORE_FOOTPRINT: - return "RestoreFootprintOp" + case REVOKE_SPONSORSHIP_LEDGER_ENTRY: + return "LedgerKey" + case REVOKE_SPONSORSHIP_SIGNER: + return "Signer" } return "" } -type XdrType_XdrAnon_Operation_Body = *XdrAnon_Operation_Body +type XdrType_RevokeSponsorshipOp = *RevokeSponsorshipOp -func (v *XdrAnon_Operation_Body) XdrPointer() interface{} { return v } -func (XdrAnon_Operation_Body) XdrTypeName() string { return "XdrAnon_Operation_Body" } -func (v XdrAnon_Operation_Body) XdrValue() interface{} { return v } -func (v *XdrAnon_Operation_Body) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *XdrAnon_Operation_Body) XdrRecurse(x XDR, name string) { +func (v *RevokeSponsorshipOp) XdrPointer() interface{} { return v } +func (RevokeSponsorshipOp) XdrTypeName() string { return "RevokeSponsorshipOp" } +func (v RevokeSponsorshipOp) XdrValue() interface{} { return v } +func (v *RevokeSponsorshipOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *RevokeSponsorshipOp) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_OperationType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + XDR_RevokeSponsorshipType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) switch u.Type { - case CREATE_ACCOUNT: - x.Marshal(x.Sprintf("%screateAccountOp", name), XDR_CreateAccountOp(u.CreateAccountOp())) - return - case PAYMENT: - x.Marshal(x.Sprintf("%spaymentOp", name), XDR_PaymentOp(u.PaymentOp())) - return - case PATH_PAYMENT_STRICT_RECEIVE: - x.Marshal(x.Sprintf("%spathPaymentStrictReceiveOp", name), XDR_PathPaymentStrictReceiveOp(u.PathPaymentStrictReceiveOp())) - return - case MANAGE_SELL_OFFER: - x.Marshal(x.Sprintf("%smanageSellOfferOp", name), XDR_ManageSellOfferOp(u.ManageSellOfferOp())) - return - case CREATE_PASSIVE_SELL_OFFER: - x.Marshal(x.Sprintf("%screatePassiveSellOfferOp", name), XDR_CreatePassiveSellOfferOp(u.CreatePassiveSellOfferOp())) - return - case SET_OPTIONS: - x.Marshal(x.Sprintf("%ssetOptionsOp", name), XDR_SetOptionsOp(u.SetOptionsOp())) - return - case CHANGE_TRUST: - x.Marshal(x.Sprintf("%schangeTrustOp", name), XDR_ChangeTrustOp(u.ChangeTrustOp())) - return - case ALLOW_TRUST: - x.Marshal(x.Sprintf("%sallowTrustOp", name), XDR_AllowTrustOp(u.AllowTrustOp())) - return - case ACCOUNT_MERGE: - x.Marshal(x.Sprintf("%sdestination", name), XDR_MuxedAccount(u.Destination())) - return - case INFLATION: - return - case MANAGE_DATA: - x.Marshal(x.Sprintf("%smanageDataOp", name), XDR_ManageDataOp(u.ManageDataOp())) - return - case BUMP_SEQUENCE: - x.Marshal(x.Sprintf("%sbumpSequenceOp", name), XDR_BumpSequenceOp(u.BumpSequenceOp())) - return - case MANAGE_BUY_OFFER: - x.Marshal(x.Sprintf("%smanageBuyOfferOp", name), XDR_ManageBuyOfferOp(u.ManageBuyOfferOp())) - return - case PATH_PAYMENT_STRICT_SEND: - x.Marshal(x.Sprintf("%spathPaymentStrictSendOp", name), XDR_PathPaymentStrictSendOp(u.PathPaymentStrictSendOp())) - return - case CREATE_CLAIMABLE_BALANCE: - x.Marshal(x.Sprintf("%screateClaimableBalanceOp", name), XDR_CreateClaimableBalanceOp(u.CreateClaimableBalanceOp())) - return - case CLAIM_CLAIMABLE_BALANCE: - x.Marshal(x.Sprintf("%sclaimClaimableBalanceOp", name), XDR_ClaimClaimableBalanceOp(u.ClaimClaimableBalanceOp())) - return - case BEGIN_SPONSORING_FUTURE_RESERVES: - x.Marshal(x.Sprintf("%sbeginSponsoringFutureReservesOp", name), XDR_BeginSponsoringFutureReservesOp(u.BeginSponsoringFutureReservesOp())) - return - case END_SPONSORING_FUTURE_RESERVES: - return - case REVOKE_SPONSORSHIP: - x.Marshal(x.Sprintf("%srevokeSponsorshipOp", name), XDR_RevokeSponsorshipOp(u.RevokeSponsorshipOp())) - return - case CLAWBACK: - x.Marshal(x.Sprintf("%sclawbackOp", name), XDR_ClawbackOp(u.ClawbackOp())) - return - case CLAWBACK_CLAIMABLE_BALANCE: - x.Marshal(x.Sprintf("%sclawbackClaimableBalanceOp", name), XDR_ClawbackClaimableBalanceOp(u.ClawbackClaimableBalanceOp())) - return - case SET_TRUST_LINE_FLAGS: - x.Marshal(x.Sprintf("%ssetTrustLineFlagsOp", name), XDR_SetTrustLineFlagsOp(u.SetTrustLineFlagsOp())) - return - case LIQUIDITY_POOL_DEPOSIT: - x.Marshal(x.Sprintf("%sliquidityPoolDepositOp", name), XDR_LiquidityPoolDepositOp(u.LiquidityPoolDepositOp())) - return - case LIQUIDITY_POOL_WITHDRAW: - x.Marshal(x.Sprintf("%sliquidityPoolWithdrawOp", name), XDR_LiquidityPoolWithdrawOp(u.LiquidityPoolWithdrawOp())) - return - case INVOKE_HOST_FUNCTION: - x.Marshal(x.Sprintf("%sinvokeHostFunctionOp", name), XDR_InvokeHostFunctionOp(u.InvokeHostFunctionOp())) - return - case EXTEND_FOOTPRINT_TTL: - x.Marshal(x.Sprintf("%sextendFootprintTTLOp", name), XDR_ExtendFootprintTTLOp(u.ExtendFootprintTTLOp())) + case REVOKE_SPONSORSHIP_LEDGER_ENTRY: + x.Marshal(x.Sprintf("%sledgerKey", name), XDR_LedgerKey(u.LedgerKey())) return - case RESTORE_FOOTPRINT: - x.Marshal(x.Sprintf("%srestoreFootprintOp", name), XDR_RestoreFootprintOp(u.RestoreFootprintOp())) + case REVOKE_SPONSORSHIP_SIGNER: + x.Marshal(x.Sprintf("%ssigner", name), XDR_XdrAnon_RevokeSponsorshipOp_Signer(u.Signer())) return } - XdrPanic("invalid Type (%v) in XdrAnon_Operation_Body", u.Type) + XdrPanic("invalid Type (%v) in RevokeSponsorshipOp", u.Type) +} +func XDR_RevokeSponsorshipOp(v *RevokeSponsorshipOp) *RevokeSponsorshipOp { return v } + +type XdrType_ClawbackOp = *ClawbackOp + +func (v *ClawbackOp) XdrPointer() interface{} { return v } +func (ClawbackOp) XdrTypeName() string { return "ClawbackOp" } +func (v ClawbackOp) XdrValue() interface{} { return v } +func (v *ClawbackOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ClawbackOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sasset", name), XDR_Asset(&v.Asset)) + x.Marshal(x.Sprintf("%sfrom", name), XDR_MuxedAccount(&v.From)) + x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) +} +func XDR_ClawbackOp(v *ClawbackOp) *ClawbackOp { return v } + +type XdrType_ClawbackClaimableBalanceOp = *ClawbackClaimableBalanceOp + +func (v *ClawbackClaimableBalanceOp) XdrPointer() interface{} { return v } +func (ClawbackClaimableBalanceOp) XdrTypeName() string { return "ClawbackClaimableBalanceOp" } +func (v ClawbackClaimableBalanceOp) XdrValue() interface{} { return v } +func (v *ClawbackClaimableBalanceOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ClawbackClaimableBalanceOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sbalanceID", name), XDR_ClaimableBalanceID(&v.BalanceID)) +} +func XDR_ClawbackClaimableBalanceOp(v *ClawbackClaimableBalanceOp) *ClawbackClaimableBalanceOp { + return v +} + +type XdrType_SetTrustLineFlagsOp = *SetTrustLineFlagsOp + +func (v *SetTrustLineFlagsOp) XdrPointer() interface{} { return v } +func (SetTrustLineFlagsOp) XdrTypeName() string { return "SetTrustLineFlagsOp" } +func (v SetTrustLineFlagsOp) XdrValue() interface{} { return v } +func (v *SetTrustLineFlagsOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SetTrustLineFlagsOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%strustor", name), XDR_AccountID(&v.Trustor)) + x.Marshal(x.Sprintf("%sasset", name), XDR_Asset(&v.Asset)) + x.Marshal(x.Sprintf("%sclearFlags", name), XDR_Uint32(&v.ClearFlags)) + x.Marshal(x.Sprintf("%ssetFlags", name), XDR_Uint32(&v.SetFlags)) +} +func XDR_SetTrustLineFlagsOp(v *SetTrustLineFlagsOp) *SetTrustLineFlagsOp { return v } + +type XdrType_LiquidityPoolDepositOp = *LiquidityPoolDepositOp + +func (v *LiquidityPoolDepositOp) XdrPointer() interface{} { return v } +func (LiquidityPoolDepositOp) XdrTypeName() string { return "LiquidityPoolDepositOp" } +func (v LiquidityPoolDepositOp) XdrValue() interface{} { return v } +func (v *LiquidityPoolDepositOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LiquidityPoolDepositOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sliquidityPoolID", name), XDR_PoolID(&v.LiquidityPoolID)) + x.Marshal(x.Sprintf("%smaxAmountA", name), XDR_Int64(&v.MaxAmountA)) + x.Marshal(x.Sprintf("%smaxAmountB", name), XDR_Int64(&v.MaxAmountB)) + x.Marshal(x.Sprintf("%sminPrice", name), XDR_Price(&v.MinPrice)) + x.Marshal(x.Sprintf("%smaxPrice", name), XDR_Price(&v.MaxPrice)) +} +func XDR_LiquidityPoolDepositOp(v *LiquidityPoolDepositOp) *LiquidityPoolDepositOp { return v } + +type XdrType_LiquidityPoolWithdrawOp = *LiquidityPoolWithdrawOp + +func (v *LiquidityPoolWithdrawOp) XdrPointer() interface{} { return v } +func (LiquidityPoolWithdrawOp) XdrTypeName() string { return "LiquidityPoolWithdrawOp" } +func (v LiquidityPoolWithdrawOp) XdrValue() interface{} { return v } +func (v *LiquidityPoolWithdrawOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LiquidityPoolWithdrawOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sliquidityPoolID", name), XDR_PoolID(&v.LiquidityPoolID)) + x.Marshal(x.Sprintf("%samount", name), XDR_Int64(&v.Amount)) + x.Marshal(x.Sprintf("%sminAmountA", name), XDR_Int64(&v.MinAmountA)) + x.Marshal(x.Sprintf("%sminAmountB", name), XDR_Int64(&v.MinAmountB)) +} +func XDR_LiquidityPoolWithdrawOp(v *LiquidityPoolWithdrawOp) *LiquidityPoolWithdrawOp { return v } + +var _XdrNames_HostFunctionType = map[int32]string{ + int32(HOST_FUNCTION_TYPE_INVOKE_CONTRACT): "HOST_FUNCTION_TYPE_INVOKE_CONTRACT", + int32(HOST_FUNCTION_TYPE_CREATE_CONTRACT): "HOST_FUNCTION_TYPE_CREATE_CONTRACT", + int32(HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM): "HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM", + int32(HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2): "HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2", +} +var _XdrValues_HostFunctionType = map[string]int32{ + "HOST_FUNCTION_TYPE_INVOKE_CONTRACT": int32(HOST_FUNCTION_TYPE_INVOKE_CONTRACT), + "HOST_FUNCTION_TYPE_CREATE_CONTRACT": int32(HOST_FUNCTION_TYPE_CREATE_CONTRACT), + "HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM": int32(HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM), + "HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2": int32(HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2), +} + +func (HostFunctionType) XdrEnumNames() map[int32]string { + return _XdrNames_HostFunctionType +} +func (v HostFunctionType) String() string { + if s, ok := _XdrNames_HostFunctionType[int32(v)]; ok { + return s + } + return fmt.Sprintf("HostFunctionType#%d", v) +} +func (v *HostFunctionType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_HostFunctionType[stok]; ok { + *v = HostFunctionType(val) + return nil + } else if stok == "HostFunctionType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } + } + return XdrError(fmt.Sprintf("%s is not a valid HostFunctionType.", stok)) + } +} +func (v HostFunctionType) GetU32() uint32 { return uint32(v) } +func (v *HostFunctionType) SetU32(n uint32) { *v = HostFunctionType(n) } +func (v *HostFunctionType) XdrPointer() interface{} { return v } +func (HostFunctionType) XdrTypeName() string { return "HostFunctionType" } +func (v HostFunctionType) XdrValue() interface{} { return v } +func (v *HostFunctionType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_HostFunctionType = *HostFunctionType + +func XDR_HostFunctionType(v *HostFunctionType) *HostFunctionType { return v } + +var _XdrNames_ContractIDPreimageType = map[int32]string{ + int32(CONTRACT_ID_PREIMAGE_FROM_ADDRESS): "CONTRACT_ID_PREIMAGE_FROM_ADDRESS", + int32(CONTRACT_ID_PREIMAGE_FROM_ASSET): "CONTRACT_ID_PREIMAGE_FROM_ASSET", +} +var _XdrValues_ContractIDPreimageType = map[string]int32{ + "CONTRACT_ID_PREIMAGE_FROM_ADDRESS": int32(CONTRACT_ID_PREIMAGE_FROM_ADDRESS), + "CONTRACT_ID_PREIMAGE_FROM_ASSET": int32(CONTRACT_ID_PREIMAGE_FROM_ASSET), +} + +func (ContractIDPreimageType) XdrEnumNames() map[int32]string { + return _XdrNames_ContractIDPreimageType +} +func (v ContractIDPreimageType) String() string { + if s, ok := _XdrNames_ContractIDPreimageType[int32(v)]; ok { + return s + } + return fmt.Sprintf("ContractIDPreimageType#%d", v) +} +func (v *ContractIDPreimageType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_ContractIDPreimageType[stok]; ok { + *v = ContractIDPreimageType(val) + return nil + } else if stok == "ContractIDPreimageType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } + } + return XdrError(fmt.Sprintf("%s is not a valid ContractIDPreimageType.", stok)) + } +} +func (v ContractIDPreimageType) GetU32() uint32 { return uint32(v) } +func (v *ContractIDPreimageType) SetU32(n uint32) { *v = ContractIDPreimageType(n) } +func (v *ContractIDPreimageType) XdrPointer() interface{} { return v } +func (ContractIDPreimageType) XdrTypeName() string { return "ContractIDPreimageType" } +func (v ContractIDPreimageType) XdrValue() interface{} { return v } +func (v *ContractIDPreimageType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_ContractIDPreimageType = *ContractIDPreimageType + +func XDR_ContractIDPreimageType(v *ContractIDPreimageType) *ContractIDPreimageType { return v } + +type XdrType_XdrAnon_ContractIDPreimage_FromAddress = *XdrAnon_ContractIDPreimage_FromAddress + +func (v *XdrAnon_ContractIDPreimage_FromAddress) XdrPointer() interface{} { return v } +func (XdrAnon_ContractIDPreimage_FromAddress) XdrTypeName() string { + return "XdrAnon_ContractIDPreimage_FromAddress" +} +func (v XdrAnon_ContractIDPreimage_FromAddress) XdrValue() interface{} { return v } +func (v *XdrAnon_ContractIDPreimage_FromAddress) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *XdrAnon_ContractIDPreimage_FromAddress) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%saddress", name), XDR_SCAddress(&v.Address)) + x.Marshal(x.Sprintf("%ssalt", name), XDR_Uint256(&v.Salt)) +} +func XDR_XdrAnon_ContractIDPreimage_FromAddress(v *XdrAnon_ContractIDPreimage_FromAddress) *XdrAnon_ContractIDPreimage_FromAddress { + return v +} + +var _XdrTags_ContractIDPreimage = map[int32]bool{ + XdrToI32(CONTRACT_ID_PREIMAGE_FROM_ADDRESS): true, + XdrToI32(CONTRACT_ID_PREIMAGE_FROM_ASSET): true, +} + +func (_ ContractIDPreimage) XdrValidTags() map[int32]bool { + return _XdrTags_ContractIDPreimage +} +func (u *ContractIDPreimage) FromAddress() *XdrAnon_ContractIDPreimage_FromAddress { + switch u.Type { + case CONTRACT_ID_PREIMAGE_FROM_ADDRESS: + if v, ok := u._u.(*XdrAnon_ContractIDPreimage_FromAddress); ok { + return v + } else { + var zero XdrAnon_ContractIDPreimage_FromAddress + u._u = &zero + return &zero + } + default: + XdrPanic("ContractIDPreimage.FromAddress accessed when Type == %v", u.Type) + return nil + } +} +func (u *ContractIDPreimage) FromAsset() *Asset { + switch u.Type { + case CONTRACT_ID_PREIMAGE_FROM_ASSET: + if v, ok := u._u.(*Asset); ok { + return v + } else { + var zero Asset + u._u = &zero + return &zero + } + default: + XdrPanic("ContractIDPreimage.FromAsset accessed when Type == %v", u.Type) + return nil + } +} +func (u ContractIDPreimage) XdrValid() bool { + switch u.Type { + case CONTRACT_ID_PREIMAGE_FROM_ADDRESS, CONTRACT_ID_PREIMAGE_FROM_ASSET: + return true + } + return false +} +func (u *ContractIDPreimage) XdrUnionTag() XdrNum32 { + return XDR_ContractIDPreimageType(&u.Type) +} +func (u *ContractIDPreimage) XdrUnionTagName() string { + return "Type" +} +func (u *ContractIDPreimage) XdrUnionBody() XdrType { + switch u.Type { + case CONTRACT_ID_PREIMAGE_FROM_ADDRESS: + return XDR_XdrAnon_ContractIDPreimage_FromAddress(u.FromAddress()) + case CONTRACT_ID_PREIMAGE_FROM_ASSET: + return XDR_Asset(u.FromAsset()) + } + return nil +} +func (u *ContractIDPreimage) XdrUnionBodyName() string { + switch u.Type { + case CONTRACT_ID_PREIMAGE_FROM_ADDRESS: + return "FromAddress" + case CONTRACT_ID_PREIMAGE_FROM_ASSET: + return "FromAsset" + } + return "" +} + +type XdrType_ContractIDPreimage = *ContractIDPreimage + +func (v *ContractIDPreimage) XdrPointer() interface{} { return v } +func (ContractIDPreimage) XdrTypeName() string { return "ContractIDPreimage" } +func (v ContractIDPreimage) XdrValue() interface{} { return v } +func (v *ContractIDPreimage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *ContractIDPreimage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_ContractIDPreimageType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case CONTRACT_ID_PREIMAGE_FROM_ADDRESS: + x.Marshal(x.Sprintf("%sfromAddress", name), XDR_XdrAnon_ContractIDPreimage_FromAddress(u.FromAddress())) + return + case CONTRACT_ID_PREIMAGE_FROM_ASSET: + x.Marshal(x.Sprintf("%sfromAsset", name), XDR_Asset(u.FromAsset())) + return + } + XdrPanic("invalid Type (%v) in ContractIDPreimage", u.Type) +} +func XDR_ContractIDPreimage(v *ContractIDPreimage) *ContractIDPreimage { return v } + +type XdrType_CreateContractArgs = *CreateContractArgs + +func (v *CreateContractArgs) XdrPointer() interface{} { return v } +func (CreateContractArgs) XdrTypeName() string { return "CreateContractArgs" } +func (v CreateContractArgs) XdrValue() interface{} { return v } +func (v *CreateContractArgs) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *CreateContractArgs) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%scontractIDPreimage", name), XDR_ContractIDPreimage(&v.ContractIDPreimage)) + x.Marshal(x.Sprintf("%sexecutable", name), XDR_ContractExecutable(&v.Executable)) +} +func XDR_CreateContractArgs(v *CreateContractArgs) *CreateContractArgs { return v } + +type XdrType_CreateContractArgsV2 = *CreateContractArgsV2 + +func (v *CreateContractArgsV2) XdrPointer() interface{} { return v } +func (CreateContractArgsV2) XdrTypeName() string { return "CreateContractArgsV2" } +func (v CreateContractArgsV2) XdrValue() interface{} { return v } +func (v *CreateContractArgsV2) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *CreateContractArgsV2) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%scontractIDPreimage", name), XDR_ContractIDPreimage(&v.ContractIDPreimage)) + x.Marshal(x.Sprintf("%sexecutable", name), XDR_ContractExecutable(&v.Executable)) + x.Marshal(x.Sprintf("%sconstructorArgs", name), (*_XdrVec_unbounded_SCVal)(&v.ConstructorArgs)) +} +func XDR_CreateContractArgsV2(v *CreateContractArgsV2) *CreateContractArgsV2 { return v } + +type XdrType_InvokeContractArgs = *InvokeContractArgs + +func (v *InvokeContractArgs) XdrPointer() interface{} { return v } +func (InvokeContractArgs) XdrTypeName() string { return "InvokeContractArgs" } +func (v InvokeContractArgs) XdrValue() interface{} { return v } +func (v *InvokeContractArgs) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *InvokeContractArgs) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%scontractAddress", name), XDR_SCAddress(&v.ContractAddress)) + x.Marshal(x.Sprintf("%sfunctionName", name), XDR_SCSymbol(&v.FunctionName)) + x.Marshal(x.Sprintf("%sargs", name), (*_XdrVec_unbounded_SCVal)(&v.Args)) +} +func XDR_InvokeContractArgs(v *InvokeContractArgs) *InvokeContractArgs { return v } + +var _XdrTags_HostFunction = map[int32]bool{ + XdrToI32(HOST_FUNCTION_TYPE_INVOKE_CONTRACT): true, + XdrToI32(HOST_FUNCTION_TYPE_CREATE_CONTRACT): true, + XdrToI32(HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM): true, + XdrToI32(HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2): true, +} + +func (_ HostFunction) XdrValidTags() map[int32]bool { + return _XdrTags_HostFunction +} +func (u *HostFunction) InvokeContract() *InvokeContractArgs { + switch u.Type { + case HOST_FUNCTION_TYPE_INVOKE_CONTRACT: + if v, ok := u._u.(*InvokeContractArgs); ok { + return v + } else { + var zero InvokeContractArgs + u._u = &zero + return &zero + } + default: + XdrPanic("HostFunction.InvokeContract accessed when Type == %v", u.Type) + return nil + } +} +func (u *HostFunction) CreateContract() *CreateContractArgs { + switch u.Type { + case HOST_FUNCTION_TYPE_CREATE_CONTRACT: + if v, ok := u._u.(*CreateContractArgs); ok { + return v + } else { + var zero CreateContractArgs + u._u = &zero + return &zero + } + default: + XdrPanic("HostFunction.CreateContract accessed when Type == %v", u.Type) + return nil + } +} +func (u *HostFunction) Wasm() *[]byte { + switch u.Type { + case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: + if v, ok := u._u.(*[]byte); ok { + return v + } else { + var zero []byte + u._u = &zero + return &zero + } + default: + XdrPanic("HostFunction.Wasm accessed when Type == %v", u.Type) + return nil + } +} +func (u *HostFunction) CreateContractV2() *CreateContractArgsV2 { + switch u.Type { + case HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2: + if v, ok := u._u.(*CreateContractArgsV2); ok { + return v + } else { + var zero CreateContractArgsV2 + u._u = &zero + return &zero + } + default: + XdrPanic("HostFunction.CreateContractV2 accessed when Type == %v", u.Type) + return nil + } +} +func (u HostFunction) XdrValid() bool { + switch u.Type { + case HOST_FUNCTION_TYPE_INVOKE_CONTRACT, HOST_FUNCTION_TYPE_CREATE_CONTRACT, HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM, HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2: + return true + } + return false +} +func (u *HostFunction) XdrUnionTag() XdrNum32 { + return XDR_HostFunctionType(&u.Type) +} +func (u *HostFunction) XdrUnionTagName() string { + return "Type" +} +func (u *HostFunction) XdrUnionBody() XdrType { + switch u.Type { + case HOST_FUNCTION_TYPE_INVOKE_CONTRACT: + return XDR_InvokeContractArgs(u.InvokeContract()) + case HOST_FUNCTION_TYPE_CREATE_CONTRACT: + return XDR_CreateContractArgs(u.CreateContract()) + case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: + return XdrVecOpaque{u.Wasm(), 0xffffffff} + case HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2: + return XDR_CreateContractArgsV2(u.CreateContractV2()) + } + return nil +} +func (u *HostFunction) XdrUnionBodyName() string { + switch u.Type { + case HOST_FUNCTION_TYPE_INVOKE_CONTRACT: + return "InvokeContract" + case HOST_FUNCTION_TYPE_CREATE_CONTRACT: + return "CreateContract" + case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: + return "Wasm" + case HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2: + return "CreateContractV2" + } + return "" +} + +type XdrType_HostFunction = *HostFunction + +func (v *HostFunction) XdrPointer() interface{} { return v } +func (HostFunction) XdrTypeName() string { return "HostFunction" } +func (v HostFunction) XdrValue() interface{} { return v } +func (v *HostFunction) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *HostFunction) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_HostFunctionType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case HOST_FUNCTION_TYPE_INVOKE_CONTRACT: + x.Marshal(x.Sprintf("%sinvokeContract", name), XDR_InvokeContractArgs(u.InvokeContract())) + return + case HOST_FUNCTION_TYPE_CREATE_CONTRACT: + x.Marshal(x.Sprintf("%screateContract", name), XDR_CreateContractArgs(u.CreateContract())) + return + case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: + x.Marshal(x.Sprintf("%swasm", name), XdrVecOpaque{u.Wasm(), 0xffffffff}) + return + case HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2: + x.Marshal(x.Sprintf("%screateContractV2", name), XDR_CreateContractArgsV2(u.CreateContractV2())) + return + } + XdrPanic("invalid Type (%v) in HostFunction", u.Type) +} +func XDR_HostFunction(v *HostFunction) *HostFunction { return v } + +var _XdrNames_SorobanAuthorizedFunctionType = map[int32]string{ + int32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN): "SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN", + int32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN): "SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN", + int32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN): "SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN", +} +var _XdrValues_SorobanAuthorizedFunctionType = map[string]int32{ + "SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN": int32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN), + "SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN": int32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN), + "SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN": int32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN), +} + +func (SorobanAuthorizedFunctionType) XdrEnumNames() map[int32]string { + return _XdrNames_SorobanAuthorizedFunctionType +} +func (v SorobanAuthorizedFunctionType) String() string { + if s, ok := _XdrNames_SorobanAuthorizedFunctionType[int32(v)]; ok { + return s + } + return fmt.Sprintf("SorobanAuthorizedFunctionType#%d", v) +} +func (v *SorobanAuthorizedFunctionType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_SorobanAuthorizedFunctionType[stok]; ok { + *v = SorobanAuthorizedFunctionType(val) + return nil + } else if stok == "SorobanAuthorizedFunctionType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } + } + return XdrError(fmt.Sprintf("%s is not a valid SorobanAuthorizedFunctionType.", stok)) + } +} +func (v SorobanAuthorizedFunctionType) GetU32() uint32 { return uint32(v) } +func (v *SorobanAuthorizedFunctionType) SetU32(n uint32) { *v = SorobanAuthorizedFunctionType(n) } +func (v *SorobanAuthorizedFunctionType) XdrPointer() interface{} { return v } +func (SorobanAuthorizedFunctionType) XdrTypeName() string { return "SorobanAuthorizedFunctionType" } +func (v SorobanAuthorizedFunctionType) XdrValue() interface{} { return v } +func (v *SorobanAuthorizedFunctionType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_SorobanAuthorizedFunctionType = *SorobanAuthorizedFunctionType + +func XDR_SorobanAuthorizedFunctionType(v *SorobanAuthorizedFunctionType) *SorobanAuthorizedFunctionType { + return v +} + +var _XdrTags_SorobanAuthorizedFunction = map[int32]bool{ + XdrToI32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN): true, + XdrToI32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN): true, + XdrToI32(SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN): true, +} + +func (_ SorobanAuthorizedFunction) XdrValidTags() map[int32]bool { + return _XdrTags_SorobanAuthorizedFunction +} +func (u *SorobanAuthorizedFunction) ContractFn() *InvokeContractArgs { + switch u.Type { + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: + if v, ok := u._u.(*InvokeContractArgs); ok { + return v + } else { + var zero InvokeContractArgs + u._u = &zero + return &zero + } + default: + XdrPanic("SorobanAuthorizedFunction.ContractFn accessed when Type == %v", u.Type) + return nil + } +} +func (u *SorobanAuthorizedFunction) CreateContractHostFn() *CreateContractArgs { + switch u.Type { + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: + if v, ok := u._u.(*CreateContractArgs); ok { + return v + } else { + var zero CreateContractArgs + u._u = &zero + return &zero + } + default: + XdrPanic("SorobanAuthorizedFunction.CreateContractHostFn accessed when Type == %v", u.Type) + return nil + } +} +func (u *SorobanAuthorizedFunction) CreateContractV2HostFn() *CreateContractArgsV2 { + switch u.Type { + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: + if v, ok := u._u.(*CreateContractArgsV2); ok { + return v + } else { + var zero CreateContractArgsV2 + u._u = &zero + return &zero + } + default: + XdrPanic("SorobanAuthorizedFunction.CreateContractV2HostFn accessed when Type == %v", u.Type) + return nil + } +} +func (u SorobanAuthorizedFunction) XdrValid() bool { + switch u.Type { + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN, SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN, SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: + return true + } + return false +} +func (u *SorobanAuthorizedFunction) XdrUnionTag() XdrNum32 { + return XDR_SorobanAuthorizedFunctionType(&u.Type) +} +func (u *SorobanAuthorizedFunction) XdrUnionTagName() string { + return "Type" +} +func (u *SorobanAuthorizedFunction) XdrUnionBody() XdrType { + switch u.Type { + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: + return XDR_InvokeContractArgs(u.ContractFn()) + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: + return XDR_CreateContractArgs(u.CreateContractHostFn()) + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: + return XDR_CreateContractArgsV2(u.CreateContractV2HostFn()) + } + return nil +} +func (u *SorobanAuthorizedFunction) XdrUnionBodyName() string { + switch u.Type { + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: + return "ContractFn" + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: + return "CreateContractHostFn" + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: + return "CreateContractV2HostFn" + } + return "" +} + +type XdrType_SorobanAuthorizedFunction = *SorobanAuthorizedFunction + +func (v *SorobanAuthorizedFunction) XdrPointer() interface{} { return v } +func (SorobanAuthorizedFunction) XdrTypeName() string { return "SorobanAuthorizedFunction" } +func (v SorobanAuthorizedFunction) XdrValue() interface{} { return v } +func (v *SorobanAuthorizedFunction) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *SorobanAuthorizedFunction) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_SorobanAuthorizedFunctionType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: + x.Marshal(x.Sprintf("%scontractFn", name), XDR_InvokeContractArgs(u.ContractFn())) + return + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: + x.Marshal(x.Sprintf("%screateContractHostFn", name), XDR_CreateContractArgs(u.CreateContractHostFn())) + return + case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: + x.Marshal(x.Sprintf("%screateContractV2HostFn", name), XDR_CreateContractArgsV2(u.CreateContractV2HostFn())) + return + } + XdrPanic("invalid Type (%v) in SorobanAuthorizedFunction", u.Type) +} +func XDR_SorobanAuthorizedFunction(v *SorobanAuthorizedFunction) *SorobanAuthorizedFunction { return v } + +type _XdrVec_unbounded_SorobanAuthorizedInvocation []SorobanAuthorizedInvocation + +func (_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound +} +func (_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_SorobanAuthorizedInvocation length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_SorobanAuthorizedInvocation length %d exceeds max int", length) + } +} +func (v _XdrVec_unbounded_SorobanAuthorizedInvocation) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_SorobanAuthorizedInvocation) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] + } + return + } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) + } + nv := make([]SorobanAuthorizedInvocation, int(length), newcap) + copy(nv, *v) + *v = nv +} +func (v *_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_SorobanAuthorizedInvocation(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] + } +} +func (v *_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) +} +func (_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrTypeName() string { + return "SorobanAuthorizedInvocation<>" +} +func (v *_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrPointer() interface{} { + return (*[]SorobanAuthorizedInvocation)(v) +} +func (v _XdrVec_unbounded_SorobanAuthorizedInvocation) XdrValue() interface{} { + return ([]SorobanAuthorizedInvocation)(v) +} +func (v *_XdrVec_unbounded_SorobanAuthorizedInvocation) XdrMarshal(x XDR, name string) { + x.Marshal(name, v) +} + +type XdrType_SorobanAuthorizedInvocation = *SorobanAuthorizedInvocation + +func (v *SorobanAuthorizedInvocation) XdrPointer() interface{} { return v } +func (SorobanAuthorizedInvocation) XdrTypeName() string { return "SorobanAuthorizedInvocation" } +func (v SorobanAuthorizedInvocation) XdrValue() interface{} { return v } +func (v *SorobanAuthorizedInvocation) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SorobanAuthorizedInvocation) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sfunction", name), XDR_SorobanAuthorizedFunction(&v.Function)) + x.Marshal(x.Sprintf("%ssubInvocations", name), (*_XdrVec_unbounded_SorobanAuthorizedInvocation)(&v.SubInvocations)) +} +func XDR_SorobanAuthorizedInvocation(v *SorobanAuthorizedInvocation) *SorobanAuthorizedInvocation { + return v +} + +type XdrType_SorobanAddressCredentials = *SorobanAddressCredentials + +func (v *SorobanAddressCredentials) XdrPointer() interface{} { return v } +func (SorobanAddressCredentials) XdrTypeName() string { return "SorobanAddressCredentials" } +func (v SorobanAddressCredentials) XdrValue() interface{} { return v } +func (v *SorobanAddressCredentials) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SorobanAddressCredentials) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%saddress", name), XDR_SCAddress(&v.Address)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Int64(&v.Nonce)) + x.Marshal(x.Sprintf("%ssignatureExpirationLedger", name), XDR_Uint32(&v.SignatureExpirationLedger)) + x.Marshal(x.Sprintf("%ssignature", name), XDR_SCVal(&v.Signature)) +} +func XDR_SorobanAddressCredentials(v *SorobanAddressCredentials) *SorobanAddressCredentials { return v } + +var _XdrNames_SorobanCredentialsType = map[int32]string{ + int32(SOROBAN_CREDENTIALS_SOURCE_ACCOUNT): "SOROBAN_CREDENTIALS_SOURCE_ACCOUNT", + int32(SOROBAN_CREDENTIALS_ADDRESS): "SOROBAN_CREDENTIALS_ADDRESS", +} +var _XdrValues_SorobanCredentialsType = map[string]int32{ + "SOROBAN_CREDENTIALS_SOURCE_ACCOUNT": int32(SOROBAN_CREDENTIALS_SOURCE_ACCOUNT), + "SOROBAN_CREDENTIALS_ADDRESS": int32(SOROBAN_CREDENTIALS_ADDRESS), +} + +func (SorobanCredentialsType) XdrEnumNames() map[int32]string { + return _XdrNames_SorobanCredentialsType +} +func (v SorobanCredentialsType) String() string { + if s, ok := _XdrNames_SorobanCredentialsType[int32(v)]; ok { + return s + } + return fmt.Sprintf("SorobanCredentialsType#%d", v) +} +func (v *SorobanCredentialsType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_SorobanCredentialsType[stok]; ok { + *v = SorobanCredentialsType(val) + return nil + } else if stok == "SorobanCredentialsType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } + } + return XdrError(fmt.Sprintf("%s is not a valid SorobanCredentialsType.", stok)) + } +} +func (v SorobanCredentialsType) GetU32() uint32 { return uint32(v) } +func (v *SorobanCredentialsType) SetU32(n uint32) { *v = SorobanCredentialsType(n) } +func (v *SorobanCredentialsType) XdrPointer() interface{} { return v } +func (SorobanCredentialsType) XdrTypeName() string { return "SorobanCredentialsType" } +func (v SorobanCredentialsType) XdrValue() interface{} { return v } +func (v *SorobanCredentialsType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_SorobanCredentialsType = *SorobanCredentialsType + +func XDR_SorobanCredentialsType(v *SorobanCredentialsType) *SorobanCredentialsType { return v } + +var _XdrTags_SorobanCredentials = map[int32]bool{ + XdrToI32(SOROBAN_CREDENTIALS_SOURCE_ACCOUNT): true, + XdrToI32(SOROBAN_CREDENTIALS_ADDRESS): true, +} + +func (_ SorobanCredentials) XdrValidTags() map[int32]bool { + return _XdrTags_SorobanCredentials +} +func (u *SorobanCredentials) Address() *SorobanAddressCredentials { + switch u.Type { + case SOROBAN_CREDENTIALS_ADDRESS: + if v, ok := u._u.(*SorobanAddressCredentials); ok { + return v + } else { + var zero SorobanAddressCredentials + u._u = &zero + return &zero + } + default: + XdrPanic("SorobanCredentials.Address accessed when Type == %v", u.Type) + return nil + } +} +func (u SorobanCredentials) XdrValid() bool { + switch u.Type { + case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT, SOROBAN_CREDENTIALS_ADDRESS: + return true + } + return false +} +func (u *SorobanCredentials) XdrUnionTag() XdrNum32 { + return XDR_SorobanCredentialsType(&u.Type) +} +func (u *SorobanCredentials) XdrUnionTagName() string { + return "Type" +} +func (u *SorobanCredentials) XdrUnionBody() XdrType { + switch u.Type { + case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: + return nil + case SOROBAN_CREDENTIALS_ADDRESS: + return XDR_SorobanAddressCredentials(u.Address()) + } + return nil +} +func (u *SorobanCredentials) XdrUnionBodyName() string { + switch u.Type { + case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: + return "" + case SOROBAN_CREDENTIALS_ADDRESS: + return "Address" + } + return "" +} + +type XdrType_SorobanCredentials = *SorobanCredentials + +func (v *SorobanCredentials) XdrPointer() interface{} { return v } +func (SorobanCredentials) XdrTypeName() string { return "SorobanCredentials" } +func (v SorobanCredentials) XdrValue() interface{} { return v } +func (v *SorobanCredentials) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *SorobanCredentials) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_SorobanCredentialsType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT: + return + case SOROBAN_CREDENTIALS_ADDRESS: + x.Marshal(x.Sprintf("%saddress", name), XDR_SorobanAddressCredentials(u.Address())) + return + } + XdrPanic("invalid Type (%v) in SorobanCredentials", u.Type) +} +func XDR_SorobanCredentials(v *SorobanCredentials) *SorobanCredentials { return v } + +type XdrType_SorobanAuthorizationEntry = *SorobanAuthorizationEntry + +func (v *SorobanAuthorizationEntry) XdrPointer() interface{} { return v } +func (SorobanAuthorizationEntry) XdrTypeName() string { return "SorobanAuthorizationEntry" } +func (v SorobanAuthorizationEntry) XdrValue() interface{} { return v } +func (v *SorobanAuthorizationEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SorobanAuthorizationEntry) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%scredentials", name), XDR_SorobanCredentials(&v.Credentials)) + x.Marshal(x.Sprintf("%srootInvocation", name), XDR_SorobanAuthorizedInvocation(&v.RootInvocation)) +} +func XDR_SorobanAuthorizationEntry(v *SorobanAuthorizationEntry) *SorobanAuthorizationEntry { return v } + +type _XdrVec_unbounded_SorobanAuthorizationEntry []SorobanAuthorizationEntry + +func (_XdrVec_unbounded_SorobanAuthorizationEntry) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound +} +func (_XdrVec_unbounded_SorobanAuthorizationEntry) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_SorobanAuthorizationEntry length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_SorobanAuthorizationEntry length %d exceeds max int", length) + } +} +func (v _XdrVec_unbounded_SorobanAuthorizationEntry) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] + } + return + } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) + } + nv := make([]SorobanAuthorizationEntry, int(length), newcap) + copy(nv, *v) + *v = nv +} +func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_SorobanAuthorizationEntry(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] + } +} +func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) +} +func (_XdrVec_unbounded_SorobanAuthorizationEntry) XdrTypeName() string { + return "SorobanAuthorizationEntry<>" +} +func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) XdrPointer() interface{} { + return (*[]SorobanAuthorizationEntry)(v) +} +func (v _XdrVec_unbounded_SorobanAuthorizationEntry) XdrValue() interface{} { + return ([]SorobanAuthorizationEntry)(v) +} +func (v *_XdrVec_unbounded_SorobanAuthorizationEntry) XdrMarshal(x XDR, name string) { + x.Marshal(name, v) +} + +type XdrType_InvokeHostFunctionOp = *InvokeHostFunctionOp + +func (v *InvokeHostFunctionOp) XdrPointer() interface{} { return v } +func (InvokeHostFunctionOp) XdrTypeName() string { return "InvokeHostFunctionOp" } +func (v InvokeHostFunctionOp) XdrValue() interface{} { return v } +func (v *InvokeHostFunctionOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *InvokeHostFunctionOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%shostFunction", name), XDR_HostFunction(&v.HostFunction)) + x.Marshal(x.Sprintf("%sauth", name), (*_XdrVec_unbounded_SorobanAuthorizationEntry)(&v.Auth)) +} +func XDR_InvokeHostFunctionOp(v *InvokeHostFunctionOp) *InvokeHostFunctionOp { return v } + +type XdrType_ExtendFootprintTTLOp = *ExtendFootprintTTLOp + +func (v *ExtendFootprintTTLOp) XdrPointer() interface{} { return v } +func (ExtendFootprintTTLOp) XdrTypeName() string { return "ExtendFootprintTTLOp" } +func (v ExtendFootprintTTLOp) XdrValue() interface{} { return v } +func (v *ExtendFootprintTTLOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ExtendFootprintTTLOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%sextendTo", name), XDR_Uint32(&v.ExtendTo)) +} +func XDR_ExtendFootprintTTLOp(v *ExtendFootprintTTLOp) *ExtendFootprintTTLOp { return v } + +type XdrType_RestoreFootprintOp = *RestoreFootprintOp + +func (v *RestoreFootprintOp) XdrPointer() interface{} { return v } +func (RestoreFootprintOp) XdrTypeName() string { return "RestoreFootprintOp" } +func (v RestoreFootprintOp) XdrValue() interface{} { return v } +func (v *RestoreFootprintOp) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *RestoreFootprintOp) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) +} +func XDR_RestoreFootprintOp(v *RestoreFootprintOp) *RestoreFootprintOp { return v } + +var _XdrTags_XdrAnon_Operation_Body = map[int32]bool{ + XdrToI32(CREATE_ACCOUNT): true, + XdrToI32(PAYMENT): true, + XdrToI32(PATH_PAYMENT_STRICT_RECEIVE): true, + XdrToI32(MANAGE_SELL_OFFER): true, + XdrToI32(CREATE_PASSIVE_SELL_OFFER): true, + XdrToI32(SET_OPTIONS): true, + XdrToI32(CHANGE_TRUST): true, + XdrToI32(ALLOW_TRUST): true, + XdrToI32(ACCOUNT_MERGE): true, + XdrToI32(INFLATION): true, + XdrToI32(MANAGE_DATA): true, + XdrToI32(BUMP_SEQUENCE): true, + XdrToI32(MANAGE_BUY_OFFER): true, + XdrToI32(PATH_PAYMENT_STRICT_SEND): true, + XdrToI32(CREATE_CLAIMABLE_BALANCE): true, + XdrToI32(CLAIM_CLAIMABLE_BALANCE): true, + XdrToI32(BEGIN_SPONSORING_FUTURE_RESERVES): true, + XdrToI32(END_SPONSORING_FUTURE_RESERVES): true, + XdrToI32(REVOKE_SPONSORSHIP): true, + XdrToI32(CLAWBACK): true, + XdrToI32(CLAWBACK_CLAIMABLE_BALANCE): true, + XdrToI32(SET_TRUST_LINE_FLAGS): true, + XdrToI32(LIQUIDITY_POOL_DEPOSIT): true, + XdrToI32(LIQUIDITY_POOL_WITHDRAW): true, + XdrToI32(INVOKE_HOST_FUNCTION): true, + XdrToI32(EXTEND_FOOTPRINT_TTL): true, + XdrToI32(RESTORE_FOOTPRINT): true, +} + +func (_ XdrAnon_Operation_Body) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_Operation_Body +} +func (u *XdrAnon_Operation_Body) CreateAccountOp() *CreateAccountOp { + switch u.Type { + case CREATE_ACCOUNT: + if v, ok := u._u.(*CreateAccountOp); ok { + return v + } else { + var zero CreateAccountOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.CreateAccountOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) PaymentOp() *PaymentOp { + switch u.Type { + case PAYMENT: + if v, ok := u._u.(*PaymentOp); ok { + return v + } else { + var zero PaymentOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.PaymentOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) PathPaymentStrictReceiveOp() *PathPaymentStrictReceiveOp { + switch u.Type { + case PATH_PAYMENT_STRICT_RECEIVE: + if v, ok := u._u.(*PathPaymentStrictReceiveOp); ok { + return v + } else { + var zero PathPaymentStrictReceiveOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.PathPaymentStrictReceiveOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) ManageSellOfferOp() *ManageSellOfferOp { + switch u.Type { + case MANAGE_SELL_OFFER: + if v, ok := u._u.(*ManageSellOfferOp); ok { + return v + } else { + var zero ManageSellOfferOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.ManageSellOfferOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) CreatePassiveSellOfferOp() *CreatePassiveSellOfferOp { + switch u.Type { + case CREATE_PASSIVE_SELL_OFFER: + if v, ok := u._u.(*CreatePassiveSellOfferOp); ok { + return v + } else { + var zero CreatePassiveSellOfferOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.CreatePassiveSellOfferOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) SetOptionsOp() *SetOptionsOp { + switch u.Type { + case SET_OPTIONS: + if v, ok := u._u.(*SetOptionsOp); ok { + return v + } else { + var zero SetOptionsOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.SetOptionsOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) ChangeTrustOp() *ChangeTrustOp { + switch u.Type { + case CHANGE_TRUST: + if v, ok := u._u.(*ChangeTrustOp); ok { + return v + } else { + var zero ChangeTrustOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.ChangeTrustOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) AllowTrustOp() *AllowTrustOp { + switch u.Type { + case ALLOW_TRUST: + if v, ok := u._u.(*AllowTrustOp); ok { + return v + } else { + var zero AllowTrustOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.AllowTrustOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) Destination() *MuxedAccount { + switch u.Type { + case ACCOUNT_MERGE: + if v, ok := u._u.(*MuxedAccount); ok { + return v + } else { + var zero MuxedAccount + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.Destination accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) ManageDataOp() *ManageDataOp { + switch u.Type { + case MANAGE_DATA: + if v, ok := u._u.(*ManageDataOp); ok { + return v + } else { + var zero ManageDataOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.ManageDataOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) BumpSequenceOp() *BumpSequenceOp { + switch u.Type { + case BUMP_SEQUENCE: + if v, ok := u._u.(*BumpSequenceOp); ok { + return v + } else { + var zero BumpSequenceOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.BumpSequenceOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) ManageBuyOfferOp() *ManageBuyOfferOp { + switch u.Type { + case MANAGE_BUY_OFFER: + if v, ok := u._u.(*ManageBuyOfferOp); ok { + return v + } else { + var zero ManageBuyOfferOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.ManageBuyOfferOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) PathPaymentStrictSendOp() *PathPaymentStrictSendOp { + switch u.Type { + case PATH_PAYMENT_STRICT_SEND: + if v, ok := u._u.(*PathPaymentStrictSendOp); ok { + return v + } else { + var zero PathPaymentStrictSendOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.PathPaymentStrictSendOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) CreateClaimableBalanceOp() *CreateClaimableBalanceOp { + switch u.Type { + case CREATE_CLAIMABLE_BALANCE: + if v, ok := u._u.(*CreateClaimableBalanceOp); ok { + return v + } else { + var zero CreateClaimableBalanceOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.CreateClaimableBalanceOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) ClaimClaimableBalanceOp() *ClaimClaimableBalanceOp { + switch u.Type { + case CLAIM_CLAIMABLE_BALANCE: + if v, ok := u._u.(*ClaimClaimableBalanceOp); ok { + return v + } else { + var zero ClaimClaimableBalanceOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.ClaimClaimableBalanceOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) BeginSponsoringFutureReservesOp() *BeginSponsoringFutureReservesOp { + switch u.Type { + case BEGIN_SPONSORING_FUTURE_RESERVES: + if v, ok := u._u.(*BeginSponsoringFutureReservesOp); ok { + return v + } else { + var zero BeginSponsoringFutureReservesOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.BeginSponsoringFutureReservesOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) RevokeSponsorshipOp() *RevokeSponsorshipOp { + switch u.Type { + case REVOKE_SPONSORSHIP: + if v, ok := u._u.(*RevokeSponsorshipOp); ok { + return v + } else { + var zero RevokeSponsorshipOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.RevokeSponsorshipOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) ClawbackOp() *ClawbackOp { + switch u.Type { + case CLAWBACK: + if v, ok := u._u.(*ClawbackOp); ok { + return v + } else { + var zero ClawbackOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.ClawbackOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) ClawbackClaimableBalanceOp() *ClawbackClaimableBalanceOp { + switch u.Type { + case CLAWBACK_CLAIMABLE_BALANCE: + if v, ok := u._u.(*ClawbackClaimableBalanceOp); ok { + return v + } else { + var zero ClawbackClaimableBalanceOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.ClawbackClaimableBalanceOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) SetTrustLineFlagsOp() *SetTrustLineFlagsOp { + switch u.Type { + case SET_TRUST_LINE_FLAGS: + if v, ok := u._u.(*SetTrustLineFlagsOp); ok { + return v + } else { + var zero SetTrustLineFlagsOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.SetTrustLineFlagsOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) LiquidityPoolDepositOp() *LiquidityPoolDepositOp { + switch u.Type { + case LIQUIDITY_POOL_DEPOSIT: + if v, ok := u._u.(*LiquidityPoolDepositOp); ok { + return v + } else { + var zero LiquidityPoolDepositOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.LiquidityPoolDepositOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) LiquidityPoolWithdrawOp() *LiquidityPoolWithdrawOp { + switch u.Type { + case LIQUIDITY_POOL_WITHDRAW: + if v, ok := u._u.(*LiquidityPoolWithdrawOp); ok { + return v + } else { + var zero LiquidityPoolWithdrawOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.LiquidityPoolWithdrawOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) InvokeHostFunctionOp() *InvokeHostFunctionOp { + switch u.Type { + case INVOKE_HOST_FUNCTION: + if v, ok := u._u.(*InvokeHostFunctionOp); ok { + return v + } else { + var zero InvokeHostFunctionOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.InvokeHostFunctionOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) ExtendFootprintTTLOp() *ExtendFootprintTTLOp { + switch u.Type { + case EXTEND_FOOTPRINT_TTL: + if v, ok := u._u.(*ExtendFootprintTTLOp); ok { + return v + } else { + var zero ExtendFootprintTTLOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.ExtendFootprintTTLOp accessed when Type == %v", u.Type) + return nil + } +} +func (u *XdrAnon_Operation_Body) RestoreFootprintOp() *RestoreFootprintOp { + switch u.Type { + case RESTORE_FOOTPRINT: + if v, ok := u._u.(*RestoreFootprintOp); ok { + return v + } else { + var zero RestoreFootprintOp + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_Operation_Body.RestoreFootprintOp accessed when Type == %v", u.Type) + return nil + } +} +func (u XdrAnon_Operation_Body) XdrValid() bool { + switch u.Type { + case CREATE_ACCOUNT, PAYMENT, PATH_PAYMENT_STRICT_RECEIVE, MANAGE_SELL_OFFER, CREATE_PASSIVE_SELL_OFFER, SET_OPTIONS, CHANGE_TRUST, ALLOW_TRUST, ACCOUNT_MERGE, INFLATION, MANAGE_DATA, BUMP_SEQUENCE, MANAGE_BUY_OFFER, PATH_PAYMENT_STRICT_SEND, CREATE_CLAIMABLE_BALANCE, CLAIM_CLAIMABLE_BALANCE, BEGIN_SPONSORING_FUTURE_RESERVES, END_SPONSORING_FUTURE_RESERVES, REVOKE_SPONSORSHIP, CLAWBACK, CLAWBACK_CLAIMABLE_BALANCE, SET_TRUST_LINE_FLAGS, LIQUIDITY_POOL_DEPOSIT, LIQUIDITY_POOL_WITHDRAW, INVOKE_HOST_FUNCTION, EXTEND_FOOTPRINT_TTL, RESTORE_FOOTPRINT: + return true + } + return false +} +func (u *XdrAnon_Operation_Body) XdrUnionTag() XdrNum32 { + return XDR_OperationType(&u.Type) +} +func (u *XdrAnon_Operation_Body) XdrUnionTagName() string { + return "Type" +} +func (u *XdrAnon_Operation_Body) XdrUnionBody() XdrType { + switch u.Type { + case CREATE_ACCOUNT: + return XDR_CreateAccountOp(u.CreateAccountOp()) + case PAYMENT: + return XDR_PaymentOp(u.PaymentOp()) + case PATH_PAYMENT_STRICT_RECEIVE: + return XDR_PathPaymentStrictReceiveOp(u.PathPaymentStrictReceiveOp()) + case MANAGE_SELL_OFFER: + return XDR_ManageSellOfferOp(u.ManageSellOfferOp()) + case CREATE_PASSIVE_SELL_OFFER: + return XDR_CreatePassiveSellOfferOp(u.CreatePassiveSellOfferOp()) + case SET_OPTIONS: + return XDR_SetOptionsOp(u.SetOptionsOp()) + case CHANGE_TRUST: + return XDR_ChangeTrustOp(u.ChangeTrustOp()) + case ALLOW_TRUST: + return XDR_AllowTrustOp(u.AllowTrustOp()) + case ACCOUNT_MERGE: + return XDR_MuxedAccount(u.Destination()) + case INFLATION: + return nil + case MANAGE_DATA: + return XDR_ManageDataOp(u.ManageDataOp()) + case BUMP_SEQUENCE: + return XDR_BumpSequenceOp(u.BumpSequenceOp()) + case MANAGE_BUY_OFFER: + return XDR_ManageBuyOfferOp(u.ManageBuyOfferOp()) + case PATH_PAYMENT_STRICT_SEND: + return XDR_PathPaymentStrictSendOp(u.PathPaymentStrictSendOp()) + case CREATE_CLAIMABLE_BALANCE: + return XDR_CreateClaimableBalanceOp(u.CreateClaimableBalanceOp()) + case CLAIM_CLAIMABLE_BALANCE: + return XDR_ClaimClaimableBalanceOp(u.ClaimClaimableBalanceOp()) + case BEGIN_SPONSORING_FUTURE_RESERVES: + return XDR_BeginSponsoringFutureReservesOp(u.BeginSponsoringFutureReservesOp()) + case END_SPONSORING_FUTURE_RESERVES: + return nil + case REVOKE_SPONSORSHIP: + return XDR_RevokeSponsorshipOp(u.RevokeSponsorshipOp()) + case CLAWBACK: + return XDR_ClawbackOp(u.ClawbackOp()) + case CLAWBACK_CLAIMABLE_BALANCE: + return XDR_ClawbackClaimableBalanceOp(u.ClawbackClaimableBalanceOp()) + case SET_TRUST_LINE_FLAGS: + return XDR_SetTrustLineFlagsOp(u.SetTrustLineFlagsOp()) + case LIQUIDITY_POOL_DEPOSIT: + return XDR_LiquidityPoolDepositOp(u.LiquidityPoolDepositOp()) + case LIQUIDITY_POOL_WITHDRAW: + return XDR_LiquidityPoolWithdrawOp(u.LiquidityPoolWithdrawOp()) + case INVOKE_HOST_FUNCTION: + return XDR_InvokeHostFunctionOp(u.InvokeHostFunctionOp()) + case EXTEND_FOOTPRINT_TTL: + return XDR_ExtendFootprintTTLOp(u.ExtendFootprintTTLOp()) + case RESTORE_FOOTPRINT: + return XDR_RestoreFootprintOp(u.RestoreFootprintOp()) + } + return nil +} +func (u *XdrAnon_Operation_Body) XdrUnionBodyName() string { + switch u.Type { + case CREATE_ACCOUNT: + return "CreateAccountOp" + case PAYMENT: + return "PaymentOp" + case PATH_PAYMENT_STRICT_RECEIVE: + return "PathPaymentStrictReceiveOp" + case MANAGE_SELL_OFFER: + return "ManageSellOfferOp" + case CREATE_PASSIVE_SELL_OFFER: + return "CreatePassiveSellOfferOp" + case SET_OPTIONS: + return "SetOptionsOp" + case CHANGE_TRUST: + return "ChangeTrustOp" + case ALLOW_TRUST: + return "AllowTrustOp" + case ACCOUNT_MERGE: + return "Destination" + case INFLATION: + return "" + case MANAGE_DATA: + return "ManageDataOp" + case BUMP_SEQUENCE: + return "BumpSequenceOp" + case MANAGE_BUY_OFFER: + return "ManageBuyOfferOp" + case PATH_PAYMENT_STRICT_SEND: + return "PathPaymentStrictSendOp" + case CREATE_CLAIMABLE_BALANCE: + return "CreateClaimableBalanceOp" + case CLAIM_CLAIMABLE_BALANCE: + return "ClaimClaimableBalanceOp" + case BEGIN_SPONSORING_FUTURE_RESERVES: + return "BeginSponsoringFutureReservesOp" + case END_SPONSORING_FUTURE_RESERVES: + return "" + case REVOKE_SPONSORSHIP: + return "RevokeSponsorshipOp" + case CLAWBACK: + return "ClawbackOp" + case CLAWBACK_CLAIMABLE_BALANCE: + return "ClawbackClaimableBalanceOp" + case SET_TRUST_LINE_FLAGS: + return "SetTrustLineFlagsOp" + case LIQUIDITY_POOL_DEPOSIT: + return "LiquidityPoolDepositOp" + case LIQUIDITY_POOL_WITHDRAW: + return "LiquidityPoolWithdrawOp" + case INVOKE_HOST_FUNCTION: + return "InvokeHostFunctionOp" + case EXTEND_FOOTPRINT_TTL: + return "ExtendFootprintTTLOp" + case RESTORE_FOOTPRINT: + return "RestoreFootprintOp" + } + return "" +} + +type XdrType_XdrAnon_Operation_Body = *XdrAnon_Operation_Body + +func (v *XdrAnon_Operation_Body) XdrPointer() interface{} { return v } +func (XdrAnon_Operation_Body) XdrTypeName() string { return "XdrAnon_Operation_Body" } +func (v XdrAnon_Operation_Body) XdrValue() interface{} { return v } +func (v *XdrAnon_Operation_Body) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_Operation_Body) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_OperationType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case CREATE_ACCOUNT: + x.Marshal(x.Sprintf("%screateAccountOp", name), XDR_CreateAccountOp(u.CreateAccountOp())) + return + case PAYMENT: + x.Marshal(x.Sprintf("%spaymentOp", name), XDR_PaymentOp(u.PaymentOp())) + return + case PATH_PAYMENT_STRICT_RECEIVE: + x.Marshal(x.Sprintf("%spathPaymentStrictReceiveOp", name), XDR_PathPaymentStrictReceiveOp(u.PathPaymentStrictReceiveOp())) + return + case MANAGE_SELL_OFFER: + x.Marshal(x.Sprintf("%smanageSellOfferOp", name), XDR_ManageSellOfferOp(u.ManageSellOfferOp())) + return + case CREATE_PASSIVE_SELL_OFFER: + x.Marshal(x.Sprintf("%screatePassiveSellOfferOp", name), XDR_CreatePassiveSellOfferOp(u.CreatePassiveSellOfferOp())) + return + case SET_OPTIONS: + x.Marshal(x.Sprintf("%ssetOptionsOp", name), XDR_SetOptionsOp(u.SetOptionsOp())) + return + case CHANGE_TRUST: + x.Marshal(x.Sprintf("%schangeTrustOp", name), XDR_ChangeTrustOp(u.ChangeTrustOp())) + return + case ALLOW_TRUST: + x.Marshal(x.Sprintf("%sallowTrustOp", name), XDR_AllowTrustOp(u.AllowTrustOp())) + return + case ACCOUNT_MERGE: + x.Marshal(x.Sprintf("%sdestination", name), XDR_MuxedAccount(u.Destination())) + return + case INFLATION: + return + case MANAGE_DATA: + x.Marshal(x.Sprintf("%smanageDataOp", name), XDR_ManageDataOp(u.ManageDataOp())) + return + case BUMP_SEQUENCE: + x.Marshal(x.Sprintf("%sbumpSequenceOp", name), XDR_BumpSequenceOp(u.BumpSequenceOp())) + return + case MANAGE_BUY_OFFER: + x.Marshal(x.Sprintf("%smanageBuyOfferOp", name), XDR_ManageBuyOfferOp(u.ManageBuyOfferOp())) + return + case PATH_PAYMENT_STRICT_SEND: + x.Marshal(x.Sprintf("%spathPaymentStrictSendOp", name), XDR_PathPaymentStrictSendOp(u.PathPaymentStrictSendOp())) + return + case CREATE_CLAIMABLE_BALANCE: + x.Marshal(x.Sprintf("%screateClaimableBalanceOp", name), XDR_CreateClaimableBalanceOp(u.CreateClaimableBalanceOp())) + return + case CLAIM_CLAIMABLE_BALANCE: + x.Marshal(x.Sprintf("%sclaimClaimableBalanceOp", name), XDR_ClaimClaimableBalanceOp(u.ClaimClaimableBalanceOp())) + return + case BEGIN_SPONSORING_FUTURE_RESERVES: + x.Marshal(x.Sprintf("%sbeginSponsoringFutureReservesOp", name), XDR_BeginSponsoringFutureReservesOp(u.BeginSponsoringFutureReservesOp())) + return + case END_SPONSORING_FUTURE_RESERVES: + return + case REVOKE_SPONSORSHIP: + x.Marshal(x.Sprintf("%srevokeSponsorshipOp", name), XDR_RevokeSponsorshipOp(u.RevokeSponsorshipOp())) + return + case CLAWBACK: + x.Marshal(x.Sprintf("%sclawbackOp", name), XDR_ClawbackOp(u.ClawbackOp())) + return + case CLAWBACK_CLAIMABLE_BALANCE: + x.Marshal(x.Sprintf("%sclawbackClaimableBalanceOp", name), XDR_ClawbackClaimableBalanceOp(u.ClawbackClaimableBalanceOp())) + return + case SET_TRUST_LINE_FLAGS: + x.Marshal(x.Sprintf("%ssetTrustLineFlagsOp", name), XDR_SetTrustLineFlagsOp(u.SetTrustLineFlagsOp())) + return + case LIQUIDITY_POOL_DEPOSIT: + x.Marshal(x.Sprintf("%sliquidityPoolDepositOp", name), XDR_LiquidityPoolDepositOp(u.LiquidityPoolDepositOp())) + return + case LIQUIDITY_POOL_WITHDRAW: + x.Marshal(x.Sprintf("%sliquidityPoolWithdrawOp", name), XDR_LiquidityPoolWithdrawOp(u.LiquidityPoolWithdrawOp())) + return + case INVOKE_HOST_FUNCTION: + x.Marshal(x.Sprintf("%sinvokeHostFunctionOp", name), XDR_InvokeHostFunctionOp(u.InvokeHostFunctionOp())) + return + case EXTEND_FOOTPRINT_TTL: + x.Marshal(x.Sprintf("%sextendFootprintTTLOp", name), XDR_ExtendFootprintTTLOp(u.ExtendFootprintTTLOp())) + return + case RESTORE_FOOTPRINT: + x.Marshal(x.Sprintf("%srestoreFootprintOp", name), XDR_RestoreFootprintOp(u.RestoreFootprintOp())) + return + } + XdrPanic("invalid Type (%v) in XdrAnon_Operation_Body", u.Type) +} +func XDR_XdrAnon_Operation_Body(v *XdrAnon_Operation_Body) *XdrAnon_Operation_Body { return v } + +type _XdrPtr_MuxedAccount struct { + p **MuxedAccount +} +type _ptrflag_MuxedAccount _XdrPtr_MuxedAccount + +func (v _ptrflag_MuxedAccount) String() string { + if *v.p == nil { + return "nil" + } + return "non-nil" +} +func (v _ptrflag_MuxedAccount) Scan(ss fmt.ScanState, r rune) error { + tok, err := ss.Token(true, func(c rune) bool { + return c == '-' || (c >= 'a' && c <= 'z') + }) + if err != nil { + return err + } + switch string(tok) { + case "nil": + v.SetU32(0) + case "non-nil": + v.SetU32(1) + default: + return XdrError("MuxedAccount flag should be \"nil\" or \"non-nil\"") + } + return nil +} +func (v _ptrflag_MuxedAccount) GetU32() uint32 { + if *v.p == nil { + return 0 + } + return 1 +} +func (v _ptrflag_MuxedAccount) SetU32(nv uint32) { + switch nv { + case 0: + *v.p = nil + case 1: + if *v.p == nil { + *v.p = new(MuxedAccount) + } + default: + XdrPanic("*MuxedAccount present flag value %d should be 0 or 1", nv) + } +} +func (_ptrflag_MuxedAccount) XdrTypeName() string { return "MuxedAccount?" } +func (v _ptrflag_MuxedAccount) XdrPointer() interface{} { return nil } +func (v _ptrflag_MuxedAccount) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_MuxedAccount) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_MuxedAccount) XdrBound() uint32 { return 1 } +func (v _XdrPtr_MuxedAccount) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_MuxedAccount) SetPresent(present bool) { + if !present { + *v.p = nil + } else if *v.p == nil { + *v.p = new(MuxedAccount) + } +} +func (v _XdrPtr_MuxedAccount) XdrMarshalValue(x XDR, name string) { + if *v.p != nil { + XDR_MuxedAccount(*v.p).XdrMarshal(x, name) + } +} +func (v _XdrPtr_MuxedAccount) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_MuxedAccount) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_MuxedAccount(v)) + v.XdrMarshalValue(x, name) +} +func (_XdrPtr_MuxedAccount) XdrTypeName() string { return "MuxedAccount*" } +func (v _XdrPtr_MuxedAccount) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_MuxedAccount) XdrValue() interface{} { return *v.p } + +type XdrType_Operation = *Operation + +func (v *Operation) XdrPointer() interface{} { return v } +func (Operation) XdrTypeName() string { return "Operation" } +func (v Operation) XdrValue() interface{} { return v } +func (v *Operation) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *Operation) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%ssourceAccount", name), _XdrPtr_MuxedAccount{&v.SourceAccount}) + x.Marshal(x.Sprintf("%sbody", name), XDR_XdrAnon_Operation_Body(&v.Body)) +} +func XDR_Operation(v *Operation) *Operation { return v } + +type XdrType_XdrAnon_HashIDPreimage_OperationID = *XdrAnon_HashIDPreimage_OperationID + +func (v *XdrAnon_HashIDPreimage_OperationID) XdrPointer() interface{} { return v } +func (XdrAnon_HashIDPreimage_OperationID) XdrTypeName() string { + return "XdrAnon_HashIDPreimage_OperationID" +} +func (v XdrAnon_HashIDPreimage_OperationID) XdrValue() interface{} { return v } +func (v *XdrAnon_HashIDPreimage_OperationID) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *XdrAnon_HashIDPreimage_OperationID) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%ssourceAccount", name), XDR_AccountID(&v.SourceAccount)) + x.Marshal(x.Sprintf("%sseqNum", name), XDR_SequenceNumber(&v.SeqNum)) + x.Marshal(x.Sprintf("%sopNum", name), XDR_Uint32(&v.OpNum)) +} +func XDR_XdrAnon_HashIDPreimage_OperationID(v *XdrAnon_HashIDPreimage_OperationID) *XdrAnon_HashIDPreimage_OperationID { + return v +} + +type XdrType_XdrAnon_HashIDPreimage_RevokeID = *XdrAnon_HashIDPreimage_RevokeID + +func (v *XdrAnon_HashIDPreimage_RevokeID) XdrPointer() interface{} { return v } +func (XdrAnon_HashIDPreimage_RevokeID) XdrTypeName() string { return "XdrAnon_HashIDPreimage_RevokeID" } +func (v XdrAnon_HashIDPreimage_RevokeID) XdrValue() interface{} { return v } +func (v *XdrAnon_HashIDPreimage_RevokeID) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *XdrAnon_HashIDPreimage_RevokeID) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%ssourceAccount", name), XDR_AccountID(&v.SourceAccount)) + x.Marshal(x.Sprintf("%sseqNum", name), XDR_SequenceNumber(&v.SeqNum)) + x.Marshal(x.Sprintf("%sopNum", name), XDR_Uint32(&v.OpNum)) + x.Marshal(x.Sprintf("%sliquidityPoolID", name), XDR_PoolID(&v.LiquidityPoolID)) + x.Marshal(x.Sprintf("%sasset", name), XDR_Asset(&v.Asset)) +} +func XDR_XdrAnon_HashIDPreimage_RevokeID(v *XdrAnon_HashIDPreimage_RevokeID) *XdrAnon_HashIDPreimage_RevokeID { + return v +} + +type XdrType_XdrAnon_HashIDPreimage_ContractID = *XdrAnon_HashIDPreimage_ContractID + +func (v *XdrAnon_HashIDPreimage_ContractID) XdrPointer() interface{} { return v } +func (XdrAnon_HashIDPreimage_ContractID) XdrTypeName() string { + return "XdrAnon_HashIDPreimage_ContractID" +} +func (v XdrAnon_HashIDPreimage_ContractID) XdrValue() interface{} { return v } +func (v *XdrAnon_HashIDPreimage_ContractID) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *XdrAnon_HashIDPreimage_ContractID) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%snetworkID", name), XDR_Hash(&v.NetworkID)) + x.Marshal(x.Sprintf("%scontractIDPreimage", name), XDR_ContractIDPreimage(&v.ContractIDPreimage)) +} +func XDR_XdrAnon_HashIDPreimage_ContractID(v *XdrAnon_HashIDPreimage_ContractID) *XdrAnon_HashIDPreimage_ContractID { + return v +} + +type XdrType_XdrAnon_HashIDPreimage_SorobanAuthorization = *XdrAnon_HashIDPreimage_SorobanAuthorization + +func (v *XdrAnon_HashIDPreimage_SorobanAuthorization) XdrPointer() interface{} { return v } +func (XdrAnon_HashIDPreimage_SorobanAuthorization) XdrTypeName() string { + return "XdrAnon_HashIDPreimage_SorobanAuthorization" +} +func (v XdrAnon_HashIDPreimage_SorobanAuthorization) XdrValue() interface{} { return v } +func (v *XdrAnon_HashIDPreimage_SorobanAuthorization) XdrMarshal(x XDR, name string) { + x.Marshal(name, v) +} +func (v *XdrAnon_HashIDPreimage_SorobanAuthorization) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%snetworkID", name), XDR_Hash(&v.NetworkID)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Int64(&v.Nonce)) + x.Marshal(x.Sprintf("%ssignatureExpirationLedger", name), XDR_Uint32(&v.SignatureExpirationLedger)) + x.Marshal(x.Sprintf("%sinvocation", name), XDR_SorobanAuthorizedInvocation(&v.Invocation)) +} +func XDR_XdrAnon_HashIDPreimage_SorobanAuthorization(v *XdrAnon_HashIDPreimage_SorobanAuthorization) *XdrAnon_HashIDPreimage_SorobanAuthorization { + return v +} + +var _XdrTags_HashIDPreimage = map[int32]bool{ + XdrToI32(ENVELOPE_TYPE_OP_ID): true, + XdrToI32(ENVELOPE_TYPE_POOL_REVOKE_OP_ID): true, + XdrToI32(ENVELOPE_TYPE_CONTRACT_ID): true, + XdrToI32(ENVELOPE_TYPE_SOROBAN_AUTHORIZATION): true, +} + +func (_ HashIDPreimage) XdrValidTags() map[int32]bool { + return _XdrTags_HashIDPreimage +} +func (u *HashIDPreimage) OperationID() *XdrAnon_HashIDPreimage_OperationID { + switch u.Type { + case ENVELOPE_TYPE_OP_ID: + if v, ok := u._u.(*XdrAnon_HashIDPreimage_OperationID); ok { + return v + } else { + var zero XdrAnon_HashIDPreimage_OperationID + u._u = &zero + return &zero + } + default: + XdrPanic("HashIDPreimage.OperationID accessed when Type == %v", u.Type) + return nil + } +} +func (u *HashIDPreimage) RevokeID() *XdrAnon_HashIDPreimage_RevokeID { + switch u.Type { + case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: + if v, ok := u._u.(*XdrAnon_HashIDPreimage_RevokeID); ok { + return v + } else { + var zero XdrAnon_HashIDPreimage_RevokeID + u._u = &zero + return &zero + } + default: + XdrPanic("HashIDPreimage.RevokeID accessed when Type == %v", u.Type) + return nil + } +} +func (u *HashIDPreimage) ContractID() *XdrAnon_HashIDPreimage_ContractID { + switch u.Type { + case ENVELOPE_TYPE_CONTRACT_ID: + if v, ok := u._u.(*XdrAnon_HashIDPreimage_ContractID); ok { + return v + } else { + var zero XdrAnon_HashIDPreimage_ContractID + u._u = &zero + return &zero + } + default: + XdrPanic("HashIDPreimage.ContractID accessed when Type == %v", u.Type) + return nil + } +} +func (u *HashIDPreimage) SorobanAuthorization() *XdrAnon_HashIDPreimage_SorobanAuthorization { + switch u.Type { + case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: + if v, ok := u._u.(*XdrAnon_HashIDPreimage_SorobanAuthorization); ok { + return v + } else { + var zero XdrAnon_HashIDPreimage_SorobanAuthorization + u._u = &zero + return &zero + } + default: + XdrPanic("HashIDPreimage.SorobanAuthorization accessed when Type == %v", u.Type) + return nil + } +} +func (u HashIDPreimage) XdrValid() bool { + switch u.Type { + case ENVELOPE_TYPE_OP_ID, ENVELOPE_TYPE_POOL_REVOKE_OP_ID, ENVELOPE_TYPE_CONTRACT_ID, ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: + return true + } + return false +} +func (u *HashIDPreimage) XdrUnionTag() XdrNum32 { + return XDR_EnvelopeType(&u.Type) +} +func (u *HashIDPreimage) XdrUnionTagName() string { + return "Type" +} +func (u *HashIDPreimage) XdrUnionBody() XdrType { + switch u.Type { + case ENVELOPE_TYPE_OP_ID: + return XDR_XdrAnon_HashIDPreimage_OperationID(u.OperationID()) + case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: + return XDR_XdrAnon_HashIDPreimage_RevokeID(u.RevokeID()) + case ENVELOPE_TYPE_CONTRACT_ID: + return XDR_XdrAnon_HashIDPreimage_ContractID(u.ContractID()) + case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: + return XDR_XdrAnon_HashIDPreimage_SorobanAuthorization(u.SorobanAuthorization()) + } + return nil +} +func (u *HashIDPreimage) XdrUnionBodyName() string { + switch u.Type { + case ENVELOPE_TYPE_OP_ID: + return "OperationID" + case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: + return "RevokeID" + case ENVELOPE_TYPE_CONTRACT_ID: + return "ContractID" + case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: + return "SorobanAuthorization" + } + return "" +} + +type XdrType_HashIDPreimage = *HashIDPreimage + +func (v *HashIDPreimage) XdrPointer() interface{} { return v } +func (HashIDPreimage) XdrTypeName() string { return "HashIDPreimage" } +func (v HashIDPreimage) XdrValue() interface{} { return v } +func (v *HashIDPreimage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *HashIDPreimage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_EnvelopeType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case ENVELOPE_TYPE_OP_ID: + x.Marshal(x.Sprintf("%soperationID", name), XDR_XdrAnon_HashIDPreimage_OperationID(u.OperationID())) + return + case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: + x.Marshal(x.Sprintf("%srevokeID", name), XDR_XdrAnon_HashIDPreimage_RevokeID(u.RevokeID())) + return + case ENVELOPE_TYPE_CONTRACT_ID: + x.Marshal(x.Sprintf("%scontractID", name), XDR_XdrAnon_HashIDPreimage_ContractID(u.ContractID())) + return + case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: + x.Marshal(x.Sprintf("%ssorobanAuthorization", name), XDR_XdrAnon_HashIDPreimage_SorobanAuthorization(u.SorobanAuthorization())) + return + } + XdrPanic("invalid Type (%v) in HashIDPreimage", u.Type) +} +func (v *HashIDPreimage) XdrInitialize() { + var zero EnvelopeType + switch zero { + case ENVELOPE_TYPE_OP_ID, ENVELOPE_TYPE_POOL_REVOKE_OP_ID, ENVELOPE_TYPE_CONTRACT_ID, ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: + default: + if v.Type == zero { + v.Type = ENVELOPE_TYPE_OP_ID + } + } +} +func XDR_HashIDPreimage(v *HashIDPreimage) *HashIDPreimage { return v } + +var _XdrNames_MemoType = map[int32]string{ + int32(MEMO_NONE): "MEMO_NONE", + int32(MEMO_TEXT): "MEMO_TEXT", + int32(MEMO_ID): "MEMO_ID", + int32(MEMO_HASH): "MEMO_HASH", + int32(MEMO_RETURN): "MEMO_RETURN", +} +var _XdrValues_MemoType = map[string]int32{ + "MEMO_NONE": int32(MEMO_NONE), + "MEMO_TEXT": int32(MEMO_TEXT), + "MEMO_ID": int32(MEMO_ID), + "MEMO_HASH": int32(MEMO_HASH), + "MEMO_RETURN": int32(MEMO_RETURN), +} + +func (MemoType) XdrEnumNames() map[int32]string { + return _XdrNames_MemoType +} +func (v MemoType) String() string { + if s, ok := _XdrNames_MemoType[int32(v)]; ok { + return s + } + return fmt.Sprintf("MemoType#%d", v) +} +func (v *MemoType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_MemoType[stok]; ok { + *v = MemoType(val) + return nil + } else if stok == "MemoType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } + } + return XdrError(fmt.Sprintf("%s is not a valid MemoType.", stok)) + } +} +func (v MemoType) GetU32() uint32 { return uint32(v) } +func (v *MemoType) SetU32(n uint32) { *v = MemoType(n) } +func (v *MemoType) XdrPointer() interface{} { return v } +func (MemoType) XdrTypeName() string { return "MemoType" } +func (v MemoType) XdrValue() interface{} { return v } +func (v *MemoType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_MemoType = *MemoType + +func XDR_MemoType(v *MemoType) *MemoType { return v } + +var _XdrTags_Memo = map[int32]bool{ + XdrToI32(MEMO_NONE): true, + XdrToI32(MEMO_TEXT): true, + XdrToI32(MEMO_ID): true, + XdrToI32(MEMO_HASH): true, + XdrToI32(MEMO_RETURN): true, +} + +func (_ Memo) XdrValidTags() map[int32]bool { + return _XdrTags_Memo +} +func (u *Memo) Text() *string { + switch u.Type { + case MEMO_TEXT: + if v, ok := u._u.(*string); ok { + return v + } else { + var zero string + u._u = &zero + return &zero + } + default: + XdrPanic("Memo.Text accessed when Type == %v", u.Type) + return nil + } +} +func (u *Memo) Id() *Uint64 { + switch u.Type { + case MEMO_ID: + if v, ok := u._u.(*Uint64); ok { + return v + } else { + var zero Uint64 + u._u = &zero + return &zero + } + default: + XdrPanic("Memo.Id accessed when Type == %v", u.Type) + return nil + } +} + +// the hash of what to pull from the content server +func (u *Memo) Hash() *Hash { + switch u.Type { + case MEMO_HASH: + if v, ok := u._u.(*Hash); ok { + return v + } else { + var zero Hash + u._u = &zero + return &zero + } + default: + XdrPanic("Memo.Hash accessed when Type == %v", u.Type) + return nil + } +} + +// the hash of the tx you are rejecting +func (u *Memo) RetHash() *Hash { + switch u.Type { + case MEMO_RETURN: + if v, ok := u._u.(*Hash); ok { + return v + } else { + var zero Hash + u._u = &zero + return &zero + } + default: + XdrPanic("Memo.RetHash accessed when Type == %v", u.Type) + return nil + } +} +func (u Memo) XdrValid() bool { + switch u.Type { + case MEMO_NONE, MEMO_TEXT, MEMO_ID, MEMO_HASH, MEMO_RETURN: + return true + } + return false +} +func (u *Memo) XdrUnionTag() XdrNum32 { + return XDR_MemoType(&u.Type) +} +func (u *Memo) XdrUnionTagName() string { + return "Type" +} +func (u *Memo) XdrUnionBody() XdrType { + switch u.Type { + case MEMO_NONE: + return nil + case MEMO_TEXT: + return XdrString{u.Text(), 28} + case MEMO_ID: + return XDR_Uint64(u.Id()) + case MEMO_HASH: + return XDR_Hash(u.Hash()) + case MEMO_RETURN: + return XDR_Hash(u.RetHash()) + } + return nil +} +func (u *Memo) XdrUnionBodyName() string { + switch u.Type { + case MEMO_NONE: + return "" + case MEMO_TEXT: + return "Text" + case MEMO_ID: + return "Id" + case MEMO_HASH: + return "Hash" + case MEMO_RETURN: + return "RetHash" + } + return "" +} + +type XdrType_Memo = *Memo + +func (v *Memo) XdrPointer() interface{} { return v } +func (Memo) XdrTypeName() string { return "Memo" } +func (v Memo) XdrValue() interface{} { return v } +func (v *Memo) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *Memo) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_MemoType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + switch u.Type { + case MEMO_NONE: + return + case MEMO_TEXT: + x.Marshal(x.Sprintf("%stext", name), XdrString{u.Text(), 28}) + return + case MEMO_ID: + x.Marshal(x.Sprintf("%sid", name), XDR_Uint64(u.Id())) + return + case MEMO_HASH: + x.Marshal(x.Sprintf("%shash", name), XDR_Hash(u.Hash())) + return + case MEMO_RETURN: + x.Marshal(x.Sprintf("%sretHash", name), XDR_Hash(u.RetHash())) + return + } + XdrPanic("invalid Type (%v) in Memo", u.Type) +} +func XDR_Memo(v *Memo) *Memo { return v } + +type XdrType_TimeBounds = *TimeBounds + +func (v *TimeBounds) XdrPointer() interface{} { return v } +func (TimeBounds) XdrTypeName() string { return "TimeBounds" } +func (v TimeBounds) XdrValue() interface{} { return v } +func (v *TimeBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeBounds) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sminTime", name), XDR_TimePoint(&v.MinTime)) + x.Marshal(x.Sprintf("%smaxTime", name), XDR_TimePoint(&v.MaxTime)) +} +func XDR_TimeBounds(v *TimeBounds) *TimeBounds { return v } + +type XdrType_LedgerBounds = *LedgerBounds + +func (v *LedgerBounds) XdrPointer() interface{} { return v } +func (LedgerBounds) XdrTypeName() string { return "LedgerBounds" } +func (v LedgerBounds) XdrValue() interface{} { return v } +func (v *LedgerBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerBounds) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sminLedger", name), XDR_Uint32(&v.MinLedger)) + x.Marshal(x.Sprintf("%smaxLedger", name), XDR_Uint32(&v.MaxLedger)) +} +func XDR_LedgerBounds(v *LedgerBounds) *LedgerBounds { return v } + +type _XdrPtr_TimeBounds struct { + p **TimeBounds +} +type _ptrflag_TimeBounds _XdrPtr_TimeBounds + +func (v _ptrflag_TimeBounds) String() string { + if *v.p == nil { + return "nil" + } + return "non-nil" +} +func (v _ptrflag_TimeBounds) Scan(ss fmt.ScanState, r rune) error { + tok, err := ss.Token(true, func(c rune) bool { + return c == '-' || (c >= 'a' && c <= 'z') + }) + if err != nil { + return err + } + switch string(tok) { + case "nil": + v.SetU32(0) + case "non-nil": + v.SetU32(1) + default: + return XdrError("TimeBounds flag should be \"nil\" or \"non-nil\"") + } + return nil +} +func (v _ptrflag_TimeBounds) GetU32() uint32 { + if *v.p == nil { + return 0 + } + return 1 +} +func (v _ptrflag_TimeBounds) SetU32(nv uint32) { + switch nv { + case 0: + *v.p = nil + case 1: + if *v.p == nil { + *v.p = new(TimeBounds) + } + default: + XdrPanic("*TimeBounds present flag value %d should be 0 or 1", nv) + } +} +func (_ptrflag_TimeBounds) XdrTypeName() string { return "TimeBounds?" } +func (v _ptrflag_TimeBounds) XdrPointer() interface{} { return nil } +func (v _ptrflag_TimeBounds) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_TimeBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_TimeBounds) XdrBound() uint32 { return 1 } +func (v _XdrPtr_TimeBounds) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_TimeBounds) SetPresent(present bool) { + if !present { + *v.p = nil + } else if *v.p == nil { + *v.p = new(TimeBounds) + } +} +func (v _XdrPtr_TimeBounds) XdrMarshalValue(x XDR, name string) { + if *v.p != nil { + XDR_TimeBounds(*v.p).XdrMarshal(x, name) + } +} +func (v _XdrPtr_TimeBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_TimeBounds) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_TimeBounds(v)) + v.XdrMarshalValue(x, name) +} +func (_XdrPtr_TimeBounds) XdrTypeName() string { return "TimeBounds*" } +func (v _XdrPtr_TimeBounds) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_TimeBounds) XdrValue() interface{} { return *v.p } + +type _XdrPtr_LedgerBounds struct { + p **LedgerBounds +} +type _ptrflag_LedgerBounds _XdrPtr_LedgerBounds + +func (v _ptrflag_LedgerBounds) String() string { + if *v.p == nil { + return "nil" + } + return "non-nil" +} +func (v _ptrflag_LedgerBounds) Scan(ss fmt.ScanState, r rune) error { + tok, err := ss.Token(true, func(c rune) bool { + return c == '-' || (c >= 'a' && c <= 'z') + }) + if err != nil { + return err + } + switch string(tok) { + case "nil": + v.SetU32(0) + case "non-nil": + v.SetU32(1) + default: + return XdrError("LedgerBounds flag should be \"nil\" or \"non-nil\"") + } + return nil +} +func (v _ptrflag_LedgerBounds) GetU32() uint32 { + if *v.p == nil { + return 0 + } + return 1 +} +func (v _ptrflag_LedgerBounds) SetU32(nv uint32) { + switch nv { + case 0: + *v.p = nil + case 1: + if *v.p == nil { + *v.p = new(LedgerBounds) + } + default: + XdrPanic("*LedgerBounds present flag value %d should be 0 or 1", nv) + } +} +func (_ptrflag_LedgerBounds) XdrTypeName() string { return "LedgerBounds?" } +func (v _ptrflag_LedgerBounds) XdrPointer() interface{} { return nil } +func (v _ptrflag_LedgerBounds) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_LedgerBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_LedgerBounds) XdrBound() uint32 { return 1 } +func (v _XdrPtr_LedgerBounds) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_LedgerBounds) SetPresent(present bool) { + if !present { + *v.p = nil + } else if *v.p == nil { + *v.p = new(LedgerBounds) + } +} +func (v _XdrPtr_LedgerBounds) XdrMarshalValue(x XDR, name string) { + if *v.p != nil { + XDR_LedgerBounds(*v.p).XdrMarshal(x, name) + } +} +func (v _XdrPtr_LedgerBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_LedgerBounds) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_LedgerBounds(v)) + v.XdrMarshalValue(x, name) } -func XDR_XdrAnon_Operation_Body(v *XdrAnon_Operation_Body) *XdrAnon_Operation_Body { return v } +func (_XdrPtr_LedgerBounds) XdrTypeName() string { return "LedgerBounds*" } +func (v _XdrPtr_LedgerBounds) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_LedgerBounds) XdrValue() interface{} { return *v.p } -type _XdrPtr_MuxedAccount struct { - p **MuxedAccount +type _XdrPtr_SequenceNumber struct { + p **SequenceNumber } -type _ptrflag_MuxedAccount _XdrPtr_MuxedAccount +type _ptrflag_SequenceNumber _XdrPtr_SequenceNumber -func (v _ptrflag_MuxedAccount) String() string { +func (v _ptrflag_SequenceNumber) String() string { if *v.p == nil { return "nil" } return "non-nil" } -func (v _ptrflag_MuxedAccount) Scan(ss fmt.ScanState, r rune) error { +func (v _ptrflag_SequenceNumber) Scan(ss fmt.ScanState, r rune) error { tok, err := ss.Token(true, func(c rune) bool { return c == '-' || (c >= 'a' && c <= 'z') }) @@ -17838,766 +19311,500 @@ func (v _ptrflag_MuxedAccount) Scan(ss fmt.ScanState, r rune) error { case "non-nil": v.SetU32(1) default: - return XdrError("MuxedAccount flag should be \"nil\" or \"non-nil\"") + return XdrError("SequenceNumber flag should be \"nil\" or \"non-nil\"") } return nil } -func (v _ptrflag_MuxedAccount) GetU32() uint32 { +func (v _ptrflag_SequenceNumber) GetU32() uint32 { if *v.p == nil { return 0 } return 1 } -func (v _ptrflag_MuxedAccount) SetU32(nv uint32) { +func (v _ptrflag_SequenceNumber) SetU32(nv uint32) { switch nv { case 0: *v.p = nil case 1: if *v.p == nil { - *v.p = new(MuxedAccount) + *v.p = new(SequenceNumber) } default: - XdrPanic("*MuxedAccount present flag value %d should be 0 or 1", nv) + XdrPanic("*SequenceNumber present flag value %d should be 0 or 1", nv) } } -func (_ptrflag_MuxedAccount) XdrTypeName() string { return "MuxedAccount?" } -func (v _ptrflag_MuxedAccount) XdrPointer() interface{} { return nil } -func (v _ptrflag_MuxedAccount) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_MuxedAccount) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_MuxedAccount) XdrBound() uint32 { return 1 } -func (v _XdrPtr_MuxedAccount) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_MuxedAccount) SetPresent(present bool) { +func (_ptrflag_SequenceNumber) XdrTypeName() string { return "SequenceNumber?" } +func (v _ptrflag_SequenceNumber) XdrPointer() interface{} { return nil } +func (v _ptrflag_SequenceNumber) XdrValue() interface{} { return v.GetU32() != 0 } +func (v _ptrflag_SequenceNumber) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _ptrflag_SequenceNumber) XdrBound() uint32 { return 1 } +func (v _XdrPtr_SequenceNumber) GetPresent() bool { return *v.p != nil } +func (v _XdrPtr_SequenceNumber) SetPresent(present bool) { if !present { *v.p = nil } else if *v.p == nil { - *v.p = new(MuxedAccount) + *v.p = new(SequenceNumber) } } -func (v _XdrPtr_MuxedAccount) XdrMarshalValue(x XDR, name string) { +func (v _XdrPtr_SequenceNumber) XdrMarshalValue(x XDR, name string) { if *v.p != nil { - XDR_MuxedAccount(*v.p).XdrMarshal(x, name) + XDR_SequenceNumber(*v.p).XdrMarshal(x, name) } } -func (v _XdrPtr_MuxedAccount) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_MuxedAccount) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_MuxedAccount(v)) +func (v _XdrPtr_SequenceNumber) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v _XdrPtr_SequenceNumber) XdrRecurse(x XDR, name string) { + x.Marshal(name, _ptrflag_SequenceNumber(v)) v.XdrMarshalValue(x, name) } -func (_XdrPtr_MuxedAccount) XdrTypeName() string { return "MuxedAccount*" } -func (v _XdrPtr_MuxedAccount) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_MuxedAccount) XdrValue() interface{} { return *v.p } - -type XdrType_Operation = *Operation - -func (v *Operation) XdrPointer() interface{} { return v } -func (Operation) XdrTypeName() string { return "Operation" } -func (v Operation) XdrValue() interface{} { return v } -func (v *Operation) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *Operation) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%ssourceAccount", name), _XdrPtr_MuxedAccount{&v.SourceAccount}) - x.Marshal(x.Sprintf("%sbody", name), XDR_XdrAnon_Operation_Body(&v.Body)) -} -func XDR_Operation(v *Operation) *Operation { return v } - -type XdrType_XdrAnon_HashIDPreimage_OperationID = *XdrAnon_HashIDPreimage_OperationID - -func (v *XdrAnon_HashIDPreimage_OperationID) XdrPointer() interface{} { return v } -func (XdrAnon_HashIDPreimage_OperationID) XdrTypeName() string { - return "XdrAnon_HashIDPreimage_OperationID" -} -func (v XdrAnon_HashIDPreimage_OperationID) XdrValue() interface{} { return v } -func (v *XdrAnon_HashIDPreimage_OperationID) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *XdrAnon_HashIDPreimage_OperationID) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%ssourceAccount", name), XDR_AccountID(&v.SourceAccount)) - x.Marshal(x.Sprintf("%sseqNum", name), XDR_SequenceNumber(&v.SeqNum)) - x.Marshal(x.Sprintf("%sopNum", name), XDR_Uint32(&v.OpNum)) -} -func XDR_XdrAnon_HashIDPreimage_OperationID(v *XdrAnon_HashIDPreimage_OperationID) *XdrAnon_HashIDPreimage_OperationID { - return v -} - -type XdrType_XdrAnon_HashIDPreimage_RevokeID = *XdrAnon_HashIDPreimage_RevokeID - -func (v *XdrAnon_HashIDPreimage_RevokeID) XdrPointer() interface{} { return v } -func (XdrAnon_HashIDPreimage_RevokeID) XdrTypeName() string { return "XdrAnon_HashIDPreimage_RevokeID" } -func (v XdrAnon_HashIDPreimage_RevokeID) XdrValue() interface{} { return v } -func (v *XdrAnon_HashIDPreimage_RevokeID) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *XdrAnon_HashIDPreimage_RevokeID) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%ssourceAccount", name), XDR_AccountID(&v.SourceAccount)) - x.Marshal(x.Sprintf("%sseqNum", name), XDR_SequenceNumber(&v.SeqNum)) - x.Marshal(x.Sprintf("%sopNum", name), XDR_Uint32(&v.OpNum)) - x.Marshal(x.Sprintf("%sliquidityPoolID", name), XDR_PoolID(&v.LiquidityPoolID)) - x.Marshal(x.Sprintf("%sasset", name), XDR_Asset(&v.Asset)) -} -func XDR_XdrAnon_HashIDPreimage_RevokeID(v *XdrAnon_HashIDPreimage_RevokeID) *XdrAnon_HashIDPreimage_RevokeID { - return v -} - -type XdrType_XdrAnon_HashIDPreimage_ContractID = *XdrAnon_HashIDPreimage_ContractID - -func (v *XdrAnon_HashIDPreimage_ContractID) XdrPointer() interface{} { return v } -func (XdrAnon_HashIDPreimage_ContractID) XdrTypeName() string { - return "XdrAnon_HashIDPreimage_ContractID" -} -func (v XdrAnon_HashIDPreimage_ContractID) XdrValue() interface{} { return v } -func (v *XdrAnon_HashIDPreimage_ContractID) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *XdrAnon_HashIDPreimage_ContractID) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%snetworkID", name), XDR_Hash(&v.NetworkID)) - x.Marshal(x.Sprintf("%scontractIDPreimage", name), XDR_ContractIDPreimage(&v.ContractIDPreimage)) -} -func XDR_XdrAnon_HashIDPreimage_ContractID(v *XdrAnon_HashIDPreimage_ContractID) *XdrAnon_HashIDPreimage_ContractID { - return v -} - -type XdrType_XdrAnon_HashIDPreimage_SorobanAuthorization = *XdrAnon_HashIDPreimage_SorobanAuthorization - -func (v *XdrAnon_HashIDPreimage_SorobanAuthorization) XdrPointer() interface{} { return v } -func (XdrAnon_HashIDPreimage_SorobanAuthorization) XdrTypeName() string { - return "XdrAnon_HashIDPreimage_SorobanAuthorization" -} -func (v XdrAnon_HashIDPreimage_SorobanAuthorization) XdrValue() interface{} { return v } -func (v *XdrAnon_HashIDPreimage_SorobanAuthorization) XdrMarshal(x XDR, name string) { - x.Marshal(name, v) -} -func (v *XdrAnon_HashIDPreimage_SorobanAuthorization) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%snetworkID", name), XDR_Hash(&v.NetworkID)) - x.Marshal(x.Sprintf("%snonce", name), XDR_Int64(&v.Nonce)) - x.Marshal(x.Sprintf("%ssignatureExpirationLedger", name), XDR_Uint32(&v.SignatureExpirationLedger)) - x.Marshal(x.Sprintf("%sinvocation", name), XDR_SorobanAuthorizedInvocation(&v.Invocation)) -} -func XDR_XdrAnon_HashIDPreimage_SorobanAuthorization(v *XdrAnon_HashIDPreimage_SorobanAuthorization) *XdrAnon_HashIDPreimage_SorobanAuthorization { - return v -} +func (_XdrPtr_SequenceNumber) XdrTypeName() string { return "SequenceNumber*" } +func (v _XdrPtr_SequenceNumber) XdrPointer() interface{} { return v.p } +func (v _XdrPtr_SequenceNumber) XdrValue() interface{} { return *v.p } -var _XdrTags_HashIDPreimage = map[int32]bool{ - XdrToI32(ENVELOPE_TYPE_OP_ID): true, - XdrToI32(ENVELOPE_TYPE_POOL_REVOKE_OP_ID): true, - XdrToI32(ENVELOPE_TYPE_CONTRACT_ID): true, - XdrToI32(ENVELOPE_TYPE_SOROBAN_AUTHORIZATION): true, -} +type _XdrVec_2_SignerKey []SignerKey -func (_ HashIDPreimage) XdrValidTags() map[int32]bool { - return _XdrTags_HashIDPreimage -} -func (u *HashIDPreimage) OperationID() *XdrAnon_HashIDPreimage_OperationID { - switch u.Type { - case ENVELOPE_TYPE_OP_ID: - if v, ok := u._u.(*XdrAnon_HashIDPreimage_OperationID); ok { - return v - } else { - var zero XdrAnon_HashIDPreimage_OperationID - u._u = &zero - return &zero - } - default: - XdrPanic("HashIDPreimage.OperationID accessed when Type == %v", u.Type) - return nil - } -} -func (u *HashIDPreimage) RevokeID() *XdrAnon_HashIDPreimage_RevokeID { - switch u.Type { - case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: - if v, ok := u._u.(*XdrAnon_HashIDPreimage_RevokeID); ok { - return v - } else { - var zero XdrAnon_HashIDPreimage_RevokeID - u._u = &zero - return &zero - } - default: - XdrPanic("HashIDPreimage.RevokeID accessed when Type == %v", u.Type) - return nil - } +func (_XdrVec_2_SignerKey) XdrBound() uint32 { + const bound uint32 = 2 // Force error if not const or doesn't fit + return bound } -func (u *HashIDPreimage) ContractID() *XdrAnon_HashIDPreimage_ContractID { - switch u.Type { - case ENVELOPE_TYPE_CONTRACT_ID: - if v, ok := u._u.(*XdrAnon_HashIDPreimage_ContractID); ok { - return v - } else { - var zero XdrAnon_HashIDPreimage_ContractID - u._u = &zero - return &zero - } - default: - XdrPanic("HashIDPreimage.ContractID accessed when Type == %v", u.Type) - return nil +func (_XdrVec_2_SignerKey) XdrCheckLen(length uint32) { + if length > uint32(2) { + XdrPanic("_XdrVec_2_SignerKey length %d exceeds bound 2", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_2_SignerKey length %d exceeds max int", length) } } -func (u *HashIDPreimage) SorobanAuthorization() *XdrAnon_HashIDPreimage_SorobanAuthorization { - switch u.Type { - case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: - if v, ok := u._u.(*XdrAnon_HashIDPreimage_SorobanAuthorization); ok { - return v - } else { - var zero XdrAnon_HashIDPreimage_SorobanAuthorization - u._u = &zero - return &zero +func (v _XdrVec_2_SignerKey) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_2_SignerKey) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] } - default: - XdrPanic("HashIDPreimage.SorobanAuthorization accessed when Type == %v", u.Type) - return nil - } -} -func (u HashIDPreimage) XdrValid() bool { - switch u.Type { - case ENVELOPE_TYPE_OP_ID, ENVELOPE_TYPE_POOL_REVOKE_OP_ID, ENVELOPE_TYPE_CONTRACT_ID, ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: - return true + return } - return false -} -func (u *HashIDPreimage) XdrUnionTag() XdrNum32 { - return XDR_EnvelopeType(&u.Type) -} -func (u *HashIDPreimage) XdrUnionTagName() string { - return "Type" -} -func (u *HashIDPreimage) XdrUnionBody() XdrType { - switch u.Type { - case ENVELOPE_TYPE_OP_ID: - return XDR_XdrAnon_HashIDPreimage_OperationID(u.OperationID()) - case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: - return XDR_XdrAnon_HashIDPreimage_RevokeID(u.RevokeID()) - case ENVELOPE_TYPE_CONTRACT_ID: - return XDR_XdrAnon_HashIDPreimage_ContractID(u.ContractID()) - case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: - return XDR_XdrAnon_HashIDPreimage_SorobanAuthorization(u.SorobanAuthorization()) + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(2); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) } - return nil + nv := make([]SignerKey, int(length), newcap) + copy(nv, *v) + *v = nv } -func (u *HashIDPreimage) XdrUnionBodyName() string { - switch u.Type { - case ENVELOPE_TYPE_OP_ID: - return "OperationID" - case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: - return "RevokeID" - case ENVELOPE_TYPE_CONTRACT_ID: - return "ContractID" - case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: - return "SorobanAuthorization" +func (v *_XdrVec_2_SignerKey) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_SignerKey(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } - return "" + if int(n) < len(*v) { + *v = (*v)[:int(n)] + } +} +func (v *_XdrVec_2_SignerKey) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 2} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } +func (_XdrVec_2_SignerKey) XdrTypeName() string { return "SignerKey<>" } +func (v *_XdrVec_2_SignerKey) XdrPointer() interface{} { return (*[]SignerKey)(v) } +func (v _XdrVec_2_SignerKey) XdrValue() interface{} { return ([]SignerKey)(v) } +func (v *_XdrVec_2_SignerKey) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_HashIDPreimage = *HashIDPreimage +type XdrType_PreconditionsV2 = *PreconditionsV2 -func (v *HashIDPreimage) XdrPointer() interface{} { return v } -func (HashIDPreimage) XdrTypeName() string { return "HashIDPreimage" } -func (v HashIDPreimage) XdrValue() interface{} { return v } -func (v *HashIDPreimage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *HashIDPreimage) XdrRecurse(x XDR, name string) { +func (v *PreconditionsV2) XdrPointer() interface{} { return v } +func (PreconditionsV2) XdrTypeName() string { return "PreconditionsV2" } +func (v PreconditionsV2) XdrValue() interface{} { return v } +func (v *PreconditionsV2) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *PreconditionsV2) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_EnvelopeType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case ENVELOPE_TYPE_OP_ID: - x.Marshal(x.Sprintf("%soperationID", name), XDR_XdrAnon_HashIDPreimage_OperationID(u.OperationID())) - return - case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: - x.Marshal(x.Sprintf("%srevokeID", name), XDR_XdrAnon_HashIDPreimage_RevokeID(u.RevokeID())) - return - case ENVELOPE_TYPE_CONTRACT_ID: - x.Marshal(x.Sprintf("%scontractID", name), XDR_XdrAnon_HashIDPreimage_ContractID(u.ContractID())) - return - case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: - x.Marshal(x.Sprintf("%ssorobanAuthorization", name), XDR_XdrAnon_HashIDPreimage_SorobanAuthorization(u.SorobanAuthorization())) - return - } - XdrPanic("invalid Type (%v) in HashIDPreimage", u.Type) -} -func (v *HashIDPreimage) XdrInitialize() { - var zero EnvelopeType - switch zero { - case ENVELOPE_TYPE_OP_ID, ENVELOPE_TYPE_POOL_REVOKE_OP_ID, ENVELOPE_TYPE_CONTRACT_ID, ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: - default: - if v.Type == zero { - v.Type = ENVELOPE_TYPE_OP_ID - } - } + x.Marshal(x.Sprintf("%stimeBounds", name), _XdrPtr_TimeBounds{&v.TimeBounds}) + x.Marshal(x.Sprintf("%sledgerBounds", name), _XdrPtr_LedgerBounds{&v.LedgerBounds}) + x.Marshal(x.Sprintf("%sminSeqNum", name), _XdrPtr_SequenceNumber{&v.MinSeqNum}) + x.Marshal(x.Sprintf("%sminSeqAge", name), XDR_Duration(&v.MinSeqAge)) + x.Marshal(x.Sprintf("%sminSeqLedgerGap", name), XDR_Uint32(&v.MinSeqLedgerGap)) + x.Marshal(x.Sprintf("%sextraSigners", name), (*_XdrVec_2_SignerKey)(&v.ExtraSigners)) } -func XDR_HashIDPreimage(v *HashIDPreimage) *HashIDPreimage { return v } +func XDR_PreconditionsV2(v *PreconditionsV2) *PreconditionsV2 { return v } -var _XdrNames_MemoType = map[int32]string{ - int32(MEMO_NONE): "MEMO_NONE", - int32(MEMO_TEXT): "MEMO_TEXT", - int32(MEMO_ID): "MEMO_ID", - int32(MEMO_HASH): "MEMO_HASH", - int32(MEMO_RETURN): "MEMO_RETURN", +var _XdrNames_PreconditionType = map[int32]string{ + int32(PRECOND_NONE): "PRECOND_NONE", + int32(PRECOND_TIME): "PRECOND_TIME", + int32(PRECOND_V2): "PRECOND_V2", } -var _XdrValues_MemoType = map[string]int32{ - "MEMO_NONE": int32(MEMO_NONE), - "MEMO_TEXT": int32(MEMO_TEXT), - "MEMO_ID": int32(MEMO_ID), - "MEMO_HASH": int32(MEMO_HASH), - "MEMO_RETURN": int32(MEMO_RETURN), +var _XdrValues_PreconditionType = map[string]int32{ + "PRECOND_NONE": int32(PRECOND_NONE), + "PRECOND_TIME": int32(PRECOND_TIME), + "PRECOND_V2": int32(PRECOND_V2), } -func (MemoType) XdrEnumNames() map[int32]string { - return _XdrNames_MemoType +func (PreconditionType) XdrEnumNames() map[int32]string { + return _XdrNames_PreconditionType } -func (v MemoType) String() string { - if s, ok := _XdrNames_MemoType[int32(v)]; ok { +func (v PreconditionType) String() string { + if s, ok := _XdrNames_PreconditionType[int32(v)]; ok { return s } - return fmt.Sprintf("MemoType#%d", v) + return fmt.Sprintf("PreconditionType#%d", v) } -func (v *MemoType) Scan(ss fmt.ScanState, _ rune) error { +func (v *PreconditionType) Scan(ss fmt.ScanState, _ rune) error { if tok, err := ss.Token(true, XdrSymChar); err != nil { return err } else { stok := string(tok) - if val, ok := _XdrValues_MemoType[stok]; ok { - *v = MemoType(val) + if val, ok := _XdrValues_PreconditionType[stok]; ok { + *v = PreconditionType(val) return nil - } else if stok == "MemoType" { + } else if stok == "PreconditionType" { if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { return nil } } - return XdrError(fmt.Sprintf("%s is not a valid MemoType.", stok)) + return XdrError(fmt.Sprintf("%s is not a valid PreconditionType.", stok)) } } -func (v MemoType) GetU32() uint32 { return uint32(v) } -func (v *MemoType) SetU32(n uint32) { *v = MemoType(n) } -func (v *MemoType) XdrPointer() interface{} { return v } -func (MemoType) XdrTypeName() string { return "MemoType" } -func (v MemoType) XdrValue() interface{} { return v } -func (v *MemoType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v PreconditionType) GetU32() uint32 { return uint32(v) } +func (v *PreconditionType) SetU32(n uint32) { *v = PreconditionType(n) } +func (v *PreconditionType) XdrPointer() interface{} { return v } +func (PreconditionType) XdrTypeName() string { return "PreconditionType" } +func (v PreconditionType) XdrValue() interface{} { return v } +func (v *PreconditionType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_MemoType = *MemoType +type XdrType_PreconditionType = *PreconditionType -func XDR_MemoType(v *MemoType) *MemoType { return v } +func XDR_PreconditionType(v *PreconditionType) *PreconditionType { return v } -var _XdrTags_Memo = map[int32]bool{ - XdrToI32(MEMO_NONE): true, - XdrToI32(MEMO_TEXT): true, - XdrToI32(MEMO_ID): true, - XdrToI32(MEMO_HASH): true, - XdrToI32(MEMO_RETURN): true, +var _XdrTags_Preconditions = map[int32]bool{ + XdrToI32(PRECOND_NONE): true, + XdrToI32(PRECOND_TIME): true, + XdrToI32(PRECOND_V2): true, } -func (_ Memo) XdrValidTags() map[int32]bool { - return _XdrTags_Memo -} -func (u *Memo) Text() *string { - switch u.Type { - case MEMO_TEXT: - if v, ok := u._u.(*string); ok { - return v - } else { - var zero string - u._u = &zero - return &zero - } - default: - XdrPanic("Memo.Text accessed when Type == %v", u.Type) - return nil - } -} -func (u *Memo) Id() *Uint64 { - switch u.Type { - case MEMO_ID: - if v, ok := u._u.(*Uint64); ok { - return v - } else { - var zero Uint64 - u._u = &zero - return &zero - } - default: - XdrPanic("Memo.Id accessed when Type == %v", u.Type) - return nil - } +func (_ Preconditions) XdrValidTags() map[int32]bool { + return _XdrTags_Preconditions } - -// the hash of what to pull from the content server -func (u *Memo) Hash() *Hash { +func (u *Preconditions) TimeBounds() *TimeBounds { switch u.Type { - case MEMO_HASH: - if v, ok := u._u.(*Hash); ok { + case PRECOND_TIME: + if v, ok := u._u.(*TimeBounds); ok { return v } else { - var zero Hash + var zero TimeBounds u._u = &zero return &zero } default: - XdrPanic("Memo.Hash accessed when Type == %v", u.Type) + XdrPanic("Preconditions.TimeBounds accessed when Type == %v", u.Type) return nil } } - -// the hash of the tx you are rejecting -func (u *Memo) RetHash() *Hash { +func (u *Preconditions) V2() *PreconditionsV2 { switch u.Type { - case MEMO_RETURN: - if v, ok := u._u.(*Hash); ok { + case PRECOND_V2: + if v, ok := u._u.(*PreconditionsV2); ok { return v } else { - var zero Hash + var zero PreconditionsV2 u._u = &zero return &zero } default: - XdrPanic("Memo.RetHash accessed when Type == %v", u.Type) + XdrPanic("Preconditions.V2 accessed when Type == %v", u.Type) return nil } } -func (u Memo) XdrValid() bool { +func (u Preconditions) XdrValid() bool { switch u.Type { - case MEMO_NONE, MEMO_TEXT, MEMO_ID, MEMO_HASH, MEMO_RETURN: + case PRECOND_NONE, PRECOND_TIME, PRECOND_V2: return true } return false } -func (u *Memo) XdrUnionTag() XdrNum32 { - return XDR_MemoType(&u.Type) +func (u *Preconditions) XdrUnionTag() XdrNum32 { + return XDR_PreconditionType(&u.Type) } -func (u *Memo) XdrUnionTagName() string { +func (u *Preconditions) XdrUnionTagName() string { return "Type" } -func (u *Memo) XdrUnionBody() XdrType { +func (u *Preconditions) XdrUnionBody() XdrType { switch u.Type { - case MEMO_NONE: + case PRECOND_NONE: return nil - case MEMO_TEXT: - return XdrString{u.Text(), 28} - case MEMO_ID: - return XDR_Uint64(u.Id()) - case MEMO_HASH: - return XDR_Hash(u.Hash()) - case MEMO_RETURN: - return XDR_Hash(u.RetHash()) + case PRECOND_TIME: + return XDR_TimeBounds(u.TimeBounds()) + case PRECOND_V2: + return XDR_PreconditionsV2(u.V2()) } return nil } -func (u *Memo) XdrUnionBodyName() string { +func (u *Preconditions) XdrUnionBodyName() string { switch u.Type { - case MEMO_NONE: + case PRECOND_NONE: return "" - case MEMO_TEXT: - return "Text" - case MEMO_ID: - return "Id" - case MEMO_HASH: - return "Hash" - case MEMO_RETURN: - return "RetHash" + case PRECOND_TIME: + return "TimeBounds" + case PRECOND_V2: + return "V2" } return "" } -type XdrType_Memo = *Memo +type XdrType_Preconditions = *Preconditions -func (v *Memo) XdrPointer() interface{} { return v } -func (Memo) XdrTypeName() string { return "Memo" } -func (v Memo) XdrValue() interface{} { return v } -func (v *Memo) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *Memo) XdrRecurse(x XDR, name string) { +func (v *Preconditions) XdrPointer() interface{} { return v } +func (Preconditions) XdrTypeName() string { return "Preconditions" } +func (v Preconditions) XdrValue() interface{} { return v } +func (v *Preconditions) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *Preconditions) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_MemoType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) + XDR_PreconditionType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) switch u.Type { - case MEMO_NONE: - return - case MEMO_TEXT: - x.Marshal(x.Sprintf("%stext", name), XdrString{u.Text(), 28}) - return - case MEMO_ID: - x.Marshal(x.Sprintf("%sid", name), XDR_Uint64(u.Id())) + case PRECOND_NONE: return - case MEMO_HASH: - x.Marshal(x.Sprintf("%shash", name), XDR_Hash(u.Hash())) + case PRECOND_TIME: + x.Marshal(x.Sprintf("%stimeBounds", name), XDR_TimeBounds(u.TimeBounds())) return - case MEMO_RETURN: - x.Marshal(x.Sprintf("%sretHash", name), XDR_Hash(u.RetHash())) + case PRECOND_V2: + x.Marshal(x.Sprintf("%sv2", name), XDR_PreconditionsV2(u.V2())) return } - XdrPanic("invalid Type (%v) in Memo", u.Type) + XdrPanic("invalid Type (%v) in Preconditions", u.Type) } -func XDR_Memo(v *Memo) *Memo { return v } +func XDR_Preconditions(v *Preconditions) *Preconditions { return v } -type XdrType_TimeBounds = *TimeBounds +type XdrType_LedgerFootprint = *LedgerFootprint -func (v *TimeBounds) XdrPointer() interface{} { return v } -func (TimeBounds) XdrTypeName() string { return "TimeBounds" } -func (v TimeBounds) XdrValue() interface{} { return v } -func (v *TimeBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *TimeBounds) XdrRecurse(x XDR, name string) { +func (v *LedgerFootprint) XdrPointer() interface{} { return v } +func (LedgerFootprint) XdrTypeName() string { return "LedgerFootprint" } +func (v LedgerFootprint) XdrValue() interface{} { return v } +func (v *LedgerFootprint) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerFootprint) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sminTime", name), XDR_TimePoint(&v.MinTime)) - x.Marshal(x.Sprintf("%smaxTime", name), XDR_TimePoint(&v.MaxTime)) + x.Marshal(x.Sprintf("%sreadOnly", name), (*_XdrVec_unbounded_LedgerKey)(&v.ReadOnly)) + x.Marshal(x.Sprintf("%sreadWrite", name), (*_XdrVec_unbounded_LedgerKey)(&v.ReadWrite)) } -func XDR_TimeBounds(v *TimeBounds) *TimeBounds { return v } - -type XdrType_LedgerBounds = *LedgerBounds +func XDR_LedgerFootprint(v *LedgerFootprint) *LedgerFootprint { return v } -func (v *LedgerBounds) XdrPointer() interface{} { return v } -func (LedgerBounds) XdrTypeName() string { return "LedgerBounds" } -func (v LedgerBounds) XdrValue() interface{} { return v } -func (v *LedgerBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LedgerBounds) XdrRecurse(x XDR, name string) { - if name != "" { - name = x.Sprintf("%s.", name) - } - x.Marshal(x.Sprintf("%sminLedger", name), XDR_Uint32(&v.MinLedger)) - x.Marshal(x.Sprintf("%smaxLedger", name), XDR_Uint32(&v.MaxLedger)) +var _XdrNames_ArchivalProofType = map[int32]string{ + int32(EXISTENCE): "EXISTENCE", + int32(NONEXISTENCE): "NONEXISTENCE", } -func XDR_LedgerBounds(v *LedgerBounds) *LedgerBounds { return v } - -type _XdrPtr_TimeBounds struct { - p **TimeBounds +var _XdrValues_ArchivalProofType = map[string]int32{ + "EXISTENCE": int32(EXISTENCE), + "NONEXISTENCE": int32(NONEXISTENCE), } -type _ptrflag_TimeBounds _XdrPtr_TimeBounds -func (v _ptrflag_TimeBounds) String() string { - if *v.p == nil { - return "nil" - } - return "non-nil" -} -func (v _ptrflag_TimeBounds) Scan(ss fmt.ScanState, r rune) error { - tok, err := ss.Token(true, func(c rune) bool { - return c == '-' || (c >= 'a' && c <= 'z') - }) - if err != nil { - return err - } - switch string(tok) { - case "nil": - v.SetU32(0) - case "non-nil": - v.SetU32(1) - default: - return XdrError("TimeBounds flag should be \"nil\" or \"non-nil\"") - } - return nil +func (ArchivalProofType) XdrEnumNames() map[int32]string { + return _XdrNames_ArchivalProofType } -func (v _ptrflag_TimeBounds) GetU32() uint32 { - if *v.p == nil { - return 0 +func (v ArchivalProofType) String() string { + if s, ok := _XdrNames_ArchivalProofType[int32(v)]; ok { + return s } - return 1 + return fmt.Sprintf("ArchivalProofType#%d", v) } -func (v _ptrflag_TimeBounds) SetU32(nv uint32) { - switch nv { - case 0: - *v.p = nil - case 1: - if *v.p == nil { - *v.p = new(TimeBounds) +func (v *ArchivalProofType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_ArchivalProofType[stok]; ok { + *v = ArchivalProofType(val) + return nil + } else if stok == "ArchivalProofType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } } - default: - XdrPanic("*TimeBounds present flag value %d should be 0 or 1", nv) - } -} -func (_ptrflag_TimeBounds) XdrTypeName() string { return "TimeBounds?" } -func (v _ptrflag_TimeBounds) XdrPointer() interface{} { return nil } -func (v _ptrflag_TimeBounds) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_TimeBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_TimeBounds) XdrBound() uint32 { return 1 } -func (v _XdrPtr_TimeBounds) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_TimeBounds) SetPresent(present bool) { - if !present { - *v.p = nil - } else if *v.p == nil { - *v.p = new(TimeBounds) + return XdrError(fmt.Sprintf("%s is not a valid ArchivalProofType.", stok)) } } -func (v _XdrPtr_TimeBounds) XdrMarshalValue(x XDR, name string) { - if *v.p != nil { - XDR_TimeBounds(*v.p).XdrMarshal(x, name) +func (v ArchivalProofType) GetU32() uint32 { return uint32(v) } +func (v *ArchivalProofType) SetU32(n uint32) { *v = ArchivalProofType(n) } +func (v *ArchivalProofType) XdrPointer() interface{} { return v } +func (ArchivalProofType) XdrTypeName() string { return "ArchivalProofType" } +func (v ArchivalProofType) XdrValue() interface{} { return v } +func (v *ArchivalProofType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_ArchivalProofType = *ArchivalProofType + +func XDR_ArchivalProofType(v *ArchivalProofType) *ArchivalProofType { return v } + +type XdrType_ArchivalProofNode = *ArchivalProofNode + +func (v *ArchivalProofNode) XdrPointer() interface{} { return v } +func (ArchivalProofNode) XdrTypeName() string { return "ArchivalProofNode" } +func (v ArchivalProofNode) XdrValue() interface{} { return v } +func (v *ArchivalProofNode) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ArchivalProofNode) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%sindex", name), XDR_Uint32(&v.Index)) + x.Marshal(x.Sprintf("%shash", name), XDR_Hash(&v.Hash)) } -func (v _XdrPtr_TimeBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_TimeBounds) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_TimeBounds(v)) - v.XdrMarshalValue(x, name) -} -func (_XdrPtr_TimeBounds) XdrTypeName() string { return "TimeBounds*" } -func (v _XdrPtr_TimeBounds) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_TimeBounds) XdrValue() interface{} { return *v.p } +func XDR_ArchivalProofNode(v *ArchivalProofNode) *ArchivalProofNode { return v } -type _XdrPtr_LedgerBounds struct { - p **LedgerBounds -} -type _ptrflag_LedgerBounds _XdrPtr_LedgerBounds +type _XdrVec_unbounded_ArchivalProofNode []ArchivalProofNode -func (v _ptrflag_LedgerBounds) String() string { - if *v.p == nil { - return "nil" - } - return "non-nil" +func (_XdrVec_unbounded_ArchivalProofNode) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound } -func (v _ptrflag_LedgerBounds) Scan(ss fmt.ScanState, r rune) error { - tok, err := ss.Token(true, func(c rune) bool { - return c == '-' || (c >= 'a' && c <= 'z') - }) - if err != nil { - return err - } - switch string(tok) { - case "nil": - v.SetU32(0) - case "non-nil": - v.SetU32(1) - default: - return XdrError("LedgerBounds flag should be \"nil\" or \"non-nil\"") +func (_XdrVec_unbounded_ArchivalProofNode) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_ArchivalProofNode length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_ArchivalProofNode length %d exceeds max int", length) } - return nil } -func (v _ptrflag_LedgerBounds) GetU32() uint32 { - if *v.p == nil { - return 0 +func (v _XdrVec_unbounded_ArchivalProofNode) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_ArchivalProofNode) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] + } + return } - return 1 -} -func (v _ptrflag_LedgerBounds) SetU32(nv uint32) { - switch nv { - case 0: - *v.p = nil - case 1: - if *v.p == nil { - *v.p = new(LedgerBounds) + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 } - default: - XdrPanic("*LedgerBounds present flag value %d should be 0 or 1", nv) + newcap = int(bound) } + nv := make([]ArchivalProofNode, int(length), newcap) + copy(nv, *v) + *v = nv } -func (_ptrflag_LedgerBounds) XdrTypeName() string { return "LedgerBounds?" } -func (v _ptrflag_LedgerBounds) XdrPointer() interface{} { return nil } -func (v _ptrflag_LedgerBounds) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_LedgerBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_LedgerBounds) XdrBound() uint32 { return 1 } -func (v _XdrPtr_LedgerBounds) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_LedgerBounds) SetPresent(present bool) { - if !present { - *v.p = nil - } else if *v.p == nil { - *v.p = new(LedgerBounds) +func (v *_XdrVec_unbounded_ArchivalProofNode) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_ArchivalProofNode(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } -} -func (v _XdrPtr_LedgerBounds) XdrMarshalValue(x XDR, name string) { - if *v.p != nil { - XDR_LedgerBounds(*v.p).XdrMarshal(x, name) + if int(n) < len(*v) { + *v = (*v)[:int(n)] } } -func (v _XdrPtr_LedgerBounds) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_LedgerBounds) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_LedgerBounds(v)) - v.XdrMarshalValue(x, name) +func (v *_XdrVec_unbounded_ArchivalProofNode) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } -func (_XdrPtr_LedgerBounds) XdrTypeName() string { return "LedgerBounds*" } -func (v _XdrPtr_LedgerBounds) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_LedgerBounds) XdrValue() interface{} { return *v.p } - -type _XdrPtr_SequenceNumber struct { - p **SequenceNumber +func (_XdrVec_unbounded_ArchivalProofNode) XdrTypeName() string { return "ArchivalProofNode<>" } +func (v *_XdrVec_unbounded_ArchivalProofNode) XdrPointer() interface{} { + return (*[]ArchivalProofNode)(v) } -type _ptrflag_SequenceNumber _XdrPtr_SequenceNumber +func (v _XdrVec_unbounded_ArchivalProofNode) XdrValue() interface{} { return ([]ArchivalProofNode)(v) } +func (v *_XdrVec_unbounded_ArchivalProofNode) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_SequenceNumber) String() string { - if *v.p == nil { - return "nil" - } - return "non-nil" +type XdrType_ProofLevel struct { + *_XdrVec_unbounded_ArchivalProofNode } -func (v _ptrflag_SequenceNumber) Scan(ss fmt.ScanState, r rune) error { - tok, err := ss.Token(true, func(c rune) bool { - return c == '-' || (c >= 'a' && c <= 'z') - }) - if err != nil { - return err - } - switch string(tok) { - case "nil": - v.SetU32(0) - case "non-nil": - v.SetU32(1) - default: - return XdrError("SequenceNumber flag should be \"nil\" or \"non-nil\"") - } - return nil + +func XDR_ProofLevel(v *ProofLevel) XdrType_ProofLevel { + return XdrType_ProofLevel{(*_XdrVec_unbounded_ArchivalProofNode)(v)} } -func (v _ptrflag_SequenceNumber) GetU32() uint32 { - if *v.p == nil { - return 0 +func (XdrType_ProofLevel) XdrTypeName() string { return "ProofLevel" } +func (v XdrType_ProofLevel) XdrUnwrap() XdrType { return v._XdrVec_unbounded_ArchivalProofNode } + +type _XdrVec_unbounded_ColdArchiveBucketEntry []ColdArchiveBucketEntry + +func (_XdrVec_unbounded_ColdArchiveBucketEntry) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound +} +func (_XdrVec_unbounded_ColdArchiveBucketEntry) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_ColdArchiveBucketEntry length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_ColdArchiveBucketEntry length %d exceeds max int", length) } - return 1 } -func (v _ptrflag_SequenceNumber) SetU32(nv uint32) { - switch nv { - case 0: - *v.p = nil - case 1: - if *v.p == nil { - *v.p = new(SequenceNumber) +func (v _XdrVec_unbounded_ColdArchiveBucketEntry) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_ColdArchiveBucketEntry) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] } - default: - XdrPanic("*SequenceNumber present flag value %d should be 0 or 1", nv) + return } -} -func (_ptrflag_SequenceNumber) XdrTypeName() string { return "SequenceNumber?" } -func (v _ptrflag_SequenceNumber) XdrPointer() interface{} { return nil } -func (v _ptrflag_SequenceNumber) XdrValue() interface{} { return v.GetU32() != 0 } -func (v _ptrflag_SequenceNumber) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _ptrflag_SequenceNumber) XdrBound() uint32 { return 1 } -func (v _XdrPtr_SequenceNumber) GetPresent() bool { return *v.p != nil } -func (v _XdrPtr_SequenceNumber) SetPresent(present bool) { - if !present { - *v.p = nil - } else if *v.p == nil { - *v.p = new(SequenceNumber) + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) } + nv := make([]ColdArchiveBucketEntry, int(length), newcap) + copy(nv, *v) + *v = nv } -func (v _XdrPtr_SequenceNumber) XdrMarshalValue(x XDR, name string) { - if *v.p != nil { - XDR_SequenceNumber(*v.p).XdrMarshal(x, name) +func (v *_XdrVec_unbounded_ColdArchiveBucketEntry) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_ColdArchiveBucketEntry(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] } } -func (v _XdrPtr_SequenceNumber) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v _XdrPtr_SequenceNumber) XdrRecurse(x XDR, name string) { - x.Marshal(name, _ptrflag_SequenceNumber(v)) - v.XdrMarshalValue(x, name) +func (v *_XdrVec_unbounded_ColdArchiveBucketEntry) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) } -func (_XdrPtr_SequenceNumber) XdrTypeName() string { return "SequenceNumber*" } -func (v _XdrPtr_SequenceNumber) XdrPointer() interface{} { return v.p } -func (v _XdrPtr_SequenceNumber) XdrValue() interface{} { return *v.p } +func (_XdrVec_unbounded_ColdArchiveBucketEntry) XdrTypeName() string { + return "ColdArchiveBucketEntry<>" +} +func (v *_XdrVec_unbounded_ColdArchiveBucketEntry) XdrPointer() interface{} { + return (*[]ColdArchiveBucketEntry)(v) +} +func (v _XdrVec_unbounded_ColdArchiveBucketEntry) XdrValue() interface{} { + return ([]ColdArchiveBucketEntry)(v) +} +func (v *_XdrVec_unbounded_ColdArchiveBucketEntry) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type _XdrVec_2_SignerKey []SignerKey +type _XdrVec_unbounded_ProofLevel []ProofLevel -func (_XdrVec_2_SignerKey) XdrBound() uint32 { - const bound uint32 = 2 // Force error if not const or doesn't fit +func (_XdrVec_unbounded_ProofLevel) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit return bound } -func (_XdrVec_2_SignerKey) XdrCheckLen(length uint32) { - if length > uint32(2) { - XdrPanic("_XdrVec_2_SignerKey length %d exceeds bound 2", length) +func (_XdrVec_unbounded_ProofLevel) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_ProofLevel length %d exceeds bound 4294967295", length) } else if int(length) < 0 { - XdrPanic("_XdrVec_2_SignerKey length %d exceeds max int", length) + XdrPanic("_XdrVec_unbounded_ProofLevel length %d exceeds max int", length) } } -func (v _XdrVec_2_SignerKey) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_2_SignerKey) SetVecLen(length uint32) { +func (v _XdrVec_unbounded_ProofLevel) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_ProofLevel) SetVecLen(length uint32) { v.XdrCheckLen(length) if int(length) <= cap(*v) { if int(length) != len(*v) { @@ -18608,218 +19815,179 @@ func (v *_XdrVec_2_SignerKey) SetVecLen(length uint32) { newcap := 2 * cap(*v) if newcap < int(length) { // also catches overflow where 2*cap < 0 newcap = int(length) - } else if bound := uint(2); uint(newcap) > bound { + } else if bound := uint(4294967295); uint(newcap) > bound { if int(bound) < 0 { bound = ^uint(0) >> 1 } newcap = int(bound) } - nv := make([]SignerKey, int(length), newcap) + nv := make([]ProofLevel, int(length), newcap) copy(nv, *v) *v = nv } -func (v *_XdrVec_2_SignerKey) XdrMarshalN(x XDR, name string, n uint32) { +func (v *_XdrVec_unbounded_ProofLevel) XdrMarshalN(x XDR, name string, n uint32) { v.XdrCheckLen(n) for i := 0; i < int(n); i++ { if i >= len(*v) { v.SetVecLen(uint32(i + 1)) } - XDR_SignerKey(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + XDR_ProofLevel(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) } if int(n) < len(*v) { *v = (*v)[:int(n)] } } -func (v *_XdrVec_2_SignerKey) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 2} +func (v *_XdrVec_unbounded_ProofLevel) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} x.Marshal(name, &size) v.XdrMarshalN(x, name, size.Size) } -func (_XdrVec_2_SignerKey) XdrTypeName() string { return "SignerKey<>" } -func (v *_XdrVec_2_SignerKey) XdrPointer() interface{} { return (*[]SignerKey)(v) } -func (v _XdrVec_2_SignerKey) XdrValue() interface{} { return ([]SignerKey)(v) } -func (v *_XdrVec_2_SignerKey) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (_XdrVec_unbounded_ProofLevel) XdrTypeName() string { return "ProofLevel<>" } +func (v *_XdrVec_unbounded_ProofLevel) XdrPointer() interface{} { return (*[]ProofLevel)(v) } +func (v _XdrVec_unbounded_ProofLevel) XdrValue() interface{} { return ([]ProofLevel)(v) } +func (v *_XdrVec_unbounded_ProofLevel) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type XdrType_PreconditionsV2 = *PreconditionsV2 +type XdrType_NonexistenceProofBody = *NonexistenceProofBody -func (v *PreconditionsV2) XdrPointer() interface{} { return v } -func (PreconditionsV2) XdrTypeName() string { return "PreconditionsV2" } -func (v PreconditionsV2) XdrValue() interface{} { return v } -func (v *PreconditionsV2) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *PreconditionsV2) XdrRecurse(x XDR, name string) { +func (v *NonexistenceProofBody) XdrPointer() interface{} { return v } +func (NonexistenceProofBody) XdrTypeName() string { return "NonexistenceProofBody" } +func (v NonexistenceProofBody) XdrValue() interface{} { return v } +func (v *NonexistenceProofBody) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *NonexistenceProofBody) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%stimeBounds", name), _XdrPtr_TimeBounds{&v.TimeBounds}) - x.Marshal(x.Sprintf("%sledgerBounds", name), _XdrPtr_LedgerBounds{&v.LedgerBounds}) - x.Marshal(x.Sprintf("%sminSeqNum", name), _XdrPtr_SequenceNumber{&v.MinSeqNum}) - x.Marshal(x.Sprintf("%sminSeqAge", name), XDR_Duration(&v.MinSeqAge)) - x.Marshal(x.Sprintf("%sminSeqLedgerGap", name), XDR_Uint32(&v.MinSeqLedgerGap)) - x.Marshal(x.Sprintf("%sextraSigners", name), (*_XdrVec_2_SignerKey)(&v.ExtraSigners)) + x.Marshal(x.Sprintf("%sentriesToProve", name), (*_XdrVec_unbounded_ColdArchiveBucketEntry)(&v.EntriesToProve)) + x.Marshal(x.Sprintf("%sproofLevels", name), (*_XdrVec_unbounded_ProofLevel)(&v.ProofLevels)) } -func XDR_PreconditionsV2(v *PreconditionsV2) *PreconditionsV2 { return v } +func XDR_NonexistenceProofBody(v *NonexistenceProofBody) *NonexistenceProofBody { return v } -var _XdrNames_PreconditionType = map[int32]string{ - int32(PRECOND_NONE): "PRECOND_NONE", - int32(PRECOND_TIME): "PRECOND_TIME", - int32(PRECOND_V2): "PRECOND_V2", -} -var _XdrValues_PreconditionType = map[string]int32{ - "PRECOND_NONE": int32(PRECOND_NONE), - "PRECOND_TIME": int32(PRECOND_TIME), - "PRECOND_V2": int32(PRECOND_V2), -} +type XdrType_ExistenceProofBody = *ExistenceProofBody -func (PreconditionType) XdrEnumNames() map[int32]string { - return _XdrNames_PreconditionType -} -func (v PreconditionType) String() string { - if s, ok := _XdrNames_PreconditionType[int32(v)]; ok { - return s - } - return fmt.Sprintf("PreconditionType#%d", v) -} -func (v *PreconditionType) Scan(ss fmt.ScanState, _ rune) error { - if tok, err := ss.Token(true, XdrSymChar); err != nil { - return err - } else { - stok := string(tok) - if val, ok := _XdrValues_PreconditionType[stok]; ok { - *v = PreconditionType(val) - return nil - } else if stok == "PreconditionType" { - if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { - return nil - } - } - return XdrError(fmt.Sprintf("%s is not a valid PreconditionType.", stok)) +func (v *ExistenceProofBody) XdrPointer() interface{} { return v } +func (ExistenceProofBody) XdrTypeName() string { return "ExistenceProofBody" } +func (v ExistenceProofBody) XdrValue() interface{} { return v } +func (v *ExistenceProofBody) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ExistenceProofBody) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) } + x.Marshal(x.Sprintf("%skeysToProve", name), (*_XdrVec_unbounded_LedgerKey)(&v.KeysToProve)) + x.Marshal(x.Sprintf("%slowBoundEntries", name), (*_XdrVec_unbounded_ColdArchiveBucketEntry)(&v.LowBoundEntries)) + x.Marshal(x.Sprintf("%shighBoundEntries", name), (*_XdrVec_unbounded_ColdArchiveBucketEntry)(&v.HighBoundEntries)) + x.Marshal(x.Sprintf("%sproofLevels", name), (*_XdrVec_unbounded_ProofLevel)(&v.ProofLevels)) } -func (v PreconditionType) GetU32() uint32 { return uint32(v) } -func (v *PreconditionType) SetU32(n uint32) { *v = PreconditionType(n) } -func (v *PreconditionType) XdrPointer() interface{} { return v } -func (PreconditionType) XdrTypeName() string { return "PreconditionType" } -func (v PreconditionType) XdrValue() interface{} { return v } -func (v *PreconditionType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - -type XdrType_PreconditionType = *PreconditionType - -func XDR_PreconditionType(v *PreconditionType) *PreconditionType { return v } +func XDR_ExistenceProofBody(v *ExistenceProofBody) *ExistenceProofBody { return v } -var _XdrTags_Preconditions = map[int32]bool{ - XdrToI32(PRECOND_NONE): true, - XdrToI32(PRECOND_TIME): true, - XdrToI32(PRECOND_V2): true, +var _XdrTags_XdrAnon_ArchivalProof_Body = map[int32]bool{ + XdrToI32(EXISTENCE): true, + XdrToI32(NONEXISTENCE): true, } -func (_ Preconditions) XdrValidTags() map[int32]bool { - return _XdrTags_Preconditions +func (_ XdrAnon_ArchivalProof_Body) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_ArchivalProof_Body } -func (u *Preconditions) TimeBounds() *TimeBounds { - switch u.Type { - case PRECOND_TIME: - if v, ok := u._u.(*TimeBounds); ok { +func (u *XdrAnon_ArchivalProof_Body) NonexistenceProof() *NonexistenceProofBody { + switch u.T { + case EXISTENCE: + if v, ok := u._u.(*NonexistenceProofBody); ok { return v } else { - var zero TimeBounds + var zero NonexistenceProofBody u._u = &zero return &zero } default: - XdrPanic("Preconditions.TimeBounds accessed when Type == %v", u.Type) + XdrPanic("XdrAnon_ArchivalProof_Body.NonexistenceProof accessed when T == %v", u.T) return nil } } -func (u *Preconditions) V2() *PreconditionsV2 { - switch u.Type { - case PRECOND_V2: - if v, ok := u._u.(*PreconditionsV2); ok { +func (u *XdrAnon_ArchivalProof_Body) ExistenceProof() *ExistenceProofBody { + switch u.T { + case NONEXISTENCE: + if v, ok := u._u.(*ExistenceProofBody); ok { return v } else { - var zero PreconditionsV2 + var zero ExistenceProofBody u._u = &zero return &zero } default: - XdrPanic("Preconditions.V2 accessed when Type == %v", u.Type) + XdrPanic("XdrAnon_ArchivalProof_Body.ExistenceProof accessed when T == %v", u.T) return nil } } -func (u Preconditions) XdrValid() bool { - switch u.Type { - case PRECOND_NONE, PRECOND_TIME, PRECOND_V2: +func (u XdrAnon_ArchivalProof_Body) XdrValid() bool { + switch u.T { + case EXISTENCE, NONEXISTENCE: return true } return false } -func (u *Preconditions) XdrUnionTag() XdrNum32 { - return XDR_PreconditionType(&u.Type) +func (u *XdrAnon_ArchivalProof_Body) XdrUnionTag() XdrNum32 { + return XDR_ArchivalProofType(&u.T) } -func (u *Preconditions) XdrUnionTagName() string { - return "Type" +func (u *XdrAnon_ArchivalProof_Body) XdrUnionTagName() string { + return "T" } -func (u *Preconditions) XdrUnionBody() XdrType { - switch u.Type { - case PRECOND_NONE: - return nil - case PRECOND_TIME: - return XDR_TimeBounds(u.TimeBounds()) - case PRECOND_V2: - return XDR_PreconditionsV2(u.V2()) +func (u *XdrAnon_ArchivalProof_Body) XdrUnionBody() XdrType { + switch u.T { + case EXISTENCE: + return XDR_NonexistenceProofBody(u.NonexistenceProof()) + case NONEXISTENCE: + return XDR_ExistenceProofBody(u.ExistenceProof()) } return nil } -func (u *Preconditions) XdrUnionBodyName() string { - switch u.Type { - case PRECOND_NONE: - return "" - case PRECOND_TIME: - return "TimeBounds" - case PRECOND_V2: - return "V2" +func (u *XdrAnon_ArchivalProof_Body) XdrUnionBodyName() string { + switch u.T { + case EXISTENCE: + return "NonexistenceProof" + case NONEXISTENCE: + return "ExistenceProof" } return "" } -type XdrType_Preconditions = *Preconditions +type XdrType_XdrAnon_ArchivalProof_Body = *XdrAnon_ArchivalProof_Body -func (v *Preconditions) XdrPointer() interface{} { return v } -func (Preconditions) XdrTypeName() string { return "Preconditions" } -func (v Preconditions) XdrValue() interface{} { return v } -func (v *Preconditions) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (u *Preconditions) XdrRecurse(x XDR, name string) { +func (v *XdrAnon_ArchivalProof_Body) XdrPointer() interface{} { return v } +func (XdrAnon_ArchivalProof_Body) XdrTypeName() string { return "XdrAnon_ArchivalProof_Body" } +func (v XdrAnon_ArchivalProof_Body) XdrValue() interface{} { return v } +func (v *XdrAnon_ArchivalProof_Body) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_ArchivalProof_Body) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - XDR_PreconditionType(&u.Type).XdrMarshal(x, x.Sprintf("%stype", name)) - switch u.Type { - case PRECOND_NONE: - return - case PRECOND_TIME: - x.Marshal(x.Sprintf("%stimeBounds", name), XDR_TimeBounds(u.TimeBounds())) + XDR_ArchivalProofType(&u.T).XdrMarshal(x, x.Sprintf("%st", name)) + switch u.T { + case EXISTENCE: + x.Marshal(x.Sprintf("%snonexistenceProof", name), XDR_NonexistenceProofBody(u.NonexistenceProof())) return - case PRECOND_V2: - x.Marshal(x.Sprintf("%sv2", name), XDR_PreconditionsV2(u.V2())) + case NONEXISTENCE: + x.Marshal(x.Sprintf("%sexistenceProof", name), XDR_ExistenceProofBody(u.ExistenceProof())) return } - XdrPanic("invalid Type (%v) in Preconditions", u.Type) + XdrPanic("invalid T (%v) in XdrAnon_ArchivalProof_Body", u.T) +} +func XDR_XdrAnon_ArchivalProof_Body(v *XdrAnon_ArchivalProof_Body) *XdrAnon_ArchivalProof_Body { + return v } -func XDR_Preconditions(v *Preconditions) *Preconditions { return v } -type XdrType_LedgerFootprint = *LedgerFootprint +type XdrType_ArchivalProof = *ArchivalProof -func (v *LedgerFootprint) XdrPointer() interface{} { return v } -func (LedgerFootprint) XdrTypeName() string { return "LedgerFootprint" } -func (v LedgerFootprint) XdrValue() interface{} { return v } -func (v *LedgerFootprint) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -func (v *LedgerFootprint) XdrRecurse(x XDR, name string) { +func (v *ArchivalProof) XdrPointer() interface{} { return v } +func (ArchivalProof) XdrTypeName() string { return "ArchivalProof" } +func (v ArchivalProof) XdrValue() interface{} { return v } +func (v *ArchivalProof) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ArchivalProof) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sreadOnly", name), (*_XdrVec_unbounded_LedgerKey)(&v.ReadOnly)) - x.Marshal(x.Sprintf("%sreadWrite", name), (*_XdrVec_unbounded_LedgerKey)(&v.ReadWrite)) + x.Marshal(x.Sprintf("%sepoch", name), XDR_Uint32(&v.Epoch)) + x.Marshal(x.Sprintf("%sbody", name), XDR_XdrAnon_ArchivalProof_Body(&v.Body)) } -func XDR_LedgerFootprint(v *LedgerFootprint) *LedgerFootprint { return v } +func XDR_ArchivalProof(v *ArchivalProof) *ArchivalProof { return v } type XdrType_SorobanResources = *SorobanResources @@ -25832,6 +27000,91 @@ func (v *HmacSha256Mac) XdrRecurse(x XDR, name string) { } func XDR_HmacSha256Mac(v *HmacSha256Mac) *HmacSha256Mac { return v } +type XdrType_ShortHashSeed = *ShortHashSeed + +func (v *ShortHashSeed) XdrPointer() interface{} { return v } +func (ShortHashSeed) XdrTypeName() string { return "ShortHashSeed" } +func (v ShortHashSeed) XdrValue() interface{} { return v } +func (v *ShortHashSeed) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ShortHashSeed) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sseed", name), (*_XdrArray_16_opaque)(&v.Seed)) +} +func XDR_ShortHashSeed(v *ShortHashSeed) *ShortHashSeed { return v } + +var _XdrNames_BinaryFuseFilterType = map[int32]string{ + int32(BINARY_FUSE_FILTER_8_BIT): "BINARY_FUSE_FILTER_8_BIT", + int32(BINARY_FUSE_FILTER_16_BIT): "BINARY_FUSE_FILTER_16_BIT", + int32(BINARY_FUSE_FILTER_32_BIT): "BINARY_FUSE_FILTER_32_BIT", +} +var _XdrValues_BinaryFuseFilterType = map[string]int32{ + "BINARY_FUSE_FILTER_8_BIT": int32(BINARY_FUSE_FILTER_8_BIT), + "BINARY_FUSE_FILTER_16_BIT": int32(BINARY_FUSE_FILTER_16_BIT), + "BINARY_FUSE_FILTER_32_BIT": int32(BINARY_FUSE_FILTER_32_BIT), +} + +func (BinaryFuseFilterType) XdrEnumNames() map[int32]string { + return _XdrNames_BinaryFuseFilterType +} +func (v BinaryFuseFilterType) String() string { + if s, ok := _XdrNames_BinaryFuseFilterType[int32(v)]; ok { + return s + } + return fmt.Sprintf("BinaryFuseFilterType#%d", v) +} +func (v *BinaryFuseFilterType) Scan(ss fmt.ScanState, _ rune) error { + if tok, err := ss.Token(true, XdrSymChar); err != nil { + return err + } else { + stok := string(tok) + if val, ok := _XdrValues_BinaryFuseFilterType[stok]; ok { + *v = BinaryFuseFilterType(val) + return nil + } else if stok == "BinaryFuseFilterType" { + if n, err := fmt.Fscanf(ss, "#%d", (*int32)(v)); n == 1 && err == nil { + return nil + } + } + return XdrError(fmt.Sprintf("%s is not a valid BinaryFuseFilterType.", stok)) + } +} +func (v BinaryFuseFilterType) GetU32() uint32 { return uint32(v) } +func (v *BinaryFuseFilterType) SetU32(n uint32) { *v = BinaryFuseFilterType(n) } +func (v *BinaryFuseFilterType) XdrPointer() interface{} { return v } +func (BinaryFuseFilterType) XdrTypeName() string { return "BinaryFuseFilterType" } +func (v BinaryFuseFilterType) XdrValue() interface{} { return v } +func (v *BinaryFuseFilterType) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_BinaryFuseFilterType = *BinaryFuseFilterType + +func XDR_BinaryFuseFilterType(v *BinaryFuseFilterType) *BinaryFuseFilterType { return v } + +type XdrType_SerializedBinaryFuseFilter = *SerializedBinaryFuseFilter + +func (v *SerializedBinaryFuseFilter) XdrPointer() interface{} { return v } +func (SerializedBinaryFuseFilter) XdrTypeName() string { return "SerializedBinaryFuseFilter" } +func (v SerializedBinaryFuseFilter) XdrValue() interface{} { return v } +func (v *SerializedBinaryFuseFilter) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SerializedBinaryFuseFilter) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%stype", name), XDR_BinaryFuseFilterType(&v.Type)) + x.Marshal(x.Sprintf("%sinputHashSeed", name), XDR_ShortHashSeed(&v.InputHashSeed)) + x.Marshal(x.Sprintf("%sfilterSeed", name), XDR_ShortHashSeed(&v.FilterSeed)) + x.Marshal(x.Sprintf("%ssegmentLength", name), XDR_Uint32(&v.SegmentLength)) + x.Marshal(x.Sprintf("%ssegementLengthMask", name), XDR_Uint32(&v.SegementLengthMask)) + x.Marshal(x.Sprintf("%ssegmentCount", name), XDR_Uint32(&v.SegmentCount)) + x.Marshal(x.Sprintf("%ssegmentCountLength", name), XDR_Uint32(&v.SegmentCountLength)) + x.Marshal(x.Sprintf("%sfingerprintLength", name), XDR_Uint32(&v.FingerprintLength)) + x.Marshal(x.Sprintf("%sfingerprints", name), XdrVecOpaque{&v.Fingerprints, 0xffffffff}) +} +func XDR_SerializedBinaryFuseFilter(v *SerializedBinaryFuseFilter) *SerializedBinaryFuseFilter { + return v +} + var _XdrNames_SCEnvMetaKind = map[int32]string{ int32(SC_ENV_META_KIND_INTERFACE_VERSION): "SC_ENV_META_KIND_INTERFACE_VERSION", } diff --git a/xdr/Stellar-ledger-entries.x b/xdr/Stellar-ledger-entries.x index 3a137ae60d..5bf4f9d368 100644 --- a/xdr/Stellar-ledger-entries.x +++ b/xdr/Stellar-ledger-entries.x @@ -678,4 +678,120 @@ enum EnvelopeType ENVELOPE_TYPE_CONTRACT_ID = 8, ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9 }; -} + +enum BucketListType +{ + LIVE = 0, + HOT_ARCHIVE = 1, + COLD_ARCHIVE = 2 +}; + +/* Entries used to define the bucket list */ +enum BucketEntryType +{ + METAENTRY = + -1, // At-and-after protocol 11: bucket metadata, should come first. + LIVEENTRY = 0, // Before protocol 11: created-or-updated; + // At-and-after protocol 11: only updated. + DEADENTRY = 1, + INITENTRY = 2 // At-and-after protocol 11: only created. +}; + +enum HotArchiveBucketEntryType +{ + HOT_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first. + HOT_ARCHIVE_ARCHIVED = 0, // Entry is Archived + HOT_ARCHIVE_LIVE = 1, // Entry was previously HOT_ARCHIVE_ARCHIVED, or HOT_ARCHIVE_DELETED, but + // has been added back to the live BucketList. + // Does not need to be persisted. + HOT_ARCHIVE_DELETED = 2 // Entry deleted (Note: must be persisted in archive) +}; + +enum ColdArchiveBucketEntryType +{ + COLD_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first. + COLD_ARCHIVE_ARCHIVED_LEAF = 0, // Full LedgerEntry that was archived during the epoch + COLD_ARCHIVE_DELETED_LEAF = 1, // LedgerKey that was deleted during the epoch + COLD_ARCHIVE_BOUNDARY_LEAF = 2, // Dummy leaf representing low/high bound + COLD_ARCHIVE_HASH = 3 // Intermediary Merkle hash entry +}; + +struct BucketMetadata +{ + // Indicates the protocol version used to create / merge this bucket. + uint32 ledgerVersion; + + // reserved for future use + union switch (int v) + { + case 0: + void; + case 1: + BucketListType bucketListType; + } + ext; +}; + +union BucketEntry switch (BucketEntryType type) +{ +case LIVEENTRY: +case INITENTRY: + LedgerEntry liveEntry; + +case DEADENTRY: + LedgerKey deadEntry; +case METAENTRY: + BucketMetadata metaEntry; +}; + +union HotArchiveBucketEntry switch (HotArchiveBucketEntryType type) +{ +case HOT_ARCHIVE_ARCHIVED: + LedgerEntry archivedEntry; + +case HOT_ARCHIVE_LIVE: +case HOT_ARCHIVE_DELETED: + LedgerKey key; +case HOT_ARCHIVE_METAENTRY: + BucketMetadata metaEntry; +}; + +struct ColdArchiveArchivedLeaf +{ + uint32 index; + LedgerEntry archivedEntry; +}; + +struct ColdArchiveDeletedLeaf +{ + uint32 index; + LedgerKey deletedKey; +}; + +struct ColdArchiveBoundaryLeaf +{ + uint32 index; + bool isLowerBound; +}; + +struct ColdArchiveHashEntry +{ + uint32 index; + uint32 level; + Hash hash; +}; + +union ColdArchiveBucketEntry switch (ColdArchiveBucketEntryType type) +{ +case COLD_ARCHIVE_METAENTRY: + BucketMetadata metaEntry; +case COLD_ARCHIVE_ARCHIVED_LEAF: + ColdArchiveArchivedLeaf archivedLeaf; +case COLD_ARCHIVE_DELETED_LEAF: + ColdArchiveDeletedLeaf deletedLeaf; +case COLD_ARCHIVE_BOUNDARY_LEAF: + ColdArchiveBoundaryLeaf boundaryLeaf; +case COLD_ARCHIVE_HASH: + ColdArchiveHashEntry hashEntry; +}; +} \ No newline at end of file diff --git a/xdr/Stellar-ledger.x b/xdr/Stellar-ledger.x index d19462aa18..0fc03e2af3 100644 --- a/xdr/Stellar-ledger.x +++ b/xdr/Stellar-ledger.x @@ -157,43 +157,6 @@ struct ConfigUpgradeSet { ConfigSettingEntry updatedEntry<>; }; -/* Entries used to define the bucket list */ -enum BucketEntryType -{ - METAENTRY = - -1, // At-and-after protocol 11: bucket metadata, should come first. - LIVEENTRY = 0, // Before protocol 11: created-or-updated; - // At-and-after protocol 11: only updated. - DEADENTRY = 1, - INITENTRY = 2 // At-and-after protocol 11: only created. -}; - -struct BucketMetadata -{ - // Indicates the protocol version used to create / merge this bucket. - uint32 ledgerVersion; - - // reserved for future use - union switch (int v) - { - case 0: - void; - } - ext; -}; - -union BucketEntry switch (BucketEntryType type) -{ -case LIVEENTRY: -case INITENTRY: - LedgerEntry liveEntry; - -case DEADENTRY: - LedgerKey deadEntry; -case METAENTRY: - BucketMetadata metaEntry; -}; - enum TxSetComponentType { // txs with effective fee <= bid derived from a base fee (if any). diff --git a/xdr/Stellar-transaction.x b/xdr/Stellar-transaction.x index 87dd32d385..d0ed328cbd 100644 --- a/xdr/Stellar-transaction.x +++ b/xdr/Stellar-transaction.x @@ -476,7 +476,8 @@ enum HostFunctionType { HOST_FUNCTION_TYPE_INVOKE_CONTRACT = 0, HOST_FUNCTION_TYPE_CREATE_CONTRACT = 1, - HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2 + HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2, + HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2 = 3 }; enum ContractIDPreimageType @@ -503,6 +504,14 @@ struct CreateContractArgs ContractExecutable executable; }; +struct CreateContractArgsV2 +{ + ContractIDPreimage contractIDPreimage; + ContractExecutable executable; + // Arguments of the contract's constructor. + SCVal constructorArgs<>; +}; + struct InvokeContractArgs { SCAddress contractAddress; SCSymbol functionName; @@ -517,20 +526,29 @@ case HOST_FUNCTION_TYPE_CREATE_CONTRACT: CreateContractArgs createContract; case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: opaque wasm<>; +case HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2: + CreateContractArgsV2 createContractV2; }; enum SorobanAuthorizedFunctionType { SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN = 0, - SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1 + SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1, + SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN = 2 }; union SorobanAuthorizedFunction switch (SorobanAuthorizedFunctionType type) { case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: InvokeContractArgs contractFn; +// This variant of auth payload for creating new contract instances is no +// longer accepted after protocol 22. case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: CreateContractArgs createContractHostFn; +// This variant of auth payload for creating new contract instances +// is only accepted in and after protocol 22. +case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: + CreateContractArgsV2 createContractV2HostFn; }; struct SorobanAuthorizedInvocation @@ -801,6 +819,56 @@ struct LedgerFootprint LedgerKey readWrite<>; }; +enum ArchivalProofType +{ + EXISTENCE = 0, + NONEXISTENCE = 1 +}; + +struct ArchivalProofNode +{ + uint32 index; + Hash hash; +}; + +typedef ArchivalProofNode ProofLevel<>; + +struct NonexistenceProofBody +{ + ColdArchiveBucketEntry entriesToProve<>; + + // Vector of vectors, where proofLevels[level] + // contains all HashNodes that correspond with that level + ProofLevel proofLevels<>; +}; + +struct ExistenceProofBody +{ + LedgerKey keysToProve<>; + + // Bounds for each key being proved, where bound[n] + // corresponds to keysToProve[n] + ColdArchiveBucketEntry lowBoundEntries<>; + ColdArchiveBucketEntry highBoundEntries<>; + + // Vector of vectors, where proofLevels[level] + // contains all HashNodes that correspond with that level + ProofLevel proofLevels<>; +}; + +struct ArchivalProof +{ + uint32 epoch; // AST Subtree for this proof + + union switch (ArchivalProofType t) + { + case EXISTENCE: + NonexistenceProofBody nonexistenceProof; + case NONEXISTENCE: + ExistenceProofBody existenceProof; + } body; +}; + // Resource limits for a Soroban transaction. // The transaction will fail if it exceeds any of these limits. struct SorobanResources diff --git a/xdr/Stellar-types.x b/xdr/Stellar-types.x index d71bf0d49d..73c4e79581 100644 --- a/xdr/Stellar-types.x +++ b/xdr/Stellar-types.x @@ -103,4 +103,35 @@ struct HmacSha256Mac { opaque mac[32]; }; -} + +struct ShortHashSeed +{ + opaque seed[16]; +}; + +enum BinaryFuseFilterType +{ + BINARY_FUSE_FILTER_8_BIT = 0, + BINARY_FUSE_FILTER_16_BIT = 1, + BINARY_FUSE_FILTER_32_BIT = 2 +}; + +struct SerializedBinaryFuseFilter +{ + BinaryFuseFilterType type; + + // Seed used to hash input to filter + ShortHashSeed inputHashSeed; + + // Seed used for internal filter hash operations + ShortHashSeed filterSeed; + uint32 segmentLength; + uint32 segementLengthMask; + uint32 segmentCount; + uint32 segmentCountLength; + uint32 fingerprintLength; // Length in terms of element count, not bytes + + // Array of uint8_t, uint16_t, or uint32_t depending on filter type + opaque fingerprints<>; +}; +} \ No newline at end of file diff --git a/xdr/xdr_commit_generated.txt b/xdr/xdr_commit_generated.txt index 793097adeb..20860efdcb 100644 --- a/xdr/xdr_commit_generated.txt +++ b/xdr/xdr_commit_generated.txt @@ -1 +1 @@ -70180d5e8d9caee9e8645ed8a38c36a8cf403cd9 \ No newline at end of file +4ec28d95dd84b109253e22b151314478d6f00522 \ No newline at end of file diff --git a/xdr/xdr_generated.go b/xdr/xdr_generated.go index fb7fb7471e..0892e9f404 100644 --- a/xdr/xdr_generated.go +++ b/xdr/xdr_generated.go @@ -40,11 +40,11 @@ var XdrFilesSHA256 = map[string]string{ "xdr/Stellar-contract.x": "7f665e4103e146a88fcdabce879aaaacd3bf9283feb194cc47ff986264c1e315", "xdr/Stellar-exporter.x": "a00c83d02e8c8382e06f79a191f1fb5abd097a4bbcab8481c67467e3270e0529", "xdr/Stellar-internal.x": "227835866c1b2122d1eaf28839ba85ea7289d1cb681dda4ca619c2da3d71fe00", - "xdr/Stellar-ledger-entries.x": "77dc7062ae6d0812136333e12e35b2294d7c2896a536be9c811eb0ed2abbbccb", - "xdr/Stellar-ledger.x": "46c1c55972750b97650ff00788a2be4764975b787ef51c8fa931c56e2028a3c4", + "xdr/Stellar-ledger-entries.x": "03e8be938bace784410b0e837ed6496ff66dc0d1e70fc6e4f0d006566a344879", + "xdr/Stellar-ledger.x": "c2ac5bde5da28d4d02e2ea455f3bc5d5133adf271d374010cebe4e314c8504e8", "xdr/Stellar-overlay.x": "8c73b7c3ad974e7fc4aa4fdf34f7ad50053406254efbd7406c96657cf41691d3", - "xdr/Stellar-transaction.x": "0d2b35a331a540b48643925d0869857236eb2487c02d340ea32e365e784ea2b8", - "xdr/Stellar-types.x": "6e3b13f0d3e360b09fa5e2b0e55d43f4d974a769df66afb34e8aecbb329d3f15", + "xdr/Stellar-transaction.x": "a938e583ab5d25237c51f355a47446215575b720150db89a1cecf13773249df1", + "xdr/Stellar-types.x": "253f515fc5e06bc938105e92a4c7f562251d4ebc178d39d6e6751e6b85fe1064", } var ErrMaxDecodingDepthReached = errors.New("maximum decoding depth reached") @@ -11114,45 +11114,71 @@ func (s EnvelopeType) xdrType() {} var _ xdrType = (*EnvelopeType)(nil) -// UpgradeType is an XDR Typedef defines as: +// BucketListType is an XDR Enum defines as: // -// typedef opaque UpgradeType<128>; -type UpgradeType []byte +// enum BucketListType +// { +// LIVE = 0, +// HOT_ARCHIVE = 1, +// COLD_ARCHIVE = 2 +// }; +type BucketListType int32 -// XDRMaxSize implements the Sized interface for UpgradeType -func (e UpgradeType) XDRMaxSize() int { - return 128 +const ( + BucketListTypeLive BucketListType = 0 + BucketListTypeHotArchive BucketListType = 1 + BucketListTypeColdArchive BucketListType = 2 +) + +var bucketListTypeMap = map[int32]string{ + 0: "BucketListTypeLive", + 1: "BucketListTypeHotArchive", + 2: "BucketListTypeColdArchive", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for BucketListType +func (e BucketListType) ValidEnum(v int32) bool { + _, ok := bucketListTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e BucketListType) String() string { + name, _ := bucketListTypeMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (s UpgradeType) EncodeTo(e *xdr.Encoder) error { - var err error - if _, err = e.EncodeOpaque(s[:]); err != nil { - return err +func (e BucketListType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := bucketListTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid BucketListType enum value", e) } - return nil + _, err := enc.EncodeInt(int32(e)) + return err } -var _ decoderFrom = (*UpgradeType)(nil) +var _ decoderFrom = (*BucketListType)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *UpgradeType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *BucketListType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding UpgradeType: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding BucketListType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - var err error - var n, nTmp int - (*s), nTmp, err = d.DecodeOpaque(128) - n += nTmp + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding UpgradeType: %w", err) + return n, fmt.Errorf("decoding BucketListType: %w", err) + } + if _, ok := bucketListTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid BucketListType enum value", v) } + *e = BucketListType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s UpgradeType) MarshalBinary() ([]byte, error) { +func (s BucketListType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -11160,7 +11186,7 @@ func (s UpgradeType) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *UpgradeType) UnmarshalBinary(inp []byte) error { +func (s *BucketListType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -11170,77 +11196,85 @@ func (s *UpgradeType) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*UpgradeType)(nil) - _ encoding.BinaryUnmarshaler = (*UpgradeType)(nil) + _ encoding.BinaryMarshaler = (*BucketListType)(nil) + _ encoding.BinaryUnmarshaler = (*BucketListType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s UpgradeType) xdrType() {} +func (s BucketListType) xdrType() {} -var _ xdrType = (*UpgradeType)(nil) +var _ xdrType = (*BucketListType)(nil) -// StellarValueType is an XDR Enum defines as: +// BucketEntryType is an XDR Enum defines as: // -// enum StellarValueType +// enum BucketEntryType // { -// STELLAR_VALUE_BASIC = 0, -// STELLAR_VALUE_SIGNED = 1 +// METAENTRY = +// -1, // At-and-after protocol 11: bucket metadata, should come first. +// LIVEENTRY = 0, // Before protocol 11: created-or-updated; +// // At-and-after protocol 11: only updated. +// DEADENTRY = 1, +// INITENTRY = 2 // At-and-after protocol 11: only created. // }; -type StellarValueType int32 +type BucketEntryType int32 const ( - StellarValueTypeStellarValueBasic StellarValueType = 0 - StellarValueTypeStellarValueSigned StellarValueType = 1 + BucketEntryTypeMetaentry BucketEntryType = -1 + BucketEntryTypeLiveentry BucketEntryType = 0 + BucketEntryTypeDeadentry BucketEntryType = 1 + BucketEntryTypeInitentry BucketEntryType = 2 ) -var stellarValueTypeMap = map[int32]string{ - 0: "StellarValueTypeStellarValueBasic", - 1: "StellarValueTypeStellarValueSigned", +var bucketEntryTypeMap = map[int32]string{ + -1: "BucketEntryTypeMetaentry", + 0: "BucketEntryTypeLiveentry", + 1: "BucketEntryTypeDeadentry", + 2: "BucketEntryTypeInitentry", } // ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for StellarValueType -func (e StellarValueType) ValidEnum(v int32) bool { - _, ok := stellarValueTypeMap[v] +// the Enum interface for BucketEntryType +func (e BucketEntryType) ValidEnum(v int32) bool { + _, ok := bucketEntryTypeMap[v] return ok } // String returns the name of `e` -func (e StellarValueType) String() string { - name, _ := stellarValueTypeMap[int32(e)] +func (e BucketEntryType) String() string { + name, _ := bucketEntryTypeMap[int32(e)] return name } // EncodeTo encodes this value using the Encoder. -func (e StellarValueType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := stellarValueTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid StellarValueType enum value", e) +func (e BucketEntryType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := bucketEntryTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid BucketEntryType enum value", e) } _, err := enc.EncodeInt(int32(e)) return err } -var _ decoderFrom = (*StellarValueType)(nil) +var _ decoderFrom = (*BucketEntryType)(nil) // DecodeFrom decodes this value using the Decoder. -func (e *StellarValueType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *BucketEntryType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding StellarValueType: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding BucketEntryType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding StellarValueType: %w", err) + return n, fmt.Errorf("decoding BucketEntryType: %w", err) } - if _, ok := stellarValueTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid StellarValueType enum value", v) + if _, ok := bucketEntryTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid BucketEntryType enum value", v) } - *e = StellarValueType(v) + *e = BucketEntryType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s StellarValueType) MarshalBinary() ([]byte, error) { +func (s BucketEntryType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -11248,7 +11282,7 @@ func (s StellarValueType) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *StellarValueType) UnmarshalBinary(inp []byte) error { +func (s *BucketEntryType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -11258,64 +11292,182 @@ func (s *StellarValueType) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*StellarValueType)(nil) - _ encoding.BinaryUnmarshaler = (*StellarValueType)(nil) + _ encoding.BinaryMarshaler = (*BucketEntryType)(nil) + _ encoding.BinaryUnmarshaler = (*BucketEntryType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s StellarValueType) xdrType() {} +func (s BucketEntryType) xdrType() {} -var _ xdrType = (*StellarValueType)(nil) +var _ xdrType = (*BucketEntryType)(nil) -// LedgerCloseValueSignature is an XDR Struct defines as: +// HotArchiveBucketEntryType is an XDR Enum defines as: // -// struct LedgerCloseValueSignature +// enum HotArchiveBucketEntryType // { -// NodeID nodeID; // which node introduced the value -// Signature signature; // nodeID's signature +// HOT_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first. +// HOT_ARCHIVE_ARCHIVED = 0, // Entry is Archived +// HOT_ARCHIVE_LIVE = 1, // Entry was previously HOT_ARCHIVE_ARCHIVED, or HOT_ARCHIVE_DELETED, but +// // has been added back to the live BucketList. +// // Does not need to be persisted. +// HOT_ARCHIVE_DELETED = 2 // Entry deleted (Note: must be persisted in archive) // }; -type LedgerCloseValueSignature struct { - NodeId NodeId - Signature Signature +type HotArchiveBucketEntryType int32 + +const ( + HotArchiveBucketEntryTypeHotArchiveMetaentry HotArchiveBucketEntryType = -1 + HotArchiveBucketEntryTypeHotArchiveArchived HotArchiveBucketEntryType = 0 + HotArchiveBucketEntryTypeHotArchiveLive HotArchiveBucketEntryType = 1 + HotArchiveBucketEntryTypeHotArchiveDeleted HotArchiveBucketEntryType = 2 +) + +var hotArchiveBucketEntryTypeMap = map[int32]string{ + -1: "HotArchiveBucketEntryTypeHotArchiveMetaentry", + 0: "HotArchiveBucketEntryTypeHotArchiveArchived", + 1: "HotArchiveBucketEntryTypeHotArchiveLive", + 2: "HotArchiveBucketEntryTypeHotArchiveDeleted", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for HotArchiveBucketEntryType +func (e HotArchiveBucketEntryType) ValidEnum(v int32) bool { + _, ok := hotArchiveBucketEntryTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e HotArchiveBucketEntryType) String() string { + name, _ := hotArchiveBucketEntryTypeMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (s *LedgerCloseValueSignature) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.NodeId.EncodeTo(e); err != nil { - return err - } - if err = s.Signature.EncodeTo(e); err != nil { - return err +func (e HotArchiveBucketEntryType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := hotArchiveBucketEntryTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid HotArchiveBucketEntryType enum value", e) } - return nil + _, err := enc.EncodeInt(int32(e)) + return err } -var _ decoderFrom = (*LedgerCloseValueSignature)(nil) +var _ decoderFrom = (*HotArchiveBucketEntryType)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *LedgerCloseValueSignature) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *HotArchiveBucketEntryType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerCloseValueSignature: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding HotArchiveBucketEntryType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.NodeId.DecodeFrom(d, maxDepth) - n += nTmp + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding NodeId: %w", err) + return n, fmt.Errorf("decoding HotArchiveBucketEntryType: %w", err) } - nTmp, err = s.Signature.DecodeFrom(d, maxDepth) - n += nTmp + if _, ok := hotArchiveBucketEntryTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid HotArchiveBucketEntryType enum value", v) + } + *e = HotArchiveBucketEntryType(v) + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s HotArchiveBucketEntryType) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *HotArchiveBucketEntryType) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*HotArchiveBucketEntryType)(nil) + _ encoding.BinaryUnmarshaler = (*HotArchiveBucketEntryType)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s HotArchiveBucketEntryType) xdrType() {} + +var _ xdrType = (*HotArchiveBucketEntryType)(nil) + +// ColdArchiveBucketEntryType is an XDR Enum defines as: +// +// enum ColdArchiveBucketEntryType +// { +// COLD_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first. +// COLD_ARCHIVE_ARCHIVED_LEAF = 0, // Full LedgerEntry that was archived during the epoch +// COLD_ARCHIVE_DELETED_LEAF = 1, // LedgerKey that was deleted during the epoch +// COLD_ARCHIVE_BOUNDARY_LEAF = 2, // Dummy leaf representing low/high bound +// COLD_ARCHIVE_HASH = 3 // Intermediary Merkle hash entry +// }; +type ColdArchiveBucketEntryType int32 + +const ( + ColdArchiveBucketEntryTypeColdArchiveMetaentry ColdArchiveBucketEntryType = -1 + ColdArchiveBucketEntryTypeColdArchiveArchivedLeaf ColdArchiveBucketEntryType = 0 + ColdArchiveBucketEntryTypeColdArchiveDeletedLeaf ColdArchiveBucketEntryType = 1 + ColdArchiveBucketEntryTypeColdArchiveBoundaryLeaf ColdArchiveBucketEntryType = 2 + ColdArchiveBucketEntryTypeColdArchiveHash ColdArchiveBucketEntryType = 3 +) + +var coldArchiveBucketEntryTypeMap = map[int32]string{ + -1: "ColdArchiveBucketEntryTypeColdArchiveMetaentry", + 0: "ColdArchiveBucketEntryTypeColdArchiveArchivedLeaf", + 1: "ColdArchiveBucketEntryTypeColdArchiveDeletedLeaf", + 2: "ColdArchiveBucketEntryTypeColdArchiveBoundaryLeaf", + 3: "ColdArchiveBucketEntryTypeColdArchiveHash", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for ColdArchiveBucketEntryType +func (e ColdArchiveBucketEntryType) ValidEnum(v int32) bool { + _, ok := coldArchiveBucketEntryTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e ColdArchiveBucketEntryType) String() string { + name, _ := coldArchiveBucketEntryTypeMap[int32(e)] + return name +} + +// EncodeTo encodes this value using the Encoder. +func (e ColdArchiveBucketEntryType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := coldArchiveBucketEntryTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid ColdArchiveBucketEntryType enum value", e) + } + _, err := enc.EncodeInt(int32(e)) + return err +} + +var _ decoderFrom = (*ColdArchiveBucketEntryType)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (e *ColdArchiveBucketEntryType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding ColdArchiveBucketEntryType: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding Signature: %w", err) + return n, fmt.Errorf("decoding ColdArchiveBucketEntryType: %w", err) } + if _, ok := coldArchiveBucketEntryTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid ColdArchiveBucketEntryType enum value", v) + } + *e = ColdArchiveBucketEntryType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerCloseValueSignature) MarshalBinary() ([]byte, error) { +func (s ColdArchiveBucketEntryType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -11323,7 +11475,7 @@ func (s LedgerCloseValueSignature) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerCloseValueSignature) UnmarshalBinary(inp []byte) error { +func (s *ColdArchiveBucketEntryType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -11333,83 +11485,83 @@ func (s *LedgerCloseValueSignature) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerCloseValueSignature)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerCloseValueSignature)(nil) + _ encoding.BinaryMarshaler = (*ColdArchiveBucketEntryType)(nil) + _ encoding.BinaryUnmarshaler = (*ColdArchiveBucketEntryType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerCloseValueSignature) xdrType() {} +func (s ColdArchiveBucketEntryType) xdrType() {} -var _ xdrType = (*LedgerCloseValueSignature)(nil) +var _ xdrType = (*ColdArchiveBucketEntryType)(nil) -// StellarValueExt is an XDR NestedUnion defines as: +// BucketMetadataExt is an XDR NestedUnion defines as: // -// union switch (StellarValueType v) +// union switch (int v) // { -// case STELLAR_VALUE_BASIC: +// case 0: // void; -// case STELLAR_VALUE_SIGNED: -// LedgerCloseValueSignature lcValueSignature; +// case 1: +// BucketListType bucketListType; // } -type StellarValueExt struct { - V StellarValueType - LcValueSignature *LedgerCloseValueSignature +type BucketMetadataExt struct { + V int32 + BucketListType *BucketListType } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u StellarValueExt) SwitchFieldName() string { +func (u BucketMetadataExt) SwitchFieldName() string { return "V" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of StellarValueExt -func (u StellarValueExt) ArmForSwitch(sw int32) (string, bool) { - switch StellarValueType(sw) { - case StellarValueTypeStellarValueBasic: +// the value for an instance of BucketMetadataExt +func (u BucketMetadataExt) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 0: return "", true - case StellarValueTypeStellarValueSigned: - return "LcValueSignature", true + case 1: + return "BucketListType", true } return "-", false } -// NewStellarValueExt creates a new StellarValueExt. -func NewStellarValueExt(v StellarValueType, value interface{}) (result StellarValueExt, err error) { +// NewBucketMetadataExt creates a new BucketMetadataExt. +func NewBucketMetadataExt(v int32, value interface{}) (result BucketMetadataExt, err error) { result.V = v - switch StellarValueType(v) { - case StellarValueTypeStellarValueBasic: + switch int32(v) { + case 0: // void - case StellarValueTypeStellarValueSigned: - tv, ok := value.(LedgerCloseValueSignature) + case 1: + tv, ok := value.(BucketListType) if !ok { - err = errors.New("invalid value, must be LedgerCloseValueSignature") + err = errors.New("invalid value, must be BucketListType") return } - result.LcValueSignature = &tv + result.BucketListType = &tv } return } -// MustLcValueSignature retrieves the LcValueSignature value from the union, +// MustBucketListType retrieves the BucketListType value from the union, // panicing if the value is not set. -func (u StellarValueExt) MustLcValueSignature() LedgerCloseValueSignature { - val, ok := u.GetLcValueSignature() +func (u BucketMetadataExt) MustBucketListType() BucketListType { + val, ok := u.GetBucketListType() if !ok { - panic("arm LcValueSignature is not set") + panic("arm BucketListType is not set") } return val } -// GetLcValueSignature retrieves the LcValueSignature value from the union, +// GetBucketListType retrieves the BucketListType value from the union, // returning ok if the union's switch indicated the value is valid. -func (u StellarValueExt) GetLcValueSignature() (result LedgerCloseValueSignature, ok bool) { +func (u BucketMetadataExt) GetBucketListType() (result BucketListType, ok bool) { armName, _ := u.ArmForSwitch(int32(u.V)) - if armName == "LcValueSignature" { - result = *u.LcValueSignature + if armName == "BucketListType" { + result = *u.BucketListType ok = true } @@ -11417,57 +11569,57 @@ func (u StellarValueExt) GetLcValueSignature() (result LedgerCloseValueSignature } // EncodeTo encodes this value using the Encoder. -func (u StellarValueExt) EncodeTo(e *xdr.Encoder) error { +func (u BucketMetadataExt) EncodeTo(e *xdr.Encoder) error { var err error - if err = u.V.EncodeTo(e); err != nil { + if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } - switch StellarValueType(u.V) { - case StellarValueTypeStellarValueBasic: + switch int32(u.V) { + case 0: // Void return nil - case StellarValueTypeStellarValueSigned: - if err = (*u.LcValueSignature).EncodeTo(e); err != nil { + case 1: + if err = (*u.BucketListType).EncodeTo(e); err != nil { return err } return nil } - return fmt.Errorf("V (StellarValueType) switch value '%d' is not valid for union StellarValueExt", u.V) + return fmt.Errorf("V (int32) switch value '%d' is not valid for union BucketMetadataExt", u.V) } -var _ decoderFrom = (*StellarValueExt)(nil) +var _ decoderFrom = (*BucketMetadataExt)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *StellarValueExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *BucketMetadataExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding StellarValueExt: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding BucketMetadataExt: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = u.V.DecodeFrom(d, maxDepth) + u.V, nTmp, err = d.DecodeInt() n += nTmp if err != nil { - return n, fmt.Errorf("decoding StellarValueType: %w", err) + return n, fmt.Errorf("decoding Int: %w", err) } - switch StellarValueType(u.V) { - case StellarValueTypeStellarValueBasic: + switch int32(u.V) { + case 0: // Void return n, nil - case StellarValueTypeStellarValueSigned: - u.LcValueSignature = new(LedgerCloseValueSignature) - nTmp, err = (*u.LcValueSignature).DecodeFrom(d, maxDepth) + case 1: + u.BucketListType = new(BucketListType) + nTmp, err = (*u.BucketListType).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerCloseValueSignature: %w", err) + return n, fmt.Errorf("decoding BucketListType: %w", err) } return n, nil } - return n, fmt.Errorf("union StellarValueExt has invalid V (StellarValueType) switch value '%d'", u.V) + return n, fmt.Errorf("union BucketMetadataExt has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s StellarValueExt) MarshalBinary() ([]byte, error) { +func (s BucketMetadataExt) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -11475,7 +11627,7 @@ func (s StellarValueExt) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *StellarValueExt) UnmarshalBinary(inp []byte) error { +func (s *BucketMetadataExt) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -11485,122 +11637,74 @@ func (s *StellarValueExt) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*StellarValueExt)(nil) - _ encoding.BinaryUnmarshaler = (*StellarValueExt)(nil) + _ encoding.BinaryMarshaler = (*BucketMetadataExt)(nil) + _ encoding.BinaryUnmarshaler = (*BucketMetadataExt)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s StellarValueExt) xdrType() {} +func (s BucketMetadataExt) xdrType() {} -var _ xdrType = (*StellarValueExt)(nil) +var _ xdrType = (*BucketMetadataExt)(nil) -// StellarValue is an XDR Struct defines as: +// BucketMetadata is an XDR Struct defines as: // -// struct StellarValue +// struct BucketMetadata // { -// Hash txSetHash; // transaction set to apply to previous ledger -// TimePoint closeTime; // network close time -// -// // upgrades to apply to the previous ledger (usually empty) -// // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop -// // unknown steps during consensus if needed. -// // see notes below on 'LedgerUpgrade' for more detail -// // max size is dictated by number of upgrade types (+ room for future) -// UpgradeType upgrades<6>; +// // Indicates the protocol version used to create / merge this bucket. +// uint32 ledgerVersion; // // // reserved for future use -// union switch (StellarValueType v) +// union switch (int v) // { -// case STELLAR_VALUE_BASIC: +// case 0: // void; -// case STELLAR_VALUE_SIGNED: -// LedgerCloseValueSignature lcValueSignature; +// case 1: +// BucketListType bucketListType; // } // ext; // }; -type StellarValue struct { - TxSetHash Hash - CloseTime TimePoint - Upgrades []UpgradeType `xdrmaxsize:"6"` - Ext StellarValueExt +type BucketMetadata struct { + LedgerVersion Uint32 + Ext BucketMetadataExt } // EncodeTo encodes this value using the Encoder. -func (s *StellarValue) EncodeTo(e *xdr.Encoder) error { +func (s *BucketMetadata) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.TxSetHash.EncodeTo(e); err != nil { - return err - } - if err = s.CloseTime.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeUint(uint32(len(s.Upgrades))); err != nil { + if err = s.LedgerVersion.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s.Upgrades); i++ { - if err = s.Upgrades[i].EncodeTo(e); err != nil { - return err - } - } if err = s.Ext.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*StellarValue)(nil) +var _ decoderFrom = (*BucketMetadata)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *StellarValue) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *BucketMetadata) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding StellarValue: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding BucketMetadata: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.TxSetHash.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - nTmp, err = s.CloseTime.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TimePoint: %w", err) - } - var l uint32 - l, nTmp, err = d.DecodeUint() + nTmp, err = s.LedgerVersion.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding UpgradeType: %w", err) - } - if l > 6 { - return n, fmt.Errorf("decoding UpgradeType: data size (%d) exceeds size limit (6)", l) - } - s.Upgrades = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding UpgradeType: length (%d) exceeds remaining input length (%d)", l, il) - } - s.Upgrades = make([]UpgradeType, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.Upgrades[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding UpgradeType: %w", err) - } - } + return n, fmt.Errorf("decoding Uint32: %w", err) } nTmp, err = s.Ext.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding StellarValueExt: %w", err) + return n, fmt.Errorf("decoding BucketMetadataExt: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s StellarValue) MarshalBinary() ([]byte, error) { +func (s BucketMetadata) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -11608,7 +11712,7 @@ func (s StellarValue) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *StellarValue) UnmarshalBinary(inp []byte) error { +func (s *BucketMetadata) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -11618,85 +11722,253 @@ func (s *StellarValue) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*StellarValue)(nil) - _ encoding.BinaryUnmarshaler = (*StellarValue)(nil) + _ encoding.BinaryMarshaler = (*BucketMetadata)(nil) + _ encoding.BinaryUnmarshaler = (*BucketMetadata)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s StellarValue) xdrType() {} - -var _ xdrType = (*StellarValue)(nil) +func (s BucketMetadata) xdrType() {} -// MaskLedgerHeaderFlags is an XDR Const defines as: -// -// const MASK_LEDGER_HEADER_FLAGS = 0x7; -const MaskLedgerHeaderFlags = 0x7 +var _ xdrType = (*BucketMetadata)(nil) -// LedgerHeaderFlags is an XDR Enum defines as: +// BucketEntry is an XDR Union defines as: // -// enum LedgerHeaderFlags +// union BucketEntry switch (BucketEntryType type) // { -// DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 0x1, -// DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 0x2, -// DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 0x4 +// case LIVEENTRY: +// case INITENTRY: +// LedgerEntry liveEntry; +// +// case DEADENTRY: +// LedgerKey deadEntry; +// case METAENTRY: +// BucketMetadata metaEntry; // }; -type LedgerHeaderFlags int32 - -const ( - LedgerHeaderFlagsDisableLiquidityPoolTradingFlag LedgerHeaderFlags = 1 - LedgerHeaderFlagsDisableLiquidityPoolDepositFlag LedgerHeaderFlags = 2 - LedgerHeaderFlagsDisableLiquidityPoolWithdrawalFlag LedgerHeaderFlags = 4 -) - -var ledgerHeaderFlagsMap = map[int32]string{ - 1: "LedgerHeaderFlagsDisableLiquidityPoolTradingFlag", - 2: "LedgerHeaderFlagsDisableLiquidityPoolDepositFlag", - 4: "LedgerHeaderFlagsDisableLiquidityPoolWithdrawalFlag", +type BucketEntry struct { + Type BucketEntryType + LiveEntry *LedgerEntry + DeadEntry *LedgerKey + MetaEntry *BucketMetadata } -// ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for LedgerHeaderFlags -func (e LedgerHeaderFlags) ValidEnum(v int32) bool { - _, ok := ledgerHeaderFlagsMap[v] - return ok +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u BucketEntry) SwitchFieldName() string { + return "Type" } -// String returns the name of `e` -func (e LedgerHeaderFlags) String() string { - name, _ := ledgerHeaderFlagsMap[int32(e)] - return name +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of BucketEntry +func (u BucketEntry) ArmForSwitch(sw int32) (string, bool) { + switch BucketEntryType(sw) { + case BucketEntryTypeLiveentry: + return "LiveEntry", true + case BucketEntryTypeInitentry: + return "LiveEntry", true + case BucketEntryTypeDeadentry: + return "DeadEntry", true + case BucketEntryTypeMetaentry: + return "MetaEntry", true + } + return "-", false } -// EncodeTo encodes this value using the Encoder. -func (e LedgerHeaderFlags) EncodeTo(enc *xdr.Encoder) error { - if _, ok := ledgerHeaderFlagsMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid LedgerHeaderFlags enum value", e) +// NewBucketEntry creates a new BucketEntry. +func NewBucketEntry(aType BucketEntryType, value interface{}) (result BucketEntry, err error) { + result.Type = aType + switch BucketEntryType(aType) { + case BucketEntryTypeLiveentry: + tv, ok := value.(LedgerEntry) + if !ok { + err = errors.New("invalid value, must be LedgerEntry") + return + } + result.LiveEntry = &tv + case BucketEntryTypeInitentry: + tv, ok := value.(LedgerEntry) + if !ok { + err = errors.New("invalid value, must be LedgerEntry") + return + } + result.LiveEntry = &tv + case BucketEntryTypeDeadentry: + tv, ok := value.(LedgerKey) + if !ok { + err = errors.New("invalid value, must be LedgerKey") + return + } + result.DeadEntry = &tv + case BucketEntryTypeMetaentry: + tv, ok := value.(BucketMetadata) + if !ok { + err = errors.New("invalid value, must be BucketMetadata") + return + } + result.MetaEntry = &tv } - _, err := enc.EncodeInt(int32(e)) - return err + return } -var _ decoderFrom = (*LedgerHeaderFlags)(nil) - -// DecodeFrom decodes this value using the Decoder. -func (e *LedgerHeaderFlags) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +// MustLiveEntry retrieves the LiveEntry value from the union, +// panicing if the value is not set. +func (u BucketEntry) MustLiveEntry() LedgerEntry { + val, ok := u.GetLiveEntry() + + if !ok { + panic("arm LiveEntry is not set") + } + + return val +} + +// GetLiveEntry retrieves the LiveEntry value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u BucketEntry) GetLiveEntry() (result LedgerEntry, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "LiveEntry" { + result = *u.LiveEntry + ok = true + } + + return +} + +// MustDeadEntry retrieves the DeadEntry value from the union, +// panicing if the value is not set. +func (u BucketEntry) MustDeadEntry() LedgerKey { + val, ok := u.GetDeadEntry() + + if !ok { + panic("arm DeadEntry is not set") + } + + return val +} + +// GetDeadEntry retrieves the DeadEntry value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u BucketEntry) GetDeadEntry() (result LedgerKey, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "DeadEntry" { + result = *u.DeadEntry + ok = true + } + + return +} + +// MustMetaEntry retrieves the MetaEntry value from the union, +// panicing if the value is not set. +func (u BucketEntry) MustMetaEntry() BucketMetadata { + val, ok := u.GetMetaEntry() + + if !ok { + panic("arm MetaEntry is not set") + } + + return val +} + +// GetMetaEntry retrieves the MetaEntry value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u BucketEntry) GetMetaEntry() (result BucketMetadata, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "MetaEntry" { + result = *u.MetaEntry + ok = true + } + + return +} + +// EncodeTo encodes this value using the Encoder. +func (u BucketEntry) EncodeTo(e *xdr.Encoder) error { + var err error + if err = u.Type.EncodeTo(e); err != nil { + return err + } + switch BucketEntryType(u.Type) { + case BucketEntryTypeLiveentry: + if err = (*u.LiveEntry).EncodeTo(e); err != nil { + return err + } + return nil + case BucketEntryTypeInitentry: + if err = (*u.LiveEntry).EncodeTo(e); err != nil { + return err + } + return nil + case BucketEntryTypeDeadentry: + if err = (*u.DeadEntry).EncodeTo(e); err != nil { + return err + } + return nil + case BucketEntryTypeMetaentry: + if err = (*u.MetaEntry).EncodeTo(e); err != nil { + return err + } + return nil + } + return fmt.Errorf("Type (BucketEntryType) switch value '%d' is not valid for union BucketEntry", u.Type) +} + +var _ decoderFrom = (*BucketEntry)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (u *BucketEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerHeaderFlags: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding BucketEntry: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - v, n, err := d.DecodeInt() + var err error + var n, nTmp int + nTmp, err = u.Type.DecodeFrom(d, maxDepth) + n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerHeaderFlags: %w", err) + return n, fmt.Errorf("decoding BucketEntryType: %w", err) } - if _, ok := ledgerHeaderFlagsMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid LedgerHeaderFlags enum value", v) + switch BucketEntryType(u.Type) { + case BucketEntryTypeLiveentry: + u.LiveEntry = new(LedgerEntry) + nTmp, err = (*u.LiveEntry).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerEntry: %w", err) + } + return n, nil + case BucketEntryTypeInitentry: + u.LiveEntry = new(LedgerEntry) + nTmp, err = (*u.LiveEntry).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerEntry: %w", err) + } + return n, nil + case BucketEntryTypeDeadentry: + u.DeadEntry = new(LedgerKey) + nTmp, err = (*u.DeadEntry).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerKey: %w", err) + } + return n, nil + case BucketEntryTypeMetaentry: + u.MetaEntry = new(BucketMetadata) + nTmp, err = (*u.MetaEntry).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding BucketMetadata: %w", err) + } + return n, nil } - *e = LedgerHeaderFlags(v) - return n, nil + return n, fmt.Errorf("union BucketEntry has invalid Type (BucketEntryType) switch value '%d'", u.Type) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerHeaderFlags) MarshalBinary() ([]byte, error) { +func (s BucketEntry) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -11704,7 +11976,7 @@ func (s LedgerHeaderFlags) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerHeaderFlags) UnmarshalBinary(inp []byte) error { +func (s *BucketEntry) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -11714,91 +11986,253 @@ func (s *LedgerHeaderFlags) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerHeaderFlags)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerHeaderFlags)(nil) + _ encoding.BinaryMarshaler = (*BucketEntry)(nil) + _ encoding.BinaryUnmarshaler = (*BucketEntry)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerHeaderFlags) xdrType() {} +func (s BucketEntry) xdrType() {} -var _ xdrType = (*LedgerHeaderFlags)(nil) +var _ xdrType = (*BucketEntry)(nil) -// LedgerHeaderExtensionV1Ext is an XDR NestedUnion defines as: +// HotArchiveBucketEntry is an XDR Union defines as: // -// union switch (int v) -// { -// case 0: -// void; -// } -type LedgerHeaderExtensionV1Ext struct { - V int32 +// union HotArchiveBucketEntry switch (HotArchiveBucketEntryType type) +// { +// case HOT_ARCHIVE_ARCHIVED: +// LedgerEntry archivedEntry; +// +// case HOT_ARCHIVE_LIVE: +// case HOT_ARCHIVE_DELETED: +// LedgerKey key; +// case HOT_ARCHIVE_METAENTRY: +// BucketMetadata metaEntry; +// }; +type HotArchiveBucketEntry struct { + Type HotArchiveBucketEntryType + ArchivedEntry *LedgerEntry + Key *LedgerKey + MetaEntry *BucketMetadata } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u LedgerHeaderExtensionV1Ext) SwitchFieldName() string { - return "V" +func (u HotArchiveBucketEntry) SwitchFieldName() string { + return "Type" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of LedgerHeaderExtensionV1Ext -func (u LedgerHeaderExtensionV1Ext) ArmForSwitch(sw int32) (string, bool) { - switch int32(sw) { - case 0: - return "", true +// the value for an instance of HotArchiveBucketEntry +func (u HotArchiveBucketEntry) ArmForSwitch(sw int32) (string, bool) { + switch HotArchiveBucketEntryType(sw) { + case HotArchiveBucketEntryTypeHotArchiveArchived: + return "ArchivedEntry", true + case HotArchiveBucketEntryTypeHotArchiveLive: + return "Key", true + case HotArchiveBucketEntryTypeHotArchiveDeleted: + return "Key", true + case HotArchiveBucketEntryTypeHotArchiveMetaentry: + return "MetaEntry", true } return "-", false } -// NewLedgerHeaderExtensionV1Ext creates a new LedgerHeaderExtensionV1Ext. -func NewLedgerHeaderExtensionV1Ext(v int32, value interface{}) (result LedgerHeaderExtensionV1Ext, err error) { - result.V = v - switch int32(v) { - case 0: - // void +// NewHotArchiveBucketEntry creates a new HotArchiveBucketEntry. +func NewHotArchiveBucketEntry(aType HotArchiveBucketEntryType, value interface{}) (result HotArchiveBucketEntry, err error) { + result.Type = aType + switch HotArchiveBucketEntryType(aType) { + case HotArchiveBucketEntryTypeHotArchiveArchived: + tv, ok := value.(LedgerEntry) + if !ok { + err = errors.New("invalid value, must be LedgerEntry") + return + } + result.ArchivedEntry = &tv + case HotArchiveBucketEntryTypeHotArchiveLive: + tv, ok := value.(LedgerKey) + if !ok { + err = errors.New("invalid value, must be LedgerKey") + return + } + result.Key = &tv + case HotArchiveBucketEntryTypeHotArchiveDeleted: + tv, ok := value.(LedgerKey) + if !ok { + err = errors.New("invalid value, must be LedgerKey") + return + } + result.Key = &tv + case HotArchiveBucketEntryTypeHotArchiveMetaentry: + tv, ok := value.(BucketMetadata) + if !ok { + err = errors.New("invalid value, must be BucketMetadata") + return + } + result.MetaEntry = &tv + } + return +} + +// MustArchivedEntry retrieves the ArchivedEntry value from the union, +// panicing if the value is not set. +func (u HotArchiveBucketEntry) MustArchivedEntry() LedgerEntry { + val, ok := u.GetArchivedEntry() + + if !ok { + panic("arm ArchivedEntry is not set") + } + + return val +} + +// GetArchivedEntry retrieves the ArchivedEntry value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u HotArchiveBucketEntry) GetArchivedEntry() (result LedgerEntry, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "ArchivedEntry" { + result = *u.ArchivedEntry + ok = true + } + + return +} + +// MustKey retrieves the Key value from the union, +// panicing if the value is not set. +func (u HotArchiveBucketEntry) MustKey() LedgerKey { + val, ok := u.GetKey() + + if !ok { + panic("arm Key is not set") + } + + return val +} + +// GetKey retrieves the Key value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u HotArchiveBucketEntry) GetKey() (result LedgerKey, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "Key" { + result = *u.Key + ok = true + } + + return +} + +// MustMetaEntry retrieves the MetaEntry value from the union, +// panicing if the value is not set. +func (u HotArchiveBucketEntry) MustMetaEntry() BucketMetadata { + val, ok := u.GetMetaEntry() + + if !ok { + panic("arm MetaEntry is not set") + } + + return val +} + +// GetMetaEntry retrieves the MetaEntry value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u HotArchiveBucketEntry) GetMetaEntry() (result BucketMetadata, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "MetaEntry" { + result = *u.MetaEntry + ok = true } + return } // EncodeTo encodes this value using the Encoder. -func (u LedgerHeaderExtensionV1Ext) EncodeTo(e *xdr.Encoder) error { +func (u HotArchiveBucketEntry) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeInt(int32(u.V)); err != nil { + if err = u.Type.EncodeTo(e); err != nil { return err } - switch int32(u.V) { - case 0: - // Void + switch HotArchiveBucketEntryType(u.Type) { + case HotArchiveBucketEntryTypeHotArchiveArchived: + if err = (*u.ArchivedEntry).EncodeTo(e); err != nil { + return err + } + return nil + case HotArchiveBucketEntryTypeHotArchiveLive: + if err = (*u.Key).EncodeTo(e); err != nil { + return err + } + return nil + case HotArchiveBucketEntryTypeHotArchiveDeleted: + if err = (*u.Key).EncodeTo(e); err != nil { + return err + } + return nil + case HotArchiveBucketEntryTypeHotArchiveMetaentry: + if err = (*u.MetaEntry).EncodeTo(e); err != nil { + return err + } return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerHeaderExtensionV1Ext", u.V) + return fmt.Errorf("Type (HotArchiveBucketEntryType) switch value '%d' is not valid for union HotArchiveBucketEntry", u.Type) } -var _ decoderFrom = (*LedgerHeaderExtensionV1Ext)(nil) +var _ decoderFrom = (*HotArchiveBucketEntry)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *LedgerHeaderExtensionV1Ext) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *HotArchiveBucketEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerHeaderExtensionV1Ext: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding HotArchiveBucketEntry: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - u.V, nTmp, err = d.DecodeInt() + nTmp, err = u.Type.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int: %w", err) + return n, fmt.Errorf("decoding HotArchiveBucketEntryType: %w", err) } - switch int32(u.V) { - case 0: - // Void + switch HotArchiveBucketEntryType(u.Type) { + case HotArchiveBucketEntryTypeHotArchiveArchived: + u.ArchivedEntry = new(LedgerEntry) + nTmp, err = (*u.ArchivedEntry).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerEntry: %w", err) + } + return n, nil + case HotArchiveBucketEntryTypeHotArchiveLive: + u.Key = new(LedgerKey) + nTmp, err = (*u.Key).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerKey: %w", err) + } + return n, nil + case HotArchiveBucketEntryTypeHotArchiveDeleted: + u.Key = new(LedgerKey) + nTmp, err = (*u.Key).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerKey: %w", err) + } + return n, nil + case HotArchiveBucketEntryTypeHotArchiveMetaentry: + u.MetaEntry = new(BucketMetadata) + nTmp, err = (*u.MetaEntry).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding BucketMetadata: %w", err) + } return n, nil } - return n, fmt.Errorf("union LedgerHeaderExtensionV1Ext has invalid V (int32) switch value '%d'", u.V) + return n, fmt.Errorf("union HotArchiveBucketEntry has invalid Type (HotArchiveBucketEntryType) switch value '%d'", u.Type) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerHeaderExtensionV1Ext) MarshalBinary() ([]byte, error) { +func (s HotArchiveBucketEntry) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -11806,7 +12240,7 @@ func (s LedgerHeaderExtensionV1Ext) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerHeaderExtensionV1Ext) UnmarshalBinary(inp []byte) error { +func (s *HotArchiveBucketEntry) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -11816,70 +12250,64 @@ func (s *LedgerHeaderExtensionV1Ext) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerHeaderExtensionV1Ext)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerHeaderExtensionV1Ext)(nil) + _ encoding.BinaryMarshaler = (*HotArchiveBucketEntry)(nil) + _ encoding.BinaryUnmarshaler = (*HotArchiveBucketEntry)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerHeaderExtensionV1Ext) xdrType() {} +func (s HotArchiveBucketEntry) xdrType() {} -var _ xdrType = (*LedgerHeaderExtensionV1Ext)(nil) +var _ xdrType = (*HotArchiveBucketEntry)(nil) -// LedgerHeaderExtensionV1 is an XDR Struct defines as: +// ColdArchiveArchivedLeaf is an XDR Struct defines as: // -// struct LedgerHeaderExtensionV1 +// struct ColdArchiveArchivedLeaf // { -// uint32 flags; // LedgerHeaderFlags -// -// union switch (int v) -// { -// case 0: -// void; -// } -// ext; +// uint32 index; +// LedgerEntry archivedEntry; // }; -type LedgerHeaderExtensionV1 struct { - Flags Uint32 - Ext LedgerHeaderExtensionV1Ext +type ColdArchiveArchivedLeaf struct { + Index Uint32 + ArchivedEntry LedgerEntry } // EncodeTo encodes this value using the Encoder. -func (s *LedgerHeaderExtensionV1) EncodeTo(e *xdr.Encoder) error { +func (s *ColdArchiveArchivedLeaf) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Flags.EncodeTo(e); err != nil { + if err = s.Index.EncodeTo(e); err != nil { return err } - if err = s.Ext.EncodeTo(e); err != nil { + if err = s.ArchivedEntry.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*LedgerHeaderExtensionV1)(nil) +var _ decoderFrom = (*ColdArchiveArchivedLeaf)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *LedgerHeaderExtensionV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ColdArchiveArchivedLeaf) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerHeaderExtensionV1: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ColdArchiveArchivedLeaf: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Flags.DecodeFrom(d, maxDepth) + nTmp, err = s.Index.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + nTmp, err = s.ArchivedEntry.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerHeaderExtensionV1Ext: %w", err) + return n, fmt.Errorf("decoding LedgerEntry: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerHeaderExtensionV1) MarshalBinary() ([]byte, error) { +func (s ColdArchiveArchivedLeaf) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -11887,7 +12315,7 @@ func (s LedgerHeaderExtensionV1) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerHeaderExtensionV1) UnmarshalBinary(inp []byte) error { +func (s *ColdArchiveArchivedLeaf) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -11897,141 +12325,139 @@ func (s *LedgerHeaderExtensionV1) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerHeaderExtensionV1)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerHeaderExtensionV1)(nil) + _ encoding.BinaryMarshaler = (*ColdArchiveArchivedLeaf)(nil) + _ encoding.BinaryUnmarshaler = (*ColdArchiveArchivedLeaf)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerHeaderExtensionV1) xdrType() {} +func (s ColdArchiveArchivedLeaf) xdrType() {} -var _ xdrType = (*LedgerHeaderExtensionV1)(nil) +var _ xdrType = (*ColdArchiveArchivedLeaf)(nil) -// LedgerHeaderExt is an XDR NestedUnion defines as: +// ColdArchiveDeletedLeaf is an XDR Struct defines as: // -// union switch (int v) -// { -// case 0: -// void; -// case 1: -// LedgerHeaderExtensionV1 v1; -// } -type LedgerHeaderExt struct { - V int32 - V1 *LedgerHeaderExtensionV1 -} - -// SwitchFieldName returns the field name in which this union's -// discriminant is stored -func (u LedgerHeaderExt) SwitchFieldName() string { - return "V" +// struct ColdArchiveDeletedLeaf +// { +// uint32 index; +// LedgerKey deletedKey; +// }; +type ColdArchiveDeletedLeaf struct { + Index Uint32 + DeletedKey LedgerKey } -// ArmForSwitch returns which field name should be used for storing -// the value for an instance of LedgerHeaderExt -func (u LedgerHeaderExt) ArmForSwitch(sw int32) (string, bool) { - switch int32(sw) { - case 0: - return "", true - case 1: - return "V1", true +// EncodeTo encodes this value using the Encoder. +func (s *ColdArchiveDeletedLeaf) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Index.EncodeTo(e); err != nil { + return err } - return "-", false -} - -// NewLedgerHeaderExt creates a new LedgerHeaderExt. -func NewLedgerHeaderExt(v int32, value interface{}) (result LedgerHeaderExt, err error) { - result.V = v - switch int32(v) { - case 0: - // void - case 1: - tv, ok := value.(LedgerHeaderExtensionV1) - if !ok { - err = errors.New("invalid value, must be LedgerHeaderExtensionV1") - return - } - result.V1 = &tv + if err = s.DeletedKey.EncodeTo(e); err != nil { + return err } - return + return nil } -// MustV1 retrieves the V1 value from the union, -// panicing if the value is not set. -func (u LedgerHeaderExt) MustV1() LedgerHeaderExtensionV1 { - val, ok := u.GetV1() +var _ decoderFrom = (*ColdArchiveDeletedLeaf)(nil) - if !ok { - panic("arm V1 is not set") +// DecodeFrom decodes this value using the Decoder. +func (s *ColdArchiveDeletedLeaf) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding ColdArchiveDeletedLeaf: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Index.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) } + nTmp, err = s.DeletedKey.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerKey: %w", err) + } + return n, nil +} - return val +// MarshalBinary implements encoding.BinaryMarshaler. +func (s ColdArchiveDeletedLeaf) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err } -// GetV1 retrieves the V1 value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u LedgerHeaderExt) GetV1() (result LedgerHeaderExtensionV1, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.V)) +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *ColdArchiveDeletedLeaf) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} - if armName == "V1" { - result = *u.V1 - ok = true - } +var ( + _ encoding.BinaryMarshaler = (*ColdArchiveDeletedLeaf)(nil) + _ encoding.BinaryUnmarshaler = (*ColdArchiveDeletedLeaf)(nil) +) - return +// xdrType signals that this type represents XDR values defined by this package. +func (s ColdArchiveDeletedLeaf) xdrType() {} + +var _ xdrType = (*ColdArchiveDeletedLeaf)(nil) + +// ColdArchiveBoundaryLeaf is an XDR Struct defines as: +// +// struct ColdArchiveBoundaryLeaf +// { +// uint32 index; +// bool isLowerBound; +// }; +type ColdArchiveBoundaryLeaf struct { + Index Uint32 + IsLowerBound bool } // EncodeTo encodes this value using the Encoder. -func (u LedgerHeaderExt) EncodeTo(e *xdr.Encoder) error { +func (s *ColdArchiveBoundaryLeaf) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeInt(int32(u.V)); err != nil { + if err = s.Index.EncodeTo(e); err != nil { return err } - switch int32(u.V) { - case 0: - // Void - return nil - case 1: - if err = (*u.V1).EncodeTo(e); err != nil { - return err - } - return nil + if _, err = e.EncodeBool(bool(s.IsLowerBound)); err != nil { + return err } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerHeaderExt", u.V) + return nil } -var _ decoderFrom = (*LedgerHeaderExt)(nil) +var _ decoderFrom = (*ColdArchiveBoundaryLeaf)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *LedgerHeaderExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ColdArchiveBoundaryLeaf) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerHeaderExt: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ColdArchiveBoundaryLeaf: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - u.V, nTmp, err = d.DecodeInt() + nTmp, err = s.Index.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - switch int32(u.V) { - case 0: - // Void - return n, nil - case 1: - u.V1 = new(LedgerHeaderExtensionV1) - nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerHeaderExtensionV1: %w", err) - } - return n, nil + s.IsLowerBound, nTmp, err = d.DecodeBool() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Bool: %w", err) } - return n, fmt.Errorf("union LedgerHeaderExt has invalid V (int32) switch value '%d'", u.V) + return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerHeaderExt) MarshalBinary() ([]byte, error) { +func (s ColdArchiveBoundaryLeaf) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -12039,7 +12465,7 @@ func (s LedgerHeaderExt) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerHeaderExt) UnmarshalBinary(inp []byte) error { +func (s *ColdArchiveBoundaryLeaf) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -12049,387 +12475,65 @@ func (s *LedgerHeaderExt) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerHeaderExt)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerHeaderExt)(nil) + _ encoding.BinaryMarshaler = (*ColdArchiveBoundaryLeaf)(nil) + _ encoding.BinaryUnmarshaler = (*ColdArchiveBoundaryLeaf)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerHeaderExt) xdrType() {} +func (s ColdArchiveBoundaryLeaf) xdrType() {} -var _ xdrType = (*LedgerHeaderExt)(nil) +var _ xdrType = (*ColdArchiveBoundaryLeaf)(nil) -// LedgerHeader is an XDR Struct defines as: +// ColdArchiveHashEntry is an XDR Struct defines as: // -// struct LedgerHeader +// struct ColdArchiveHashEntry // { -// uint32 ledgerVersion; // the protocol version of the ledger -// Hash previousLedgerHash; // hash of the previous ledger header -// StellarValue scpValue; // what consensus agreed to -// Hash txSetResultHash; // the TransactionResultSet that led to this ledger -// Hash bucketListHash; // hash of the ledger state -// -// uint32 ledgerSeq; // sequence number of this ledger -// -// int64 totalCoins; // total number of stroops in existence. -// // 10,000,000 stroops in 1 XLM -// -// int64 feePool; // fees burned since last inflation run -// uint32 inflationSeq; // inflation sequence number -// -// uint64 idPool; // last used global ID, used for generating objects -// -// uint32 baseFee; // base fee per operation in stroops -// uint32 baseReserve; // account base reserve in stroops -// -// uint32 maxTxSetSize; // maximum size a transaction set can be -// -// Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back -// // in time without walking the chain back ledger by ledger -// // each slot contains the oldest ledger that is mod of -// // either 50 5000 50000 or 500000 depending on index -// // skipList[0] mod(50), skipList[1] mod(5000), etc -// -// // reserved for future use -// union switch (int v) -// { -// case 0: -// void; -// case 1: -// LedgerHeaderExtensionV1 v1; -// } -// ext; +// uint32 index; +// uint32 level; +// Hash hash; // }; -type LedgerHeader struct { - LedgerVersion Uint32 - PreviousLedgerHash Hash - ScpValue StellarValue - TxSetResultHash Hash - BucketListHash Hash - LedgerSeq Uint32 - TotalCoins Int64 - FeePool Int64 - InflationSeq Uint32 - IdPool Uint64 - BaseFee Uint32 - BaseReserve Uint32 - MaxTxSetSize Uint32 - SkipList [4]Hash - Ext LedgerHeaderExt +type ColdArchiveHashEntry struct { + Index Uint32 + Level Uint32 + Hash Hash } // EncodeTo encodes this value using the Encoder. -func (s *LedgerHeader) EncodeTo(e *xdr.Encoder) error { +func (s *ColdArchiveHashEntry) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.LedgerVersion.EncodeTo(e); err != nil { - return err - } - if err = s.PreviousLedgerHash.EncodeTo(e); err != nil { - return err - } - if err = s.ScpValue.EncodeTo(e); err != nil { - return err - } - if err = s.TxSetResultHash.EncodeTo(e); err != nil { - return err - } - if err = s.BucketListHash.EncodeTo(e); err != nil { - return err - } - if err = s.LedgerSeq.EncodeTo(e); err != nil { + if err = s.Index.EncodeTo(e); err != nil { return err } - if err = s.TotalCoins.EncodeTo(e); err != nil { - return err - } - if err = s.FeePool.EncodeTo(e); err != nil { - return err - } - if err = s.InflationSeq.EncodeTo(e); err != nil { - return err - } - if err = s.IdPool.EncodeTo(e); err != nil { - return err - } - if err = s.BaseFee.EncodeTo(e); err != nil { - return err - } - if err = s.BaseReserve.EncodeTo(e); err != nil { + if err = s.Level.EncodeTo(e); err != nil { return err } - if err = s.MaxTxSetSize.EncodeTo(e); err != nil { - return err - } - for i := 0; i < len(s.SkipList); i++ { - if err = s.SkipList[i].EncodeTo(e); err != nil { - return err - } - } - if err = s.Ext.EncodeTo(e); err != nil { + if err = s.Hash.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*LedgerHeader)(nil) +var _ decoderFrom = (*ColdArchiveHashEntry)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *LedgerHeader) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ColdArchiveHashEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerHeader: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ColdArchiveHashEntry: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.LedgerVersion.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.PreviousLedgerHash.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - nTmp, err = s.ScpValue.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding StellarValue: %w", err) - } - nTmp, err = s.TxSetResultHash.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - nTmp, err = s.BucketListHash.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - nTmp, err = s.LedgerSeq.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.TotalCoins.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Int64: %w", err) - } - nTmp, err = s.FeePool.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Int64: %w", err) - } - nTmp, err = s.InflationSeq.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.IdPool.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - nTmp, err = s.BaseFee.DecodeFrom(d, maxDepth) + nTmp, err = s.Index.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.BaseReserve.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.MaxTxSetSize.DecodeFrom(d, maxDepth) + nTmp, err = s.Level.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) } - for i := 0; i < len(s.SkipList); i++ { - nTmp, err = s.SkipList[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - } - nTmp, err = s.Ext.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerHeaderExt: %w", err) - } - return n, nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerHeader) MarshalBinary() ([]byte, error) { - b := bytes.Buffer{} - e := xdr.NewEncoder(&b) - err := s.EncodeTo(e) - return b.Bytes(), err -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerHeader) UnmarshalBinary(inp []byte) error { - r := bytes.NewReader(inp) - o := xdr.DefaultDecodeOptions - o.MaxInputLen = len(inp) - d := xdr.NewDecoderWithOptions(r, o) - _, err := s.DecodeFrom(d, o.MaxDepth) - return err -} - -var ( - _ encoding.BinaryMarshaler = (*LedgerHeader)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerHeader)(nil) -) - -// xdrType signals that this type represents XDR values defined by this package. -func (s LedgerHeader) xdrType() {} - -var _ xdrType = (*LedgerHeader)(nil) - -// LedgerUpgradeType is an XDR Enum defines as: -// -// enum LedgerUpgradeType -// { -// LEDGER_UPGRADE_VERSION = 1, -// LEDGER_UPGRADE_BASE_FEE = 2, -// LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, -// LEDGER_UPGRADE_BASE_RESERVE = 4, -// LEDGER_UPGRADE_FLAGS = 5, -// LEDGER_UPGRADE_CONFIG = 6, -// LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7 -// }; -type LedgerUpgradeType int32 - -const ( - LedgerUpgradeTypeLedgerUpgradeVersion LedgerUpgradeType = 1 - LedgerUpgradeTypeLedgerUpgradeBaseFee LedgerUpgradeType = 2 - LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize LedgerUpgradeType = 3 - LedgerUpgradeTypeLedgerUpgradeBaseReserve LedgerUpgradeType = 4 - LedgerUpgradeTypeLedgerUpgradeFlags LedgerUpgradeType = 5 - LedgerUpgradeTypeLedgerUpgradeConfig LedgerUpgradeType = 6 - LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize LedgerUpgradeType = 7 -) - -var ledgerUpgradeTypeMap = map[int32]string{ - 1: "LedgerUpgradeTypeLedgerUpgradeVersion", - 2: "LedgerUpgradeTypeLedgerUpgradeBaseFee", - 3: "LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize", - 4: "LedgerUpgradeTypeLedgerUpgradeBaseReserve", - 5: "LedgerUpgradeTypeLedgerUpgradeFlags", - 6: "LedgerUpgradeTypeLedgerUpgradeConfig", - 7: "LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize", -} - -// ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for LedgerUpgradeType -func (e LedgerUpgradeType) ValidEnum(v int32) bool { - _, ok := ledgerUpgradeTypeMap[v] - return ok -} - -// String returns the name of `e` -func (e LedgerUpgradeType) String() string { - name, _ := ledgerUpgradeTypeMap[int32(e)] - return name -} - -// EncodeTo encodes this value using the Encoder. -func (e LedgerUpgradeType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := ledgerUpgradeTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid LedgerUpgradeType enum value", e) - } - _, err := enc.EncodeInt(int32(e)) - return err -} - -var _ decoderFrom = (*LedgerUpgradeType)(nil) - -// DecodeFrom decodes this value using the Decoder. -func (e *LedgerUpgradeType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { - if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerUpgradeType: %w", ErrMaxDecodingDepthReached) - } - maxDepth -= 1 - v, n, err := d.DecodeInt() - if err != nil { - return n, fmt.Errorf("decoding LedgerUpgradeType: %w", err) - } - if _, ok := ledgerUpgradeTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid LedgerUpgradeType enum value", v) - } - *e = LedgerUpgradeType(v) - return n, nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerUpgradeType) MarshalBinary() ([]byte, error) { - b := bytes.Buffer{} - e := xdr.NewEncoder(&b) - err := s.EncodeTo(e) - return b.Bytes(), err -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerUpgradeType) UnmarshalBinary(inp []byte) error { - r := bytes.NewReader(inp) - o := xdr.DefaultDecodeOptions - o.MaxInputLen = len(inp) - d := xdr.NewDecoderWithOptions(r, o) - _, err := s.DecodeFrom(d, o.MaxDepth) - return err -} - -var ( - _ encoding.BinaryMarshaler = (*LedgerUpgradeType)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerUpgradeType)(nil) -) - -// xdrType signals that this type represents XDR values defined by this package. -func (s LedgerUpgradeType) xdrType() {} - -var _ xdrType = (*LedgerUpgradeType)(nil) - -// ConfigUpgradeSetKey is an XDR Struct defines as: -// -// struct ConfigUpgradeSetKey { -// Hash contractID; -// Hash contentHash; -// }; -type ConfigUpgradeSetKey struct { - ContractId Hash - ContentHash Hash -} - -// EncodeTo encodes this value using the Encoder. -func (s *ConfigUpgradeSetKey) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.ContractId.EncodeTo(e); err != nil { - return err - } - if err = s.ContentHash.EncodeTo(e); err != nil { - return err - } - return nil -} - -var _ decoderFrom = (*ConfigUpgradeSetKey)(nil) - -// DecodeFrom decodes this value using the Decoder. -func (s *ConfigUpgradeSetKey) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { - if maxDepth == 0 { - return 0, fmt.Errorf("decoding ConfigUpgradeSetKey: %w", ErrMaxDecodingDepthReached) - } - maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.ContractId.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - nTmp, err = s.ContentHash.DecodeFrom(d, maxDepth) + nTmp, err = s.Hash.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Hash: %w", err) @@ -12438,7 +12542,7 @@ func (s *ConfigUpgradeSetKey) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, er } // MarshalBinary implements encoding.BinaryMarshaler. -func (s ConfigUpgradeSetKey) MarshalBinary() ([]byte, error) { +func (s ColdArchiveHashEntry) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -12446,7 +12550,7 @@ func (s ConfigUpgradeSetKey) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *ConfigUpgradeSetKey) UnmarshalBinary(inp []byte) error { +func (s *ColdArchiveHashEntry) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -12456,360 +12560,273 @@ func (s *ConfigUpgradeSetKey) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*ConfigUpgradeSetKey)(nil) - _ encoding.BinaryUnmarshaler = (*ConfigUpgradeSetKey)(nil) + _ encoding.BinaryMarshaler = (*ColdArchiveHashEntry)(nil) + _ encoding.BinaryUnmarshaler = (*ColdArchiveHashEntry)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s ConfigUpgradeSetKey) xdrType() {} +func (s ColdArchiveHashEntry) xdrType() {} -var _ xdrType = (*ConfigUpgradeSetKey)(nil) +var _ xdrType = (*ColdArchiveHashEntry)(nil) -// LedgerUpgrade is an XDR Union defines as: +// ColdArchiveBucketEntry is an XDR Union defines as: // -// union LedgerUpgrade switch (LedgerUpgradeType type) +// union ColdArchiveBucketEntry switch (ColdArchiveBucketEntryType type) // { -// case LEDGER_UPGRADE_VERSION: -// uint32 newLedgerVersion; // update ledgerVersion -// case LEDGER_UPGRADE_BASE_FEE: -// uint32 newBaseFee; // update baseFee -// case LEDGER_UPGRADE_MAX_TX_SET_SIZE: -// uint32 newMaxTxSetSize; // update maxTxSetSize -// case LEDGER_UPGRADE_BASE_RESERVE: -// uint32 newBaseReserve; // update baseReserve -// case LEDGER_UPGRADE_FLAGS: -// uint32 newFlags; // update flags -// case LEDGER_UPGRADE_CONFIG: -// // Update arbitrary `ConfigSetting` entries identified by the key. -// ConfigUpgradeSetKey newConfig; -// case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: -// // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without -// // using `LEDGER_UPGRADE_CONFIG`. -// uint32 newMaxSorobanTxSetSize; -// }; -type LedgerUpgrade struct { - Type LedgerUpgradeType - NewLedgerVersion *Uint32 - NewBaseFee *Uint32 - NewMaxTxSetSize *Uint32 - NewBaseReserve *Uint32 - NewFlags *Uint32 - NewConfig *ConfigUpgradeSetKey - NewMaxSorobanTxSetSize *Uint32 +// case COLD_ARCHIVE_METAENTRY: +// BucketMetadata metaEntry; +// case COLD_ARCHIVE_ARCHIVED_LEAF: +// ColdArchiveArchivedLeaf archivedLeaf; +// case COLD_ARCHIVE_DELETED_LEAF: +// ColdArchiveDeletedLeaf deletedLeaf; +// case COLD_ARCHIVE_BOUNDARY_LEAF: +// ColdArchiveBoundaryLeaf boundaryLeaf; +// case COLD_ARCHIVE_HASH: +// ColdArchiveHashEntry hashEntry; +// }; +type ColdArchiveBucketEntry struct { + Type ColdArchiveBucketEntryType + MetaEntry *BucketMetadata + ArchivedLeaf *ColdArchiveArchivedLeaf + DeletedLeaf *ColdArchiveDeletedLeaf + BoundaryLeaf *ColdArchiveBoundaryLeaf + HashEntry *ColdArchiveHashEntry } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u LedgerUpgrade) SwitchFieldName() string { +func (u ColdArchiveBucketEntry) SwitchFieldName() string { return "Type" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of LedgerUpgrade -func (u LedgerUpgrade) ArmForSwitch(sw int32) (string, bool) { - switch LedgerUpgradeType(sw) { - case LedgerUpgradeTypeLedgerUpgradeVersion: - return "NewLedgerVersion", true - case LedgerUpgradeTypeLedgerUpgradeBaseFee: - return "NewBaseFee", true - case LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize: - return "NewMaxTxSetSize", true - case LedgerUpgradeTypeLedgerUpgradeBaseReserve: - return "NewBaseReserve", true - case LedgerUpgradeTypeLedgerUpgradeFlags: - return "NewFlags", true - case LedgerUpgradeTypeLedgerUpgradeConfig: - return "NewConfig", true - case LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize: - return "NewMaxSorobanTxSetSize", true +// the value for an instance of ColdArchiveBucketEntry +func (u ColdArchiveBucketEntry) ArmForSwitch(sw int32) (string, bool) { + switch ColdArchiveBucketEntryType(sw) { + case ColdArchiveBucketEntryTypeColdArchiveMetaentry: + return "MetaEntry", true + case ColdArchiveBucketEntryTypeColdArchiveArchivedLeaf: + return "ArchivedLeaf", true + case ColdArchiveBucketEntryTypeColdArchiveDeletedLeaf: + return "DeletedLeaf", true + case ColdArchiveBucketEntryTypeColdArchiveBoundaryLeaf: + return "BoundaryLeaf", true + case ColdArchiveBucketEntryTypeColdArchiveHash: + return "HashEntry", true } return "-", false } -// NewLedgerUpgrade creates a new LedgerUpgrade. -func NewLedgerUpgrade(aType LedgerUpgradeType, value interface{}) (result LedgerUpgrade, err error) { +// NewColdArchiveBucketEntry creates a new ColdArchiveBucketEntry. +func NewColdArchiveBucketEntry(aType ColdArchiveBucketEntryType, value interface{}) (result ColdArchiveBucketEntry, err error) { result.Type = aType - switch LedgerUpgradeType(aType) { - case LedgerUpgradeTypeLedgerUpgradeVersion: - tv, ok := value.(Uint32) - if !ok { - err = errors.New("invalid value, must be Uint32") - return - } - result.NewLedgerVersion = &tv - case LedgerUpgradeTypeLedgerUpgradeBaseFee: - tv, ok := value.(Uint32) - if !ok { - err = errors.New("invalid value, must be Uint32") - return - } - result.NewBaseFee = &tv - case LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize: - tv, ok := value.(Uint32) + switch ColdArchiveBucketEntryType(aType) { + case ColdArchiveBucketEntryTypeColdArchiveMetaentry: + tv, ok := value.(BucketMetadata) if !ok { - err = errors.New("invalid value, must be Uint32") + err = errors.New("invalid value, must be BucketMetadata") return } - result.NewMaxTxSetSize = &tv - case LedgerUpgradeTypeLedgerUpgradeBaseReserve: - tv, ok := value.(Uint32) + result.MetaEntry = &tv + case ColdArchiveBucketEntryTypeColdArchiveArchivedLeaf: + tv, ok := value.(ColdArchiveArchivedLeaf) if !ok { - err = errors.New("invalid value, must be Uint32") + err = errors.New("invalid value, must be ColdArchiveArchivedLeaf") return } - result.NewBaseReserve = &tv - case LedgerUpgradeTypeLedgerUpgradeFlags: - tv, ok := value.(Uint32) + result.ArchivedLeaf = &tv + case ColdArchiveBucketEntryTypeColdArchiveDeletedLeaf: + tv, ok := value.(ColdArchiveDeletedLeaf) if !ok { - err = errors.New("invalid value, must be Uint32") + err = errors.New("invalid value, must be ColdArchiveDeletedLeaf") return } - result.NewFlags = &tv - case LedgerUpgradeTypeLedgerUpgradeConfig: - tv, ok := value.(ConfigUpgradeSetKey) + result.DeletedLeaf = &tv + case ColdArchiveBucketEntryTypeColdArchiveBoundaryLeaf: + tv, ok := value.(ColdArchiveBoundaryLeaf) if !ok { - err = errors.New("invalid value, must be ConfigUpgradeSetKey") + err = errors.New("invalid value, must be ColdArchiveBoundaryLeaf") return } - result.NewConfig = &tv - case LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize: - tv, ok := value.(Uint32) + result.BoundaryLeaf = &tv + case ColdArchiveBucketEntryTypeColdArchiveHash: + tv, ok := value.(ColdArchiveHashEntry) if !ok { - err = errors.New("invalid value, must be Uint32") + err = errors.New("invalid value, must be ColdArchiveHashEntry") return } - result.NewMaxSorobanTxSetSize = &tv + result.HashEntry = &tv } return } -// MustNewLedgerVersion retrieves the NewLedgerVersion value from the union, +// MustMetaEntry retrieves the MetaEntry value from the union, // panicing if the value is not set. -func (u LedgerUpgrade) MustNewLedgerVersion() Uint32 { - val, ok := u.GetNewLedgerVersion() +func (u ColdArchiveBucketEntry) MustMetaEntry() BucketMetadata { + val, ok := u.GetMetaEntry() if !ok { - panic("arm NewLedgerVersion is not set") + panic("arm MetaEntry is not set") } return val } -// GetNewLedgerVersion retrieves the NewLedgerVersion value from the union, +// GetMetaEntry retrieves the MetaEntry value from the union, // returning ok if the union's switch indicated the value is valid. -func (u LedgerUpgrade) GetNewLedgerVersion() (result Uint32, ok bool) { +func (u ColdArchiveBucketEntry) GetMetaEntry() (result BucketMetadata, ok bool) { armName, _ := u.ArmForSwitch(int32(u.Type)) - if armName == "NewLedgerVersion" { - result = *u.NewLedgerVersion + if armName == "MetaEntry" { + result = *u.MetaEntry ok = true } return } -// MustNewBaseFee retrieves the NewBaseFee value from the union, +// MustArchivedLeaf retrieves the ArchivedLeaf value from the union, // panicing if the value is not set. -func (u LedgerUpgrade) MustNewBaseFee() Uint32 { - val, ok := u.GetNewBaseFee() +func (u ColdArchiveBucketEntry) MustArchivedLeaf() ColdArchiveArchivedLeaf { + val, ok := u.GetArchivedLeaf() if !ok { - panic("arm NewBaseFee is not set") + panic("arm ArchivedLeaf is not set") } return val } -// GetNewBaseFee retrieves the NewBaseFee value from the union, +// GetArchivedLeaf retrieves the ArchivedLeaf value from the union, // returning ok if the union's switch indicated the value is valid. -func (u LedgerUpgrade) GetNewBaseFee() (result Uint32, ok bool) { +func (u ColdArchiveBucketEntry) GetArchivedLeaf() (result ColdArchiveArchivedLeaf, ok bool) { armName, _ := u.ArmForSwitch(int32(u.Type)) - if armName == "NewBaseFee" { - result = *u.NewBaseFee + if armName == "ArchivedLeaf" { + result = *u.ArchivedLeaf ok = true } return } -// MustNewMaxTxSetSize retrieves the NewMaxTxSetSize value from the union, +// MustDeletedLeaf retrieves the DeletedLeaf value from the union, // panicing if the value is not set. -func (u LedgerUpgrade) MustNewMaxTxSetSize() Uint32 { - val, ok := u.GetNewMaxTxSetSize() +func (u ColdArchiveBucketEntry) MustDeletedLeaf() ColdArchiveDeletedLeaf { + val, ok := u.GetDeletedLeaf() if !ok { - panic("arm NewMaxTxSetSize is not set") + panic("arm DeletedLeaf is not set") } return val } -// GetNewMaxTxSetSize retrieves the NewMaxTxSetSize value from the union, +// GetDeletedLeaf retrieves the DeletedLeaf value from the union, // returning ok if the union's switch indicated the value is valid. -func (u LedgerUpgrade) GetNewMaxTxSetSize() (result Uint32, ok bool) { +func (u ColdArchiveBucketEntry) GetDeletedLeaf() (result ColdArchiveDeletedLeaf, ok bool) { armName, _ := u.ArmForSwitch(int32(u.Type)) - if armName == "NewMaxTxSetSize" { - result = *u.NewMaxTxSetSize + if armName == "DeletedLeaf" { + result = *u.DeletedLeaf ok = true } return } -// MustNewBaseReserve retrieves the NewBaseReserve value from the union, +// MustBoundaryLeaf retrieves the BoundaryLeaf value from the union, // panicing if the value is not set. -func (u LedgerUpgrade) MustNewBaseReserve() Uint32 { - val, ok := u.GetNewBaseReserve() +func (u ColdArchiveBucketEntry) MustBoundaryLeaf() ColdArchiveBoundaryLeaf { + val, ok := u.GetBoundaryLeaf() if !ok { - panic("arm NewBaseReserve is not set") + panic("arm BoundaryLeaf is not set") } return val } -// GetNewBaseReserve retrieves the NewBaseReserve value from the union, +// GetBoundaryLeaf retrieves the BoundaryLeaf value from the union, // returning ok if the union's switch indicated the value is valid. -func (u LedgerUpgrade) GetNewBaseReserve() (result Uint32, ok bool) { +func (u ColdArchiveBucketEntry) GetBoundaryLeaf() (result ColdArchiveBoundaryLeaf, ok bool) { armName, _ := u.ArmForSwitch(int32(u.Type)) - if armName == "NewBaseReserve" { - result = *u.NewBaseReserve + if armName == "BoundaryLeaf" { + result = *u.BoundaryLeaf ok = true } return } -// MustNewFlags retrieves the NewFlags value from the union, +// MustHashEntry retrieves the HashEntry value from the union, // panicing if the value is not set. -func (u LedgerUpgrade) MustNewFlags() Uint32 { - val, ok := u.GetNewFlags() +func (u ColdArchiveBucketEntry) MustHashEntry() ColdArchiveHashEntry { + val, ok := u.GetHashEntry() if !ok { - panic("arm NewFlags is not set") + panic("arm HashEntry is not set") } return val } -// GetNewFlags retrieves the NewFlags value from the union, +// GetHashEntry retrieves the HashEntry value from the union, // returning ok if the union's switch indicated the value is valid. -func (u LedgerUpgrade) GetNewFlags() (result Uint32, ok bool) { +func (u ColdArchiveBucketEntry) GetHashEntry() (result ColdArchiveHashEntry, ok bool) { armName, _ := u.ArmForSwitch(int32(u.Type)) - if armName == "NewFlags" { - result = *u.NewFlags + if armName == "HashEntry" { + result = *u.HashEntry ok = true } return } -// MustNewConfig retrieves the NewConfig value from the union, -// panicing if the value is not set. -func (u LedgerUpgrade) MustNewConfig() ConfigUpgradeSetKey { - val, ok := u.GetNewConfig() - - if !ok { - panic("arm NewConfig is not set") +// EncodeTo encodes this value using the Encoder. +func (u ColdArchiveBucketEntry) EncodeTo(e *xdr.Encoder) error { + var err error + if err = u.Type.EncodeTo(e); err != nil { + return err } - - return val + switch ColdArchiveBucketEntryType(u.Type) { + case ColdArchiveBucketEntryTypeColdArchiveMetaentry: + if err = (*u.MetaEntry).EncodeTo(e); err != nil { + return err + } + return nil + case ColdArchiveBucketEntryTypeColdArchiveArchivedLeaf: + if err = (*u.ArchivedLeaf).EncodeTo(e); err != nil { + return err + } + return nil + case ColdArchiveBucketEntryTypeColdArchiveDeletedLeaf: + if err = (*u.DeletedLeaf).EncodeTo(e); err != nil { + return err + } + return nil + case ColdArchiveBucketEntryTypeColdArchiveBoundaryLeaf: + if err = (*u.BoundaryLeaf).EncodeTo(e); err != nil { + return err + } + return nil + case ColdArchiveBucketEntryTypeColdArchiveHash: + if err = (*u.HashEntry).EncodeTo(e); err != nil { + return err + } + return nil + } + return fmt.Errorf("Type (ColdArchiveBucketEntryType) switch value '%d' is not valid for union ColdArchiveBucketEntry", u.Type) } -// GetNewConfig retrieves the NewConfig value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u LedgerUpgrade) GetNewConfig() (result ConfigUpgradeSetKey, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "NewConfig" { - result = *u.NewConfig - ok = true - } - - return -} - -// MustNewMaxSorobanTxSetSize retrieves the NewMaxSorobanTxSetSize value from the union, -// panicing if the value is not set. -func (u LedgerUpgrade) MustNewMaxSorobanTxSetSize() Uint32 { - val, ok := u.GetNewMaxSorobanTxSetSize() - - if !ok { - panic("arm NewMaxSorobanTxSetSize is not set") - } - - return val -} - -// GetNewMaxSorobanTxSetSize retrieves the NewMaxSorobanTxSetSize value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u LedgerUpgrade) GetNewMaxSorobanTxSetSize() (result Uint32, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "NewMaxSorobanTxSetSize" { - result = *u.NewMaxSorobanTxSetSize - ok = true - } - - return -} - -// EncodeTo encodes this value using the Encoder. -func (u LedgerUpgrade) EncodeTo(e *xdr.Encoder) error { - var err error - if err = u.Type.EncodeTo(e); err != nil { - return err - } - switch LedgerUpgradeType(u.Type) { - case LedgerUpgradeTypeLedgerUpgradeVersion: - if err = (*u.NewLedgerVersion).EncodeTo(e); err != nil { - return err - } - return nil - case LedgerUpgradeTypeLedgerUpgradeBaseFee: - if err = (*u.NewBaseFee).EncodeTo(e); err != nil { - return err - } - return nil - case LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize: - if err = (*u.NewMaxTxSetSize).EncodeTo(e); err != nil { - return err - } - return nil - case LedgerUpgradeTypeLedgerUpgradeBaseReserve: - if err = (*u.NewBaseReserve).EncodeTo(e); err != nil { - return err - } - return nil - case LedgerUpgradeTypeLedgerUpgradeFlags: - if err = (*u.NewFlags).EncodeTo(e); err != nil { - return err - } - return nil - case LedgerUpgradeTypeLedgerUpgradeConfig: - if err = (*u.NewConfig).EncodeTo(e); err != nil { - return err - } - return nil - case LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize: - if err = (*u.NewMaxSorobanTxSetSize).EncodeTo(e); err != nil { - return err - } - return nil - } - return fmt.Errorf("Type (LedgerUpgradeType) switch value '%d' is not valid for union LedgerUpgrade", u.Type) -} - -var _ decoderFrom = (*LedgerUpgrade)(nil) +var _ decoderFrom = (*ColdArchiveBucketEntry)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *LedgerUpgrade) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *ColdArchiveBucketEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerUpgrade: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ColdArchiveBucketEntry: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -12817,71 +12834,55 @@ func (u *LedgerUpgrade) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { nTmp, err = u.Type.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerUpgradeType: %w", err) + return n, fmt.Errorf("decoding ColdArchiveBucketEntryType: %w", err) } - switch LedgerUpgradeType(u.Type) { - case LedgerUpgradeTypeLedgerUpgradeVersion: - u.NewLedgerVersion = new(Uint32) - nTmp, err = (*u.NewLedgerVersion).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - return n, nil - case LedgerUpgradeTypeLedgerUpgradeBaseFee: - u.NewBaseFee = new(Uint32) - nTmp, err = (*u.NewBaseFee).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - return n, nil - case LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize: - u.NewMaxTxSetSize = new(Uint32) - nTmp, err = (*u.NewMaxTxSetSize).DecodeFrom(d, maxDepth) + switch ColdArchiveBucketEntryType(u.Type) { + case ColdArchiveBucketEntryTypeColdArchiveMetaentry: + u.MetaEntry = new(BucketMetadata) + nTmp, err = (*u.MetaEntry).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding BucketMetadata: %w", err) } return n, nil - case LedgerUpgradeTypeLedgerUpgradeBaseReserve: - u.NewBaseReserve = new(Uint32) - nTmp, err = (*u.NewBaseReserve).DecodeFrom(d, maxDepth) + case ColdArchiveBucketEntryTypeColdArchiveArchivedLeaf: + u.ArchivedLeaf = new(ColdArchiveArchivedLeaf) + nTmp, err = (*u.ArchivedLeaf).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding ColdArchiveArchivedLeaf: %w", err) } return n, nil - case LedgerUpgradeTypeLedgerUpgradeFlags: - u.NewFlags = new(Uint32) - nTmp, err = (*u.NewFlags).DecodeFrom(d, maxDepth) + case ColdArchiveBucketEntryTypeColdArchiveDeletedLeaf: + u.DeletedLeaf = new(ColdArchiveDeletedLeaf) + nTmp, err = (*u.DeletedLeaf).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding ColdArchiveDeletedLeaf: %w", err) } return n, nil - case LedgerUpgradeTypeLedgerUpgradeConfig: - u.NewConfig = new(ConfigUpgradeSetKey) - nTmp, err = (*u.NewConfig).DecodeFrom(d, maxDepth) + case ColdArchiveBucketEntryTypeColdArchiveBoundaryLeaf: + u.BoundaryLeaf = new(ColdArchiveBoundaryLeaf) + nTmp, err = (*u.BoundaryLeaf).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ConfigUpgradeSetKey: %w", err) + return n, fmt.Errorf("decoding ColdArchiveBoundaryLeaf: %w", err) } return n, nil - case LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize: - u.NewMaxSorobanTxSetSize = new(Uint32) - nTmp, err = (*u.NewMaxSorobanTxSetSize).DecodeFrom(d, maxDepth) + case ColdArchiveBucketEntryTypeColdArchiveHash: + u.HashEntry = new(ColdArchiveHashEntry) + nTmp, err = (*u.HashEntry).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding ColdArchiveHashEntry: %w", err) } return n, nil } - return n, fmt.Errorf("union LedgerUpgrade has invalid Type (LedgerUpgradeType) switch value '%d'", u.Type) + return n, fmt.Errorf("union ColdArchiveBucketEntry has invalid Type (ColdArchiveBucketEntryType) switch value '%d'", u.Type) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerUpgrade) MarshalBinary() ([]byte, error) { +func (s ColdArchiveBucketEntry) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -12889,7 +12890,7 @@ func (s LedgerUpgrade) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerUpgrade) UnmarshalBinary(inp []byte) error { +func (s *ColdArchiveBucketEntry) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -12899,73 +12900,54 @@ func (s *LedgerUpgrade) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerUpgrade)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerUpgrade)(nil) + _ encoding.BinaryMarshaler = (*ColdArchiveBucketEntry)(nil) + _ encoding.BinaryUnmarshaler = (*ColdArchiveBucketEntry)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerUpgrade) xdrType() {} +func (s ColdArchiveBucketEntry) xdrType() {} -var _ xdrType = (*LedgerUpgrade)(nil) +var _ xdrType = (*ColdArchiveBucketEntry)(nil) -// ConfigUpgradeSet is an XDR Struct defines as: +// UpgradeType is an XDR Typedef defines as: // -// struct ConfigUpgradeSet { -// ConfigSettingEntry updatedEntry<>; -// }; -type ConfigUpgradeSet struct { - UpdatedEntry []ConfigSettingEntry +// typedef opaque UpgradeType<128>; +type UpgradeType []byte + +// XDRMaxSize implements the Sized interface for UpgradeType +func (e UpgradeType) XDRMaxSize() int { + return 128 } // EncodeTo encodes this value using the Encoder. -func (s *ConfigUpgradeSet) EncodeTo(e *xdr.Encoder) error { +func (s UpgradeType) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeUint(uint32(len(s.UpdatedEntry))); err != nil { + if _, err = e.EncodeOpaque(s[:]); err != nil { return err } - for i := 0; i < len(s.UpdatedEntry); i++ { - if err = s.UpdatedEntry[i].EncodeTo(e); err != nil { - return err - } - } return nil } -var _ decoderFrom = (*ConfigUpgradeSet)(nil) +var _ decoderFrom = (*UpgradeType)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *ConfigUpgradeSet) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *UpgradeType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding ConfigUpgradeSet: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding UpgradeType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - var l uint32 - l, nTmp, err = d.DecodeUint() + (*s), nTmp, err = d.DecodeOpaque(128) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ConfigSettingEntry: %w", err) - } - s.UpdatedEntry = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding ConfigSettingEntry: length (%d) exceeds remaining input length (%d)", l, il) - } - s.UpdatedEntry = make([]ConfigSettingEntry, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.UpdatedEntry[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding ConfigSettingEntry: %w", err) - } - } + return n, fmt.Errorf("decoding UpgradeType: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s ConfigUpgradeSet) MarshalBinary() ([]byte, error) { +func (s UpgradeType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -12973,7 +12955,7 @@ func (s ConfigUpgradeSet) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *ConfigUpgradeSet) UnmarshalBinary(inp []byte) error { +func (s *UpgradeType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -12983,85 +12965,77 @@ func (s *ConfigUpgradeSet) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*ConfigUpgradeSet)(nil) - _ encoding.BinaryUnmarshaler = (*ConfigUpgradeSet)(nil) + _ encoding.BinaryMarshaler = (*UpgradeType)(nil) + _ encoding.BinaryUnmarshaler = (*UpgradeType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s ConfigUpgradeSet) xdrType() {} +func (s UpgradeType) xdrType() {} -var _ xdrType = (*ConfigUpgradeSet)(nil) +var _ xdrType = (*UpgradeType)(nil) -// BucketEntryType is an XDR Enum defines as: +// StellarValueType is an XDR Enum defines as: // -// enum BucketEntryType +// enum StellarValueType // { -// METAENTRY = -// -1, // At-and-after protocol 11: bucket metadata, should come first. -// LIVEENTRY = 0, // Before protocol 11: created-or-updated; -// // At-and-after protocol 11: only updated. -// DEADENTRY = 1, -// INITENTRY = 2 // At-and-after protocol 11: only created. +// STELLAR_VALUE_BASIC = 0, +// STELLAR_VALUE_SIGNED = 1 // }; -type BucketEntryType int32 +type StellarValueType int32 const ( - BucketEntryTypeMetaentry BucketEntryType = -1 - BucketEntryTypeLiveentry BucketEntryType = 0 - BucketEntryTypeDeadentry BucketEntryType = 1 - BucketEntryTypeInitentry BucketEntryType = 2 + StellarValueTypeStellarValueBasic StellarValueType = 0 + StellarValueTypeStellarValueSigned StellarValueType = 1 ) -var bucketEntryTypeMap = map[int32]string{ - -1: "BucketEntryTypeMetaentry", - 0: "BucketEntryTypeLiveentry", - 1: "BucketEntryTypeDeadentry", - 2: "BucketEntryTypeInitentry", +var stellarValueTypeMap = map[int32]string{ + 0: "StellarValueTypeStellarValueBasic", + 1: "StellarValueTypeStellarValueSigned", } // ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for BucketEntryType -func (e BucketEntryType) ValidEnum(v int32) bool { - _, ok := bucketEntryTypeMap[v] +// the Enum interface for StellarValueType +func (e StellarValueType) ValidEnum(v int32) bool { + _, ok := stellarValueTypeMap[v] return ok } // String returns the name of `e` -func (e BucketEntryType) String() string { - name, _ := bucketEntryTypeMap[int32(e)] +func (e StellarValueType) String() string { + name, _ := stellarValueTypeMap[int32(e)] return name } // EncodeTo encodes this value using the Encoder. -func (e BucketEntryType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := bucketEntryTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid BucketEntryType enum value", e) +func (e StellarValueType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := stellarValueTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid StellarValueType enum value", e) } _, err := enc.EncodeInt(int32(e)) return err } -var _ decoderFrom = (*BucketEntryType)(nil) +var _ decoderFrom = (*StellarValueType)(nil) // DecodeFrom decodes this value using the Decoder. -func (e *BucketEntryType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *StellarValueType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding BucketEntryType: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding StellarValueType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding BucketEntryType: %w", err) + return n, fmt.Errorf("decoding StellarValueType: %w", err) } - if _, ok := bucketEntryTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid BucketEntryType enum value", v) + if _, ok := stellarValueTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid StellarValueType enum value", v) } - *e = BucketEntryType(v) + *e = StellarValueType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s BucketEntryType) MarshalBinary() ([]byte, error) { +func (s StellarValueType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -13069,7 +13043,7 @@ func (s BucketEntryType) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *BucketEntryType) UnmarshalBinary(inp []byte) error { +func (s *StellarValueType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -13079,91 +13053,216 @@ func (s *BucketEntryType) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*BucketEntryType)(nil) - _ encoding.BinaryUnmarshaler = (*BucketEntryType)(nil) + _ encoding.BinaryMarshaler = (*StellarValueType)(nil) + _ encoding.BinaryUnmarshaler = (*StellarValueType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s BucketEntryType) xdrType() {} +func (s StellarValueType) xdrType() {} -var _ xdrType = (*BucketEntryType)(nil) +var _ xdrType = (*StellarValueType)(nil) -// BucketMetadataExt is an XDR NestedUnion defines as: +// LedgerCloseValueSignature is an XDR Struct defines as: // -// union switch (int v) +// struct LedgerCloseValueSignature +// { +// NodeID nodeID; // which node introduced the value +// Signature signature; // nodeID's signature +// }; +type LedgerCloseValueSignature struct { + NodeId NodeId + Signature Signature +} + +// EncodeTo encodes this value using the Encoder. +func (s *LedgerCloseValueSignature) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.NodeId.EncodeTo(e); err != nil { + return err + } + if err = s.Signature.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*LedgerCloseValueSignature)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *LedgerCloseValueSignature) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding LedgerCloseValueSignature: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.NodeId.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding NodeId: %w", err) + } + nTmp, err = s.Signature.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Signature: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s LedgerCloseValueSignature) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *LedgerCloseValueSignature) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*LedgerCloseValueSignature)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerCloseValueSignature)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s LedgerCloseValueSignature) xdrType() {} + +var _ xdrType = (*LedgerCloseValueSignature)(nil) + +// StellarValueExt is an XDR NestedUnion defines as: +// +// union switch (StellarValueType v) // { -// case 0: +// case STELLAR_VALUE_BASIC: // void; +// case STELLAR_VALUE_SIGNED: +// LedgerCloseValueSignature lcValueSignature; // } -type BucketMetadataExt struct { - V int32 +type StellarValueExt struct { + V StellarValueType + LcValueSignature *LedgerCloseValueSignature } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u BucketMetadataExt) SwitchFieldName() string { +func (u StellarValueExt) SwitchFieldName() string { return "V" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of BucketMetadataExt -func (u BucketMetadataExt) ArmForSwitch(sw int32) (string, bool) { - switch int32(sw) { - case 0: +// the value for an instance of StellarValueExt +func (u StellarValueExt) ArmForSwitch(sw int32) (string, bool) { + switch StellarValueType(sw) { + case StellarValueTypeStellarValueBasic: return "", true + case StellarValueTypeStellarValueSigned: + return "LcValueSignature", true } return "-", false } -// NewBucketMetadataExt creates a new BucketMetadataExt. -func NewBucketMetadataExt(v int32, value interface{}) (result BucketMetadataExt, err error) { +// NewStellarValueExt creates a new StellarValueExt. +func NewStellarValueExt(v StellarValueType, value interface{}) (result StellarValueExt, err error) { result.V = v - switch int32(v) { - case 0: + switch StellarValueType(v) { + case StellarValueTypeStellarValueBasic: // void + case StellarValueTypeStellarValueSigned: + tv, ok := value.(LedgerCloseValueSignature) + if !ok { + err = errors.New("invalid value, must be LedgerCloseValueSignature") + return + } + result.LcValueSignature = &tv + } + return +} + +// MustLcValueSignature retrieves the LcValueSignature value from the union, +// panicing if the value is not set. +func (u StellarValueExt) MustLcValueSignature() LedgerCloseValueSignature { + val, ok := u.GetLcValueSignature() + + if !ok { + panic("arm LcValueSignature is not set") + } + + return val +} + +// GetLcValueSignature retrieves the LcValueSignature value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u StellarValueExt) GetLcValueSignature() (result LedgerCloseValueSignature, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) + + if armName == "LcValueSignature" { + result = *u.LcValueSignature + ok = true } + return } // EncodeTo encodes this value using the Encoder. -func (u BucketMetadataExt) EncodeTo(e *xdr.Encoder) error { +func (u StellarValueExt) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeInt(int32(u.V)); err != nil { + if err = u.V.EncodeTo(e); err != nil { return err } - switch int32(u.V) { - case 0: + switch StellarValueType(u.V) { + case StellarValueTypeStellarValueBasic: // Void return nil + case StellarValueTypeStellarValueSigned: + if err = (*u.LcValueSignature).EncodeTo(e); err != nil { + return err + } + return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union BucketMetadataExt", u.V) + return fmt.Errorf("V (StellarValueType) switch value '%d' is not valid for union StellarValueExt", u.V) } -var _ decoderFrom = (*BucketMetadataExt)(nil) +var _ decoderFrom = (*StellarValueExt)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *BucketMetadataExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *StellarValueExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding BucketMetadataExt: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding StellarValueExt: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - u.V, nTmp, err = d.DecodeInt() + nTmp, err = u.V.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int: %w", err) + return n, fmt.Errorf("decoding StellarValueType: %w", err) } - switch int32(u.V) { - case 0: + switch StellarValueType(u.V) { + case StellarValueTypeStellarValueBasic: // Void return n, nil + case StellarValueTypeStellarValueSigned: + u.LcValueSignature = new(LedgerCloseValueSignature) + nTmp, err = (*u.LcValueSignature).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerCloseValueSignature: %w", err) + } + return n, nil } - return n, fmt.Errorf("union BucketMetadataExt has invalid V (int32) switch value '%d'", u.V) + return n, fmt.Errorf("union StellarValueExt has invalid V (StellarValueType) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s BucketMetadataExt) MarshalBinary() ([]byte, error) { +func (s StellarValueExt) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -13171,7 +13270,7 @@ func (s BucketMetadataExt) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *BucketMetadataExt) UnmarshalBinary(inp []byte) error { +func (s *StellarValueExt) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -13181,72 +13280,122 @@ func (s *BucketMetadataExt) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*BucketMetadataExt)(nil) - _ encoding.BinaryUnmarshaler = (*BucketMetadataExt)(nil) + _ encoding.BinaryMarshaler = (*StellarValueExt)(nil) + _ encoding.BinaryUnmarshaler = (*StellarValueExt)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s BucketMetadataExt) xdrType() {} +func (s StellarValueExt) xdrType() {} -var _ xdrType = (*BucketMetadataExt)(nil) +var _ xdrType = (*StellarValueExt)(nil) -// BucketMetadata is an XDR Struct defines as: +// StellarValue is an XDR Struct defines as: // -// struct BucketMetadata +// struct StellarValue // { -// // Indicates the protocol version used to create / merge this bucket. -// uint32 ledgerVersion; +// Hash txSetHash; // transaction set to apply to previous ledger +// TimePoint closeTime; // network close time +// +// // upgrades to apply to the previous ledger (usually empty) +// // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop +// // unknown steps during consensus if needed. +// // see notes below on 'LedgerUpgrade' for more detail +// // max size is dictated by number of upgrade types (+ room for future) +// UpgradeType upgrades<6>; // // // reserved for future use -// union switch (int v) +// union switch (StellarValueType v) // { -// case 0: +// case STELLAR_VALUE_BASIC: // void; +// case STELLAR_VALUE_SIGNED: +// LedgerCloseValueSignature lcValueSignature; // } // ext; // }; -type BucketMetadata struct { - LedgerVersion Uint32 - Ext BucketMetadataExt +type StellarValue struct { + TxSetHash Hash + CloseTime TimePoint + Upgrades []UpgradeType `xdrmaxsize:"6"` + Ext StellarValueExt } // EncodeTo encodes this value using the Encoder. -func (s *BucketMetadata) EncodeTo(e *xdr.Encoder) error { +func (s *StellarValue) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.LedgerVersion.EncodeTo(e); err != nil { + if err = s.TxSetHash.EncodeTo(e); err != nil { + return err + } + if err = s.CloseTime.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeUint(uint32(len(s.Upgrades))); err != nil { return err } + for i := 0; i < len(s.Upgrades); i++ { + if err = s.Upgrades[i].EncodeTo(e); err != nil { + return err + } + } if err = s.Ext.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*BucketMetadata)(nil) +var _ decoderFrom = (*StellarValue)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *BucketMetadata) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *StellarValue) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding BucketMetadata: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding StellarValue: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.LedgerVersion.DecodeFrom(d, maxDepth) + nTmp, err = s.TxSetHash.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding Hash: %w", err) } - nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + nTmp, err = s.CloseTime.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding BucketMetadataExt: %w", err) + return n, fmt.Errorf("decoding TimePoint: %w", err) } - return n, nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (s BucketMetadata) MarshalBinary() ([]byte, error) { + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding UpgradeType: %w", err) + } + if l > 6 { + return n, fmt.Errorf("decoding UpgradeType: data size (%d) exceeds size limit (6)", l) + } + s.Upgrades = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding UpgradeType: length (%d) exceeds remaining input length (%d)", l, il) + } + s.Upgrades = make([]UpgradeType, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.Upgrades[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding UpgradeType: %w", err) + } + } + } + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding StellarValueExt: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s StellarValue) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -13254,7 +13403,7 @@ func (s BucketMetadata) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *BucketMetadata) UnmarshalBinary(inp []byte) error { +func (s *StellarValue) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -13264,253 +13413,85 @@ func (s *BucketMetadata) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*BucketMetadata)(nil) - _ encoding.BinaryUnmarshaler = (*BucketMetadata)(nil) + _ encoding.BinaryMarshaler = (*StellarValue)(nil) + _ encoding.BinaryUnmarshaler = (*StellarValue)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s BucketMetadata) xdrType() {} +func (s StellarValue) xdrType() {} -var _ xdrType = (*BucketMetadata)(nil) +var _ xdrType = (*StellarValue)(nil) -// BucketEntry is an XDR Union defines as: +// MaskLedgerHeaderFlags is an XDR Const defines as: // -// union BucketEntry switch (BucketEntryType type) -// { -// case LIVEENTRY: -// case INITENTRY: -// LedgerEntry liveEntry; +// const MASK_LEDGER_HEADER_FLAGS = 0x7; +const MaskLedgerHeaderFlags = 0x7 + +// LedgerHeaderFlags is an XDR Enum defines as: // -// case DEADENTRY: -// LedgerKey deadEntry; -// case METAENTRY: -// BucketMetadata metaEntry; +// enum LedgerHeaderFlags +// { +// DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 0x1, +// DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 0x2, +// DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 0x4 // }; -type BucketEntry struct { - Type BucketEntryType - LiveEntry *LedgerEntry - DeadEntry *LedgerKey - MetaEntry *BucketMetadata -} - -// SwitchFieldName returns the field name in which this union's -// discriminant is stored -func (u BucketEntry) SwitchFieldName() string { - return "Type" -} - -// ArmForSwitch returns which field name should be used for storing -// the value for an instance of BucketEntry -func (u BucketEntry) ArmForSwitch(sw int32) (string, bool) { - switch BucketEntryType(sw) { - case BucketEntryTypeLiveentry: - return "LiveEntry", true - case BucketEntryTypeInitentry: - return "LiveEntry", true - case BucketEntryTypeDeadentry: - return "DeadEntry", true - case BucketEntryTypeMetaentry: - return "MetaEntry", true - } - return "-", false -} - -// NewBucketEntry creates a new BucketEntry. -func NewBucketEntry(aType BucketEntryType, value interface{}) (result BucketEntry, err error) { - result.Type = aType - switch BucketEntryType(aType) { - case BucketEntryTypeLiveentry: - tv, ok := value.(LedgerEntry) - if !ok { - err = errors.New("invalid value, must be LedgerEntry") - return - } - result.LiveEntry = &tv - case BucketEntryTypeInitentry: - tv, ok := value.(LedgerEntry) - if !ok { - err = errors.New("invalid value, must be LedgerEntry") - return - } - result.LiveEntry = &tv - case BucketEntryTypeDeadentry: - tv, ok := value.(LedgerKey) - if !ok { - err = errors.New("invalid value, must be LedgerKey") - return - } - result.DeadEntry = &tv - case BucketEntryTypeMetaentry: - tv, ok := value.(BucketMetadata) - if !ok { - err = errors.New("invalid value, must be BucketMetadata") - return - } - result.MetaEntry = &tv - } - return -} - -// MustLiveEntry retrieves the LiveEntry value from the union, -// panicing if the value is not set. -func (u BucketEntry) MustLiveEntry() LedgerEntry { - val, ok := u.GetLiveEntry() - - if !ok { - panic("arm LiveEntry is not set") - } - - return val -} - -// GetLiveEntry retrieves the LiveEntry value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u BucketEntry) GetLiveEntry() (result LedgerEntry, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "LiveEntry" { - result = *u.LiveEntry - ok = true - } - - return -} - -// MustDeadEntry retrieves the DeadEntry value from the union, -// panicing if the value is not set. -func (u BucketEntry) MustDeadEntry() LedgerKey { - val, ok := u.GetDeadEntry() - - if !ok { - panic("arm DeadEntry is not set") - } - - return val -} - -// GetDeadEntry retrieves the DeadEntry value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u BucketEntry) GetDeadEntry() (result LedgerKey, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) +type LedgerHeaderFlags int32 - if armName == "DeadEntry" { - result = *u.DeadEntry - ok = true - } +const ( + LedgerHeaderFlagsDisableLiquidityPoolTradingFlag LedgerHeaderFlags = 1 + LedgerHeaderFlagsDisableLiquidityPoolDepositFlag LedgerHeaderFlags = 2 + LedgerHeaderFlagsDisableLiquidityPoolWithdrawalFlag LedgerHeaderFlags = 4 +) - return +var ledgerHeaderFlagsMap = map[int32]string{ + 1: "LedgerHeaderFlagsDisableLiquidityPoolTradingFlag", + 2: "LedgerHeaderFlagsDisableLiquidityPoolDepositFlag", + 4: "LedgerHeaderFlagsDisableLiquidityPoolWithdrawalFlag", } -// MustMetaEntry retrieves the MetaEntry value from the union, -// panicing if the value is not set. -func (u BucketEntry) MustMetaEntry() BucketMetadata { - val, ok := u.GetMetaEntry() - - if !ok { - panic("arm MetaEntry is not set") - } - - return val +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for LedgerHeaderFlags +func (e LedgerHeaderFlags) ValidEnum(v int32) bool { + _, ok := ledgerHeaderFlagsMap[v] + return ok } -// GetMetaEntry retrieves the MetaEntry value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u BucketEntry) GetMetaEntry() (result BucketMetadata, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "MetaEntry" { - result = *u.MetaEntry - ok = true - } - - return +// String returns the name of `e` +func (e LedgerHeaderFlags) String() string { + name, _ := ledgerHeaderFlagsMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (u BucketEntry) EncodeTo(e *xdr.Encoder) error { - var err error - if err = u.Type.EncodeTo(e); err != nil { - return err - } - switch BucketEntryType(u.Type) { - case BucketEntryTypeLiveentry: - if err = (*u.LiveEntry).EncodeTo(e); err != nil { - return err - } - return nil - case BucketEntryTypeInitentry: - if err = (*u.LiveEntry).EncodeTo(e); err != nil { - return err - } - return nil - case BucketEntryTypeDeadentry: - if err = (*u.DeadEntry).EncodeTo(e); err != nil { - return err - } - return nil - case BucketEntryTypeMetaentry: - if err = (*u.MetaEntry).EncodeTo(e); err != nil { - return err - } - return nil +func (e LedgerHeaderFlags) EncodeTo(enc *xdr.Encoder) error { + if _, ok := ledgerHeaderFlagsMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid LedgerHeaderFlags enum value", e) } - return fmt.Errorf("Type (BucketEntryType) switch value '%d' is not valid for union BucketEntry", u.Type) + _, err := enc.EncodeInt(int32(e)) + return err } -var _ decoderFrom = (*BucketEntry)(nil) +var _ decoderFrom = (*LedgerHeaderFlags)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *BucketEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *LedgerHeaderFlags) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding BucketEntry: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerHeaderFlags: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = u.Type.DecodeFrom(d, maxDepth) - n += nTmp + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding BucketEntryType: %w", err) + return n, fmt.Errorf("decoding LedgerHeaderFlags: %w", err) } - switch BucketEntryType(u.Type) { - case BucketEntryTypeLiveentry: - u.LiveEntry = new(LedgerEntry) - nTmp, err = (*u.LiveEntry).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerEntry: %w", err) - } - return n, nil - case BucketEntryTypeInitentry: - u.LiveEntry = new(LedgerEntry) - nTmp, err = (*u.LiveEntry).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerEntry: %w", err) - } - return n, nil - case BucketEntryTypeDeadentry: - u.DeadEntry = new(LedgerKey) - nTmp, err = (*u.DeadEntry).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerKey: %w", err) - } - return n, nil - case BucketEntryTypeMetaentry: - u.MetaEntry = new(BucketMetadata) - nTmp, err = (*u.MetaEntry).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding BucketMetadata: %w", err) - } - return n, nil + if _, ok := ledgerHeaderFlagsMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid LedgerHeaderFlags enum value", v) } - return n, fmt.Errorf("union BucketEntry has invalid Type (BucketEntryType) switch value '%d'", u.Type) + *e = LedgerHeaderFlags(v) + return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s BucketEntry) MarshalBinary() ([]byte, error) { +func (s LedgerHeaderFlags) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -13518,7 +13499,7 @@ func (s BucketEntry) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *BucketEntry) UnmarshalBinary(inp []byte) error { +func (s *LedgerHeaderFlags) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -13528,76 +13509,91 @@ func (s *BucketEntry) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*BucketEntry)(nil) - _ encoding.BinaryUnmarshaler = (*BucketEntry)(nil) + _ encoding.BinaryMarshaler = (*LedgerHeaderFlags)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerHeaderFlags)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s BucketEntry) xdrType() {} +func (s LedgerHeaderFlags) xdrType() {} -var _ xdrType = (*BucketEntry)(nil) +var _ xdrType = (*LedgerHeaderFlags)(nil) -// TxSetComponentType is an XDR Enum defines as: +// LedgerHeaderExtensionV1Ext is an XDR NestedUnion defines as: // -// enum TxSetComponentType -// { -// // txs with effective fee <= bid derived from a base fee (if any). -// // If base fee is not specified, no discount is applied. -// TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE = 0 -// }; -type TxSetComponentType int32 - -const ( - TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee TxSetComponentType = 0 -) +// union switch (int v) +// { +// case 0: +// void; +// } +type LedgerHeaderExtensionV1Ext struct { + V int32 +} -var txSetComponentTypeMap = map[int32]string{ - 0: "TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee", +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u LedgerHeaderExtensionV1Ext) SwitchFieldName() string { + return "V" } -// ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for TxSetComponentType -func (e TxSetComponentType) ValidEnum(v int32) bool { - _, ok := txSetComponentTypeMap[v] - return ok +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of LedgerHeaderExtensionV1Ext +func (u LedgerHeaderExtensionV1Ext) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 0: + return "", true + } + return "-", false } -// String returns the name of `e` -func (e TxSetComponentType) String() string { - name, _ := txSetComponentTypeMap[int32(e)] - return name +// NewLedgerHeaderExtensionV1Ext creates a new LedgerHeaderExtensionV1Ext. +func NewLedgerHeaderExtensionV1Ext(v int32, value interface{}) (result LedgerHeaderExtensionV1Ext, err error) { + result.V = v + switch int32(v) { + case 0: + // void + } + return } // EncodeTo encodes this value using the Encoder. -func (e TxSetComponentType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := txSetComponentTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid TxSetComponentType enum value", e) +func (u LedgerHeaderExtensionV1Ext) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeInt(int32(u.V)); err != nil { + return err } - _, err := enc.EncodeInt(int32(e)) - return err + switch int32(u.V) { + case 0: + // Void + return nil + } + return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerHeaderExtensionV1Ext", u.V) } -var _ decoderFrom = (*TxSetComponentType)(nil) +var _ decoderFrom = (*LedgerHeaderExtensionV1Ext)(nil) // DecodeFrom decodes this value using the Decoder. -func (e *TxSetComponentType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *LedgerHeaderExtensionV1Ext) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TxSetComponentType: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerHeaderExtensionV1Ext: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - v, n, err := d.DecodeInt() + var err error + var n, nTmp int + u.V, nTmp, err = d.DecodeInt() + n += nTmp if err != nil { - return n, fmt.Errorf("decoding TxSetComponentType: %w", err) + return n, fmt.Errorf("decoding Int: %w", err) } - if _, ok := txSetComponentTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid TxSetComponentType enum value", v) + switch int32(u.V) { + case 0: + // Void + return n, nil } - *e = TxSetComponentType(v) - return n, nil + return n, fmt.Errorf("union LedgerHeaderExtensionV1Ext has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TxSetComponentType) MarshalBinary() ([]byte, error) { +func (s LedgerHeaderExtensionV1Ext) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -13605,7 +13601,7 @@ func (s TxSetComponentType) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TxSetComponentType) UnmarshalBinary(inp []byte) error { +func (s *LedgerHeaderExtensionV1Ext) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -13615,99 +13611,70 @@ func (s *TxSetComponentType) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TxSetComponentType)(nil) - _ encoding.BinaryUnmarshaler = (*TxSetComponentType)(nil) + _ encoding.BinaryMarshaler = (*LedgerHeaderExtensionV1Ext)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerHeaderExtensionV1Ext)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TxSetComponentType) xdrType() {} +func (s LedgerHeaderExtensionV1Ext) xdrType() {} -var _ xdrType = (*TxSetComponentType)(nil) +var _ xdrType = (*LedgerHeaderExtensionV1Ext)(nil) -// TxSetComponentTxsMaybeDiscountedFee is an XDR NestedStruct defines as: +// LedgerHeaderExtensionV1 is an XDR Struct defines as: // -// struct -// { -// int64* baseFee; -// TransactionEnvelope txs<>; -// } -type TxSetComponentTxsMaybeDiscountedFee struct { - BaseFee *Int64 - Txs []TransactionEnvelope +// struct LedgerHeaderExtensionV1 +// { +// uint32 flags; // LedgerHeaderFlags +// +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; +type LedgerHeaderExtensionV1 struct { + Flags Uint32 + Ext LedgerHeaderExtensionV1Ext } // EncodeTo encodes this value using the Encoder. -func (s *TxSetComponentTxsMaybeDiscountedFee) EncodeTo(e *xdr.Encoder) error { +func (s *LedgerHeaderExtensionV1) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeBool(s.BaseFee != nil); err != nil { + if err = s.Flags.EncodeTo(e); err != nil { return err } - if s.BaseFee != nil { - if err = (*s.BaseFee).EncodeTo(e); err != nil { - return err - } - } - if _, err = e.EncodeUint(uint32(len(s.Txs))); err != nil { + if err = s.Ext.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s.Txs); i++ { - if err = s.Txs[i].EncodeTo(e); err != nil { - return err - } - } return nil } -var _ decoderFrom = (*TxSetComponentTxsMaybeDiscountedFee)(nil) +var _ decoderFrom = (*LedgerHeaderExtensionV1)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TxSetComponentTxsMaybeDiscountedFee) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *LedgerHeaderExtensionV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TxSetComponentTxsMaybeDiscountedFee: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerHeaderExtensionV1: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - var b bool - b, nTmp, err = d.DecodeBool() + nTmp, err = s.Flags.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int64: %w", err) - } - s.BaseFee = nil - if b { - s.BaseFee = new(Int64) - nTmp, err = s.BaseFee.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Int64: %w", err) - } + return n, fmt.Errorf("decoding Uint32: %w", err) } - var l uint32 - l, nTmp, err = d.DecodeUint() + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionEnvelope: %w", err) - } - s.Txs = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding TransactionEnvelope: length (%d) exceeds remaining input length (%d)", l, il) - } - s.Txs = make([]TransactionEnvelope, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.Txs[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionEnvelope: %w", err) - } - } + return n, fmt.Errorf("decoding LedgerHeaderExtensionV1Ext: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TxSetComponentTxsMaybeDiscountedFee) MarshalBinary() ([]byte, error) { +func (s LedgerHeaderExtensionV1) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -13715,7 +13682,7 @@ func (s TxSetComponentTxsMaybeDiscountedFee) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TxSetComponentTxsMaybeDiscountedFee) UnmarshalBinary(inp []byte) error { +func (s *LedgerHeaderExtensionV1) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -13725,81 +13692,83 @@ func (s *TxSetComponentTxsMaybeDiscountedFee) UnmarshalBinary(inp []byte) error } var ( - _ encoding.BinaryMarshaler = (*TxSetComponentTxsMaybeDiscountedFee)(nil) - _ encoding.BinaryUnmarshaler = (*TxSetComponentTxsMaybeDiscountedFee)(nil) + _ encoding.BinaryMarshaler = (*LedgerHeaderExtensionV1)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerHeaderExtensionV1)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TxSetComponentTxsMaybeDiscountedFee) xdrType() {} +func (s LedgerHeaderExtensionV1) xdrType() {} -var _ xdrType = (*TxSetComponentTxsMaybeDiscountedFee)(nil) +var _ xdrType = (*LedgerHeaderExtensionV1)(nil) -// TxSetComponent is an XDR Union defines as: +// LedgerHeaderExt is an XDR NestedUnion defines as: // -// union TxSetComponent switch (TxSetComponentType type) -// { -// case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: -// struct -// { -// int64* baseFee; -// TransactionEnvelope txs<>; -// } txsMaybeDiscountedFee; -// }; -type TxSetComponent struct { - Type TxSetComponentType - TxsMaybeDiscountedFee *TxSetComponentTxsMaybeDiscountedFee +// union switch (int v) +// { +// case 0: +// void; +// case 1: +// LedgerHeaderExtensionV1 v1; +// } +type LedgerHeaderExt struct { + V int32 + V1 *LedgerHeaderExtensionV1 } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u TxSetComponent) SwitchFieldName() string { - return "Type" +func (u LedgerHeaderExt) SwitchFieldName() string { + return "V" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of TxSetComponent -func (u TxSetComponent) ArmForSwitch(sw int32) (string, bool) { - switch TxSetComponentType(sw) { - case TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee: - return "TxsMaybeDiscountedFee", true +// the value for an instance of LedgerHeaderExt +func (u LedgerHeaderExt) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 0: + return "", true + case 1: + return "V1", true } return "-", false } -// NewTxSetComponent creates a new TxSetComponent. -func NewTxSetComponent(aType TxSetComponentType, value interface{}) (result TxSetComponent, err error) { - result.Type = aType - switch TxSetComponentType(aType) { - case TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee: - tv, ok := value.(TxSetComponentTxsMaybeDiscountedFee) +// NewLedgerHeaderExt creates a new LedgerHeaderExt. +func NewLedgerHeaderExt(v int32, value interface{}) (result LedgerHeaderExt, err error) { + result.V = v + switch int32(v) { + case 0: + // void + case 1: + tv, ok := value.(LedgerHeaderExtensionV1) if !ok { - err = errors.New("invalid value, must be TxSetComponentTxsMaybeDiscountedFee") + err = errors.New("invalid value, must be LedgerHeaderExtensionV1") return } - result.TxsMaybeDiscountedFee = &tv + result.V1 = &tv } return } -// MustTxsMaybeDiscountedFee retrieves the TxsMaybeDiscountedFee value from the union, +// MustV1 retrieves the V1 value from the union, // panicing if the value is not set. -func (u TxSetComponent) MustTxsMaybeDiscountedFee() TxSetComponentTxsMaybeDiscountedFee { - val, ok := u.GetTxsMaybeDiscountedFee() +func (u LedgerHeaderExt) MustV1() LedgerHeaderExtensionV1 { + val, ok := u.GetV1() if !ok { - panic("arm TxsMaybeDiscountedFee is not set") + panic("arm V1 is not set") } return val } -// GetTxsMaybeDiscountedFee retrieves the TxsMaybeDiscountedFee value from the union, +// GetV1 retrieves the V1 value from the union, // returning ok if the union's switch indicated the value is valid. -func (u TxSetComponent) GetTxsMaybeDiscountedFee() (result TxSetComponentTxsMaybeDiscountedFee, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) +func (u LedgerHeaderExt) GetV1() (result LedgerHeaderExtensionV1, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) - if armName == "TxsMaybeDiscountedFee" { - result = *u.TxsMaybeDiscountedFee + if armName == "V1" { + result = *u.V1 ok = true } @@ -13807,51 +13776,57 @@ func (u TxSetComponent) GetTxsMaybeDiscountedFee() (result TxSetComponentTxsMayb } // EncodeTo encodes this value using the Encoder. -func (u TxSetComponent) EncodeTo(e *xdr.Encoder) error { +func (u LedgerHeaderExt) EncodeTo(e *xdr.Encoder) error { var err error - if err = u.Type.EncodeTo(e); err != nil { + if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } - switch TxSetComponentType(u.Type) { - case TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee: - if err = (*u.TxsMaybeDiscountedFee).EncodeTo(e); err != nil { + switch int32(u.V) { + case 0: + // Void + return nil + case 1: + if err = (*u.V1).EncodeTo(e); err != nil { return err } return nil } - return fmt.Errorf("Type (TxSetComponentType) switch value '%d' is not valid for union TxSetComponent", u.Type) + return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerHeaderExt", u.V) } -var _ decoderFrom = (*TxSetComponent)(nil) +var _ decoderFrom = (*LedgerHeaderExt)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *TxSetComponent) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *LedgerHeaderExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TxSetComponent: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerHeaderExt: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = u.Type.DecodeFrom(d, maxDepth) + u.V, nTmp, err = d.DecodeInt() n += nTmp if err != nil { - return n, fmt.Errorf("decoding TxSetComponentType: %w", err) + return n, fmt.Errorf("decoding Int: %w", err) } - switch TxSetComponentType(u.Type) { - case TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee: - u.TxsMaybeDiscountedFee = new(TxSetComponentTxsMaybeDiscountedFee) - nTmp, err = (*u.TxsMaybeDiscountedFee).DecodeFrom(d, maxDepth) + switch int32(u.V) { + case 0: + // Void + return n, nil + case 1: + u.V1 = new(LedgerHeaderExtensionV1) + nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TxSetComponentTxsMaybeDiscountedFee: %w", err) + return n, fmt.Errorf("decoding LedgerHeaderExtensionV1: %w", err) } return n, nil } - return n, fmt.Errorf("union TxSetComponent has invalid Type (TxSetComponentType) switch value '%d'", u.Type) + return n, fmt.Errorf("union LedgerHeaderExt has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TxSetComponent) MarshalBinary() ([]byte, error) { +func (s LedgerHeaderExt) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -13859,7 +13834,7 @@ func (s TxSetComponent) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TxSetComponent) UnmarshalBinary(inp []byte) error { +func (s *LedgerHeaderExt) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -13869,149 +13844,219 @@ func (s *TxSetComponent) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TxSetComponent)(nil) - _ encoding.BinaryUnmarshaler = (*TxSetComponent)(nil) + _ encoding.BinaryMarshaler = (*LedgerHeaderExt)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerHeaderExt)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TxSetComponent) xdrType() {} +func (s LedgerHeaderExt) xdrType() {} -var _ xdrType = (*TxSetComponent)(nil) +var _ xdrType = (*LedgerHeaderExt)(nil) -// TransactionPhase is an XDR Union defines as: +// LedgerHeader is an XDR Struct defines as: // -// union TransactionPhase switch (int v) +// struct LedgerHeader // { -// case 0: -// TxSetComponent v0Components<>; +// uint32 ledgerVersion; // the protocol version of the ledger +// Hash previousLedgerHash; // hash of the previous ledger header +// StellarValue scpValue; // what consensus agreed to +// Hash txSetResultHash; // the TransactionResultSet that led to this ledger +// Hash bucketListHash; // hash of the ledger state +// +// uint32 ledgerSeq; // sequence number of this ledger +// +// int64 totalCoins; // total number of stroops in existence. +// // 10,000,000 stroops in 1 XLM +// +// int64 feePool; // fees burned since last inflation run +// uint32 inflationSeq; // inflation sequence number +// +// uint64 idPool; // last used global ID, used for generating objects +// +// uint32 baseFee; // base fee per operation in stroops +// uint32 baseReserve; // account base reserve in stroops +// +// uint32 maxTxSetSize; // maximum size a transaction set can be +// +// Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back +// // in time without walking the chain back ledger by ledger +// // each slot contains the oldest ledger that is mod of +// // either 50 5000 50000 or 500000 depending on index +// // skipList[0] mod(50), skipList[1] mod(5000), etc +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// case 1: +// LedgerHeaderExtensionV1 v1; +// } +// ext; // }; -type TransactionPhase struct { - V int32 - V0Components *[]TxSetComponent -} - -// SwitchFieldName returns the field name in which this union's -// discriminant is stored -func (u TransactionPhase) SwitchFieldName() string { - return "V" +type LedgerHeader struct { + LedgerVersion Uint32 + PreviousLedgerHash Hash + ScpValue StellarValue + TxSetResultHash Hash + BucketListHash Hash + LedgerSeq Uint32 + TotalCoins Int64 + FeePool Int64 + InflationSeq Uint32 + IdPool Uint64 + BaseFee Uint32 + BaseReserve Uint32 + MaxTxSetSize Uint32 + SkipList [4]Hash + Ext LedgerHeaderExt } -// ArmForSwitch returns which field name should be used for storing -// the value for an instance of TransactionPhase -func (u TransactionPhase) ArmForSwitch(sw int32) (string, bool) { - switch int32(sw) { - case 0: - return "V0Components", true +// EncodeTo encodes this value using the Encoder. +func (s *LedgerHeader) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.LedgerVersion.EncodeTo(e); err != nil { + return err } - return "-", false -} - -// NewTransactionPhase creates a new TransactionPhase. -func NewTransactionPhase(v int32, value interface{}) (result TransactionPhase, err error) { - result.V = v - switch int32(v) { - case 0: - tv, ok := value.([]TxSetComponent) - if !ok { - err = errors.New("invalid value, must be []TxSetComponent") - return - } - result.V0Components = &tv + if err = s.PreviousLedgerHash.EncodeTo(e); err != nil { + return err } - return -} - -// MustV0Components retrieves the V0Components value from the union, -// panicing if the value is not set. -func (u TransactionPhase) MustV0Components() []TxSetComponent { - val, ok := u.GetV0Components() - - if !ok { - panic("arm V0Components is not set") + if err = s.ScpValue.EncodeTo(e); err != nil { + return err } - - return val -} - -// GetV0Components retrieves the V0Components value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u TransactionPhase) GetV0Components() (result []TxSetComponent, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.V)) - - if armName == "V0Components" { - result = *u.V0Components - ok = true + if err = s.TxSetResultHash.EncodeTo(e); err != nil { + return err } - - return -} - -// EncodeTo encodes this value using the Encoder. -func (u TransactionPhase) EncodeTo(e *xdr.Encoder) error { - var err error - if _, err = e.EncodeInt(int32(u.V)); err != nil { + if err = s.BucketListHash.EncodeTo(e); err != nil { return err } - switch int32(u.V) { - case 0: - if _, err = e.EncodeUint(uint32(len((*u.V0Components)))); err != nil { + if err = s.LedgerSeq.EncodeTo(e); err != nil { + return err + } + if err = s.TotalCoins.EncodeTo(e); err != nil { + return err + } + if err = s.FeePool.EncodeTo(e); err != nil { + return err + } + if err = s.InflationSeq.EncodeTo(e); err != nil { + return err + } + if err = s.IdPool.EncodeTo(e); err != nil { + return err + } + if err = s.BaseFee.EncodeTo(e); err != nil { + return err + } + if err = s.BaseReserve.EncodeTo(e); err != nil { + return err + } + if err = s.MaxTxSetSize.EncodeTo(e); err != nil { + return err + } + for i := 0; i < len(s.SkipList); i++ { + if err = s.SkipList[i].EncodeTo(e); err != nil { return err } - for i := 0; i < len((*u.V0Components)); i++ { - if err = (*u.V0Components)[i].EncodeTo(e); err != nil { - return err - } - } - return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union TransactionPhase", u.V) + if err = s.Ext.EncodeTo(e); err != nil { + return err + } + return nil } -var _ decoderFrom = (*TransactionPhase)(nil) +var _ decoderFrom = (*LedgerHeader)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *TransactionPhase) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *LedgerHeader) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionPhase: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerHeader: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - u.V, nTmp, err = d.DecodeInt() + nTmp, err = s.LedgerVersion.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - switch int32(u.V) { - case 0: - u.V0Components = new([]TxSetComponent) - var l uint32 - l, nTmp, err = d.DecodeUint() + nTmp, err = s.PreviousLedgerHash.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + nTmp, err = s.ScpValue.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding StellarValue: %w", err) + } + nTmp, err = s.TxSetResultHash.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + nTmp, err = s.BucketListHash.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + nTmp, err = s.LedgerSeq.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.TotalCoins.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + nTmp, err = s.FeePool.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + nTmp, err = s.InflationSeq.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.IdPool.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.BaseFee.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.BaseReserve.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.MaxTxSetSize.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + for i := 0; i < len(s.SkipList); i++ { + nTmp, err = s.SkipList[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TxSetComponent: %w", err) - } - (*u.V0Components) = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding TxSetComponent: length (%d) exceeds remaining input length (%d)", l, il) - } - (*u.V0Components) = make([]TxSetComponent, l) - for i := uint32(0); i < l; i++ { - nTmp, err = (*u.V0Components)[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TxSetComponent: %w", err) - } - } + return n, fmt.Errorf("decoding Hash: %w", err) } - return n, nil } - return n, fmt.Errorf("union TransactionPhase has invalid V (int32) switch value '%d'", u.V) + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerHeaderExt: %w", err) + } + return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionPhase) MarshalBinary() ([]byte, error) { +func (s LedgerHeader) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -14019,7 +14064,7 @@ func (s TransactionPhase) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionPhase) UnmarshalBinary(inp []byte) error { +func (s *LedgerHeader) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -14029,84 +14074,92 @@ func (s *TransactionPhase) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionPhase)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionPhase)(nil) + _ encoding.BinaryMarshaler = (*LedgerHeader)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerHeader)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionPhase) xdrType() {} +func (s LedgerHeader) xdrType() {} -var _ xdrType = (*TransactionPhase)(nil) +var _ xdrType = (*LedgerHeader)(nil) -// TransactionSet is an XDR Struct defines as: +// LedgerUpgradeType is an XDR Enum defines as: // -// struct TransactionSet +// enum LedgerUpgradeType // { -// Hash previousLedgerHash; -// TransactionEnvelope txs<>; +// LEDGER_UPGRADE_VERSION = 1, +// LEDGER_UPGRADE_BASE_FEE = 2, +// LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, +// LEDGER_UPGRADE_BASE_RESERVE = 4, +// LEDGER_UPGRADE_FLAGS = 5, +// LEDGER_UPGRADE_CONFIG = 6, +// LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7 // }; -type TransactionSet struct { - PreviousLedgerHash Hash - Txs []TransactionEnvelope +type LedgerUpgradeType int32 + +const ( + LedgerUpgradeTypeLedgerUpgradeVersion LedgerUpgradeType = 1 + LedgerUpgradeTypeLedgerUpgradeBaseFee LedgerUpgradeType = 2 + LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize LedgerUpgradeType = 3 + LedgerUpgradeTypeLedgerUpgradeBaseReserve LedgerUpgradeType = 4 + LedgerUpgradeTypeLedgerUpgradeFlags LedgerUpgradeType = 5 + LedgerUpgradeTypeLedgerUpgradeConfig LedgerUpgradeType = 6 + LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize LedgerUpgradeType = 7 +) + +var ledgerUpgradeTypeMap = map[int32]string{ + 1: "LedgerUpgradeTypeLedgerUpgradeVersion", + 2: "LedgerUpgradeTypeLedgerUpgradeBaseFee", + 3: "LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize", + 4: "LedgerUpgradeTypeLedgerUpgradeBaseReserve", + 5: "LedgerUpgradeTypeLedgerUpgradeFlags", + 6: "LedgerUpgradeTypeLedgerUpgradeConfig", + 7: "LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for LedgerUpgradeType +func (e LedgerUpgradeType) ValidEnum(v int32) bool { + _, ok := ledgerUpgradeTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e LedgerUpgradeType) String() string { + name, _ := ledgerUpgradeTypeMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (s *TransactionSet) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.PreviousLedgerHash.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeUint(uint32(len(s.Txs))); err != nil { - return err - } - for i := 0; i < len(s.Txs); i++ { - if err = s.Txs[i].EncodeTo(e); err != nil { - return err - } +func (e LedgerUpgradeType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := ledgerUpgradeTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid LedgerUpgradeType enum value", e) } - return nil + _, err := enc.EncodeInt(int32(e)) + return err } -var _ decoderFrom = (*TransactionSet)(nil) +var _ decoderFrom = (*LedgerUpgradeType)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TransactionSet) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *LedgerUpgradeType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionSet: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerUpgradeType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.PreviousLedgerHash.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - var l uint32 - l, nTmp, err = d.DecodeUint() - n += nTmp + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding TransactionEnvelope: %w", err) + return n, fmt.Errorf("decoding LedgerUpgradeType: %w", err) } - s.Txs = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding TransactionEnvelope: length (%d) exceeds remaining input length (%d)", l, il) - } - s.Txs = make([]TransactionEnvelope, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.Txs[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionEnvelope: %w", err) - } - } + if _, ok := ledgerUpgradeTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid LedgerUpgradeType enum value", v) } + *e = LedgerUpgradeType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionSet) MarshalBinary() ([]byte, error) { +func (s LedgerUpgradeType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -14114,7 +14167,7 @@ func (s TransactionSet) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionSet) UnmarshalBinary(inp []byte) error { +func (s *LedgerUpgradeType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -14124,84 +14177,63 @@ func (s *TransactionSet) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionSet)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionSet)(nil) + _ encoding.BinaryMarshaler = (*LedgerUpgradeType)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerUpgradeType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionSet) xdrType() {} +func (s LedgerUpgradeType) xdrType() {} -var _ xdrType = (*TransactionSet)(nil) +var _ xdrType = (*LedgerUpgradeType)(nil) -// TransactionSetV1 is an XDR Struct defines as: +// ConfigUpgradeSetKey is an XDR Struct defines as: // -// struct TransactionSetV1 -// { -// Hash previousLedgerHash; -// TransactionPhase phases<>; +// struct ConfigUpgradeSetKey { +// Hash contractID; +// Hash contentHash; // }; -type TransactionSetV1 struct { - PreviousLedgerHash Hash - Phases []TransactionPhase +type ConfigUpgradeSetKey struct { + ContractId Hash + ContentHash Hash } // EncodeTo encodes this value using the Encoder. -func (s *TransactionSetV1) EncodeTo(e *xdr.Encoder) error { +func (s *ConfigUpgradeSetKey) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.PreviousLedgerHash.EncodeTo(e); err != nil { + if err = s.ContractId.EncodeTo(e); err != nil { return err } - if _, err = e.EncodeUint(uint32(len(s.Phases))); err != nil { + if err = s.ContentHash.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s.Phases); i++ { - if err = s.Phases[i].EncodeTo(e); err != nil { - return err - } - } return nil } -var _ decoderFrom = (*TransactionSetV1)(nil) +var _ decoderFrom = (*ConfigUpgradeSetKey)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TransactionSetV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ConfigUpgradeSetKey) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionSetV1: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ConfigUpgradeSetKey: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.PreviousLedgerHash.DecodeFrom(d, maxDepth) + nTmp, err = s.ContractId.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Hash: %w", err) } - var l uint32 - l, nTmp, err = d.DecodeUint() + nTmp, err = s.ContentHash.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionPhase: %w", err) - } - s.Phases = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding TransactionPhase: length (%d) exceeds remaining input length (%d)", l, il) - } - s.Phases = make([]TransactionPhase, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.Phases[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionPhase: %w", err) - } - } + return n, fmt.Errorf("decoding Hash: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionSetV1) MarshalBinary() ([]byte, error) { +func (s ConfigUpgradeSetKey) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -14209,7 +14241,7 @@ func (s TransactionSetV1) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionSetV1) UnmarshalBinary(inp []byte) error { +func (s *ConfigUpgradeSetKey) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -14219,78 +14251,302 @@ func (s *TransactionSetV1) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionSetV1)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionSetV1)(nil) + _ encoding.BinaryMarshaler = (*ConfigUpgradeSetKey)(nil) + _ encoding.BinaryUnmarshaler = (*ConfigUpgradeSetKey)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionSetV1) xdrType() {} +func (s ConfigUpgradeSetKey) xdrType() {} -var _ xdrType = (*TransactionSetV1)(nil) +var _ xdrType = (*ConfigUpgradeSetKey)(nil) -// GeneralizedTransactionSet is an XDR Union defines as: +// LedgerUpgrade is an XDR Union defines as: // -// union GeneralizedTransactionSet switch (int v) +// union LedgerUpgrade switch (LedgerUpgradeType type) // { -// // We consider the legacy TransactionSet to be v0. -// case 1: -// TransactionSetV1 v1TxSet; +// case LEDGER_UPGRADE_VERSION: +// uint32 newLedgerVersion; // update ledgerVersion +// case LEDGER_UPGRADE_BASE_FEE: +// uint32 newBaseFee; // update baseFee +// case LEDGER_UPGRADE_MAX_TX_SET_SIZE: +// uint32 newMaxTxSetSize; // update maxTxSetSize +// case LEDGER_UPGRADE_BASE_RESERVE: +// uint32 newBaseReserve; // update baseReserve +// case LEDGER_UPGRADE_FLAGS: +// uint32 newFlags; // update flags +// case LEDGER_UPGRADE_CONFIG: +// // Update arbitrary `ConfigSetting` entries identified by the key. +// ConfigUpgradeSetKey newConfig; +// case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE: +// // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without +// // using `LEDGER_UPGRADE_CONFIG`. +// uint32 newMaxSorobanTxSetSize; // }; -type GeneralizedTransactionSet struct { - V int32 - V1TxSet *TransactionSetV1 +type LedgerUpgrade struct { + Type LedgerUpgradeType + NewLedgerVersion *Uint32 + NewBaseFee *Uint32 + NewMaxTxSetSize *Uint32 + NewBaseReserve *Uint32 + NewFlags *Uint32 + NewConfig *ConfigUpgradeSetKey + NewMaxSorobanTxSetSize *Uint32 } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u GeneralizedTransactionSet) SwitchFieldName() string { - return "V" +func (u LedgerUpgrade) SwitchFieldName() string { + return "Type" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of GeneralizedTransactionSet -func (u GeneralizedTransactionSet) ArmForSwitch(sw int32) (string, bool) { - switch int32(sw) { - case 1: - return "V1TxSet", true +// the value for an instance of LedgerUpgrade +func (u LedgerUpgrade) ArmForSwitch(sw int32) (string, bool) { + switch LedgerUpgradeType(sw) { + case LedgerUpgradeTypeLedgerUpgradeVersion: + return "NewLedgerVersion", true + case LedgerUpgradeTypeLedgerUpgradeBaseFee: + return "NewBaseFee", true + case LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize: + return "NewMaxTxSetSize", true + case LedgerUpgradeTypeLedgerUpgradeBaseReserve: + return "NewBaseReserve", true + case LedgerUpgradeTypeLedgerUpgradeFlags: + return "NewFlags", true + case LedgerUpgradeTypeLedgerUpgradeConfig: + return "NewConfig", true + case LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize: + return "NewMaxSorobanTxSetSize", true } return "-", false } -// NewGeneralizedTransactionSet creates a new GeneralizedTransactionSet. -func NewGeneralizedTransactionSet(v int32, value interface{}) (result GeneralizedTransactionSet, err error) { - result.V = v - switch int32(v) { - case 1: - tv, ok := value.(TransactionSetV1) +// NewLedgerUpgrade creates a new LedgerUpgrade. +func NewLedgerUpgrade(aType LedgerUpgradeType, value interface{}) (result LedgerUpgrade, err error) { + result.Type = aType + switch LedgerUpgradeType(aType) { + case LedgerUpgradeTypeLedgerUpgradeVersion: + tv, ok := value.(Uint32) if !ok { - err = errors.New("invalid value, must be TransactionSetV1") + err = errors.New("invalid value, must be Uint32") return } - result.V1TxSet = &tv + result.NewLedgerVersion = &tv + case LedgerUpgradeTypeLedgerUpgradeBaseFee: + tv, ok := value.(Uint32) + if !ok { + err = errors.New("invalid value, must be Uint32") + return + } + result.NewBaseFee = &tv + case LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize: + tv, ok := value.(Uint32) + if !ok { + err = errors.New("invalid value, must be Uint32") + return + } + result.NewMaxTxSetSize = &tv + case LedgerUpgradeTypeLedgerUpgradeBaseReserve: + tv, ok := value.(Uint32) + if !ok { + err = errors.New("invalid value, must be Uint32") + return + } + result.NewBaseReserve = &tv + case LedgerUpgradeTypeLedgerUpgradeFlags: + tv, ok := value.(Uint32) + if !ok { + err = errors.New("invalid value, must be Uint32") + return + } + result.NewFlags = &tv + case LedgerUpgradeTypeLedgerUpgradeConfig: + tv, ok := value.(ConfigUpgradeSetKey) + if !ok { + err = errors.New("invalid value, must be ConfigUpgradeSetKey") + return + } + result.NewConfig = &tv + case LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize: + tv, ok := value.(Uint32) + if !ok { + err = errors.New("invalid value, must be Uint32") + return + } + result.NewMaxSorobanTxSetSize = &tv } return } -// MustV1TxSet retrieves the V1TxSet value from the union, +// MustNewLedgerVersion retrieves the NewLedgerVersion value from the union, // panicing if the value is not set. -func (u GeneralizedTransactionSet) MustV1TxSet() TransactionSetV1 { - val, ok := u.GetV1TxSet() +func (u LedgerUpgrade) MustNewLedgerVersion() Uint32 { + val, ok := u.GetNewLedgerVersion() if !ok { - panic("arm V1TxSet is not set") + panic("arm NewLedgerVersion is not set") } return val } -// GetV1TxSet retrieves the V1TxSet value from the union, +// GetNewLedgerVersion retrieves the NewLedgerVersion value from the union, // returning ok if the union's switch indicated the value is valid. -func (u GeneralizedTransactionSet) GetV1TxSet() (result TransactionSetV1, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.V)) +func (u LedgerUpgrade) GetNewLedgerVersion() (result Uint32, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) - if armName == "V1TxSet" { - result = *u.V1TxSet + if armName == "NewLedgerVersion" { + result = *u.NewLedgerVersion + ok = true + } + + return +} + +// MustNewBaseFee retrieves the NewBaseFee value from the union, +// panicing if the value is not set. +func (u LedgerUpgrade) MustNewBaseFee() Uint32 { + val, ok := u.GetNewBaseFee() + + if !ok { + panic("arm NewBaseFee is not set") + } + + return val +} + +// GetNewBaseFee retrieves the NewBaseFee value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerUpgrade) GetNewBaseFee() (result Uint32, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "NewBaseFee" { + result = *u.NewBaseFee + ok = true + } + + return +} + +// MustNewMaxTxSetSize retrieves the NewMaxTxSetSize value from the union, +// panicing if the value is not set. +func (u LedgerUpgrade) MustNewMaxTxSetSize() Uint32 { + val, ok := u.GetNewMaxTxSetSize() + + if !ok { + panic("arm NewMaxTxSetSize is not set") + } + + return val +} + +// GetNewMaxTxSetSize retrieves the NewMaxTxSetSize value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerUpgrade) GetNewMaxTxSetSize() (result Uint32, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "NewMaxTxSetSize" { + result = *u.NewMaxTxSetSize + ok = true + } + + return +} + +// MustNewBaseReserve retrieves the NewBaseReserve value from the union, +// panicing if the value is not set. +func (u LedgerUpgrade) MustNewBaseReserve() Uint32 { + val, ok := u.GetNewBaseReserve() + + if !ok { + panic("arm NewBaseReserve is not set") + } + + return val +} + +// GetNewBaseReserve retrieves the NewBaseReserve value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerUpgrade) GetNewBaseReserve() (result Uint32, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "NewBaseReserve" { + result = *u.NewBaseReserve + ok = true + } + + return +} + +// MustNewFlags retrieves the NewFlags value from the union, +// panicing if the value is not set. +func (u LedgerUpgrade) MustNewFlags() Uint32 { + val, ok := u.GetNewFlags() + + if !ok { + panic("arm NewFlags is not set") + } + + return val +} + +// GetNewFlags retrieves the NewFlags value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerUpgrade) GetNewFlags() (result Uint32, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "NewFlags" { + result = *u.NewFlags + ok = true + } + + return +} + +// MustNewConfig retrieves the NewConfig value from the union, +// panicing if the value is not set. +func (u LedgerUpgrade) MustNewConfig() ConfigUpgradeSetKey { + val, ok := u.GetNewConfig() + + if !ok { + panic("arm NewConfig is not set") + } + + return val +} + +// GetNewConfig retrieves the NewConfig value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerUpgrade) GetNewConfig() (result ConfigUpgradeSetKey, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "NewConfig" { + result = *u.NewConfig + ok = true + } + + return +} + +// MustNewMaxSorobanTxSetSize retrieves the NewMaxSorobanTxSetSize value from the union, +// panicing if the value is not set. +func (u LedgerUpgrade) MustNewMaxSorobanTxSetSize() Uint32 { + val, ok := u.GetNewMaxSorobanTxSetSize() + + if !ok { + panic("arm NewMaxSorobanTxSetSize is not set") + } + + return val +} + +// GetNewMaxSorobanTxSetSize retrieves the NewMaxSorobanTxSetSize value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerUpgrade) GetNewMaxSorobanTxSetSize() (result Uint32, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "NewMaxSorobanTxSetSize" { + result = *u.NewMaxSorobanTxSetSize ok = true } @@ -14298,51 +14554,129 @@ func (u GeneralizedTransactionSet) GetV1TxSet() (result TransactionSetV1, ok boo } // EncodeTo encodes this value using the Encoder. -func (u GeneralizedTransactionSet) EncodeTo(e *xdr.Encoder) error { +func (u LedgerUpgrade) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeInt(int32(u.V)); err != nil { + if err = u.Type.EncodeTo(e); err != nil { return err } - switch int32(u.V) { - case 1: - if err = (*u.V1TxSet).EncodeTo(e); err != nil { + switch LedgerUpgradeType(u.Type) { + case LedgerUpgradeTypeLedgerUpgradeVersion: + if err = (*u.NewLedgerVersion).EncodeTo(e); err != nil { + return err + } + return nil + case LedgerUpgradeTypeLedgerUpgradeBaseFee: + if err = (*u.NewBaseFee).EncodeTo(e); err != nil { + return err + } + return nil + case LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize: + if err = (*u.NewMaxTxSetSize).EncodeTo(e); err != nil { + return err + } + return nil + case LedgerUpgradeTypeLedgerUpgradeBaseReserve: + if err = (*u.NewBaseReserve).EncodeTo(e); err != nil { + return err + } + return nil + case LedgerUpgradeTypeLedgerUpgradeFlags: + if err = (*u.NewFlags).EncodeTo(e); err != nil { + return err + } + return nil + case LedgerUpgradeTypeLedgerUpgradeConfig: + if err = (*u.NewConfig).EncodeTo(e); err != nil { + return err + } + return nil + case LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize: + if err = (*u.NewMaxSorobanTxSetSize).EncodeTo(e); err != nil { return err } return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union GeneralizedTransactionSet", u.V) + return fmt.Errorf("Type (LedgerUpgradeType) switch value '%d' is not valid for union LedgerUpgrade", u.Type) } -var _ decoderFrom = (*GeneralizedTransactionSet)(nil) +var _ decoderFrom = (*LedgerUpgrade)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *GeneralizedTransactionSet) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *LedgerUpgrade) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding GeneralizedTransactionSet: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerUpgrade: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - u.V, nTmp, err = d.DecodeInt() + nTmp, err = u.Type.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int: %w", err) + return n, fmt.Errorf("decoding LedgerUpgradeType: %w", err) } - switch int32(u.V) { - case 1: - u.V1TxSet = new(TransactionSetV1) - nTmp, err = (*u.V1TxSet).DecodeFrom(d, maxDepth) + switch LedgerUpgradeType(u.Type) { + case LedgerUpgradeTypeLedgerUpgradeVersion: + u.NewLedgerVersion = new(Uint32) + nTmp, err = (*u.NewLedgerVersion).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionSetV1: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil + case LedgerUpgradeTypeLedgerUpgradeBaseFee: + u.NewBaseFee = new(Uint32) + nTmp, err = (*u.NewBaseFee).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil + case LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize: + u.NewMaxTxSetSize = new(Uint32) + nTmp, err = (*u.NewMaxTxSetSize).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil + case LedgerUpgradeTypeLedgerUpgradeBaseReserve: + u.NewBaseReserve = new(Uint32) + nTmp, err = (*u.NewBaseReserve).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil + case LedgerUpgradeTypeLedgerUpgradeFlags: + u.NewFlags = new(Uint32) + nTmp, err = (*u.NewFlags).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil + case LedgerUpgradeTypeLedgerUpgradeConfig: + u.NewConfig = new(ConfigUpgradeSetKey) + nTmp, err = (*u.NewConfig).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ConfigUpgradeSetKey: %w", err) + } + return n, nil + case LedgerUpgradeTypeLedgerUpgradeMaxSorobanTxSetSize: + u.NewMaxSorobanTxSetSize = new(Uint32) + nTmp, err = (*u.NewMaxSorobanTxSetSize).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) } return n, nil } - return n, fmt.Errorf("union GeneralizedTransactionSet has invalid V (int32) switch value '%d'", u.V) + return n, fmt.Errorf("union LedgerUpgrade has invalid Type (LedgerUpgradeType) switch value '%d'", u.Type) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s GeneralizedTransactionSet) MarshalBinary() ([]byte, error) { +func (s LedgerUpgrade) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -14350,7 +14684,7 @@ func (s GeneralizedTransactionSet) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *GeneralizedTransactionSet) UnmarshalBinary(inp []byte) error { +func (s *LedgerUpgrade) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -14360,64 +14694,73 @@ func (s *GeneralizedTransactionSet) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*GeneralizedTransactionSet)(nil) - _ encoding.BinaryUnmarshaler = (*GeneralizedTransactionSet)(nil) + _ encoding.BinaryMarshaler = (*LedgerUpgrade)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerUpgrade)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s GeneralizedTransactionSet) xdrType() {} +func (s LedgerUpgrade) xdrType() {} -var _ xdrType = (*GeneralizedTransactionSet)(nil) +var _ xdrType = (*LedgerUpgrade)(nil) -// TransactionResultPair is an XDR Struct defines as: +// ConfigUpgradeSet is an XDR Struct defines as: // -// struct TransactionResultPair -// { -// Hash transactionHash; -// TransactionResult result; // result for the transaction +// struct ConfigUpgradeSet { +// ConfigSettingEntry updatedEntry<>; // }; -type TransactionResultPair struct { - TransactionHash Hash - Result TransactionResult +type ConfigUpgradeSet struct { + UpdatedEntry []ConfigSettingEntry } // EncodeTo encodes this value using the Encoder. -func (s *TransactionResultPair) EncodeTo(e *xdr.Encoder) error { +func (s *ConfigUpgradeSet) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.TransactionHash.EncodeTo(e); err != nil { + if _, err = e.EncodeUint(uint32(len(s.UpdatedEntry))); err != nil { return err } - if err = s.Result.EncodeTo(e); err != nil { - return err + for i := 0; i < len(s.UpdatedEntry); i++ { + if err = s.UpdatedEntry[i].EncodeTo(e); err != nil { + return err + } } return nil } -var _ decoderFrom = (*TransactionResultPair)(nil) +var _ decoderFrom = (*ConfigUpgradeSet)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TransactionResultPair) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ConfigUpgradeSet) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionResultPair: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ConfigUpgradeSet: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.TransactionHash.DecodeFrom(d, maxDepth) + var l uint32 + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) + return n, fmt.Errorf("decoding ConfigSettingEntry: %w", err) } - nTmp, err = s.Result.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionResult: %w", err) + s.UpdatedEntry = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding ConfigSettingEntry: length (%d) exceeds remaining input length (%d)", l, il) + } + s.UpdatedEntry = make([]ConfigSettingEntry, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.UpdatedEntry[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ConfigSettingEntry: %w", err) + } + } } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionResultPair) MarshalBinary() ([]byte, error) { +func (s ConfigUpgradeSet) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -14425,7 +14768,7 @@ func (s TransactionResultPair) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionResultPair) UnmarshalBinary(inp []byte) error { +func (s *ConfigUpgradeSet) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -14435,66 +14778,178 @@ func (s *TransactionResultPair) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionResultPair)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionResultPair)(nil) + _ encoding.BinaryMarshaler = (*ConfigUpgradeSet)(nil) + _ encoding.BinaryUnmarshaler = (*ConfigUpgradeSet)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionResultPair) xdrType() {} +func (s ConfigUpgradeSet) xdrType() {} -var _ xdrType = (*TransactionResultPair)(nil) +var _ xdrType = (*ConfigUpgradeSet)(nil) -// TransactionResultSet is an XDR Struct defines as: +// TxSetComponentType is an XDR Enum defines as: // -// struct TransactionResultSet +// enum TxSetComponentType // { -// TransactionResultPair results<>; +// // txs with effective fee <= bid derived from a base fee (if any). +// // If base fee is not specified, no discount is applied. +// TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE = 0 // }; -type TransactionResultSet struct { - Results []TransactionResultPair +type TxSetComponentType int32 + +const ( + TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee TxSetComponentType = 0 +) + +var txSetComponentTypeMap = map[int32]string{ + 0: "TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for TxSetComponentType +func (e TxSetComponentType) ValidEnum(v int32) bool { + _, ok := txSetComponentTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e TxSetComponentType) String() string { + name, _ := txSetComponentTypeMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (s *TransactionResultSet) EncodeTo(e *xdr.Encoder) error { +func (e TxSetComponentType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := txSetComponentTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid TxSetComponentType enum value", e) + } + _, err := enc.EncodeInt(int32(e)) + return err +} + +var _ decoderFrom = (*TxSetComponentType)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (e *TxSetComponentType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TxSetComponentType: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + v, n, err := d.DecodeInt() + if err != nil { + return n, fmt.Errorf("decoding TxSetComponentType: %w", err) + } + if _, ok := txSetComponentTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid TxSetComponentType enum value", v) + } + *e = TxSetComponentType(v) + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TxSetComponentType) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TxSetComponentType) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TxSetComponentType)(nil) + _ encoding.BinaryUnmarshaler = (*TxSetComponentType)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TxSetComponentType) xdrType() {} + +var _ xdrType = (*TxSetComponentType)(nil) + +// TxSetComponentTxsMaybeDiscountedFee is an XDR NestedStruct defines as: +// +// struct +// { +// int64* baseFee; +// TransactionEnvelope txs<>; +// } +type TxSetComponentTxsMaybeDiscountedFee struct { + BaseFee *Int64 + Txs []TransactionEnvelope +} + +// EncodeTo encodes this value using the Encoder. +func (s *TxSetComponentTxsMaybeDiscountedFee) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeUint(uint32(len(s.Results))); err != nil { + if _, err = e.EncodeBool(s.BaseFee != nil); err != nil { return err } - for i := 0; i < len(s.Results); i++ { - if err = s.Results[i].EncodeTo(e); err != nil { + if s.BaseFee != nil { + if err = (*s.BaseFee).EncodeTo(e); err != nil { + return err + } + } + if _, err = e.EncodeUint(uint32(len(s.Txs))); err != nil { + return err + } + for i := 0; i < len(s.Txs); i++ { + if err = s.Txs[i].EncodeTo(e); err != nil { return err } } return nil } -var _ decoderFrom = (*TransactionResultSet)(nil) +var _ decoderFrom = (*TxSetComponentTxsMaybeDiscountedFee)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TransactionResultSet) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TxSetComponentTxsMaybeDiscountedFee) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionResultSet: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TxSetComponentTxsMaybeDiscountedFee: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int + var b bool + b, nTmp, err = d.DecodeBool() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + s.BaseFee = nil + if b { + s.BaseFee = new(Int64) + nTmp, err = s.BaseFee.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + } var l uint32 l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionResultPair: %w", err) + return n, fmt.Errorf("decoding TransactionEnvelope: %w", err) } - s.Results = nil + s.Txs = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding TransactionResultPair: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding TransactionEnvelope: length (%d) exceeds remaining input length (%d)", l, il) } - s.Results = make([]TransactionResultPair, l) + s.Txs = make([]TransactionEnvelope, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.Results[i].DecodeFrom(d, maxDepth) + nTmp, err = s.Txs[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionResultPair: %w", err) + return n, fmt.Errorf("decoding TransactionEnvelope: %w", err) } } } @@ -14502,7 +14957,7 @@ func (s *TransactionResultSet) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, e } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionResultSet) MarshalBinary() ([]byte, error) { +func (s TxSetComponentTxsMaybeDiscountedFee) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -14510,7 +14965,7 @@ func (s TransactionResultSet) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionResultSet) UnmarshalBinary(inp []byte) error { +func (s *TxSetComponentTxsMaybeDiscountedFee) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -14520,83 +14975,81 @@ func (s *TransactionResultSet) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionResultSet)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionResultSet)(nil) + _ encoding.BinaryMarshaler = (*TxSetComponentTxsMaybeDiscountedFee)(nil) + _ encoding.BinaryUnmarshaler = (*TxSetComponentTxsMaybeDiscountedFee)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionResultSet) xdrType() {} +func (s TxSetComponentTxsMaybeDiscountedFee) xdrType() {} -var _ xdrType = (*TransactionResultSet)(nil) +var _ xdrType = (*TxSetComponentTxsMaybeDiscountedFee)(nil) -// TransactionHistoryEntryExt is an XDR NestedUnion defines as: +// TxSetComponent is an XDR Union defines as: // -// union switch (int v) -// { -// case 0: -// void; -// case 1: -// GeneralizedTransactionSet generalizedTxSet; -// } -type TransactionHistoryEntryExt struct { - V int32 - GeneralizedTxSet *GeneralizedTransactionSet +// union TxSetComponent switch (TxSetComponentType type) +// { +// case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE: +// struct +// { +// int64* baseFee; +// TransactionEnvelope txs<>; +// } txsMaybeDiscountedFee; +// }; +type TxSetComponent struct { + Type TxSetComponentType + TxsMaybeDiscountedFee *TxSetComponentTxsMaybeDiscountedFee } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u TransactionHistoryEntryExt) SwitchFieldName() string { - return "V" +func (u TxSetComponent) SwitchFieldName() string { + return "Type" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of TransactionHistoryEntryExt -func (u TransactionHistoryEntryExt) ArmForSwitch(sw int32) (string, bool) { - switch int32(sw) { - case 0: - return "", true - case 1: - return "GeneralizedTxSet", true +// the value for an instance of TxSetComponent +func (u TxSetComponent) ArmForSwitch(sw int32) (string, bool) { + switch TxSetComponentType(sw) { + case TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee: + return "TxsMaybeDiscountedFee", true } return "-", false } -// NewTransactionHistoryEntryExt creates a new TransactionHistoryEntryExt. -func NewTransactionHistoryEntryExt(v int32, value interface{}) (result TransactionHistoryEntryExt, err error) { - result.V = v - switch int32(v) { - case 0: - // void - case 1: - tv, ok := value.(GeneralizedTransactionSet) +// NewTxSetComponent creates a new TxSetComponent. +func NewTxSetComponent(aType TxSetComponentType, value interface{}) (result TxSetComponent, err error) { + result.Type = aType + switch TxSetComponentType(aType) { + case TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee: + tv, ok := value.(TxSetComponentTxsMaybeDiscountedFee) if !ok { - err = errors.New("invalid value, must be GeneralizedTransactionSet") + err = errors.New("invalid value, must be TxSetComponentTxsMaybeDiscountedFee") return } - result.GeneralizedTxSet = &tv + result.TxsMaybeDiscountedFee = &tv } return } -// MustGeneralizedTxSet retrieves the GeneralizedTxSet value from the union, +// MustTxsMaybeDiscountedFee retrieves the TxsMaybeDiscountedFee value from the union, // panicing if the value is not set. -func (u TransactionHistoryEntryExt) MustGeneralizedTxSet() GeneralizedTransactionSet { - val, ok := u.GetGeneralizedTxSet() +func (u TxSetComponent) MustTxsMaybeDiscountedFee() TxSetComponentTxsMaybeDiscountedFee { + val, ok := u.GetTxsMaybeDiscountedFee() if !ok { - panic("arm GeneralizedTxSet is not set") + panic("arm TxsMaybeDiscountedFee is not set") } return val } -// GetGeneralizedTxSet retrieves the GeneralizedTxSet value from the union, +// GetTxsMaybeDiscountedFee retrieves the TxsMaybeDiscountedFee value from the union, // returning ok if the union's switch indicated the value is valid. -func (u TransactionHistoryEntryExt) GetGeneralizedTxSet() (result GeneralizedTransactionSet, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.V)) +func (u TxSetComponent) GetTxsMaybeDiscountedFee() (result TxSetComponentTxsMaybeDiscountedFee, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) - if armName == "GeneralizedTxSet" { - result = *u.GeneralizedTxSet + if armName == "TxsMaybeDiscountedFee" { + result = *u.TxsMaybeDiscountedFee ok = true } @@ -14604,57 +15057,51 @@ func (u TransactionHistoryEntryExt) GetGeneralizedTxSet() (result GeneralizedTra } // EncodeTo encodes this value using the Encoder. -func (u TransactionHistoryEntryExt) EncodeTo(e *xdr.Encoder) error { +func (u TxSetComponent) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeInt(int32(u.V)); err != nil { + if err = u.Type.EncodeTo(e); err != nil { return err } - switch int32(u.V) { - case 0: - // Void - return nil - case 1: - if err = (*u.GeneralizedTxSet).EncodeTo(e); err != nil { + switch TxSetComponentType(u.Type) { + case TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee: + if err = (*u.TxsMaybeDiscountedFee).EncodeTo(e); err != nil { return err } return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union TransactionHistoryEntryExt", u.V) + return fmt.Errorf("Type (TxSetComponentType) switch value '%d' is not valid for union TxSetComponent", u.Type) } -var _ decoderFrom = (*TransactionHistoryEntryExt)(nil) +var _ decoderFrom = (*TxSetComponent)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *TransactionHistoryEntryExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *TxSetComponent) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionHistoryEntryExt: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TxSetComponent: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - u.V, nTmp, err = d.DecodeInt() + nTmp, err = u.Type.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int: %w", err) + return n, fmt.Errorf("decoding TxSetComponentType: %w", err) } - switch int32(u.V) { - case 0: - // Void - return n, nil - case 1: - u.GeneralizedTxSet = new(GeneralizedTransactionSet) - nTmp, err = (*u.GeneralizedTxSet).DecodeFrom(d, maxDepth) + switch TxSetComponentType(u.Type) { + case TxSetComponentTypeTxsetCompTxsMaybeDiscountedFee: + u.TxsMaybeDiscountedFee = new(TxSetComponentTxsMaybeDiscountedFee) + nTmp, err = (*u.TxsMaybeDiscountedFee).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding GeneralizedTransactionSet: %w", err) + return n, fmt.Errorf("decoding TxSetComponentTxsMaybeDiscountedFee: %w", err) } return n, nil } - return n, fmt.Errorf("union TransactionHistoryEntryExt has invalid V (int32) switch value '%d'", u.V) + return n, fmt.Errorf("union TxSetComponent has invalid Type (TxSetComponentType) switch value '%d'", u.Type) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionHistoryEntryExt) MarshalBinary() ([]byte, error) { +func (s TxSetComponent) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -14662,7 +15109,7 @@ func (s TransactionHistoryEntryExt) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionHistoryEntryExt) UnmarshalBinary(inp []byte) error { +func (s *TxSetComponent) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -14672,166 +15119,110 @@ func (s *TransactionHistoryEntryExt) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionHistoryEntryExt)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionHistoryEntryExt)(nil) + _ encoding.BinaryMarshaler = (*TxSetComponent)(nil) + _ encoding.BinaryUnmarshaler = (*TxSetComponent)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionHistoryEntryExt) xdrType() {} +func (s TxSetComponent) xdrType() {} -var _ xdrType = (*TransactionHistoryEntryExt)(nil) +var _ xdrType = (*TxSetComponent)(nil) -// TransactionHistoryEntry is an XDR Struct defines as: +// TransactionPhase is an XDR Union defines as: // -// struct TransactionHistoryEntry +// union TransactionPhase switch (int v) // { -// uint32 ledgerSeq; -// TransactionSet txSet; -// -// // when v != 0, txSet must be empty -// union switch (int v) -// { -// case 0: -// void; -// case 1: -// GeneralizedTransactionSet generalizedTxSet; -// } -// ext; +// case 0: +// TxSetComponent v0Components<>; // }; -type TransactionHistoryEntry struct { - LedgerSeq Uint32 - TxSet TransactionSet - Ext TransactionHistoryEntryExt -} - -// EncodeTo encodes this value using the Encoder. -func (s *TransactionHistoryEntry) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.LedgerSeq.EncodeTo(e); err != nil { - return err - } - if err = s.TxSet.EncodeTo(e); err != nil { - return err - } - if err = s.Ext.EncodeTo(e); err != nil { - return err - } - return nil -} - -var _ decoderFrom = (*TransactionHistoryEntry)(nil) - -// DecodeFrom decodes this value using the Decoder. -func (s *TransactionHistoryEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { - if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionHistoryEntry: %w", ErrMaxDecodingDepthReached) - } - maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.LedgerSeq.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.TxSet.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionSet: %w", err) - } - nTmp, err = s.Ext.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionHistoryEntryExt: %w", err) - } - return n, nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionHistoryEntry) MarshalBinary() ([]byte, error) { - b := bytes.Buffer{} - e := xdr.NewEncoder(&b) - err := s.EncodeTo(e) - return b.Bytes(), err -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionHistoryEntry) UnmarshalBinary(inp []byte) error { - r := bytes.NewReader(inp) - o := xdr.DefaultDecodeOptions - o.MaxInputLen = len(inp) - d := xdr.NewDecoderWithOptions(r, o) - _, err := s.DecodeFrom(d, o.MaxDepth) - return err -} - -var ( - _ encoding.BinaryMarshaler = (*TransactionHistoryEntry)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionHistoryEntry)(nil) -) - -// xdrType signals that this type represents XDR values defined by this package. -func (s TransactionHistoryEntry) xdrType() {} - -var _ xdrType = (*TransactionHistoryEntry)(nil) - -// TransactionHistoryResultEntryExt is an XDR NestedUnion defines as: -// -// union switch (int v) -// { -// case 0: -// void; -// } -type TransactionHistoryResultEntryExt struct { - V int32 +type TransactionPhase struct { + V int32 + V0Components *[]TxSetComponent } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u TransactionHistoryResultEntryExt) SwitchFieldName() string { +func (u TransactionPhase) SwitchFieldName() string { return "V" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of TransactionHistoryResultEntryExt -func (u TransactionHistoryResultEntryExt) ArmForSwitch(sw int32) (string, bool) { +// the value for an instance of TransactionPhase +func (u TransactionPhase) ArmForSwitch(sw int32) (string, bool) { switch int32(sw) { case 0: - return "", true + return "V0Components", true } return "-", false } -// NewTransactionHistoryResultEntryExt creates a new TransactionHistoryResultEntryExt. -func NewTransactionHistoryResultEntryExt(v int32, value interface{}) (result TransactionHistoryResultEntryExt, err error) { +// NewTransactionPhase creates a new TransactionPhase. +func NewTransactionPhase(v int32, value interface{}) (result TransactionPhase, err error) { result.V = v switch int32(v) { case 0: - // void + tv, ok := value.([]TxSetComponent) + if !ok { + err = errors.New("invalid value, must be []TxSetComponent") + return + } + result.V0Components = &tv + } + return +} + +// MustV0Components retrieves the V0Components value from the union, +// panicing if the value is not set. +func (u TransactionPhase) MustV0Components() []TxSetComponent { + val, ok := u.GetV0Components() + + if !ok { + panic("arm V0Components is not set") + } + + return val +} + +// GetV0Components retrieves the V0Components value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u TransactionPhase) GetV0Components() (result []TxSetComponent, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) + + if armName == "V0Components" { + result = *u.V0Components + ok = true } + return } // EncodeTo encodes this value using the Encoder. -func (u TransactionHistoryResultEntryExt) EncodeTo(e *xdr.Encoder) error { +func (u TransactionPhase) EncodeTo(e *xdr.Encoder) error { var err error if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } switch int32(u.V) { case 0: - // Void + if _, err = e.EncodeUint(uint32(len((*u.V0Components)))); err != nil { + return err + } + for i := 0; i < len((*u.V0Components)); i++ { + if err = (*u.V0Components)[i].EncodeTo(e); err != nil { + return err + } + } return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union TransactionHistoryResultEntryExt", u.V) + return fmt.Errorf("V (int32) switch value '%d' is not valid for union TransactionPhase", u.V) } -var _ decoderFrom = (*TransactionHistoryResultEntryExt)(nil) +var _ decoderFrom = (*TransactionPhase)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *TransactionHistoryResultEntryExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *TransactionPhase) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionHistoryResultEntryExt: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionPhase: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -14843,14 +15234,34 @@ func (u *TransactionHistoryResultEntryExt) DecodeFrom(d *xdr.Decoder, maxDepth u } switch int32(u.V) { case 0: - // Void + u.V0Components = new([]TxSetComponent) + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TxSetComponent: %w", err) + } + (*u.V0Components) = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding TxSetComponent: length (%d) exceeds remaining input length (%d)", l, il) + } + (*u.V0Components) = make([]TxSetComponent, l) + for i := uint32(0); i < l; i++ { + nTmp, err = (*u.V0Components)[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TxSetComponent: %w", err) + } + } + } return n, nil } - return n, fmt.Errorf("union TransactionHistoryResultEntryExt has invalid V (int32) switch value '%d'", u.V) + return n, fmt.Errorf("union TransactionPhase has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionHistoryResultEntryExt) MarshalBinary() ([]byte, error) { +func (s TransactionPhase) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -14858,7 +15269,7 @@ func (s TransactionHistoryResultEntryExt) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionHistoryResultEntryExt) UnmarshalBinary(inp []byte) error { +func (s *TransactionPhase) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -14868,81 +15279,84 @@ func (s *TransactionHistoryResultEntryExt) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionHistoryResultEntryExt)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionHistoryResultEntryExt)(nil) + _ encoding.BinaryMarshaler = (*TransactionPhase)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionPhase)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionHistoryResultEntryExt) xdrType() {} +func (s TransactionPhase) xdrType() {} -var _ xdrType = (*TransactionHistoryResultEntryExt)(nil) +var _ xdrType = (*TransactionPhase)(nil) -// TransactionHistoryResultEntry is an XDR Struct defines as: +// TransactionSet is an XDR Struct defines as: // -// struct TransactionHistoryResultEntry +// struct TransactionSet // { -// uint32 ledgerSeq; -// TransactionResultSet txResultSet; -// -// // reserved for future use -// union switch (int v) -// { -// case 0: -// void; -// } -// ext; +// Hash previousLedgerHash; +// TransactionEnvelope txs<>; // }; -type TransactionHistoryResultEntry struct { - LedgerSeq Uint32 - TxResultSet TransactionResultSet - Ext TransactionHistoryResultEntryExt +type TransactionSet struct { + PreviousLedgerHash Hash + Txs []TransactionEnvelope } // EncodeTo encodes this value using the Encoder. -func (s *TransactionHistoryResultEntry) EncodeTo(e *xdr.Encoder) error { +func (s *TransactionSet) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.LedgerSeq.EncodeTo(e); err != nil { + if err = s.PreviousLedgerHash.EncodeTo(e); err != nil { return err } - if err = s.TxResultSet.EncodeTo(e); err != nil { + if _, err = e.EncodeUint(uint32(len(s.Txs))); err != nil { return err } - if err = s.Ext.EncodeTo(e); err != nil { - return err + for i := 0; i < len(s.Txs); i++ { + if err = s.Txs[i].EncodeTo(e); err != nil { + return err + } } return nil } -var _ decoderFrom = (*TransactionHistoryResultEntry)(nil) +var _ decoderFrom = (*TransactionSet)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TransactionHistoryResultEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TransactionSet) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionHistoryResultEntry: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionSet: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.LedgerSeq.DecodeFrom(d, maxDepth) + nTmp, err = s.PreviousLedgerHash.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding Hash: %w", err) } - nTmp, err = s.TxResultSet.DecodeFrom(d, maxDepth) + var l uint32 + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionResultSet: %w", err) + return n, fmt.Errorf("decoding TransactionEnvelope: %w", err) } - nTmp, err = s.Ext.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionHistoryResultEntryExt: %w", err) + s.Txs = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding TransactionEnvelope: length (%d) exceeds remaining input length (%d)", l, il) + } + s.Txs = make([]TransactionEnvelope, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.Txs[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionEnvelope: %w", err) + } + } } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionHistoryResultEntry) MarshalBinary() ([]byte, error) { +func (s TransactionSet) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -14950,7 +15364,7 @@ func (s TransactionHistoryResultEntry) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionHistoryResultEntry) UnmarshalBinary(inp []byte) error { +func (s *TransactionSet) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -14960,91 +15374,84 @@ func (s *TransactionHistoryResultEntry) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionHistoryResultEntry)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionHistoryResultEntry)(nil) + _ encoding.BinaryMarshaler = (*TransactionSet)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionSet)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionHistoryResultEntry) xdrType() {} +func (s TransactionSet) xdrType() {} -var _ xdrType = (*TransactionHistoryResultEntry)(nil) +var _ xdrType = (*TransactionSet)(nil) -// LedgerHeaderHistoryEntryExt is an XDR NestedUnion defines as: +// TransactionSetV1 is an XDR Struct defines as: // -// union switch (int v) -// { -// case 0: -// void; -// } -type LedgerHeaderHistoryEntryExt struct { - V int32 -} - -// SwitchFieldName returns the field name in which this union's -// discriminant is stored -func (u LedgerHeaderHistoryEntryExt) SwitchFieldName() string { - return "V" -} - -// ArmForSwitch returns which field name should be used for storing -// the value for an instance of LedgerHeaderHistoryEntryExt -func (u LedgerHeaderHistoryEntryExt) ArmForSwitch(sw int32) (string, bool) { - switch int32(sw) { - case 0: - return "", true - } - return "-", false -} - -// NewLedgerHeaderHistoryEntryExt creates a new LedgerHeaderHistoryEntryExt. -func NewLedgerHeaderHistoryEntryExt(v int32, value interface{}) (result LedgerHeaderHistoryEntryExt, err error) { - result.V = v - switch int32(v) { - case 0: - // void - } - return +// struct TransactionSetV1 +// { +// Hash previousLedgerHash; +// TransactionPhase phases<>; +// }; +type TransactionSetV1 struct { + PreviousLedgerHash Hash + Phases []TransactionPhase } // EncodeTo encodes this value using the Encoder. -func (u LedgerHeaderHistoryEntryExt) EncodeTo(e *xdr.Encoder) error { +func (s *TransactionSetV1) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeInt(int32(u.V)); err != nil { + if err = s.PreviousLedgerHash.EncodeTo(e); err != nil { return err } - switch int32(u.V) { - case 0: - // Void - return nil + if _, err = e.EncodeUint(uint32(len(s.Phases))); err != nil { + return err } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerHeaderHistoryEntryExt", u.V) + for i := 0; i < len(s.Phases); i++ { + if err = s.Phases[i].EncodeTo(e); err != nil { + return err + } + } + return nil } -var _ decoderFrom = (*LedgerHeaderHistoryEntryExt)(nil) +var _ decoderFrom = (*TransactionSetV1)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *LedgerHeaderHistoryEntryExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TransactionSetV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerHeaderHistoryEntryExt: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionSetV1: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - u.V, nTmp, err = d.DecodeInt() + nTmp, err = s.PreviousLedgerHash.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int: %w", err) + return n, fmt.Errorf("decoding Hash: %w", err) } - switch int32(u.V) { - case 0: - // Void - return n, nil + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionPhase: %w", err) } - return n, fmt.Errorf("union LedgerHeaderHistoryEntryExt has invalid V (int32) switch value '%d'", u.V) + s.Phases = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding TransactionPhase: length (%d) exceeds remaining input length (%d)", l, il) + } + s.Phases = make([]TransactionPhase, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.Phases[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionPhase: %w", err) + } + } + } + return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerHeaderHistoryEntryExt) MarshalBinary() ([]byte, error) { +func (s TransactionSetV1) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -15052,7 +15459,7 @@ func (s LedgerHeaderHistoryEntryExt) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerHeaderHistoryEntryExt) UnmarshalBinary(inp []byte) error { +func (s *TransactionSetV1) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -15062,81 +15469,130 @@ func (s *LedgerHeaderHistoryEntryExt) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerHeaderHistoryEntryExt)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerHeaderHistoryEntryExt)(nil) + _ encoding.BinaryMarshaler = (*TransactionSetV1)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionSetV1)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerHeaderHistoryEntryExt) xdrType() {} +func (s TransactionSetV1) xdrType() {} -var _ xdrType = (*LedgerHeaderHistoryEntryExt)(nil) +var _ xdrType = (*TransactionSetV1)(nil) -// LedgerHeaderHistoryEntry is an XDR Struct defines as: +// GeneralizedTransactionSet is an XDR Union defines as: // -// struct LedgerHeaderHistoryEntry +// union GeneralizedTransactionSet switch (int v) // { -// Hash hash; -// LedgerHeader header; -// -// // reserved for future use -// union switch (int v) -// { -// case 0: -// void; -// } -// ext; +// // We consider the legacy TransactionSet to be v0. +// case 1: +// TransactionSetV1 v1TxSet; // }; -type LedgerHeaderHistoryEntry struct { - Hash Hash - Header LedgerHeader - Ext LedgerHeaderHistoryEntryExt +type GeneralizedTransactionSet struct { + V int32 + V1TxSet *TransactionSetV1 +} + +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u GeneralizedTransactionSet) SwitchFieldName() string { + return "V" +} + +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of GeneralizedTransactionSet +func (u GeneralizedTransactionSet) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 1: + return "V1TxSet", true + } + return "-", false +} + +// NewGeneralizedTransactionSet creates a new GeneralizedTransactionSet. +func NewGeneralizedTransactionSet(v int32, value interface{}) (result GeneralizedTransactionSet, err error) { + result.V = v + switch int32(v) { + case 1: + tv, ok := value.(TransactionSetV1) + if !ok { + err = errors.New("invalid value, must be TransactionSetV1") + return + } + result.V1TxSet = &tv + } + return +} + +// MustV1TxSet retrieves the V1TxSet value from the union, +// panicing if the value is not set. +func (u GeneralizedTransactionSet) MustV1TxSet() TransactionSetV1 { + val, ok := u.GetV1TxSet() + + if !ok { + panic("arm V1TxSet is not set") + } + + return val +} + +// GetV1TxSet retrieves the V1TxSet value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u GeneralizedTransactionSet) GetV1TxSet() (result TransactionSetV1, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) + + if armName == "V1TxSet" { + result = *u.V1TxSet + ok = true + } + + return } // EncodeTo encodes this value using the Encoder. -func (s *LedgerHeaderHistoryEntry) EncodeTo(e *xdr.Encoder) error { +func (u GeneralizedTransactionSet) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Hash.EncodeTo(e); err != nil { - return err - } - if err = s.Header.EncodeTo(e); err != nil { + if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } - if err = s.Ext.EncodeTo(e); err != nil { - return err + switch int32(u.V) { + case 1: + if err = (*u.V1TxSet).EncodeTo(e); err != nil { + return err + } + return nil } - return nil + return fmt.Errorf("V (int32) switch value '%d' is not valid for union GeneralizedTransactionSet", u.V) } -var _ decoderFrom = (*LedgerHeaderHistoryEntry)(nil) +var _ decoderFrom = (*GeneralizedTransactionSet)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *LedgerHeaderHistoryEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *GeneralizedTransactionSet) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerHeaderHistoryEntry: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding GeneralizedTransactionSet: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Hash.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - nTmp, err = s.Header.DecodeFrom(d, maxDepth) + u.V, nTmp, err = d.DecodeInt() n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerHeader: %w", err) + return n, fmt.Errorf("decoding Int: %w", err) } - nTmp, err = s.Ext.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerHeaderHistoryEntryExt: %w", err) + switch int32(u.V) { + case 1: + u.V1TxSet = new(TransactionSetV1) + nTmp, err = (*u.V1TxSet).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionSetV1: %w", err) + } + return n, nil } - return n, nil + return n, fmt.Errorf("union GeneralizedTransactionSet has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerHeaderHistoryEntry) MarshalBinary() ([]byte, error) { +func (s GeneralizedTransactionSet) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -15144,7 +15600,7 @@ func (s LedgerHeaderHistoryEntry) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerHeaderHistoryEntry) UnmarshalBinary(inp []byte) error { +func (s *GeneralizedTransactionSet) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -15154,84 +15610,64 @@ func (s *LedgerHeaderHistoryEntry) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerHeaderHistoryEntry)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerHeaderHistoryEntry)(nil) + _ encoding.BinaryMarshaler = (*GeneralizedTransactionSet)(nil) + _ encoding.BinaryUnmarshaler = (*GeneralizedTransactionSet)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerHeaderHistoryEntry) xdrType() {} +func (s GeneralizedTransactionSet) xdrType() {} -var _ xdrType = (*LedgerHeaderHistoryEntry)(nil) +var _ xdrType = (*GeneralizedTransactionSet)(nil) -// LedgerScpMessages is an XDR Struct defines as: +// TransactionResultPair is an XDR Struct defines as: // -// struct LedgerSCPMessages +// struct TransactionResultPair // { -// uint32 ledgerSeq; -// SCPEnvelope messages<>; +// Hash transactionHash; +// TransactionResult result; // result for the transaction // }; -type LedgerScpMessages struct { - LedgerSeq Uint32 - Messages []ScpEnvelope +type TransactionResultPair struct { + TransactionHash Hash + Result TransactionResult } // EncodeTo encodes this value using the Encoder. -func (s *LedgerScpMessages) EncodeTo(e *xdr.Encoder) error { +func (s *TransactionResultPair) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.LedgerSeq.EncodeTo(e); err != nil { + if err = s.TransactionHash.EncodeTo(e); err != nil { return err } - if _, err = e.EncodeUint(uint32(len(s.Messages))); err != nil { + if err = s.Result.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s.Messages); i++ { - if err = s.Messages[i].EncodeTo(e); err != nil { - return err - } - } return nil } -var _ decoderFrom = (*LedgerScpMessages)(nil) +var _ decoderFrom = (*TransactionResultPair)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *LedgerScpMessages) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TransactionResultPair) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerScpMessages: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionResultPair: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.LedgerSeq.DecodeFrom(d, maxDepth) + nTmp, err = s.TransactionHash.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding Hash: %w", err) } - var l uint32 - l, nTmp, err = d.DecodeUint() + nTmp, err = s.Result.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ScpEnvelope: %w", err) - } - s.Messages = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding ScpEnvelope: length (%d) exceeds remaining input length (%d)", l, il) - } - s.Messages = make([]ScpEnvelope, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.Messages[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding ScpEnvelope: %w", err) - } - } + return n, fmt.Errorf("decoding TransactionResult: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerScpMessages) MarshalBinary() ([]byte, error) { +func (s TransactionResultPair) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -15239,7 +15675,7 @@ func (s LedgerScpMessages) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerScpMessages) UnmarshalBinary(inp []byte) error { +func (s *TransactionResultPair) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -15249,50 +15685,45 @@ func (s *LedgerScpMessages) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerScpMessages)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerScpMessages)(nil) + _ encoding.BinaryMarshaler = (*TransactionResultPair)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionResultPair)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerScpMessages) xdrType() {} +func (s TransactionResultPair) xdrType() {} -var _ xdrType = (*LedgerScpMessages)(nil) +var _ xdrType = (*TransactionResultPair)(nil) -// ScpHistoryEntryV0 is an XDR Struct defines as: +// TransactionResultSet is an XDR Struct defines as: // -// struct SCPHistoryEntryV0 +// struct TransactionResultSet // { -// SCPQuorumSet quorumSets<>; // additional quorum sets used by ledgerMessages -// LedgerSCPMessages ledgerMessages; +// TransactionResultPair results<>; // }; -type ScpHistoryEntryV0 struct { - QuorumSets []ScpQuorumSet - LedgerMessages LedgerScpMessages +type TransactionResultSet struct { + Results []TransactionResultPair } // EncodeTo encodes this value using the Encoder. -func (s *ScpHistoryEntryV0) EncodeTo(e *xdr.Encoder) error { +func (s *TransactionResultSet) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeUint(uint32(len(s.QuorumSets))); err != nil { + if _, err = e.EncodeUint(uint32(len(s.Results))); err != nil { return err } - for i := 0; i < len(s.QuorumSets); i++ { - if err = s.QuorumSets[i].EncodeTo(e); err != nil { + for i := 0; i < len(s.Results); i++ { + if err = s.Results[i].EncodeTo(e); err != nil { return err } } - if err = s.LedgerMessages.EncodeTo(e); err != nil { - return err - } return nil } -var _ decoderFrom = (*ScpHistoryEntryV0)(nil) +var _ decoderFrom = (*TransactionResultSet)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *ScpHistoryEntryV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TransactionResultSet) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding ScpHistoryEntryV0: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionResultSet: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -15301,32 +15732,27 @@ func (s *ScpHistoryEntryV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, erro l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding ScpQuorumSet: %w", err) + return n, fmt.Errorf("decoding TransactionResultPair: %w", err) } - s.QuorumSets = nil + s.Results = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding ScpQuorumSet: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding TransactionResultPair: length (%d) exceeds remaining input length (%d)", l, il) } - s.QuorumSets = make([]ScpQuorumSet, l) + s.Results = make([]TransactionResultPair, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.QuorumSets[i].DecodeFrom(d, maxDepth) + nTmp, err = s.Results[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ScpQuorumSet: %w", err) + return n, fmt.Errorf("decoding TransactionResultPair: %w", err) } } } - nTmp, err = s.LedgerMessages.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerScpMessages: %w", err) - } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s ScpHistoryEntryV0) MarshalBinary() ([]byte, error) { +func (s TransactionResultSet) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -15334,7 +15760,7 @@ func (s ScpHistoryEntryV0) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *ScpHistoryEntryV0) UnmarshalBinary(inp []byte) error { +func (s *TransactionResultSet) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -15344,77 +15770,83 @@ func (s *ScpHistoryEntryV0) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*ScpHistoryEntryV0)(nil) - _ encoding.BinaryUnmarshaler = (*ScpHistoryEntryV0)(nil) + _ encoding.BinaryMarshaler = (*TransactionResultSet)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionResultSet)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s ScpHistoryEntryV0) xdrType() {} +func (s TransactionResultSet) xdrType() {} -var _ xdrType = (*ScpHistoryEntryV0)(nil) +var _ xdrType = (*TransactionResultSet)(nil) -// ScpHistoryEntry is an XDR Union defines as: +// TransactionHistoryEntryExt is an XDR NestedUnion defines as: // -// union SCPHistoryEntry switch (int v) -// { -// case 0: -// SCPHistoryEntryV0 v0; -// }; -type ScpHistoryEntry struct { - V int32 - V0 *ScpHistoryEntryV0 +// union switch (int v) +// { +// case 0: +// void; +// case 1: +// GeneralizedTransactionSet generalizedTxSet; +// } +type TransactionHistoryEntryExt struct { + V int32 + GeneralizedTxSet *GeneralizedTransactionSet } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u ScpHistoryEntry) SwitchFieldName() string { +func (u TransactionHistoryEntryExt) SwitchFieldName() string { return "V" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of ScpHistoryEntry -func (u ScpHistoryEntry) ArmForSwitch(sw int32) (string, bool) { +// the value for an instance of TransactionHistoryEntryExt +func (u TransactionHistoryEntryExt) ArmForSwitch(sw int32) (string, bool) { switch int32(sw) { case 0: - return "V0", true + return "", true + case 1: + return "GeneralizedTxSet", true } return "-", false } -// NewScpHistoryEntry creates a new ScpHistoryEntry. -func NewScpHistoryEntry(v int32, value interface{}) (result ScpHistoryEntry, err error) { +// NewTransactionHistoryEntryExt creates a new TransactionHistoryEntryExt. +func NewTransactionHistoryEntryExt(v int32, value interface{}) (result TransactionHistoryEntryExt, err error) { result.V = v switch int32(v) { case 0: - tv, ok := value.(ScpHistoryEntryV0) + // void + case 1: + tv, ok := value.(GeneralizedTransactionSet) if !ok { - err = errors.New("invalid value, must be ScpHistoryEntryV0") + err = errors.New("invalid value, must be GeneralizedTransactionSet") return } - result.V0 = &tv + result.GeneralizedTxSet = &tv } return } -// MustV0 retrieves the V0 value from the union, +// MustGeneralizedTxSet retrieves the GeneralizedTxSet value from the union, // panicing if the value is not set. -func (u ScpHistoryEntry) MustV0() ScpHistoryEntryV0 { - val, ok := u.GetV0() +func (u TransactionHistoryEntryExt) MustGeneralizedTxSet() GeneralizedTransactionSet { + val, ok := u.GetGeneralizedTxSet() if !ok { - panic("arm V0 is not set") + panic("arm GeneralizedTxSet is not set") } return val } -// GetV0 retrieves the V0 value from the union, +// GetGeneralizedTxSet retrieves the GeneralizedTxSet value from the union, // returning ok if the union's switch indicated the value is valid. -func (u ScpHistoryEntry) GetV0() (result ScpHistoryEntryV0, ok bool) { +func (u TransactionHistoryEntryExt) GetGeneralizedTxSet() (result GeneralizedTransactionSet, ok bool) { armName, _ := u.ArmForSwitch(int32(u.V)) - if armName == "V0" { - result = *u.V0 + if armName == "GeneralizedTxSet" { + result = *u.GeneralizedTxSet ok = true } @@ -15422,27 +15854,30 @@ func (u ScpHistoryEntry) GetV0() (result ScpHistoryEntryV0, ok bool) { } // EncodeTo encodes this value using the Encoder. -func (u ScpHistoryEntry) EncodeTo(e *xdr.Encoder) error { +func (u TransactionHistoryEntryExt) EncodeTo(e *xdr.Encoder) error { var err error if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } switch int32(u.V) { case 0: - if err = (*u.V0).EncodeTo(e); err != nil { + // Void + return nil + case 1: + if err = (*u.GeneralizedTxSet).EncodeTo(e); err != nil { return err } return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union ScpHistoryEntry", u.V) + return fmt.Errorf("V (int32) switch value '%d' is not valid for union TransactionHistoryEntryExt", u.V) } -var _ decoderFrom = (*ScpHistoryEntry)(nil) +var _ decoderFrom = (*TransactionHistoryEntryExt)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *ScpHistoryEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *TransactionHistoryEntryExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding ScpHistoryEntry: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionHistoryEntryExt: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -15454,19 +15889,22 @@ func (u *ScpHistoryEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) } switch int32(u.V) { case 0: - u.V0 = new(ScpHistoryEntryV0) - nTmp, err = (*u.V0).DecodeFrom(d, maxDepth) + // Void + return n, nil + case 1: + u.GeneralizedTxSet = new(GeneralizedTransactionSet) + nTmp, err = (*u.GeneralizedTxSet).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ScpHistoryEntryV0: %w", err) + return n, fmt.Errorf("decoding GeneralizedTransactionSet: %w", err) } return n, nil } - return n, fmt.Errorf("union ScpHistoryEntry has invalid V (int32) switch value '%d'", u.V) + return n, fmt.Errorf("union TransactionHistoryEntryExt has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s ScpHistoryEntry) MarshalBinary() ([]byte, error) { +func (s TransactionHistoryEntryExt) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -15474,7 +15912,7 @@ func (s ScpHistoryEntry) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *ScpHistoryEntry) UnmarshalBinary(inp []byte) error { +func (s *TransactionHistoryEntryExt) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -15484,83 +15922,83 @@ func (s *ScpHistoryEntry) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*ScpHistoryEntry)(nil) - _ encoding.BinaryUnmarshaler = (*ScpHistoryEntry)(nil) + _ encoding.BinaryMarshaler = (*TransactionHistoryEntryExt)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionHistoryEntryExt)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s ScpHistoryEntry) xdrType() {} +func (s TransactionHistoryEntryExt) xdrType() {} -var _ xdrType = (*ScpHistoryEntry)(nil) +var _ xdrType = (*TransactionHistoryEntryExt)(nil) -// LedgerEntryChangeType is an XDR Enum defines as: +// TransactionHistoryEntry is an XDR Struct defines as: // -// enum LedgerEntryChangeType +// struct TransactionHistoryEntry // { -// LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger -// LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger -// LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger -// LEDGER_ENTRY_STATE = 3 // value of the entry +// uint32 ledgerSeq; +// TransactionSet txSet; +// +// // when v != 0, txSet must be empty +// union switch (int v) +// { +// case 0: +// void; +// case 1: +// GeneralizedTransactionSet generalizedTxSet; +// } +// ext; // }; -type LedgerEntryChangeType int32 - -const ( - LedgerEntryChangeTypeLedgerEntryCreated LedgerEntryChangeType = 0 - LedgerEntryChangeTypeLedgerEntryUpdated LedgerEntryChangeType = 1 - LedgerEntryChangeTypeLedgerEntryRemoved LedgerEntryChangeType = 2 - LedgerEntryChangeTypeLedgerEntryState LedgerEntryChangeType = 3 -) - -var ledgerEntryChangeTypeMap = map[int32]string{ - 0: "LedgerEntryChangeTypeLedgerEntryCreated", - 1: "LedgerEntryChangeTypeLedgerEntryUpdated", - 2: "LedgerEntryChangeTypeLedgerEntryRemoved", - 3: "LedgerEntryChangeTypeLedgerEntryState", -} - -// ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for LedgerEntryChangeType -func (e LedgerEntryChangeType) ValidEnum(v int32) bool { - _, ok := ledgerEntryChangeTypeMap[v] - return ok -} - -// String returns the name of `e` -func (e LedgerEntryChangeType) String() string { - name, _ := ledgerEntryChangeTypeMap[int32(e)] - return name +type TransactionHistoryEntry struct { + LedgerSeq Uint32 + TxSet TransactionSet + Ext TransactionHistoryEntryExt } // EncodeTo encodes this value using the Encoder. -func (e LedgerEntryChangeType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := ledgerEntryChangeTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid LedgerEntryChangeType enum value", e) +func (s *TransactionHistoryEntry) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.LedgerSeq.EncodeTo(e); err != nil { + return err } - _, err := enc.EncodeInt(int32(e)) - return err + if err = s.TxSet.EncodeTo(e); err != nil { + return err + } + if err = s.Ext.EncodeTo(e); err != nil { + return err + } + return nil } -var _ decoderFrom = (*LedgerEntryChangeType)(nil) +var _ decoderFrom = (*TransactionHistoryEntry)(nil) // DecodeFrom decodes this value using the Decoder. -func (e *LedgerEntryChangeType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TransactionHistoryEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerEntryChangeType: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionHistoryEntry: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - v, n, err := d.DecodeInt() + var err error + var n, nTmp int + nTmp, err = s.LedgerSeq.DecodeFrom(d, maxDepth) + n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChangeType: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - if _, ok := ledgerEntryChangeTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid LedgerEntryChangeType enum value", v) + nTmp, err = s.TxSet.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionSet: %w", err) + } + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionHistoryEntryExt: %w", err) } - *e = LedgerEntryChangeType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerEntryChangeType) MarshalBinary() ([]byte, error) { +func (s TransactionHistoryEntry) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -15568,7 +16006,7 @@ func (s LedgerEntryChangeType) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerEntryChangeType) UnmarshalBinary(inp []byte) error { +func (s *TransactionHistoryEntry) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -15578,279 +16016,91 @@ func (s *LedgerEntryChangeType) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerEntryChangeType)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerEntryChangeType)(nil) + _ encoding.BinaryMarshaler = (*TransactionHistoryEntry)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionHistoryEntry)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerEntryChangeType) xdrType() {} +func (s TransactionHistoryEntry) xdrType() {} -var _ xdrType = (*LedgerEntryChangeType)(nil) +var _ xdrType = (*TransactionHistoryEntry)(nil) -// LedgerEntryChange is an XDR Union defines as: +// TransactionHistoryResultEntryExt is an XDR NestedUnion defines as: // -// union LedgerEntryChange switch (LedgerEntryChangeType type) -// { -// case LEDGER_ENTRY_CREATED: -// LedgerEntry created; -// case LEDGER_ENTRY_UPDATED: -// LedgerEntry updated; -// case LEDGER_ENTRY_REMOVED: -// LedgerKey removed; -// case LEDGER_ENTRY_STATE: -// LedgerEntry state; -// }; -type LedgerEntryChange struct { - Type LedgerEntryChangeType - Created *LedgerEntry - Updated *LedgerEntry - Removed *LedgerKey - State *LedgerEntry +// union switch (int v) +// { +// case 0: +// void; +// } +type TransactionHistoryResultEntryExt struct { + V int32 } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u LedgerEntryChange) SwitchFieldName() string { - return "Type" +func (u TransactionHistoryResultEntryExt) SwitchFieldName() string { + return "V" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of LedgerEntryChange -func (u LedgerEntryChange) ArmForSwitch(sw int32) (string, bool) { - switch LedgerEntryChangeType(sw) { - case LedgerEntryChangeTypeLedgerEntryCreated: - return "Created", true - case LedgerEntryChangeTypeLedgerEntryUpdated: - return "Updated", true - case LedgerEntryChangeTypeLedgerEntryRemoved: - return "Removed", true - case LedgerEntryChangeTypeLedgerEntryState: - return "State", true +// the value for an instance of TransactionHistoryResultEntryExt +func (u TransactionHistoryResultEntryExt) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 0: + return "", true } return "-", false } -// NewLedgerEntryChange creates a new LedgerEntryChange. -func NewLedgerEntryChange(aType LedgerEntryChangeType, value interface{}) (result LedgerEntryChange, err error) { - result.Type = aType - switch LedgerEntryChangeType(aType) { - case LedgerEntryChangeTypeLedgerEntryCreated: - tv, ok := value.(LedgerEntry) - if !ok { - err = errors.New("invalid value, must be LedgerEntry") - return - } - result.Created = &tv - case LedgerEntryChangeTypeLedgerEntryUpdated: - tv, ok := value.(LedgerEntry) - if !ok { - err = errors.New("invalid value, must be LedgerEntry") - return - } - result.Updated = &tv - case LedgerEntryChangeTypeLedgerEntryRemoved: - tv, ok := value.(LedgerKey) - if !ok { - err = errors.New("invalid value, must be LedgerKey") - return - } - result.Removed = &tv - case LedgerEntryChangeTypeLedgerEntryState: - tv, ok := value.(LedgerEntry) - if !ok { - err = errors.New("invalid value, must be LedgerEntry") - return - } - result.State = &tv - } - return -} - -// MustCreated retrieves the Created value from the union, -// panicing if the value is not set. -func (u LedgerEntryChange) MustCreated() LedgerEntry { - val, ok := u.GetCreated() - - if !ok { - panic("arm Created is not set") - } - - return val -} - -// GetCreated retrieves the Created value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u LedgerEntryChange) GetCreated() (result LedgerEntry, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "Created" { - result = *u.Created - ok = true - } - - return -} - -// MustUpdated retrieves the Updated value from the union, -// panicing if the value is not set. -func (u LedgerEntryChange) MustUpdated() LedgerEntry { - val, ok := u.GetUpdated() - - if !ok { - panic("arm Updated is not set") - } - - return val -} - -// GetUpdated retrieves the Updated value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u LedgerEntryChange) GetUpdated() (result LedgerEntry, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "Updated" { - result = *u.Updated - ok = true - } - - return -} - -// MustRemoved retrieves the Removed value from the union, -// panicing if the value is not set. -func (u LedgerEntryChange) MustRemoved() LedgerKey { - val, ok := u.GetRemoved() - - if !ok { - panic("arm Removed is not set") - } - - return val -} - -// GetRemoved retrieves the Removed value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u LedgerEntryChange) GetRemoved() (result LedgerKey, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "Removed" { - result = *u.Removed - ok = true - } - - return -} - -// MustState retrieves the State value from the union, -// panicing if the value is not set. -func (u LedgerEntryChange) MustState() LedgerEntry { - val, ok := u.GetState() - - if !ok { - panic("arm State is not set") - } - - return val -} - -// GetState retrieves the State value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u LedgerEntryChange) GetState() (result LedgerEntry, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "State" { - result = *u.State - ok = true +// NewTransactionHistoryResultEntryExt creates a new TransactionHistoryResultEntryExt. +func NewTransactionHistoryResultEntryExt(v int32, value interface{}) (result TransactionHistoryResultEntryExt, err error) { + result.V = v + switch int32(v) { + case 0: + // void } - return } // EncodeTo encodes this value using the Encoder. -func (u LedgerEntryChange) EncodeTo(e *xdr.Encoder) error { +func (u TransactionHistoryResultEntryExt) EncodeTo(e *xdr.Encoder) error { var err error - if err = u.Type.EncodeTo(e); err != nil { + if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } - switch LedgerEntryChangeType(u.Type) { - case LedgerEntryChangeTypeLedgerEntryCreated: - if err = (*u.Created).EncodeTo(e); err != nil { - return err - } - return nil - case LedgerEntryChangeTypeLedgerEntryUpdated: - if err = (*u.Updated).EncodeTo(e); err != nil { - return err - } - return nil - case LedgerEntryChangeTypeLedgerEntryRemoved: - if err = (*u.Removed).EncodeTo(e); err != nil { - return err - } - return nil - case LedgerEntryChangeTypeLedgerEntryState: - if err = (*u.State).EncodeTo(e); err != nil { - return err - } + switch int32(u.V) { + case 0: + // Void return nil } - return fmt.Errorf("Type (LedgerEntryChangeType) switch value '%d' is not valid for union LedgerEntryChange", u.Type) + return fmt.Errorf("V (int32) switch value '%d' is not valid for union TransactionHistoryResultEntryExt", u.V) } -var _ decoderFrom = (*LedgerEntryChange)(nil) +var _ decoderFrom = (*TransactionHistoryResultEntryExt)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *LedgerEntryChange) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *TransactionHistoryResultEntryExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerEntryChange: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionHistoryResultEntryExt: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = u.Type.DecodeFrom(d, maxDepth) + u.V, nTmp, err = d.DecodeInt() n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChangeType: %w", err) + return n, fmt.Errorf("decoding Int: %w", err) } - switch LedgerEntryChangeType(u.Type) { - case LedgerEntryChangeTypeLedgerEntryCreated: - u.Created = new(LedgerEntry) - nTmp, err = (*u.Created).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerEntry: %w", err) - } - return n, nil - case LedgerEntryChangeTypeLedgerEntryUpdated: - u.Updated = new(LedgerEntry) - nTmp, err = (*u.Updated).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerEntry: %w", err) - } - return n, nil - case LedgerEntryChangeTypeLedgerEntryRemoved: - u.Removed = new(LedgerKey) - nTmp, err = (*u.Removed).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerKey: %w", err) - } - return n, nil - case LedgerEntryChangeTypeLedgerEntryState: - u.State = new(LedgerEntry) - nTmp, err = (*u.State).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerEntry: %w", err) - } + switch int32(u.V) { + case 0: + // Void return n, nil } - return n, fmt.Errorf("union LedgerEntryChange has invalid Type (LedgerEntryChangeType) switch value '%d'", u.Type) + return n, fmt.Errorf("union TransactionHistoryResultEntryExt has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerEntryChange) MarshalBinary() ([]byte, error) { +func (s TransactionHistoryResultEntryExt) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -15858,7 +16108,7 @@ func (s LedgerEntryChange) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerEntryChange) UnmarshalBinary(inp []byte) error { +func (s *TransactionHistoryResultEntryExt) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -15868,69 +16118,81 @@ func (s *LedgerEntryChange) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerEntryChange)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerEntryChange)(nil) + _ encoding.BinaryMarshaler = (*TransactionHistoryResultEntryExt)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionHistoryResultEntryExt)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerEntryChange) xdrType() {} +func (s TransactionHistoryResultEntryExt) xdrType() {} -var _ xdrType = (*LedgerEntryChange)(nil) +var _ xdrType = (*TransactionHistoryResultEntryExt)(nil) -// LedgerEntryChanges is an XDR Typedef defines as: +// TransactionHistoryResultEntry is an XDR Struct defines as: // -// typedef LedgerEntryChange LedgerEntryChanges<>; -type LedgerEntryChanges []LedgerEntryChange +// struct TransactionHistoryResultEntry +// { +// uint32 ledgerSeq; +// TransactionResultSet txResultSet; +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; +// }; +type TransactionHistoryResultEntry struct { + LedgerSeq Uint32 + TxResultSet TransactionResultSet + Ext TransactionHistoryResultEntryExt +} // EncodeTo encodes this value using the Encoder. -func (s LedgerEntryChanges) EncodeTo(e *xdr.Encoder) error { +func (s *TransactionHistoryResultEntry) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeUint(uint32(len(s))); err != nil { + if err = s.LedgerSeq.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s); i++ { - if err = s[i].EncodeTo(e); err != nil { - return err - } + if err = s.TxResultSet.EncodeTo(e); err != nil { + return err + } + if err = s.Ext.EncodeTo(e); err != nil { + return err } return nil } -var _ decoderFrom = (*LedgerEntryChanges)(nil) +var _ decoderFrom = (*TransactionHistoryResultEntry)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *LedgerEntryChanges) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TransactionHistoryResultEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerEntryChanges: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionHistoryResultEntry: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - var l uint32 - l, nTmp, err = d.DecodeUint() + nTmp, err = s.LedgerSeq.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChange: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - (*s) = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding LedgerEntryChange: length (%d) exceeds remaining input length (%d)", l, il) - } - (*s) = make([]LedgerEntryChange, l) - for i := uint32(0); i < l; i++ { - nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChange: %w", err) - } - } + nTmp, err = s.TxResultSet.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionResultSet: %w", err) + } + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionHistoryResultEntryExt: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerEntryChanges) MarshalBinary() ([]byte, error) { +func (s TransactionHistoryResultEntry) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -15938,7 +16200,7 @@ func (s LedgerEntryChanges) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerEntryChanges) UnmarshalBinary(inp []byte) error { +func (s *TransactionHistoryResultEntry) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -15948,54 +16210,91 @@ func (s *LedgerEntryChanges) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerEntryChanges)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerEntryChanges)(nil) + _ encoding.BinaryMarshaler = (*TransactionHistoryResultEntry)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionHistoryResultEntry)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerEntryChanges) xdrType() {} +func (s TransactionHistoryResultEntry) xdrType() {} -var _ xdrType = (*LedgerEntryChanges)(nil) +var _ xdrType = (*TransactionHistoryResultEntry)(nil) -// OperationMeta is an XDR Struct defines as: +// LedgerHeaderHistoryEntryExt is an XDR NestedUnion defines as: // -// struct OperationMeta -// { -// LedgerEntryChanges changes; -// }; -type OperationMeta struct { - Changes LedgerEntryChanges -} - -// EncodeTo encodes this value using the Encoder. -func (s *OperationMeta) EncodeTo(e *xdr.Encoder) error { +// union switch (int v) +// { +// case 0: +// void; +// } +type LedgerHeaderHistoryEntryExt struct { + V int32 +} + +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u LedgerHeaderHistoryEntryExt) SwitchFieldName() string { + return "V" +} + +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of LedgerHeaderHistoryEntryExt +func (u LedgerHeaderHistoryEntryExt) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 0: + return "", true + } + return "-", false +} + +// NewLedgerHeaderHistoryEntryExt creates a new LedgerHeaderHistoryEntryExt. +func NewLedgerHeaderHistoryEntryExt(v int32, value interface{}) (result LedgerHeaderHistoryEntryExt, err error) { + result.V = v + switch int32(v) { + case 0: + // void + } + return +} + +// EncodeTo encodes this value using the Encoder. +func (u LedgerHeaderHistoryEntryExt) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Changes.EncodeTo(e); err != nil { + if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } - return nil + switch int32(u.V) { + case 0: + // Void + return nil + } + return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerHeaderHistoryEntryExt", u.V) } -var _ decoderFrom = (*OperationMeta)(nil) +var _ decoderFrom = (*LedgerHeaderHistoryEntryExt)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *OperationMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *LedgerHeaderHistoryEntryExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding OperationMeta: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerHeaderHistoryEntryExt: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Changes.DecodeFrom(d, maxDepth) + u.V, nTmp, err = d.DecodeInt() n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) + return n, fmt.Errorf("decoding Int: %w", err) } - return n, nil + switch int32(u.V) { + case 0: + // Void + return n, nil + } + return n, fmt.Errorf("union LedgerHeaderHistoryEntryExt has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s OperationMeta) MarshalBinary() ([]byte, error) { +func (s LedgerHeaderHistoryEntryExt) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -16003,7 +16302,7 @@ func (s OperationMeta) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *OperationMeta) UnmarshalBinary(inp []byte) error { +func (s *LedgerHeaderHistoryEntryExt) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -16013,84 +16312,81 @@ func (s *OperationMeta) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*OperationMeta)(nil) - _ encoding.BinaryUnmarshaler = (*OperationMeta)(nil) + _ encoding.BinaryMarshaler = (*LedgerHeaderHistoryEntryExt)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerHeaderHistoryEntryExt)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s OperationMeta) xdrType() {} +func (s LedgerHeaderHistoryEntryExt) xdrType() {} -var _ xdrType = (*OperationMeta)(nil) +var _ xdrType = (*LedgerHeaderHistoryEntryExt)(nil) -// TransactionMetaV1 is an XDR Struct defines as: +// LedgerHeaderHistoryEntry is an XDR Struct defines as: // -// struct TransactionMetaV1 +// struct LedgerHeaderHistoryEntry // { -// LedgerEntryChanges txChanges; // tx level changes if any -// OperationMeta operations<>; // meta for each operation +// Hash hash; +// LedgerHeader header; +// +// // reserved for future use +// union switch (int v) +// { +// case 0: +// void; +// } +// ext; // }; -type TransactionMetaV1 struct { - TxChanges LedgerEntryChanges - Operations []OperationMeta +type LedgerHeaderHistoryEntry struct { + Hash Hash + Header LedgerHeader + Ext LedgerHeaderHistoryEntryExt } // EncodeTo encodes this value using the Encoder. -func (s *TransactionMetaV1) EncodeTo(e *xdr.Encoder) error { +func (s *LedgerHeaderHistoryEntry) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.TxChanges.EncodeTo(e); err != nil { + if err = s.Hash.EncodeTo(e); err != nil { return err } - if _, err = e.EncodeUint(uint32(len(s.Operations))); err != nil { + if err = s.Header.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s.Operations); i++ { - if err = s.Operations[i].EncodeTo(e); err != nil { - return err - } + if err = s.Ext.EncodeTo(e); err != nil { + return err } return nil } -var _ decoderFrom = (*TransactionMetaV1)(nil) +var _ decoderFrom = (*LedgerHeaderHistoryEntry)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TransactionMetaV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *LedgerHeaderHistoryEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionMetaV1: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerHeaderHistoryEntry: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.TxChanges.DecodeFrom(d, maxDepth) + nTmp, err = s.Hash.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) + return n, fmt.Errorf("decoding Hash: %w", err) } - var l uint32 - l, nTmp, err = d.DecodeUint() + nTmp, err = s.Header.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding OperationMeta: %w", err) + return n, fmt.Errorf("decoding LedgerHeader: %w", err) } - s.Operations = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding OperationMeta: length (%d) exceeds remaining input length (%d)", l, il) - } - s.Operations = make([]OperationMeta, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.Operations[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding OperationMeta: %w", err) - } - } + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerHeaderHistoryEntryExt: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionMetaV1) MarshalBinary() ([]byte, error) { +func (s LedgerHeaderHistoryEntry) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -16098,7 +16394,7 @@ func (s TransactionMetaV1) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionMetaV1) UnmarshalBinary(inp []byte) error { +func (s *LedgerHeaderHistoryEntry) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -16108,96 +16404,84 @@ func (s *TransactionMetaV1) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionMetaV1)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionMetaV1)(nil) + _ encoding.BinaryMarshaler = (*LedgerHeaderHistoryEntry)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerHeaderHistoryEntry)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionMetaV1) xdrType() {} +func (s LedgerHeaderHistoryEntry) xdrType() {} -var _ xdrType = (*TransactionMetaV1)(nil) +var _ xdrType = (*LedgerHeaderHistoryEntry)(nil) -// TransactionMetaV2 is an XDR Struct defines as: +// LedgerScpMessages is an XDR Struct defines as: // -// struct TransactionMetaV2 +// struct LedgerSCPMessages // { -// LedgerEntryChanges txChangesBefore; // tx level changes before operations -// // are applied if any -// OperationMeta operations<>; // meta for each operation -// LedgerEntryChanges txChangesAfter; // tx level changes after operations are -// // applied if any +// uint32 ledgerSeq; +// SCPEnvelope messages<>; // }; -type TransactionMetaV2 struct { - TxChangesBefore LedgerEntryChanges - Operations []OperationMeta - TxChangesAfter LedgerEntryChanges +type LedgerScpMessages struct { + LedgerSeq Uint32 + Messages []ScpEnvelope } // EncodeTo encodes this value using the Encoder. -func (s *TransactionMetaV2) EncodeTo(e *xdr.Encoder) error { +func (s *LedgerScpMessages) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.TxChangesBefore.EncodeTo(e); err != nil { + if err = s.LedgerSeq.EncodeTo(e); err != nil { return err } - if _, err = e.EncodeUint(uint32(len(s.Operations))); err != nil { + if _, err = e.EncodeUint(uint32(len(s.Messages))); err != nil { return err } - for i := 0; i < len(s.Operations); i++ { - if err = s.Operations[i].EncodeTo(e); err != nil { + for i := 0; i < len(s.Messages); i++ { + if err = s.Messages[i].EncodeTo(e); err != nil { return err } } - if err = s.TxChangesAfter.EncodeTo(e); err != nil { - return err - } return nil } -var _ decoderFrom = (*TransactionMetaV2)(nil) +var _ decoderFrom = (*LedgerScpMessages)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TransactionMetaV2) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *LedgerScpMessages) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionMetaV2: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerScpMessages: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.TxChangesBefore.DecodeFrom(d, maxDepth) + nTmp, err = s.LedgerSeq.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } var l uint32 l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding OperationMeta: %w", err) + return n, fmt.Errorf("decoding ScpEnvelope: %w", err) } - s.Operations = nil + s.Messages = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding OperationMeta: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding ScpEnvelope: length (%d) exceeds remaining input length (%d)", l, il) } - s.Operations = make([]OperationMeta, l) + s.Messages = make([]ScpEnvelope, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.Operations[i].DecodeFrom(d, maxDepth) + nTmp, err = s.Messages[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding OperationMeta: %w", err) + return n, fmt.Errorf("decoding ScpEnvelope: %w", err) } } } - nTmp, err = s.TxChangesAfter.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) - } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionMetaV2) MarshalBinary() ([]byte, error) { +func (s LedgerScpMessages) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -16205,7 +16489,7 @@ func (s TransactionMetaV2) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionMetaV2) UnmarshalBinary(inp []byte) error { +func (s *LedgerScpMessages) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -16215,141 +16499,50 @@ func (s *TransactionMetaV2) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionMetaV2)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionMetaV2)(nil) + _ encoding.BinaryMarshaler = (*LedgerScpMessages)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerScpMessages)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionMetaV2) xdrType() {} +func (s LedgerScpMessages) xdrType() {} -var _ xdrType = (*TransactionMetaV2)(nil) +var _ xdrType = (*LedgerScpMessages)(nil) -// ContractEventType is an XDR Enum defines as: +// ScpHistoryEntryV0 is an XDR Struct defines as: // -// enum ContractEventType +// struct SCPHistoryEntryV0 // { -// SYSTEM = 0, -// CONTRACT = 1, -// DIAGNOSTIC = 2 +// SCPQuorumSet quorumSets<>; // additional quorum sets used by ledgerMessages +// LedgerSCPMessages ledgerMessages; // }; -type ContractEventType int32 - -const ( - ContractEventTypeSystem ContractEventType = 0 - ContractEventTypeContract ContractEventType = 1 - ContractEventTypeDiagnostic ContractEventType = 2 -) - -var contractEventTypeMap = map[int32]string{ - 0: "ContractEventTypeSystem", - 1: "ContractEventTypeContract", - 2: "ContractEventTypeDiagnostic", -} - -// ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for ContractEventType -func (e ContractEventType) ValidEnum(v int32) bool { - _, ok := contractEventTypeMap[v] - return ok -} - -// String returns the name of `e` -func (e ContractEventType) String() string { - name, _ := contractEventTypeMap[int32(e)] - return name -} - -// EncodeTo encodes this value using the Encoder. -func (e ContractEventType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := contractEventTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid ContractEventType enum value", e) - } - _, err := enc.EncodeInt(int32(e)) - return err -} - -var _ decoderFrom = (*ContractEventType)(nil) - -// DecodeFrom decodes this value using the Decoder. -func (e *ContractEventType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { - if maxDepth == 0 { - return 0, fmt.Errorf("decoding ContractEventType: %w", ErrMaxDecodingDepthReached) - } - maxDepth -= 1 - v, n, err := d.DecodeInt() - if err != nil { - return n, fmt.Errorf("decoding ContractEventType: %w", err) - } - if _, ok := contractEventTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid ContractEventType enum value", v) - } - *e = ContractEventType(v) - return n, nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (s ContractEventType) MarshalBinary() ([]byte, error) { - b := bytes.Buffer{} - e := xdr.NewEncoder(&b) - err := s.EncodeTo(e) - return b.Bytes(), err -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *ContractEventType) UnmarshalBinary(inp []byte) error { - r := bytes.NewReader(inp) - o := xdr.DefaultDecodeOptions - o.MaxInputLen = len(inp) - d := xdr.NewDecoderWithOptions(r, o) - _, err := s.DecodeFrom(d, o.MaxDepth) - return err -} - -var ( - _ encoding.BinaryMarshaler = (*ContractEventType)(nil) - _ encoding.BinaryUnmarshaler = (*ContractEventType)(nil) -) - -// xdrType signals that this type represents XDR values defined by this package. -func (s ContractEventType) xdrType() {} - -var _ xdrType = (*ContractEventType)(nil) - -// ContractEventV0 is an XDR NestedStruct defines as: -// -// struct -// { -// SCVal topics<>; -// SCVal data; -// } -type ContractEventV0 struct { - Topics []ScVal - Data ScVal +type ScpHistoryEntryV0 struct { + QuorumSets []ScpQuorumSet + LedgerMessages LedgerScpMessages } // EncodeTo encodes this value using the Encoder. -func (s *ContractEventV0) EncodeTo(e *xdr.Encoder) error { +func (s *ScpHistoryEntryV0) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeUint(uint32(len(s.Topics))); err != nil { + if _, err = e.EncodeUint(uint32(len(s.QuorumSets))); err != nil { return err } - for i := 0; i < len(s.Topics); i++ { - if err = s.Topics[i].EncodeTo(e); err != nil { + for i := 0; i < len(s.QuorumSets); i++ { + if err = s.QuorumSets[i].EncodeTo(e); err != nil { return err } } - if err = s.Data.EncodeTo(e); err != nil { + if err = s.LedgerMessages.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*ContractEventV0)(nil) +var _ decoderFrom = (*ScpHistoryEntryV0)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *ContractEventV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ScpHistoryEntryV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding ContractEventV0: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ScpHistoryEntryV0: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -16358,32 +16551,32 @@ func (s *ContractEventV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding ScVal: %w", err) + return n, fmt.Errorf("decoding ScpQuorumSet: %w", err) } - s.Topics = nil + s.QuorumSets = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding ScVal: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding ScpQuorumSet: length (%d) exceeds remaining input length (%d)", l, il) } - s.Topics = make([]ScVal, l) + s.QuorumSets = make([]ScpQuorumSet, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.Topics[i].DecodeFrom(d, maxDepth) + nTmp, err = s.QuorumSets[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ScVal: %w", err) + return n, fmt.Errorf("decoding ScpQuorumSet: %w", err) } } } - nTmp, err = s.Data.DecodeFrom(d, maxDepth) + nTmp, err = s.LedgerMessages.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ScVal: %w", err) + return n, fmt.Errorf("decoding LedgerScpMessages: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s ContractEventV0) MarshalBinary() ([]byte, error) { +func (s ScpHistoryEntryV0) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -16391,7 +16584,7 @@ func (s ContractEventV0) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *ContractEventV0) UnmarshalBinary(inp []byte) error { +func (s *ScpHistoryEntryV0) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -16401,40 +16594,36 @@ func (s *ContractEventV0) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*ContractEventV0)(nil) - _ encoding.BinaryUnmarshaler = (*ContractEventV0)(nil) + _ encoding.BinaryMarshaler = (*ScpHistoryEntryV0)(nil) + _ encoding.BinaryUnmarshaler = (*ScpHistoryEntryV0)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s ContractEventV0) xdrType() {} +func (s ScpHistoryEntryV0) xdrType() {} -var _ xdrType = (*ContractEventV0)(nil) +var _ xdrType = (*ScpHistoryEntryV0)(nil) -// ContractEventBody is an XDR NestedUnion defines as: +// ScpHistoryEntry is an XDR Union defines as: // -// union switch (int v) -// { -// case 0: -// struct -// { -// SCVal topics<>; -// SCVal data; -// } v0; -// } -type ContractEventBody struct { +// union SCPHistoryEntry switch (int v) +// { +// case 0: +// SCPHistoryEntryV0 v0; +// }; +type ScpHistoryEntry struct { V int32 - V0 *ContractEventV0 + V0 *ScpHistoryEntryV0 } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u ContractEventBody) SwitchFieldName() string { +func (u ScpHistoryEntry) SwitchFieldName() string { return "V" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of ContractEventBody -func (u ContractEventBody) ArmForSwitch(sw int32) (string, bool) { +// the value for an instance of ScpHistoryEntry +func (u ScpHistoryEntry) ArmForSwitch(sw int32) (string, bool) { switch int32(sw) { case 0: return "V0", true @@ -16442,14 +16631,14 @@ func (u ContractEventBody) ArmForSwitch(sw int32) (string, bool) { return "-", false } -// NewContractEventBody creates a new ContractEventBody. -func NewContractEventBody(v int32, value interface{}) (result ContractEventBody, err error) { +// NewScpHistoryEntry creates a new ScpHistoryEntry. +func NewScpHistoryEntry(v int32, value interface{}) (result ScpHistoryEntry, err error) { result.V = v switch int32(v) { case 0: - tv, ok := value.(ContractEventV0) + tv, ok := value.(ScpHistoryEntryV0) if !ok { - err = errors.New("invalid value, must be ContractEventV0") + err = errors.New("invalid value, must be ScpHistoryEntryV0") return } result.V0 = &tv @@ -16459,7 +16648,7 @@ func NewContractEventBody(v int32, value interface{}) (result ContractEventBody, // MustV0 retrieves the V0 value from the union, // panicing if the value is not set. -func (u ContractEventBody) MustV0() ContractEventV0 { +func (u ScpHistoryEntry) MustV0() ScpHistoryEntryV0 { val, ok := u.GetV0() if !ok { @@ -16471,7 +16660,7 @@ func (u ContractEventBody) MustV0() ContractEventV0 { // GetV0 retrieves the V0 value from the union, // returning ok if the union's switch indicated the value is valid. -func (u ContractEventBody) GetV0() (result ContractEventV0, ok bool) { +func (u ScpHistoryEntry) GetV0() (result ScpHistoryEntryV0, ok bool) { armName, _ := u.ArmForSwitch(int32(u.V)) if armName == "V0" { @@ -16483,7 +16672,7 @@ func (u ContractEventBody) GetV0() (result ContractEventV0, ok bool) { } // EncodeTo encodes this value using the Encoder. -func (u ContractEventBody) EncodeTo(e *xdr.Encoder) error { +func (u ScpHistoryEntry) EncodeTo(e *xdr.Encoder) error { var err error if _, err = e.EncodeInt(int32(u.V)); err != nil { return err @@ -16495,15 +16684,15 @@ func (u ContractEventBody) EncodeTo(e *xdr.Encoder) error { } return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union ContractEventBody", u.V) + return fmt.Errorf("V (int32) switch value '%d' is not valid for union ScpHistoryEntry", u.V) } -var _ decoderFrom = (*ContractEventBody)(nil) +var _ decoderFrom = (*ScpHistoryEntry)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *ContractEventBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *ScpHistoryEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding ContractEventBody: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ScpHistoryEntry: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -16515,19 +16704,19 @@ func (u *ContractEventBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, erro } switch int32(u.V) { case 0: - u.V0 = new(ContractEventV0) + u.V0 = new(ScpHistoryEntryV0) nTmp, err = (*u.V0).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ContractEventV0: %w", err) + return n, fmt.Errorf("decoding ScpHistoryEntryV0: %w", err) } return n, nil } - return n, fmt.Errorf("union ContractEventBody has invalid V (int32) switch value '%d'", u.V) + return n, fmt.Errorf("union ScpHistoryEntry has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s ContractEventBody) MarshalBinary() ([]byte, error) { +func (s ScpHistoryEntry) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -16535,7 +16724,7 @@ func (s ContractEventBody) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *ContractEventBody) UnmarshalBinary(inp []byte) error { +func (s *ScpHistoryEntry) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -16545,112 +16734,83 @@ func (s *ContractEventBody) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*ContractEventBody)(nil) - _ encoding.BinaryUnmarshaler = (*ContractEventBody)(nil) + _ encoding.BinaryMarshaler = (*ScpHistoryEntry)(nil) + _ encoding.BinaryUnmarshaler = (*ScpHistoryEntry)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s ContractEventBody) xdrType() {} +func (s ScpHistoryEntry) xdrType() {} -var _ xdrType = (*ContractEventBody)(nil) +var _ xdrType = (*ScpHistoryEntry)(nil) -// ContractEvent is an XDR Struct defines as: +// LedgerEntryChangeType is an XDR Enum defines as: // -// struct ContractEvent +// enum LedgerEntryChangeType // { -// // We can use this to add more fields, or because it -// // is first, to change ContractEvent into a union. -// ExtensionPoint ext; -// -// Hash* contractID; -// ContractEventType type; -// -// union switch (int v) -// { -// case 0: -// struct -// { -// SCVal topics<>; -// SCVal data; -// } v0; -// } -// body; +// LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger +// LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger +// LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger +// LEDGER_ENTRY_STATE = 3 // value of the entry // }; -type ContractEvent struct { - Ext ExtensionPoint - ContractId *Hash - Type ContractEventType - Body ContractEventBody -} +type LedgerEntryChangeType int32 -// EncodeTo encodes this value using the Encoder. -func (s *ContractEvent) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.Ext.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeBool(s.ContractId != nil); err != nil { - return err - } - if s.ContractId != nil { - if err = (*s.ContractId).EncodeTo(e); err != nil { - return err - } - } - if err = s.Type.EncodeTo(e); err != nil { - return err - } - if err = s.Body.EncodeTo(e); err != nil { - return err - } - return nil +const ( + LedgerEntryChangeTypeLedgerEntryCreated LedgerEntryChangeType = 0 + LedgerEntryChangeTypeLedgerEntryUpdated LedgerEntryChangeType = 1 + LedgerEntryChangeTypeLedgerEntryRemoved LedgerEntryChangeType = 2 + LedgerEntryChangeTypeLedgerEntryState LedgerEntryChangeType = 3 +) + +var ledgerEntryChangeTypeMap = map[int32]string{ + 0: "LedgerEntryChangeTypeLedgerEntryCreated", + 1: "LedgerEntryChangeTypeLedgerEntryUpdated", + 2: "LedgerEntryChangeTypeLedgerEntryRemoved", + 3: "LedgerEntryChangeTypeLedgerEntryState", } -var _ decoderFrom = (*ContractEvent)(nil) +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for LedgerEntryChangeType +func (e LedgerEntryChangeType) ValidEnum(v int32) bool { + _, ok := ledgerEntryChangeTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e LedgerEntryChangeType) String() string { + name, _ := ledgerEntryChangeTypeMap[int32(e)] + return name +} + +// EncodeTo encodes this value using the Encoder. +func (e LedgerEntryChangeType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := ledgerEntryChangeTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid LedgerEntryChangeType enum value", e) + } + _, err := enc.EncodeInt(int32(e)) + return err +} + +var _ decoderFrom = (*LedgerEntryChangeType)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *ContractEvent) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *LedgerEntryChangeType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding ContractEvent: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerEntryChangeType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.Ext.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding ExtensionPoint: %w", err) - } - var b bool - b, nTmp, err = d.DecodeBool() - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - s.ContractId = nil - if b { - s.ContractId = new(Hash) - nTmp, err = s.ContractId.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - } - nTmp, err = s.Type.DecodeFrom(d, maxDepth) - n += nTmp + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding ContractEventType: %w", err) + return n, fmt.Errorf("decoding LedgerEntryChangeType: %w", err) } - nTmp, err = s.Body.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding ContractEventBody: %w", err) + if _, ok := ledgerEntryChangeTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid LedgerEntryChangeType enum value", v) } + *e = LedgerEntryChangeType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s ContractEvent) MarshalBinary() ([]byte, error) { +func (s LedgerEntryChangeType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -16658,7 +16818,7 @@ func (s ContractEvent) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *ContractEvent) UnmarshalBinary(inp []byte) error { +func (s *LedgerEntryChangeType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -16668,64 +16828,279 @@ func (s *ContractEvent) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*ContractEvent)(nil) - _ encoding.BinaryUnmarshaler = (*ContractEvent)(nil) + _ encoding.BinaryMarshaler = (*LedgerEntryChangeType)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerEntryChangeType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s ContractEvent) xdrType() {} +func (s LedgerEntryChangeType) xdrType() {} -var _ xdrType = (*ContractEvent)(nil) +var _ xdrType = (*LedgerEntryChangeType)(nil) -// DiagnosticEvent is an XDR Struct defines as: +// LedgerEntryChange is an XDR Union defines as: // -// struct DiagnosticEvent +// union LedgerEntryChange switch (LedgerEntryChangeType type) // { -// bool inSuccessfulContractCall; -// ContractEvent event; +// case LEDGER_ENTRY_CREATED: +// LedgerEntry created; +// case LEDGER_ENTRY_UPDATED: +// LedgerEntry updated; +// case LEDGER_ENTRY_REMOVED: +// LedgerKey removed; +// case LEDGER_ENTRY_STATE: +// LedgerEntry state; // }; -type DiagnosticEvent struct { - InSuccessfulContractCall bool - Event ContractEvent +type LedgerEntryChange struct { + Type LedgerEntryChangeType + Created *LedgerEntry + Updated *LedgerEntry + Removed *LedgerKey + State *LedgerEntry +} + +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u LedgerEntryChange) SwitchFieldName() string { + return "Type" +} + +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of LedgerEntryChange +func (u LedgerEntryChange) ArmForSwitch(sw int32) (string, bool) { + switch LedgerEntryChangeType(sw) { + case LedgerEntryChangeTypeLedgerEntryCreated: + return "Created", true + case LedgerEntryChangeTypeLedgerEntryUpdated: + return "Updated", true + case LedgerEntryChangeTypeLedgerEntryRemoved: + return "Removed", true + case LedgerEntryChangeTypeLedgerEntryState: + return "State", true + } + return "-", false +} + +// NewLedgerEntryChange creates a new LedgerEntryChange. +func NewLedgerEntryChange(aType LedgerEntryChangeType, value interface{}) (result LedgerEntryChange, err error) { + result.Type = aType + switch LedgerEntryChangeType(aType) { + case LedgerEntryChangeTypeLedgerEntryCreated: + tv, ok := value.(LedgerEntry) + if !ok { + err = errors.New("invalid value, must be LedgerEntry") + return + } + result.Created = &tv + case LedgerEntryChangeTypeLedgerEntryUpdated: + tv, ok := value.(LedgerEntry) + if !ok { + err = errors.New("invalid value, must be LedgerEntry") + return + } + result.Updated = &tv + case LedgerEntryChangeTypeLedgerEntryRemoved: + tv, ok := value.(LedgerKey) + if !ok { + err = errors.New("invalid value, must be LedgerKey") + return + } + result.Removed = &tv + case LedgerEntryChangeTypeLedgerEntryState: + tv, ok := value.(LedgerEntry) + if !ok { + err = errors.New("invalid value, must be LedgerEntry") + return + } + result.State = &tv + } + return +} + +// MustCreated retrieves the Created value from the union, +// panicing if the value is not set. +func (u LedgerEntryChange) MustCreated() LedgerEntry { + val, ok := u.GetCreated() + + if !ok { + panic("arm Created is not set") + } + + return val +} + +// GetCreated retrieves the Created value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerEntryChange) GetCreated() (result LedgerEntry, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "Created" { + result = *u.Created + ok = true + } + + return +} + +// MustUpdated retrieves the Updated value from the union, +// panicing if the value is not set. +func (u LedgerEntryChange) MustUpdated() LedgerEntry { + val, ok := u.GetUpdated() + + if !ok { + panic("arm Updated is not set") + } + + return val +} + +// GetUpdated retrieves the Updated value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerEntryChange) GetUpdated() (result LedgerEntry, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "Updated" { + result = *u.Updated + ok = true + } + + return +} + +// MustRemoved retrieves the Removed value from the union, +// panicing if the value is not set. +func (u LedgerEntryChange) MustRemoved() LedgerKey { + val, ok := u.GetRemoved() + + if !ok { + panic("arm Removed is not set") + } + + return val +} + +// GetRemoved retrieves the Removed value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerEntryChange) GetRemoved() (result LedgerKey, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "Removed" { + result = *u.Removed + ok = true + } + + return +} + +// MustState retrieves the State value from the union, +// panicing if the value is not set. +func (u LedgerEntryChange) MustState() LedgerEntry { + val, ok := u.GetState() + + if !ok { + panic("arm State is not set") + } + + return val +} + +// GetState retrieves the State value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerEntryChange) GetState() (result LedgerEntry, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "State" { + result = *u.State + ok = true + } + + return } // EncodeTo encodes this value using the Encoder. -func (s *DiagnosticEvent) EncodeTo(e *xdr.Encoder) error { +func (u LedgerEntryChange) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeBool(bool(s.InSuccessfulContractCall)); err != nil { + if err = u.Type.EncodeTo(e); err != nil { return err } - if err = s.Event.EncodeTo(e); err != nil { - return err + switch LedgerEntryChangeType(u.Type) { + case LedgerEntryChangeTypeLedgerEntryCreated: + if err = (*u.Created).EncodeTo(e); err != nil { + return err + } + return nil + case LedgerEntryChangeTypeLedgerEntryUpdated: + if err = (*u.Updated).EncodeTo(e); err != nil { + return err + } + return nil + case LedgerEntryChangeTypeLedgerEntryRemoved: + if err = (*u.Removed).EncodeTo(e); err != nil { + return err + } + return nil + case LedgerEntryChangeTypeLedgerEntryState: + if err = (*u.State).EncodeTo(e); err != nil { + return err + } + return nil } - return nil + return fmt.Errorf("Type (LedgerEntryChangeType) switch value '%d' is not valid for union LedgerEntryChange", u.Type) } -var _ decoderFrom = (*DiagnosticEvent)(nil) +var _ decoderFrom = (*LedgerEntryChange)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *DiagnosticEvent) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *LedgerEntryChange) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding DiagnosticEvent: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerEntryChange: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - s.InSuccessfulContractCall, nTmp, err = d.DecodeBool() + nTmp, err = u.Type.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Bool: %w", err) + return n, fmt.Errorf("decoding LedgerEntryChangeType: %w", err) } - nTmp, err = s.Event.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding ContractEvent: %w", err) + switch LedgerEntryChangeType(u.Type) { + case LedgerEntryChangeTypeLedgerEntryCreated: + u.Created = new(LedgerEntry) + nTmp, err = (*u.Created).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerEntry: %w", err) + } + return n, nil + case LedgerEntryChangeTypeLedgerEntryUpdated: + u.Updated = new(LedgerEntry) + nTmp, err = (*u.Updated).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerEntry: %w", err) + } + return n, nil + case LedgerEntryChangeTypeLedgerEntryRemoved: + u.Removed = new(LedgerKey) + nTmp, err = (*u.Removed).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerKey: %w", err) + } + return n, nil + case LedgerEntryChangeTypeLedgerEntryState: + u.State = new(LedgerEntry) + nTmp, err = (*u.State).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerEntry: %w", err) + } + return n, nil } - return n, nil + return n, fmt.Errorf("union LedgerEntryChange has invalid Type (LedgerEntryChangeType) switch value '%d'", u.Type) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s DiagnosticEvent) MarshalBinary() ([]byte, error) { +func (s LedgerEntryChange) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -16733,7 +17108,7 @@ func (s DiagnosticEvent) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *DiagnosticEvent) UnmarshalBinary(inp []byte) error { +func (s *LedgerEntryChange) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -16743,22 +17118,22 @@ func (s *DiagnosticEvent) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*DiagnosticEvent)(nil) - _ encoding.BinaryUnmarshaler = (*DiagnosticEvent)(nil) + _ encoding.BinaryMarshaler = (*LedgerEntryChange)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerEntryChange)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s DiagnosticEvent) xdrType() {} +func (s LedgerEntryChange) xdrType() {} -var _ xdrType = (*DiagnosticEvent)(nil) +var _ xdrType = (*LedgerEntryChange)(nil) -// DiagnosticEvents is an XDR Typedef defines as: +// LedgerEntryChanges is an XDR Typedef defines as: // -// typedef DiagnosticEvent DiagnosticEvents<>; -type DiagnosticEvents []DiagnosticEvent +// typedef LedgerEntryChange LedgerEntryChanges<>; +type LedgerEntryChanges []LedgerEntryChange // EncodeTo encodes this value using the Encoder. -func (s DiagnosticEvents) EncodeTo(e *xdr.Encoder) error { +func (s LedgerEntryChanges) EncodeTo(e *xdr.Encoder) error { var err error if _, err = e.EncodeUint(uint32(len(s))); err != nil { return err @@ -16771,12 +17146,12 @@ func (s DiagnosticEvents) EncodeTo(e *xdr.Encoder) error { return nil } -var _ decoderFrom = (*DiagnosticEvents)(nil) +var _ decoderFrom = (*LedgerEntryChanges)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *DiagnosticEvents) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *LedgerEntryChanges) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding DiagnosticEvents: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerEntryChanges: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -16785,19 +17160,19 @@ func (s *DiagnosticEvents) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding DiagnosticEvent: %w", err) + return n, fmt.Errorf("decoding LedgerEntryChange: %w", err) } (*s) = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding DiagnosticEvent: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding LedgerEntryChange: length (%d) exceeds remaining input length (%d)", l, il) } - (*s) = make([]DiagnosticEvent, l) + (*s) = make([]LedgerEntryChange, l) for i := uint32(0); i < l; i++ { nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding DiagnosticEvent: %w", err) + return n, fmt.Errorf("decoding LedgerEntryChange: %w", err) } } } @@ -16805,7 +17180,7 @@ func (s *DiagnosticEvents) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error } // MarshalBinary implements encoding.BinaryMarshaler. -func (s DiagnosticEvents) MarshalBinary() ([]byte, error) { +func (s LedgerEntryChanges) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -16813,7 +17188,7 @@ func (s DiagnosticEvents) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *DiagnosticEvents) UnmarshalBinary(inp []byte) error { +func (s *LedgerEntryChanges) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -16823,110 +17198,54 @@ func (s *DiagnosticEvents) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*DiagnosticEvents)(nil) - _ encoding.BinaryUnmarshaler = (*DiagnosticEvents)(nil) + _ encoding.BinaryMarshaler = (*LedgerEntryChanges)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerEntryChanges)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s DiagnosticEvents) xdrType() {} +func (s LedgerEntryChanges) xdrType() {} -var _ xdrType = (*DiagnosticEvents)(nil) +var _ xdrType = (*LedgerEntryChanges)(nil) -// SorobanTransactionMetaExtV1 is an XDR Struct defines as: +// OperationMeta is an XDR Struct defines as: // -// struct SorobanTransactionMetaExtV1 +// struct OperationMeta // { -// ExtensionPoint ext; -// -// // The following are the components of the overall Soroban resource fee -// // charged for the transaction. -// // The following relation holds: -// // `resourceFeeCharged = totalNonRefundableResourceFeeCharged + totalRefundableResourceFeeCharged` -// // where `resourceFeeCharged` is the overall fee charged for the -// // transaction. Also, `resourceFeeCharged` <= `sorobanData.resourceFee` -// // i.e.we never charge more than the declared resource fee. -// // The inclusion fee for charged the Soroban transaction can be found using -// // the following equation: -// // `result.feeCharged = resourceFeeCharged + inclusionFeeCharged`. -// -// // Total amount (in stroops) that has been charged for non-refundable -// // Soroban resources. -// // Non-refundable resources are charged based on the usage declared in -// // the transaction envelope (such as `instructions`, `readBytes` etc.) and -// // is charged regardless of the success of the transaction. -// int64 totalNonRefundableResourceFeeCharged; -// // Total amount (in stroops) that has been charged for refundable -// // Soroban resource fees. -// // Currently this comprises the rent fee (`rentFeeCharged`) and the -// // fee for the events and return value. -// // Refundable resources are charged based on the actual resources usage. -// // Since currently refundable resources are only used for the successful -// // transactions, this will be `0` for failed transactions. -// int64 totalRefundableResourceFeeCharged; -// // Amount (in stroops) that has been charged for rent. -// // This is a part of `totalNonRefundableResourceFeeCharged`. -// int64 rentFeeCharged; +// LedgerEntryChanges changes; // }; -type SorobanTransactionMetaExtV1 struct { - Ext ExtensionPoint - TotalNonRefundableResourceFeeCharged Int64 - TotalRefundableResourceFeeCharged Int64 - RentFeeCharged Int64 +type OperationMeta struct { + Changes LedgerEntryChanges } // EncodeTo encodes this value using the Encoder. -func (s *SorobanTransactionMetaExtV1) EncodeTo(e *xdr.Encoder) error { +func (s *OperationMeta) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Ext.EncodeTo(e); err != nil { - return err - } - if err = s.TotalNonRefundableResourceFeeCharged.EncodeTo(e); err != nil { - return err - } - if err = s.TotalRefundableResourceFeeCharged.EncodeTo(e); err != nil { - return err - } - if err = s.RentFeeCharged.EncodeTo(e); err != nil { + if err = s.Changes.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*SorobanTransactionMetaExtV1)(nil) +var _ decoderFrom = (*OperationMeta)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SorobanTransactionMetaExtV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *OperationMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SorobanTransactionMetaExtV1: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding OperationMeta: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Ext.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding ExtensionPoint: %w", err) - } - nTmp, err = s.TotalNonRefundableResourceFeeCharged.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Int64: %w", err) - } - nTmp, err = s.TotalRefundableResourceFeeCharged.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Int64: %w", err) - } - nTmp, err = s.RentFeeCharged.DecodeFrom(d, maxDepth) + nTmp, err = s.Changes.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int64: %w", err) + return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SorobanTransactionMetaExtV1) MarshalBinary() ([]byte, error) { +func (s OperationMeta) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -16934,7 +17253,7 @@ func (s SorobanTransactionMetaExtV1) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SorobanTransactionMetaExtV1) UnmarshalBinary(inp []byte) error { +func (s *OperationMeta) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -16944,141 +17263,84 @@ func (s *SorobanTransactionMetaExtV1) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SorobanTransactionMetaExtV1)(nil) - _ encoding.BinaryUnmarshaler = (*SorobanTransactionMetaExtV1)(nil) + _ encoding.BinaryMarshaler = (*OperationMeta)(nil) + _ encoding.BinaryUnmarshaler = (*OperationMeta)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SorobanTransactionMetaExtV1) xdrType() {} +func (s OperationMeta) xdrType() {} -var _ xdrType = (*SorobanTransactionMetaExtV1)(nil) +var _ xdrType = (*OperationMeta)(nil) -// SorobanTransactionMetaExt is an XDR Union defines as: +// TransactionMetaV1 is an XDR Struct defines as: // -// union SorobanTransactionMetaExt switch (int v) +// struct TransactionMetaV1 // { -// case 0: -// void; -// case 1: -// SorobanTransactionMetaExtV1 v1; +// LedgerEntryChanges txChanges; // tx level changes if any +// OperationMeta operations<>; // meta for each operation // }; -type SorobanTransactionMetaExt struct { - V int32 - V1 *SorobanTransactionMetaExtV1 -} - -// SwitchFieldName returns the field name in which this union's -// discriminant is stored -func (u SorobanTransactionMetaExt) SwitchFieldName() string { - return "V" +type TransactionMetaV1 struct { + TxChanges LedgerEntryChanges + Operations []OperationMeta } -// ArmForSwitch returns which field name should be used for storing -// the value for an instance of SorobanTransactionMetaExt -func (u SorobanTransactionMetaExt) ArmForSwitch(sw int32) (string, bool) { - switch int32(sw) { - case 0: - return "", true - case 1: - return "V1", true +// EncodeTo encodes this value using the Encoder. +func (s *TransactionMetaV1) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.TxChanges.EncodeTo(e); err != nil { + return err } - return "-", false + if _, err = e.EncodeUint(uint32(len(s.Operations))); err != nil { + return err + } + for i := 0; i < len(s.Operations); i++ { + if err = s.Operations[i].EncodeTo(e); err != nil { + return err + } + } + return nil } -// NewSorobanTransactionMetaExt creates a new SorobanTransactionMetaExt. -func NewSorobanTransactionMetaExt(v int32, value interface{}) (result SorobanTransactionMetaExt, err error) { - result.V = v - switch int32(v) { - case 0: - // void - case 1: - tv, ok := value.(SorobanTransactionMetaExtV1) - if !ok { - err = errors.New("invalid value, must be SorobanTransactionMetaExtV1") - return - } - result.V1 = &tv - } - return -} - -// MustV1 retrieves the V1 value from the union, -// panicing if the value is not set. -func (u SorobanTransactionMetaExt) MustV1() SorobanTransactionMetaExtV1 { - val, ok := u.GetV1() - - if !ok { - panic("arm V1 is not set") - } - - return val -} - -// GetV1 retrieves the V1 value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u SorobanTransactionMetaExt) GetV1() (result SorobanTransactionMetaExtV1, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.V)) - - if armName == "V1" { - result = *u.V1 - ok = true - } - - return -} - -// EncodeTo encodes this value using the Encoder. -func (u SorobanTransactionMetaExt) EncodeTo(e *xdr.Encoder) error { - var err error - if _, err = e.EncodeInt(int32(u.V)); err != nil { - return err - } - switch int32(u.V) { - case 0: - // Void - return nil - case 1: - if err = (*u.V1).EncodeTo(e); err != nil { - return err - } - return nil - } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union SorobanTransactionMetaExt", u.V) -} - -var _ decoderFrom = (*SorobanTransactionMetaExt)(nil) +var _ decoderFrom = (*TransactionMetaV1)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *SorobanTransactionMetaExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TransactionMetaV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SorobanTransactionMetaExt: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionMetaV1: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - u.V, nTmp, err = d.DecodeInt() + nTmp, err = s.TxChanges.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int: %w", err) + return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) } - switch int32(u.V) { - case 0: - // Void - return n, nil - case 1: - u.V1 = new(SorobanTransactionMetaExtV1) - nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding SorobanTransactionMetaExtV1: %w", err) + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding OperationMeta: %w", err) + } + s.Operations = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding OperationMeta: length (%d) exceeds remaining input length (%d)", l, il) + } + s.Operations = make([]OperationMeta, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.Operations[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding OperationMeta: %w", err) + } } - return n, nil } - return n, fmt.Errorf("union SorobanTransactionMetaExt has invalid V (int32) switch value '%d'", u.V) + return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SorobanTransactionMetaExt) MarshalBinary() ([]byte, error) { +func (s TransactionMetaV1) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -17086,7 +17348,7 @@ func (s SorobanTransactionMetaExt) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SorobanTransactionMetaExt) UnmarshalBinary(inp []byte) error { +func (s *TransactionMetaV1) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -17096,129 +17358,96 @@ func (s *SorobanTransactionMetaExt) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SorobanTransactionMetaExt)(nil) - _ encoding.BinaryUnmarshaler = (*SorobanTransactionMetaExt)(nil) + _ encoding.BinaryMarshaler = (*TransactionMetaV1)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionMetaV1)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SorobanTransactionMetaExt) xdrType() {} +func (s TransactionMetaV1) xdrType() {} -var _ xdrType = (*SorobanTransactionMetaExt)(nil) +var _ xdrType = (*TransactionMetaV1)(nil) -// SorobanTransactionMeta is an XDR Struct defines as: +// TransactionMetaV2 is an XDR Struct defines as: // -// struct SorobanTransactionMeta +// struct TransactionMetaV2 // { -// SorobanTransactionMetaExt ext; -// -// ContractEvent events<>; // custom events populated by the -// // contracts themselves. -// SCVal returnValue; // return value of the host fn invocation -// -// // Diagnostics events that are not hashed. -// // This will contain all contract and diagnostic events. Even ones -// // that were emitted in a failed contract call. -// DiagnosticEvent diagnosticEvents<>; +// LedgerEntryChanges txChangesBefore; // tx level changes before operations +// // are applied if any +// OperationMeta operations<>; // meta for each operation +// LedgerEntryChanges txChangesAfter; // tx level changes after operations are +// // applied if any // }; -type SorobanTransactionMeta struct { - Ext SorobanTransactionMetaExt - Events []ContractEvent - ReturnValue ScVal - DiagnosticEvents []DiagnosticEvent +type TransactionMetaV2 struct { + TxChangesBefore LedgerEntryChanges + Operations []OperationMeta + TxChangesAfter LedgerEntryChanges } // EncodeTo encodes this value using the Encoder. -func (s *SorobanTransactionMeta) EncodeTo(e *xdr.Encoder) error { +func (s *TransactionMetaV2) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Ext.EncodeTo(e); err != nil { + if err = s.TxChangesBefore.EncodeTo(e); err != nil { return err } - if _, err = e.EncodeUint(uint32(len(s.Events))); err != nil { + if _, err = e.EncodeUint(uint32(len(s.Operations))); err != nil { return err } - for i := 0; i < len(s.Events); i++ { - if err = s.Events[i].EncodeTo(e); err != nil { + for i := 0; i < len(s.Operations); i++ { + if err = s.Operations[i].EncodeTo(e); err != nil { return err } } - if err = s.ReturnValue.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeUint(uint32(len(s.DiagnosticEvents))); err != nil { + if err = s.TxChangesAfter.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s.DiagnosticEvents); i++ { - if err = s.DiagnosticEvents[i].EncodeTo(e); err != nil { - return err - } - } return nil } -var _ decoderFrom = (*SorobanTransactionMeta)(nil) +var _ decoderFrom = (*TransactionMetaV2)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SorobanTransactionMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TransactionMetaV2) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SorobanTransactionMeta: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionMetaV2: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + nTmp, err = s.TxChangesBefore.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding SorobanTransactionMetaExt: %w", err) + return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) } var l uint32 l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding ContractEvent: %w", err) + return n, fmt.Errorf("decoding OperationMeta: %w", err) } - s.Events = nil + s.Operations = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding ContractEvent: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding OperationMeta: length (%d) exceeds remaining input length (%d)", l, il) } - s.Events = make([]ContractEvent, l) + s.Operations = make([]OperationMeta, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.Events[i].DecodeFrom(d, maxDepth) + nTmp, err = s.Operations[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ContractEvent: %w", err) + return n, fmt.Errorf("decoding OperationMeta: %w", err) } } } - nTmp, err = s.ReturnValue.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding ScVal: %w", err) - } - l, nTmp, err = d.DecodeUint() + nTmp, err = s.TxChangesAfter.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding DiagnosticEvent: %w", err) - } - s.DiagnosticEvents = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding DiagnosticEvent: length (%d) exceeds remaining input length (%d)", l, il) - } - s.DiagnosticEvents = make([]DiagnosticEvent, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.DiagnosticEvents[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding DiagnosticEvent: %w", err) - } - } + return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SorobanTransactionMeta) MarshalBinary() ([]byte, error) { +func (s TransactionMetaV2) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -17226,7 +17455,7 @@ func (s SorobanTransactionMeta) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SorobanTransactionMeta) UnmarshalBinary(inp []byte) error { +func (s *TransactionMetaV2) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -17236,133 +17465,80 @@ func (s *SorobanTransactionMeta) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SorobanTransactionMeta)(nil) - _ encoding.BinaryUnmarshaler = (*SorobanTransactionMeta)(nil) + _ encoding.BinaryMarshaler = (*TransactionMetaV2)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionMetaV2)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SorobanTransactionMeta) xdrType() {} +func (s TransactionMetaV2) xdrType() {} -var _ xdrType = (*SorobanTransactionMeta)(nil) +var _ xdrType = (*TransactionMetaV2)(nil) -// TransactionMetaV3 is an XDR Struct defines as: +// ContractEventType is an XDR Enum defines as: // -// struct TransactionMetaV3 +// enum ContractEventType // { -// ExtensionPoint ext; -// -// LedgerEntryChanges txChangesBefore; // tx level changes before operations -// // are applied if any -// OperationMeta operations<>; // meta for each operation -// LedgerEntryChanges txChangesAfter; // tx level changes after operations are -// // applied if any -// SorobanTransactionMeta* sorobanMeta; // Soroban-specific meta (only for -// // Soroban transactions). +// SYSTEM = 0, +// CONTRACT = 1, +// DIAGNOSTIC = 2 // }; -type TransactionMetaV3 struct { - Ext ExtensionPoint - TxChangesBefore LedgerEntryChanges - Operations []OperationMeta - TxChangesAfter LedgerEntryChanges - SorobanMeta *SorobanTransactionMeta +type ContractEventType int32 + +const ( + ContractEventTypeSystem ContractEventType = 0 + ContractEventTypeContract ContractEventType = 1 + ContractEventTypeDiagnostic ContractEventType = 2 +) + +var contractEventTypeMap = map[int32]string{ + 0: "ContractEventTypeSystem", + 1: "ContractEventTypeContract", + 2: "ContractEventTypeDiagnostic", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for ContractEventType +func (e ContractEventType) ValidEnum(v int32) bool { + _, ok := contractEventTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e ContractEventType) String() string { + name, _ := contractEventTypeMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (s *TransactionMetaV3) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.Ext.EncodeTo(e); err != nil { - return err - } - if err = s.TxChangesBefore.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeUint(uint32(len(s.Operations))); err != nil { - return err - } - for i := 0; i < len(s.Operations); i++ { - if err = s.Operations[i].EncodeTo(e); err != nil { - return err - } - } - if err = s.TxChangesAfter.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeBool(s.SorobanMeta != nil); err != nil { - return err - } - if s.SorobanMeta != nil { - if err = (*s.SorobanMeta).EncodeTo(e); err != nil { - return err - } +func (e ContractEventType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := contractEventTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid ContractEventType enum value", e) } - return nil + _, err := enc.EncodeInt(int32(e)) + return err } -var _ decoderFrom = (*TransactionMetaV3)(nil) +var _ decoderFrom = (*ContractEventType)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TransactionMetaV3) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *ContractEventType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionMetaV3: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ContractEventType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.Ext.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding ExtensionPoint: %w", err) - } - nTmp, err = s.TxChangesBefore.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) - } - var l uint32 - l, nTmp, err = d.DecodeUint() - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding OperationMeta: %w", err) - } - s.Operations = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding OperationMeta: length (%d) exceeds remaining input length (%d)", l, il) - } - s.Operations = make([]OperationMeta, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.Operations[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding OperationMeta: %w", err) - } - } - } - nTmp, err = s.TxChangesAfter.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) - } - var b bool - b, nTmp, err = d.DecodeBool() - n += nTmp + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding SorobanTransactionMeta: %w", err) + return n, fmt.Errorf("decoding ContractEventType: %w", err) } - s.SorobanMeta = nil - if b { - s.SorobanMeta = new(SorobanTransactionMeta) - nTmp, err = s.SorobanMeta.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding SorobanTransactionMeta: %w", err) - } + if _, ok := contractEventTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid ContractEventType enum value", v) } + *e = ContractEventType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionMetaV3) MarshalBinary() ([]byte, error) { +func (s ContractEventType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -17370,7 +17546,7 @@ func (s TransactionMetaV3) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionMetaV3) UnmarshalBinary(inp []byte) error { +func (s *ContractEventType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -17380,84 +17556,84 @@ func (s *TransactionMetaV3) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionMetaV3)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionMetaV3)(nil) + _ encoding.BinaryMarshaler = (*ContractEventType)(nil) + _ encoding.BinaryUnmarshaler = (*ContractEventType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionMetaV3) xdrType() {} +func (s ContractEventType) xdrType() {} -var _ xdrType = (*TransactionMetaV3)(nil) +var _ xdrType = (*ContractEventType)(nil) -// InvokeHostFunctionSuccessPreImage is an XDR Struct defines as: +// ContractEventV0 is an XDR NestedStruct defines as: // -// struct InvokeHostFunctionSuccessPreImage -// { -// SCVal returnValue; -// ContractEvent events<>; -// }; -type InvokeHostFunctionSuccessPreImage struct { - ReturnValue ScVal - Events []ContractEvent +// struct +// { +// SCVal topics<>; +// SCVal data; +// } +type ContractEventV0 struct { + Topics []ScVal + Data ScVal } // EncodeTo encodes this value using the Encoder. -func (s *InvokeHostFunctionSuccessPreImage) EncodeTo(e *xdr.Encoder) error { +func (s *ContractEventV0) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.ReturnValue.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeUint(uint32(len(s.Events))); err != nil { + if _, err = e.EncodeUint(uint32(len(s.Topics))); err != nil { return err } - for i := 0; i < len(s.Events); i++ { - if err = s.Events[i].EncodeTo(e); err != nil { + for i := 0; i < len(s.Topics); i++ { + if err = s.Topics[i].EncodeTo(e); err != nil { return err } } + if err = s.Data.EncodeTo(e); err != nil { + return err + } return nil } -var _ decoderFrom = (*InvokeHostFunctionSuccessPreImage)(nil) +var _ decoderFrom = (*ContractEventV0)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *InvokeHostFunctionSuccessPreImage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ContractEventV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding InvokeHostFunctionSuccessPreImage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ContractEventV0: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.ReturnValue.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding ScVal: %w", err) - } var l uint32 l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding ContractEvent: %w", err) + return n, fmt.Errorf("decoding ScVal: %w", err) } - s.Events = nil + s.Topics = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding ContractEvent: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding ScVal: length (%d) exceeds remaining input length (%d)", l, il) } - s.Events = make([]ContractEvent, l) + s.Topics = make([]ScVal, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.Events[i].DecodeFrom(d, maxDepth) + nTmp, err = s.Topics[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ContractEvent: %w", err) + return n, fmt.Errorf("decoding ScVal: %w", err) } } } + nTmp, err = s.Data.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ScVal: %w", err) + } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s InvokeHostFunctionSuccessPreImage) MarshalBinary() ([]byte, error) { +func (s ContractEventV0) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -17465,7 +17641,7 @@ func (s InvokeHostFunctionSuccessPreImage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *InvokeHostFunctionSuccessPreImage) UnmarshalBinary(inp []byte) error { +func (s *ContractEventV0) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -17475,188 +17651,81 @@ func (s *InvokeHostFunctionSuccessPreImage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*InvokeHostFunctionSuccessPreImage)(nil) - _ encoding.BinaryUnmarshaler = (*InvokeHostFunctionSuccessPreImage)(nil) + _ encoding.BinaryMarshaler = (*ContractEventV0)(nil) + _ encoding.BinaryUnmarshaler = (*ContractEventV0)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s InvokeHostFunctionSuccessPreImage) xdrType() {} +func (s ContractEventV0) xdrType() {} -var _ xdrType = (*InvokeHostFunctionSuccessPreImage)(nil) +var _ xdrType = (*ContractEventV0)(nil) -// TransactionMeta is an XDR Union defines as: +// ContractEventBody is an XDR NestedUnion defines as: // -// union TransactionMeta switch (int v) -// { -// case 0: -// OperationMeta operations<>; -// case 1: -// TransactionMetaV1 v1; -// case 2: -// TransactionMetaV2 v2; -// case 3: -// TransactionMetaV3 v3; -// }; -type TransactionMeta struct { - V int32 - Operations *[]OperationMeta - V1 *TransactionMetaV1 - V2 *TransactionMetaV2 - V3 *TransactionMetaV3 +// union switch (int v) +// { +// case 0: +// struct +// { +// SCVal topics<>; +// SCVal data; +// } v0; +// } +type ContractEventBody struct { + V int32 + V0 *ContractEventV0 } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u TransactionMeta) SwitchFieldName() string { +func (u ContractEventBody) SwitchFieldName() string { return "V" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of TransactionMeta -func (u TransactionMeta) ArmForSwitch(sw int32) (string, bool) { +// the value for an instance of ContractEventBody +func (u ContractEventBody) ArmForSwitch(sw int32) (string, bool) { switch int32(sw) { case 0: - return "Operations", true - case 1: - return "V1", true - case 2: - return "V2", true - case 3: - return "V3", true + return "V0", true } return "-", false } -// NewTransactionMeta creates a new TransactionMeta. -func NewTransactionMeta(v int32, value interface{}) (result TransactionMeta, err error) { +// NewContractEventBody creates a new ContractEventBody. +func NewContractEventBody(v int32, value interface{}) (result ContractEventBody, err error) { result.V = v switch int32(v) { case 0: - tv, ok := value.([]OperationMeta) - if !ok { - err = errors.New("invalid value, must be []OperationMeta") - return - } - result.Operations = &tv - case 1: - tv, ok := value.(TransactionMetaV1) - if !ok { - err = errors.New("invalid value, must be TransactionMetaV1") - return - } - result.V1 = &tv - case 2: - tv, ok := value.(TransactionMetaV2) + tv, ok := value.(ContractEventV0) if !ok { - err = errors.New("invalid value, must be TransactionMetaV2") + err = errors.New("invalid value, must be ContractEventV0") return } - result.V2 = &tv - case 3: - tv, ok := value.(TransactionMetaV3) - if !ok { - err = errors.New("invalid value, must be TransactionMetaV3") - return - } - result.V3 = &tv - } - return -} - -// MustOperations retrieves the Operations value from the union, -// panicing if the value is not set. -func (u TransactionMeta) MustOperations() []OperationMeta { - val, ok := u.GetOperations() - - if !ok { - panic("arm Operations is not set") - } - - return val -} - -// GetOperations retrieves the Operations value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u TransactionMeta) GetOperations() (result []OperationMeta, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.V)) - - if armName == "Operations" { - result = *u.Operations - ok = true - } - - return -} - -// MustV1 retrieves the V1 value from the union, -// panicing if the value is not set. -func (u TransactionMeta) MustV1() TransactionMetaV1 { - val, ok := u.GetV1() - - if !ok { - panic("arm V1 is not set") - } - - return val -} - -// GetV1 retrieves the V1 value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u TransactionMeta) GetV1() (result TransactionMetaV1, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.V)) - - if armName == "V1" { - result = *u.V1 - ok = true - } - - return -} - -// MustV2 retrieves the V2 value from the union, -// panicing if the value is not set. -func (u TransactionMeta) MustV2() TransactionMetaV2 { - val, ok := u.GetV2() - - if !ok { - panic("arm V2 is not set") - } - - return val -} - -// GetV2 retrieves the V2 value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u TransactionMeta) GetV2() (result TransactionMetaV2, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.V)) - - if armName == "V2" { - result = *u.V2 - ok = true + result.V0 = &tv } - return } -// MustV3 retrieves the V3 value from the union, +// MustV0 retrieves the V0 value from the union, // panicing if the value is not set. -func (u TransactionMeta) MustV3() TransactionMetaV3 { - val, ok := u.GetV3() +func (u ContractEventBody) MustV0() ContractEventV0 { + val, ok := u.GetV0() if !ok { - panic("arm V3 is not set") + panic("arm V0 is not set") } return val } -// GetV3 retrieves the V3 value from the union, +// GetV0 retrieves the V0 value from the union, // returning ok if the union's switch indicated the value is valid. -func (u TransactionMeta) GetV3() (result TransactionMetaV3, ok bool) { +func (u ContractEventBody) GetV0() (result ContractEventV0, ok bool) { armName, _ := u.ArmForSwitch(int32(u.V)) - if armName == "V3" { - result = *u.V3 + if armName == "V0" { + result = *u.V0 ok = true } @@ -17664,47 +17733,27 @@ func (u TransactionMeta) GetV3() (result TransactionMetaV3, ok bool) { } // EncodeTo encodes this value using the Encoder. -func (u TransactionMeta) EncodeTo(e *xdr.Encoder) error { +func (u ContractEventBody) EncodeTo(e *xdr.Encoder) error { var err error if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } switch int32(u.V) { case 0: - if _, err = e.EncodeUint(uint32(len((*u.Operations)))); err != nil { - return err - } - for i := 0; i < len((*u.Operations)); i++ { - if err = (*u.Operations)[i].EncodeTo(e); err != nil { - return err - } - } - return nil - case 1: - if err = (*u.V1).EncodeTo(e); err != nil { - return err - } - return nil - case 2: - if err = (*u.V2).EncodeTo(e); err != nil { - return err - } - return nil - case 3: - if err = (*u.V3).EncodeTo(e); err != nil { + if err = (*u.V0).EncodeTo(e); err != nil { return err } return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union TransactionMeta", u.V) + return fmt.Errorf("V (int32) switch value '%d' is not valid for union ContractEventBody", u.V) } -var _ decoderFrom = (*TransactionMeta)(nil) +var _ decoderFrom = (*ContractEventBody)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *TransactionMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *ContractEventBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionMeta: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ContractEventBody: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -17716,58 +17765,19 @@ func (u *TransactionMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) } switch int32(u.V) { case 0: - u.Operations = new([]OperationMeta) - var l uint32 - l, nTmp, err = d.DecodeUint() - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding OperationMeta: %w", err) - } - (*u.Operations) = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding OperationMeta: length (%d) exceeds remaining input length (%d)", l, il) - } - (*u.Operations) = make([]OperationMeta, l) - for i := uint32(0); i < l; i++ { - nTmp, err = (*u.Operations)[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding OperationMeta: %w", err) - } - } - } - return n, nil - case 1: - u.V1 = new(TransactionMetaV1) - nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionMetaV1: %w", err) - } - return n, nil - case 2: - u.V2 = new(TransactionMetaV2) - nTmp, err = (*u.V2).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionMetaV2: %w", err) - } - return n, nil - case 3: - u.V3 = new(TransactionMetaV3) - nTmp, err = (*u.V3).DecodeFrom(d, maxDepth) + u.V0 = new(ContractEventV0) + nTmp, err = (*u.V0).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionMetaV3: %w", err) + return n, fmt.Errorf("decoding ContractEventV0: %w", err) } return n, nil } - return n, fmt.Errorf("union TransactionMeta has invalid V (int32) switch value '%d'", u.V) + return n, fmt.Errorf("union ContractEventBody has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionMeta) MarshalBinary() ([]byte, error) { +func (s ContractEventBody) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -17775,7 +17785,7 @@ func (s TransactionMeta) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionMeta) UnmarshalBinary(inp []byte) error { +func (s *ContractEventBody) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -17785,74 +17795,112 @@ func (s *TransactionMeta) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionMeta)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionMeta)(nil) + _ encoding.BinaryMarshaler = (*ContractEventBody)(nil) + _ encoding.BinaryUnmarshaler = (*ContractEventBody)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionMeta) xdrType() {} +func (s ContractEventBody) xdrType() {} -var _ xdrType = (*TransactionMeta)(nil) +var _ xdrType = (*ContractEventBody)(nil) -// TransactionResultMeta is an XDR Struct defines as: +// ContractEvent is an XDR Struct defines as: // -// struct TransactionResultMeta +// struct ContractEvent // { -// TransactionResultPair result; -// LedgerEntryChanges feeProcessing; -// TransactionMeta txApplyProcessing; +// // We can use this to add more fields, or because it +// // is first, to change ContractEvent into a union. +// ExtensionPoint ext; +// +// Hash* contractID; +// ContractEventType type; +// +// union switch (int v) +// { +// case 0: +// struct +// { +// SCVal topics<>; +// SCVal data; +// } v0; +// } +// body; // }; -type TransactionResultMeta struct { - Result TransactionResultPair - FeeProcessing LedgerEntryChanges - TxApplyProcessing TransactionMeta +type ContractEvent struct { + Ext ExtensionPoint + ContractId *Hash + Type ContractEventType + Body ContractEventBody } // EncodeTo encodes this value using the Encoder. -func (s *TransactionResultMeta) EncodeTo(e *xdr.Encoder) error { +func (s *ContractEvent) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Result.EncodeTo(e); err != nil { + if err = s.Ext.EncodeTo(e); err != nil { return err } - if err = s.FeeProcessing.EncodeTo(e); err != nil { + if _, err = e.EncodeBool(s.ContractId != nil); err != nil { return err } - if err = s.TxApplyProcessing.EncodeTo(e); err != nil { + if s.ContractId != nil { + if err = (*s.ContractId).EncodeTo(e); err != nil { + return err + } + } + if err = s.Type.EncodeTo(e); err != nil { + return err + } + if err = s.Body.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*TransactionResultMeta)(nil) +var _ decoderFrom = (*ContractEvent)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TransactionResultMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ContractEvent) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TransactionResultMeta: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ContractEvent: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Result.DecodeFrom(d, maxDepth) + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionResultPair: %w", err) + return n, fmt.Errorf("decoding ExtensionPoint: %w", err) } - nTmp, err = s.FeeProcessing.DecodeFrom(d, maxDepth) + var b bool + b, nTmp, err = d.DecodeBool() n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) + return n, fmt.Errorf("decoding Hash: %w", err) } - nTmp, err = s.TxApplyProcessing.DecodeFrom(d, maxDepth) + s.ContractId = nil + if b { + s.ContractId = new(Hash) + nTmp, err = s.ContractId.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + } + nTmp, err = s.Type.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionMeta: %w", err) + return n, fmt.Errorf("decoding ContractEventType: %w", err) + } + nTmp, err = s.Body.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ContractEventBody: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TransactionResultMeta) MarshalBinary() ([]byte, error) { +func (s ContractEvent) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -17860,7 +17908,7 @@ func (s TransactionResultMeta) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TransactionResultMeta) UnmarshalBinary(inp []byte) error { +func (s *ContractEvent) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -17870,64 +17918,64 @@ func (s *TransactionResultMeta) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TransactionResultMeta)(nil) - _ encoding.BinaryUnmarshaler = (*TransactionResultMeta)(nil) + _ encoding.BinaryMarshaler = (*ContractEvent)(nil) + _ encoding.BinaryUnmarshaler = (*ContractEvent)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TransactionResultMeta) xdrType() {} +func (s ContractEvent) xdrType() {} -var _ xdrType = (*TransactionResultMeta)(nil) +var _ xdrType = (*ContractEvent)(nil) -// UpgradeEntryMeta is an XDR Struct defines as: +// DiagnosticEvent is an XDR Struct defines as: // -// struct UpgradeEntryMeta +// struct DiagnosticEvent // { -// LedgerUpgrade upgrade; -// LedgerEntryChanges changes; +// bool inSuccessfulContractCall; +// ContractEvent event; // }; -type UpgradeEntryMeta struct { - Upgrade LedgerUpgrade - Changes LedgerEntryChanges +type DiagnosticEvent struct { + InSuccessfulContractCall bool + Event ContractEvent } // EncodeTo encodes this value using the Encoder. -func (s *UpgradeEntryMeta) EncodeTo(e *xdr.Encoder) error { +func (s *DiagnosticEvent) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Upgrade.EncodeTo(e); err != nil { + if _, err = e.EncodeBool(bool(s.InSuccessfulContractCall)); err != nil { return err } - if err = s.Changes.EncodeTo(e); err != nil { + if err = s.Event.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*UpgradeEntryMeta)(nil) +var _ decoderFrom = (*DiagnosticEvent)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *UpgradeEntryMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *DiagnosticEvent) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding UpgradeEntryMeta: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding DiagnosticEvent: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Upgrade.DecodeFrom(d, maxDepth) + s.InSuccessfulContractCall, nTmp, err = d.DecodeBool() n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerUpgrade: %w", err) + return n, fmt.Errorf("decoding Bool: %w", err) } - nTmp, err = s.Changes.DecodeFrom(d, maxDepth) + nTmp, err = s.Event.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) + return n, fmt.Errorf("decoding ContractEvent: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s UpgradeEntryMeta) MarshalBinary() ([]byte, error) { +func (s DiagnosticEvent) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -17935,7 +17983,7 @@ func (s UpgradeEntryMeta) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *UpgradeEntryMeta) UnmarshalBinary(inp []byte) error { +func (s *DiagnosticEvent) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -17945,153 +17993,61 @@ func (s *UpgradeEntryMeta) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*UpgradeEntryMeta)(nil) - _ encoding.BinaryUnmarshaler = (*UpgradeEntryMeta)(nil) + _ encoding.BinaryMarshaler = (*DiagnosticEvent)(nil) + _ encoding.BinaryUnmarshaler = (*DiagnosticEvent)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s UpgradeEntryMeta) xdrType() {} +func (s DiagnosticEvent) xdrType() {} -var _ xdrType = (*UpgradeEntryMeta)(nil) +var _ xdrType = (*DiagnosticEvent)(nil) -// LedgerCloseMetaV0 is an XDR Struct defines as: -// -// struct LedgerCloseMetaV0 -// { -// LedgerHeaderHistoryEntry ledgerHeader; -// // NB: txSet is sorted in "Hash order" -// TransactionSet txSet; -// -// // NB: transactions are sorted in apply order here -// // fees for all transactions are processed first -// // followed by applying transactions -// TransactionResultMeta txProcessing<>; -// -// // upgrades are applied last -// UpgradeEntryMeta upgradesProcessing<>; +// DiagnosticEvents is an XDR Typedef defines as: // -// // other misc information attached to the ledger close -// SCPHistoryEntry scpInfo<>; -// }; -type LedgerCloseMetaV0 struct { - LedgerHeader LedgerHeaderHistoryEntry - TxSet TransactionSet - TxProcessing []TransactionResultMeta - UpgradesProcessing []UpgradeEntryMeta - ScpInfo []ScpHistoryEntry -} +// typedef DiagnosticEvent DiagnosticEvents<>; +type DiagnosticEvents []DiagnosticEvent // EncodeTo encodes this value using the Encoder. -func (s *LedgerCloseMetaV0) EncodeTo(e *xdr.Encoder) error { +func (s DiagnosticEvents) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.LedgerHeader.EncodeTo(e); err != nil { - return err - } - if err = s.TxSet.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeUint(uint32(len(s.TxProcessing))); err != nil { - return err - } - for i := 0; i < len(s.TxProcessing); i++ { - if err = s.TxProcessing[i].EncodeTo(e); err != nil { - return err - } - } - if _, err = e.EncodeUint(uint32(len(s.UpgradesProcessing))); err != nil { - return err - } - for i := 0; i < len(s.UpgradesProcessing); i++ { - if err = s.UpgradesProcessing[i].EncodeTo(e); err != nil { - return err - } - } - if _, err = e.EncodeUint(uint32(len(s.ScpInfo))); err != nil { + if _, err = e.EncodeUint(uint32(len(s))); err != nil { return err } - for i := 0; i < len(s.ScpInfo); i++ { - if err = s.ScpInfo[i].EncodeTo(e); err != nil { + for i := 0; i < len(s); i++ { + if err = s[i].EncodeTo(e); err != nil { return err } } return nil } -var _ decoderFrom = (*LedgerCloseMetaV0)(nil) +var _ decoderFrom = (*DiagnosticEvents)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *LedgerCloseMetaV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *DiagnosticEvents) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerCloseMetaV0: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding DiagnosticEvents: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.LedgerHeader.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerHeaderHistoryEntry: %w", err) - } - nTmp, err = s.TxSet.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionSet: %w", err) - } var l uint32 l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionResultMeta: %w", err) - } - s.TxProcessing = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding TransactionResultMeta: length (%d) exceeds remaining input length (%d)", l, il) - } - s.TxProcessing = make([]TransactionResultMeta, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.TxProcessing[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TransactionResultMeta: %w", err) - } - } - } - l, nTmp, err = d.DecodeUint() - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding UpgradeEntryMeta: %w", err) - } - s.UpgradesProcessing = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding UpgradeEntryMeta: length (%d) exceeds remaining input length (%d)", l, il) - } - s.UpgradesProcessing = make([]UpgradeEntryMeta, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.UpgradesProcessing[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding UpgradeEntryMeta: %w", err) - } - } - } - l, nTmp, err = d.DecodeUint() - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding ScpHistoryEntry: %w", err) + return n, fmt.Errorf("decoding DiagnosticEvent: %w", err) } - s.ScpInfo = nil + (*s) = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding ScpHistoryEntry: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding DiagnosticEvent: length (%d) exceeds remaining input length (%d)", l, il) } - s.ScpInfo = make([]ScpHistoryEntry, l) + (*s) = make([]DiagnosticEvent, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.ScpInfo[i].DecodeFrom(d, maxDepth) + nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ScpHistoryEntry: %w", err) + return n, fmt.Errorf("decoding DiagnosticEvent: %w", err) } } } @@ -18099,7 +18055,7 @@ func (s *LedgerCloseMetaV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, erro } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerCloseMetaV0) MarshalBinary() ([]byte, error) { +func (s DiagnosticEvents) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -18107,7 +18063,7 @@ func (s LedgerCloseMetaV0) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerCloseMetaV0) UnmarshalBinary(inp []byte) error { +func (s *DiagnosticEvents) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -18117,45 +18073,81 @@ func (s *LedgerCloseMetaV0) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerCloseMetaV0)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerCloseMetaV0)(nil) + _ encoding.BinaryMarshaler = (*DiagnosticEvents)(nil) + _ encoding.BinaryUnmarshaler = (*DiagnosticEvents)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerCloseMetaV0) xdrType() {} +func (s DiagnosticEvents) xdrType() {} -var _ xdrType = (*LedgerCloseMetaV0)(nil) +var _ xdrType = (*DiagnosticEvents)(nil) -// LedgerCloseMetaExtV1 is an XDR Struct defines as: +// SorobanTransactionMetaExtV1 is an XDR Struct defines as: // -// struct LedgerCloseMetaExtV1 +// struct SorobanTransactionMetaExtV1 // { // ExtensionPoint ext; -// int64 sorobanFeeWrite1KB; +// +// // The following are the components of the overall Soroban resource fee +// // charged for the transaction. +// // The following relation holds: +// // `resourceFeeCharged = totalNonRefundableResourceFeeCharged + totalRefundableResourceFeeCharged` +// // where `resourceFeeCharged` is the overall fee charged for the +// // transaction. Also, `resourceFeeCharged` <= `sorobanData.resourceFee` +// // i.e.we never charge more than the declared resource fee. +// // The inclusion fee for charged the Soroban transaction can be found using +// // the following equation: +// // `result.feeCharged = resourceFeeCharged + inclusionFeeCharged`. +// +// // Total amount (in stroops) that has been charged for non-refundable +// // Soroban resources. +// // Non-refundable resources are charged based on the usage declared in +// // the transaction envelope (such as `instructions`, `readBytes` etc.) and +// // is charged regardless of the success of the transaction. +// int64 totalNonRefundableResourceFeeCharged; +// // Total amount (in stroops) that has been charged for refundable +// // Soroban resource fees. +// // Currently this comprises the rent fee (`rentFeeCharged`) and the +// // fee for the events and return value. +// // Refundable resources are charged based on the actual resources usage. +// // Since currently refundable resources are only used for the successful +// // transactions, this will be `0` for failed transactions. +// int64 totalRefundableResourceFeeCharged; +// // Amount (in stroops) that has been charged for rent. +// // This is a part of `totalNonRefundableResourceFeeCharged`. +// int64 rentFeeCharged; // }; -type LedgerCloseMetaExtV1 struct { - Ext ExtensionPoint - SorobanFeeWrite1Kb Int64 +type SorobanTransactionMetaExtV1 struct { + Ext ExtensionPoint + TotalNonRefundableResourceFeeCharged Int64 + TotalRefundableResourceFeeCharged Int64 + RentFeeCharged Int64 } // EncodeTo encodes this value using the Encoder. -func (s *LedgerCloseMetaExtV1) EncodeTo(e *xdr.Encoder) error { +func (s *SorobanTransactionMetaExtV1) EncodeTo(e *xdr.Encoder) error { var err error if err = s.Ext.EncodeTo(e); err != nil { return err } - if err = s.SorobanFeeWrite1Kb.EncodeTo(e); err != nil { + if err = s.TotalNonRefundableResourceFeeCharged.EncodeTo(e); err != nil { return err } - return nil -} - -var _ decoderFrom = (*LedgerCloseMetaExtV1)(nil) - + if err = s.TotalRefundableResourceFeeCharged.EncodeTo(e); err != nil { + return err + } + if err = s.RentFeeCharged.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*SorobanTransactionMetaExtV1)(nil) + // DecodeFrom decodes this value using the Decoder. -func (s *LedgerCloseMetaExtV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SorobanTransactionMetaExtV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerCloseMetaExtV1: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SorobanTransactionMetaExtV1: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -18165,7 +18157,17 @@ func (s *LedgerCloseMetaExtV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, e if err != nil { return n, fmt.Errorf("decoding ExtensionPoint: %w", err) } - nTmp, err = s.SorobanFeeWrite1Kb.DecodeFrom(d, maxDepth) + nTmp, err = s.TotalNonRefundableResourceFeeCharged.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + nTmp, err = s.TotalRefundableResourceFeeCharged.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + nTmp, err = s.RentFeeCharged.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Int64: %w", err) @@ -18174,7 +18176,7 @@ func (s *LedgerCloseMetaExtV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, e } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerCloseMetaExtV1) MarshalBinary() ([]byte, error) { +func (s SorobanTransactionMetaExtV1) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -18182,7 +18184,7 @@ func (s LedgerCloseMetaExtV1) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerCloseMetaExtV1) UnmarshalBinary(inp []byte) error { +func (s *SorobanTransactionMetaExtV1) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -18192,38 +18194,38 @@ func (s *LedgerCloseMetaExtV1) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerCloseMetaExtV1)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerCloseMetaExtV1)(nil) + _ encoding.BinaryMarshaler = (*SorobanTransactionMetaExtV1)(nil) + _ encoding.BinaryUnmarshaler = (*SorobanTransactionMetaExtV1)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerCloseMetaExtV1) xdrType() {} +func (s SorobanTransactionMetaExtV1) xdrType() {} -var _ xdrType = (*LedgerCloseMetaExtV1)(nil) +var _ xdrType = (*SorobanTransactionMetaExtV1)(nil) -// LedgerCloseMetaExt is an XDR Union defines as: +// SorobanTransactionMetaExt is an XDR Union defines as: // -// union LedgerCloseMetaExt switch (int v) +// union SorobanTransactionMetaExt switch (int v) // { // case 0: // void; // case 1: -// LedgerCloseMetaExtV1 v1; +// SorobanTransactionMetaExtV1 v1; // }; -type LedgerCloseMetaExt struct { +type SorobanTransactionMetaExt struct { V int32 - V1 *LedgerCloseMetaExtV1 + V1 *SorobanTransactionMetaExtV1 } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u LedgerCloseMetaExt) SwitchFieldName() string { +func (u SorobanTransactionMetaExt) SwitchFieldName() string { return "V" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of LedgerCloseMetaExt -func (u LedgerCloseMetaExt) ArmForSwitch(sw int32) (string, bool) { +// the value for an instance of SorobanTransactionMetaExt +func (u SorobanTransactionMetaExt) ArmForSwitch(sw int32) (string, bool) { switch int32(sw) { case 0: return "", true @@ -18233,16 +18235,16 @@ func (u LedgerCloseMetaExt) ArmForSwitch(sw int32) (string, bool) { return "-", false } -// NewLedgerCloseMetaExt creates a new LedgerCloseMetaExt. -func NewLedgerCloseMetaExt(v int32, value interface{}) (result LedgerCloseMetaExt, err error) { +// NewSorobanTransactionMetaExt creates a new SorobanTransactionMetaExt. +func NewSorobanTransactionMetaExt(v int32, value interface{}) (result SorobanTransactionMetaExt, err error) { result.V = v switch int32(v) { case 0: // void case 1: - tv, ok := value.(LedgerCloseMetaExtV1) + tv, ok := value.(SorobanTransactionMetaExtV1) if !ok { - err = errors.New("invalid value, must be LedgerCloseMetaExtV1") + err = errors.New("invalid value, must be SorobanTransactionMetaExtV1") return } result.V1 = &tv @@ -18252,7 +18254,7 @@ func NewLedgerCloseMetaExt(v int32, value interface{}) (result LedgerCloseMetaEx // MustV1 retrieves the V1 value from the union, // panicing if the value is not set. -func (u LedgerCloseMetaExt) MustV1() LedgerCloseMetaExtV1 { +func (u SorobanTransactionMetaExt) MustV1() SorobanTransactionMetaExtV1 { val, ok := u.GetV1() if !ok { @@ -18264,7 +18266,7 @@ func (u LedgerCloseMetaExt) MustV1() LedgerCloseMetaExtV1 { // GetV1 retrieves the V1 value from the union, // returning ok if the union's switch indicated the value is valid. -func (u LedgerCloseMetaExt) GetV1() (result LedgerCloseMetaExtV1, ok bool) { +func (u SorobanTransactionMetaExt) GetV1() (result SorobanTransactionMetaExtV1, ok bool) { armName, _ := u.ArmForSwitch(int32(u.V)) if armName == "V1" { @@ -18276,7 +18278,7 @@ func (u LedgerCloseMetaExt) GetV1() (result LedgerCloseMetaExtV1, ok bool) { } // EncodeTo encodes this value using the Encoder. -func (u LedgerCloseMetaExt) EncodeTo(e *xdr.Encoder) error { +func (u SorobanTransactionMetaExt) EncodeTo(e *xdr.Encoder) error { var err error if _, err = e.EncodeInt(int32(u.V)); err != nil { return err @@ -18291,15 +18293,15 @@ func (u LedgerCloseMetaExt) EncodeTo(e *xdr.Encoder) error { } return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerCloseMetaExt", u.V) + return fmt.Errorf("V (int32) switch value '%d' is not valid for union SorobanTransactionMetaExt", u.V) } -var _ decoderFrom = (*LedgerCloseMetaExt)(nil) +var _ decoderFrom = (*SorobanTransactionMetaExt)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *LedgerCloseMetaExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *SorobanTransactionMetaExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerCloseMetaExt: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SorobanTransactionMetaExt: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -18314,19 +18316,19 @@ func (u *LedgerCloseMetaExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, err // Void return n, nil case 1: - u.V1 = new(LedgerCloseMetaExtV1) + u.V1 = new(SorobanTransactionMetaExtV1) nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerCloseMetaExtV1: %w", err) + return n, fmt.Errorf("decoding SorobanTransactionMetaExtV1: %w", err) } return n, nil } - return n, fmt.Errorf("union LedgerCloseMetaExt has invalid V (int32) switch value '%d'", u.V) + return n, fmt.Errorf("union SorobanTransactionMetaExt has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerCloseMetaExt) MarshalBinary() ([]byte, error) { +func (s SorobanTransactionMetaExt) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -18334,7 +18336,7 @@ func (s LedgerCloseMetaExt) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerCloseMetaExt) UnmarshalBinary(inp []byte) error { +func (s *SorobanTransactionMetaExt) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -18344,123 +18346,71 @@ func (s *LedgerCloseMetaExt) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerCloseMetaExt)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerCloseMetaExt)(nil) + _ encoding.BinaryMarshaler = (*SorobanTransactionMetaExt)(nil) + _ encoding.BinaryUnmarshaler = (*SorobanTransactionMetaExt)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerCloseMetaExt) xdrType() {} +func (s SorobanTransactionMetaExt) xdrType() {} -var _ xdrType = (*LedgerCloseMetaExt)(nil) +var _ xdrType = (*SorobanTransactionMetaExt)(nil) -// LedgerCloseMetaV1 is an XDR Struct defines as: +// SorobanTransactionMeta is an XDR Struct defines as: // -// struct LedgerCloseMetaV1 +// struct SorobanTransactionMeta // { -// LedgerCloseMetaExt ext; -// -// LedgerHeaderHistoryEntry ledgerHeader; -// -// GeneralizedTransactionSet txSet; -// -// // NB: transactions are sorted in apply order here -// // fees for all transactions are processed first -// // followed by applying transactions -// TransactionResultMeta txProcessing<>; -// -// // upgrades are applied last -// UpgradeEntryMeta upgradesProcessing<>; -// -// // other misc information attached to the ledger close -// SCPHistoryEntry scpInfo<>; -// -// // Size in bytes of BucketList, to support downstream -// // systems calculating storage fees correctly. -// uint64 totalByteSizeOfBucketList; +// SorobanTransactionMetaExt ext; // -// // Temp keys that are being evicted at this ledger. -// LedgerKey evictedTemporaryLedgerKeys<>; +// ContractEvent events<>; // custom events populated by the +// // contracts themselves. +// SCVal returnValue; // return value of the host fn invocation // -// // Archived restorable ledger entries that are being -// // evicted at this ledger. -// LedgerEntry evictedPersistentLedgerEntries<>; +// // Diagnostics events that are not hashed. +// // This will contain all contract and diagnostic events. Even ones +// // that were emitted in a failed contract call. +// DiagnosticEvent diagnosticEvents<>; // }; -type LedgerCloseMetaV1 struct { - Ext LedgerCloseMetaExt - LedgerHeader LedgerHeaderHistoryEntry - TxSet GeneralizedTransactionSet - TxProcessing []TransactionResultMeta - UpgradesProcessing []UpgradeEntryMeta - ScpInfo []ScpHistoryEntry - TotalByteSizeOfBucketList Uint64 - EvictedTemporaryLedgerKeys []LedgerKey - EvictedPersistentLedgerEntries []LedgerEntry +type SorobanTransactionMeta struct { + Ext SorobanTransactionMetaExt + Events []ContractEvent + ReturnValue ScVal + DiagnosticEvents []DiagnosticEvent } // EncodeTo encodes this value using the Encoder. -func (s *LedgerCloseMetaV1) EncodeTo(e *xdr.Encoder) error { +func (s *SorobanTransactionMeta) EncodeTo(e *xdr.Encoder) error { var err error if err = s.Ext.EncodeTo(e); err != nil { return err } - if err = s.LedgerHeader.EncodeTo(e); err != nil { - return err - } - if err = s.TxSet.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeUint(uint32(len(s.TxProcessing))); err != nil { - return err - } - for i := 0; i < len(s.TxProcessing); i++ { - if err = s.TxProcessing[i].EncodeTo(e); err != nil { - return err - } - } - if _, err = e.EncodeUint(uint32(len(s.UpgradesProcessing))); err != nil { - return err - } - for i := 0; i < len(s.UpgradesProcessing); i++ { - if err = s.UpgradesProcessing[i].EncodeTo(e); err != nil { - return err - } - } - if _, err = e.EncodeUint(uint32(len(s.ScpInfo))); err != nil { + if _, err = e.EncodeUint(uint32(len(s.Events))); err != nil { return err } - for i := 0; i < len(s.ScpInfo); i++ { - if err = s.ScpInfo[i].EncodeTo(e); err != nil { + for i := 0; i < len(s.Events); i++ { + if err = s.Events[i].EncodeTo(e); err != nil { return err } } - if err = s.TotalByteSizeOfBucketList.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeUint(uint32(len(s.EvictedTemporaryLedgerKeys))); err != nil { + if err = s.ReturnValue.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s.EvictedTemporaryLedgerKeys); i++ { - if err = s.EvictedTemporaryLedgerKeys[i].EncodeTo(e); err != nil { - return err - } - } - if _, err = e.EncodeUint(uint32(len(s.EvictedPersistentLedgerEntries))); err != nil { + if _, err = e.EncodeUint(uint32(len(s.DiagnosticEvents))); err != nil { return err } - for i := 0; i < len(s.EvictedPersistentLedgerEntries); i++ { - if err = s.EvictedPersistentLedgerEntries[i].EncodeTo(e); err != nil { + for i := 0; i < len(s.DiagnosticEvents); i++ { + if err = s.DiagnosticEvents[i].EncodeTo(e); err != nil { return err } } return nil } -var _ decoderFrom = (*LedgerCloseMetaV1)(nil) +var _ decoderFrom = (*SorobanTransactionMeta)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *LedgerCloseMetaV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SorobanTransactionMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerCloseMetaV1: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SorobanTransactionMeta: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -18468,116 +18418,288 @@ func (s *LedgerCloseMetaV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, erro nTmp, err = s.Ext.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerCloseMetaExt: %w", err) - } - nTmp, err = s.LedgerHeader.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerHeaderHistoryEntry: %w", err) - } - nTmp, err = s.TxSet.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding GeneralizedTransactionSet: %w", err) + return n, fmt.Errorf("decoding SorobanTransactionMetaExt: %w", err) } var l uint32 l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionResultMeta: %w", err) + return n, fmt.Errorf("decoding ContractEvent: %w", err) } - s.TxProcessing = nil + s.Events = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding TransactionResultMeta: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding ContractEvent: length (%d) exceeds remaining input length (%d)", l, il) } - s.TxProcessing = make([]TransactionResultMeta, l) + s.Events = make([]ContractEvent, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.TxProcessing[i].DecodeFrom(d, maxDepth) + nTmp, err = s.Events[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TransactionResultMeta: %w", err) + return n, fmt.Errorf("decoding ContractEvent: %w", err) } } } + nTmp, err = s.ReturnValue.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ScVal: %w", err) + } l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding UpgradeEntryMeta: %w", err) + return n, fmt.Errorf("decoding DiagnosticEvent: %w", err) } - s.UpgradesProcessing = nil + s.DiagnosticEvents = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding UpgradeEntryMeta: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding DiagnosticEvent: length (%d) exceeds remaining input length (%d)", l, il) } - s.UpgradesProcessing = make([]UpgradeEntryMeta, l) + s.DiagnosticEvents = make([]DiagnosticEvent, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.UpgradesProcessing[i].DecodeFrom(d, maxDepth) + nTmp, err = s.DiagnosticEvents[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding UpgradeEntryMeta: %w", err) + return n, fmt.Errorf("decoding DiagnosticEvent: %w", err) } } } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SorobanTransactionMeta) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SorobanTransactionMeta) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*SorobanTransactionMeta)(nil) + _ encoding.BinaryUnmarshaler = (*SorobanTransactionMeta)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SorobanTransactionMeta) xdrType() {} + +var _ xdrType = (*SorobanTransactionMeta)(nil) + +// TransactionMetaV3 is an XDR Struct defines as: +// +// struct TransactionMetaV3 +// { +// ExtensionPoint ext; +// +// LedgerEntryChanges txChangesBefore; // tx level changes before operations +// // are applied if any +// OperationMeta operations<>; // meta for each operation +// LedgerEntryChanges txChangesAfter; // tx level changes after operations are +// // applied if any +// SorobanTransactionMeta* sorobanMeta; // Soroban-specific meta (only for +// // Soroban transactions). +// }; +type TransactionMetaV3 struct { + Ext ExtensionPoint + TxChangesBefore LedgerEntryChanges + Operations []OperationMeta + TxChangesAfter LedgerEntryChanges + SorobanMeta *SorobanTransactionMeta +} + +// EncodeTo encodes this value using the Encoder. +func (s *TransactionMetaV3) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Ext.EncodeTo(e); err != nil { + return err + } + if err = s.TxChangesBefore.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeUint(uint32(len(s.Operations))); err != nil { + return err + } + for i := 0; i < len(s.Operations); i++ { + if err = s.Operations[i].EncodeTo(e); err != nil { + return err + } + } + if err = s.TxChangesAfter.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeBool(s.SorobanMeta != nil); err != nil { + return err + } + if s.SorobanMeta != nil { + if err = (*s.SorobanMeta).EncodeTo(e); err != nil { + return err + } + } + return nil +} + +var _ decoderFrom = (*TransactionMetaV3)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TransactionMetaV3) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TransactionMetaV3: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ExtensionPoint: %w", err) + } + nTmp, err = s.TxChangesBefore.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) + } + var l uint32 l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding ScpHistoryEntry: %w", err) + return n, fmt.Errorf("decoding OperationMeta: %w", err) } - s.ScpInfo = nil + s.Operations = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding ScpHistoryEntry: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding OperationMeta: length (%d) exceeds remaining input length (%d)", l, il) } - s.ScpInfo = make([]ScpHistoryEntry, l) + s.Operations = make([]OperationMeta, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.ScpInfo[i].DecodeFrom(d, maxDepth) + nTmp, err = s.Operations[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ScpHistoryEntry: %w", err) + return n, fmt.Errorf("decoding OperationMeta: %w", err) } } } - nTmp, err = s.TotalByteSizeOfBucketList.DecodeFrom(d, maxDepth) + nTmp, err = s.TxChangesAfter.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) } - l, nTmp, err = d.DecodeUint() + var b bool + b, nTmp, err = d.DecodeBool() n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerKey: %w", err) + return n, fmt.Errorf("decoding SorobanTransactionMeta: %w", err) } - s.EvictedTemporaryLedgerKeys = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding LedgerKey: length (%d) exceeds remaining input length (%d)", l, il) + s.SorobanMeta = nil + if b { + s.SorobanMeta = new(SorobanTransactionMeta) + nTmp, err = s.SorobanMeta.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SorobanTransactionMeta: %w", err) } - s.EvictedTemporaryLedgerKeys = make([]LedgerKey, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.EvictedTemporaryLedgerKeys[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerKey: %w", err) - } + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TransactionMetaV3) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TransactionMetaV3) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TransactionMetaV3)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionMetaV3)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TransactionMetaV3) xdrType() {} + +var _ xdrType = (*TransactionMetaV3)(nil) + +// InvokeHostFunctionSuccessPreImage is an XDR Struct defines as: +// +// struct InvokeHostFunctionSuccessPreImage +// { +// SCVal returnValue; +// ContractEvent events<>; +// }; +type InvokeHostFunctionSuccessPreImage struct { + ReturnValue ScVal + Events []ContractEvent +} + +// EncodeTo encodes this value using the Encoder. +func (s *InvokeHostFunctionSuccessPreImage) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.ReturnValue.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeUint(uint32(len(s.Events))); err != nil { + return err + } + for i := 0; i < len(s.Events); i++ { + if err = s.Events[i].EncodeTo(e); err != nil { + return err } } + return nil +} + +var _ decoderFrom = (*InvokeHostFunctionSuccessPreImage)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *InvokeHostFunctionSuccessPreImage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding InvokeHostFunctionSuccessPreImage: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.ReturnValue.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ScVal: %w", err) + } + var l uint32 l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerEntry: %w", err) + return n, fmt.Errorf("decoding ContractEvent: %w", err) } - s.EvictedPersistentLedgerEntries = nil + s.Events = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding LedgerEntry: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding ContractEvent: length (%d) exceeds remaining input length (%d)", l, il) } - s.EvictedPersistentLedgerEntries = make([]LedgerEntry, l) + s.Events = make([]ContractEvent, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.EvictedPersistentLedgerEntries[i].DecodeFrom(d, maxDepth) + nTmp, err = s.Events[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerEntry: %w", err) + return n, fmt.Errorf("decoding ContractEvent: %w", err) } } } @@ -18585,7 +18707,7 @@ func (s *LedgerCloseMetaV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, erro } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerCloseMetaV1) MarshalBinary() ([]byte, error) { +func (s InvokeHostFunctionSuccessPreImage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -18593,7 +18715,7 @@ func (s LedgerCloseMetaV1) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerCloseMetaV1) UnmarshalBinary(inp []byte) error { +func (s *InvokeHostFunctionSuccessPreImage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -18603,89 +18725,113 @@ func (s *LedgerCloseMetaV1) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerCloseMetaV1)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerCloseMetaV1)(nil) + _ encoding.BinaryMarshaler = (*InvokeHostFunctionSuccessPreImage)(nil) + _ encoding.BinaryUnmarshaler = (*InvokeHostFunctionSuccessPreImage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerCloseMetaV1) xdrType() {} +func (s InvokeHostFunctionSuccessPreImage) xdrType() {} -var _ xdrType = (*LedgerCloseMetaV1)(nil) +var _ xdrType = (*InvokeHostFunctionSuccessPreImage)(nil) -// LedgerCloseMeta is an XDR Union defines as: +// TransactionMeta is an XDR Union defines as: // -// union LedgerCloseMeta switch (int v) +// union TransactionMeta switch (int v) // { // case 0: -// LedgerCloseMetaV0 v0; +// OperationMeta operations<>; // case 1: -// LedgerCloseMetaV1 v1; +// TransactionMetaV1 v1; +// case 2: +// TransactionMetaV2 v2; +// case 3: +// TransactionMetaV3 v3; // }; -type LedgerCloseMeta struct { - V int32 - V0 *LedgerCloseMetaV0 - V1 *LedgerCloseMetaV1 +type TransactionMeta struct { + V int32 + Operations *[]OperationMeta + V1 *TransactionMetaV1 + V2 *TransactionMetaV2 + V3 *TransactionMetaV3 } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u LedgerCloseMeta) SwitchFieldName() string { +func (u TransactionMeta) SwitchFieldName() string { return "V" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of LedgerCloseMeta -func (u LedgerCloseMeta) ArmForSwitch(sw int32) (string, bool) { +// the value for an instance of TransactionMeta +func (u TransactionMeta) ArmForSwitch(sw int32) (string, bool) { switch int32(sw) { case 0: - return "V0", true + return "Operations", true case 1: return "V1", true + case 2: + return "V2", true + case 3: + return "V3", true } return "-", false } -// NewLedgerCloseMeta creates a new LedgerCloseMeta. -func NewLedgerCloseMeta(v int32, value interface{}) (result LedgerCloseMeta, err error) { +// NewTransactionMeta creates a new TransactionMeta. +func NewTransactionMeta(v int32, value interface{}) (result TransactionMeta, err error) { result.V = v switch int32(v) { case 0: - tv, ok := value.(LedgerCloseMetaV0) + tv, ok := value.([]OperationMeta) if !ok { - err = errors.New("invalid value, must be LedgerCloseMetaV0") + err = errors.New("invalid value, must be []OperationMeta") return } - result.V0 = &tv + result.Operations = &tv case 1: - tv, ok := value.(LedgerCloseMetaV1) + tv, ok := value.(TransactionMetaV1) if !ok { - err = errors.New("invalid value, must be LedgerCloseMetaV1") + err = errors.New("invalid value, must be TransactionMetaV1") return } result.V1 = &tv + case 2: + tv, ok := value.(TransactionMetaV2) + if !ok { + err = errors.New("invalid value, must be TransactionMetaV2") + return + } + result.V2 = &tv + case 3: + tv, ok := value.(TransactionMetaV3) + if !ok { + err = errors.New("invalid value, must be TransactionMetaV3") + return + } + result.V3 = &tv } return } -// MustV0 retrieves the V0 value from the union, +// MustOperations retrieves the Operations value from the union, // panicing if the value is not set. -func (u LedgerCloseMeta) MustV0() LedgerCloseMetaV0 { - val, ok := u.GetV0() +func (u TransactionMeta) MustOperations() []OperationMeta { + val, ok := u.GetOperations() if !ok { - panic("arm V0 is not set") + panic("arm Operations is not set") } return val } -// GetV0 retrieves the V0 value from the union, +// GetOperations retrieves the Operations value from the union, // returning ok if the union's switch indicated the value is valid. -func (u LedgerCloseMeta) GetV0() (result LedgerCloseMetaV0, ok bool) { +func (u TransactionMeta) GetOperations() (result []OperationMeta, ok bool) { armName, _ := u.ArmForSwitch(int32(u.V)) - if armName == "V0" { - result = *u.V0 + if armName == "Operations" { + result = *u.Operations ok = true } @@ -18694,7 +18840,7 @@ func (u LedgerCloseMeta) GetV0() (result LedgerCloseMetaV0, ok bool) { // MustV1 retrieves the V1 value from the union, // panicing if the value is not set. -func (u LedgerCloseMeta) MustV1() LedgerCloseMetaV1 { +func (u TransactionMeta) MustV1() TransactionMetaV1 { val, ok := u.GetV1() if !ok { @@ -18706,7 +18852,7 @@ func (u LedgerCloseMeta) MustV1() LedgerCloseMetaV1 { // GetV1 retrieves the V1 value from the union, // returning ok if the union's switch indicated the value is valid. -func (u LedgerCloseMeta) GetV1() (result LedgerCloseMetaV1, ok bool) { +func (u TransactionMeta) GetV1() (result TransactionMetaV1, ok bool) { armName, _ := u.ArmForSwitch(int32(u.V)) if armName == "V1" { @@ -18717,33 +18863,98 @@ func (u LedgerCloseMeta) GetV1() (result LedgerCloseMetaV1, ok bool) { return } +// MustV2 retrieves the V2 value from the union, +// panicing if the value is not set. +func (u TransactionMeta) MustV2() TransactionMetaV2 { + val, ok := u.GetV2() + + if !ok { + panic("arm V2 is not set") + } + + return val +} + +// GetV2 retrieves the V2 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u TransactionMeta) GetV2() (result TransactionMetaV2, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) + + if armName == "V2" { + result = *u.V2 + ok = true + } + + return +} + +// MustV3 retrieves the V3 value from the union, +// panicing if the value is not set. +func (u TransactionMeta) MustV3() TransactionMetaV3 { + val, ok := u.GetV3() + + if !ok { + panic("arm V3 is not set") + } + + return val +} + +// GetV3 retrieves the V3 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u TransactionMeta) GetV3() (result TransactionMetaV3, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) + + if armName == "V3" { + result = *u.V3 + ok = true + } + + return +} + // EncodeTo encodes this value using the Encoder. -func (u LedgerCloseMeta) EncodeTo(e *xdr.Encoder) error { +func (u TransactionMeta) EncodeTo(e *xdr.Encoder) error { var err error if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } switch int32(u.V) { case 0: - if err = (*u.V0).EncodeTo(e); err != nil { + if _, err = e.EncodeUint(uint32(len((*u.Operations)))); err != nil { return err } + for i := 0; i < len((*u.Operations)); i++ { + if err = (*u.Operations)[i].EncodeTo(e); err != nil { + return err + } + } return nil case 1: if err = (*u.V1).EncodeTo(e); err != nil { return err } return nil + case 2: + if err = (*u.V2).EncodeTo(e); err != nil { + return err + } + return nil + case 3: + if err = (*u.V3).EncodeTo(e); err != nil { + return err + } + return nil } - return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerCloseMeta", u.V) + return fmt.Errorf("V (int32) switch value '%d' is not valid for union TransactionMeta", u.V) } -var _ decoderFrom = (*LedgerCloseMeta)(nil) +var _ decoderFrom = (*TransactionMeta)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *LedgerCloseMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *TransactionMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerCloseMeta: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionMeta: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -18755,27 +18966,58 @@ func (u *LedgerCloseMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) } switch int32(u.V) { case 0: - u.V0 = new(LedgerCloseMetaV0) - nTmp, err = (*u.V0).DecodeFrom(d, maxDepth) + u.Operations = new([]OperationMeta) + var l uint32 + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerCloseMetaV0: %w", err) + return n, fmt.Errorf("decoding OperationMeta: %w", err) + } + (*u.Operations) = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding OperationMeta: length (%d) exceeds remaining input length (%d)", l, il) + } + (*u.Operations) = make([]OperationMeta, l) + for i := uint32(0); i < l; i++ { + nTmp, err = (*u.Operations)[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding OperationMeta: %w", err) + } + } } return n, nil case 1: - u.V1 = new(LedgerCloseMetaV1) + u.V1 = new(TransactionMetaV1) nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerCloseMetaV1: %w", err) + return n, fmt.Errorf("decoding TransactionMetaV1: %w", err) + } + return n, nil + case 2: + u.V2 = new(TransactionMetaV2) + nTmp, err = (*u.V2).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionMetaV2: %w", err) + } + return n, nil + case 3: + u.V3 = new(TransactionMetaV3) + nTmp, err = (*u.V3).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionMetaV3: %w", err) } return n, nil } - return n, fmt.Errorf("union LedgerCloseMeta has invalid V (int32) switch value '%d'", u.V) + return n, fmt.Errorf("union TransactionMeta has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerCloseMeta) MarshalBinary() ([]byte, error) { +func (s TransactionMeta) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -18783,7 +19025,7 @@ func (s LedgerCloseMeta) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerCloseMeta) UnmarshalBinary(inp []byte) error { +func (s *TransactionMeta) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -18793,86 +19035,74 @@ func (s *LedgerCloseMeta) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerCloseMeta)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerCloseMeta)(nil) + _ encoding.BinaryMarshaler = (*TransactionMeta)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionMeta)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerCloseMeta) xdrType() {} +func (s TransactionMeta) xdrType() {} -var _ xdrType = (*LedgerCloseMeta)(nil) +var _ xdrType = (*TransactionMeta)(nil) -// ErrorCode is an XDR Enum defines as: +// TransactionResultMeta is an XDR Struct defines as: // -// enum ErrorCode +// struct TransactionResultMeta // { -// ERR_MISC = 0, // Unspecific error -// ERR_DATA = 1, // Malformed data -// ERR_CONF = 2, // Misconfiguration error -// ERR_AUTH = 3, // Authentication failure -// ERR_LOAD = 4 // System overloaded +// TransactionResultPair result; +// LedgerEntryChanges feeProcessing; +// TransactionMeta txApplyProcessing; // }; -type ErrorCode int32 - -const ( - ErrorCodeErrMisc ErrorCode = 0 - ErrorCodeErrData ErrorCode = 1 - ErrorCodeErrConf ErrorCode = 2 - ErrorCodeErrAuth ErrorCode = 3 - ErrorCodeErrLoad ErrorCode = 4 -) - -var errorCodeMap = map[int32]string{ - 0: "ErrorCodeErrMisc", - 1: "ErrorCodeErrData", - 2: "ErrorCodeErrConf", - 3: "ErrorCodeErrAuth", - 4: "ErrorCodeErrLoad", -} - -// ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for ErrorCode -func (e ErrorCode) ValidEnum(v int32) bool { - _, ok := errorCodeMap[v] - return ok -} - -// String returns the name of `e` -func (e ErrorCode) String() string { - name, _ := errorCodeMap[int32(e)] - return name +type TransactionResultMeta struct { + Result TransactionResultPair + FeeProcessing LedgerEntryChanges + TxApplyProcessing TransactionMeta } // EncodeTo encodes this value using the Encoder. -func (e ErrorCode) EncodeTo(enc *xdr.Encoder) error { - if _, ok := errorCodeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid ErrorCode enum value", e) +func (s *TransactionResultMeta) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Result.EncodeTo(e); err != nil { + return err } - _, err := enc.EncodeInt(int32(e)) - return err + if err = s.FeeProcessing.EncodeTo(e); err != nil { + return err + } + if err = s.TxApplyProcessing.EncodeTo(e); err != nil { + return err + } + return nil } -var _ decoderFrom = (*ErrorCode)(nil) +var _ decoderFrom = (*TransactionResultMeta)(nil) // DecodeFrom decodes this value using the Decoder. -func (e *ErrorCode) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TransactionResultMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding ErrorCode: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TransactionResultMeta: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - v, n, err := d.DecodeInt() + var err error + var n, nTmp int + nTmp, err = s.Result.DecodeFrom(d, maxDepth) + n += nTmp if err != nil { - return n, fmt.Errorf("decoding ErrorCode: %w", err) + return n, fmt.Errorf("decoding TransactionResultPair: %w", err) } - if _, ok := errorCodeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid ErrorCode enum value", v) + nTmp, err = s.FeeProcessing.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) + } + nTmp, err = s.TxApplyProcessing.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionMeta: %w", err) } - *e = ErrorCode(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s ErrorCode) MarshalBinary() ([]byte, error) { +func (s TransactionResultMeta) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -18880,7 +19110,7 @@ func (s ErrorCode) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *ErrorCode) UnmarshalBinary(inp []byte) error { +func (s *TransactionResultMeta) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -18890,64 +19120,64 @@ func (s *ErrorCode) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*ErrorCode)(nil) - _ encoding.BinaryUnmarshaler = (*ErrorCode)(nil) + _ encoding.BinaryMarshaler = (*TransactionResultMeta)(nil) + _ encoding.BinaryUnmarshaler = (*TransactionResultMeta)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s ErrorCode) xdrType() {} +func (s TransactionResultMeta) xdrType() {} -var _ xdrType = (*ErrorCode)(nil) +var _ xdrType = (*TransactionResultMeta)(nil) -// Error is an XDR Struct defines as: +// UpgradeEntryMeta is an XDR Struct defines as: // -// struct Error +// struct UpgradeEntryMeta // { -// ErrorCode code; -// string msg<100>; +// LedgerUpgrade upgrade; +// LedgerEntryChanges changes; // }; -type Error struct { - Code ErrorCode - Msg string `xdrmaxsize:"100"` +type UpgradeEntryMeta struct { + Upgrade LedgerUpgrade + Changes LedgerEntryChanges } // EncodeTo encodes this value using the Encoder. -func (s *Error) EncodeTo(e *xdr.Encoder) error { +func (s *UpgradeEntryMeta) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Code.EncodeTo(e); err != nil { + if err = s.Upgrade.EncodeTo(e); err != nil { return err } - if _, err = e.EncodeString(string(s.Msg)); err != nil { + if err = s.Changes.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*Error)(nil) +var _ decoderFrom = (*UpgradeEntryMeta)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *Error) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *UpgradeEntryMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding Error: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding UpgradeEntryMeta: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Code.DecodeFrom(d, maxDepth) + nTmp, err = s.Upgrade.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ErrorCode: %w", err) + return n, fmt.Errorf("decoding LedgerUpgrade: %w", err) } - s.Msg, nTmp, err = d.DecodeString(100) + nTmp, err = s.Changes.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Msg: %w", err) + return n, fmt.Errorf("decoding LedgerEntryChanges: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s Error) MarshalBinary() ([]byte, error) { +func (s UpgradeEntryMeta) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -18955,7 +19185,7 @@ func (s Error) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *Error) UnmarshalBinary(inp []byte) error { +func (s *UpgradeEntryMeta) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -18965,54 +19195,161 @@ func (s *Error) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*Error)(nil) - _ encoding.BinaryUnmarshaler = (*Error)(nil) + _ encoding.BinaryMarshaler = (*UpgradeEntryMeta)(nil) + _ encoding.BinaryUnmarshaler = (*UpgradeEntryMeta)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s Error) xdrType() {} +func (s UpgradeEntryMeta) xdrType() {} -var _ xdrType = (*Error)(nil) +var _ xdrType = (*UpgradeEntryMeta)(nil) -// SendMore is an XDR Struct defines as: +// LedgerCloseMetaV0 is an XDR Struct defines as: // -// struct SendMore +// struct LedgerCloseMetaV0 // { -// uint32 numMessages; +// LedgerHeaderHistoryEntry ledgerHeader; +// // NB: txSet is sorted in "Hash order" +// TransactionSet txSet; +// +// // NB: transactions are sorted in apply order here +// // fees for all transactions are processed first +// // followed by applying transactions +// TransactionResultMeta txProcessing<>; +// +// // upgrades are applied last +// UpgradeEntryMeta upgradesProcessing<>; +// +// // other misc information attached to the ledger close +// SCPHistoryEntry scpInfo<>; // }; -type SendMore struct { - NumMessages Uint32 +type LedgerCloseMetaV0 struct { + LedgerHeader LedgerHeaderHistoryEntry + TxSet TransactionSet + TxProcessing []TransactionResultMeta + UpgradesProcessing []UpgradeEntryMeta + ScpInfo []ScpHistoryEntry } // EncodeTo encodes this value using the Encoder. -func (s *SendMore) EncodeTo(e *xdr.Encoder) error { +func (s *LedgerCloseMetaV0) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.NumMessages.EncodeTo(e); err != nil { + if err = s.LedgerHeader.EncodeTo(e); err != nil { + return err + } + if err = s.TxSet.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeUint(uint32(len(s.TxProcessing))); err != nil { + return err + } + for i := 0; i < len(s.TxProcessing); i++ { + if err = s.TxProcessing[i].EncodeTo(e); err != nil { + return err + } + } + if _, err = e.EncodeUint(uint32(len(s.UpgradesProcessing))); err != nil { + return err + } + for i := 0; i < len(s.UpgradesProcessing); i++ { + if err = s.UpgradesProcessing[i].EncodeTo(e); err != nil { + return err + } + } + if _, err = e.EncodeUint(uint32(len(s.ScpInfo))); err != nil { return err } + for i := 0; i < len(s.ScpInfo); i++ { + if err = s.ScpInfo[i].EncodeTo(e); err != nil { + return err + } + } return nil } -var _ decoderFrom = (*SendMore)(nil) +var _ decoderFrom = (*LedgerCloseMetaV0)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SendMore) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *LedgerCloseMetaV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SendMore: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerCloseMetaV0: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.NumMessages.DecodeFrom(d, maxDepth) + nTmp, err = s.LedgerHeader.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding LedgerHeaderHistoryEntry: %w", err) + } + nTmp, err = s.TxSet.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionSet: %w", err) + } + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionResultMeta: %w", err) + } + s.TxProcessing = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding TransactionResultMeta: length (%d) exceeds remaining input length (%d)", l, il) + } + s.TxProcessing = make([]TransactionResultMeta, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.TxProcessing[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionResultMeta: %w", err) + } + } + } + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding UpgradeEntryMeta: %w", err) + } + s.UpgradesProcessing = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding UpgradeEntryMeta: length (%d) exceeds remaining input length (%d)", l, il) + } + s.UpgradesProcessing = make([]UpgradeEntryMeta, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.UpgradesProcessing[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding UpgradeEntryMeta: %w", err) + } + } + } + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ScpHistoryEntry: %w", err) + } + s.ScpInfo = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding ScpHistoryEntry: length (%d) exceeds remaining input length (%d)", l, il) + } + s.ScpInfo = make([]ScpHistoryEntry, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.ScpInfo[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ScpHistoryEntry: %w", err) + } + } } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SendMore) MarshalBinary() ([]byte, error) { +func (s LedgerCloseMetaV0) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -19020,7 +19357,7 @@ func (s SendMore) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SendMore) UnmarshalBinary(inp []byte) error { +func (s *LedgerCloseMetaV0) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -19030,64 +19367,64 @@ func (s *SendMore) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SendMore)(nil) - _ encoding.BinaryUnmarshaler = (*SendMore)(nil) + _ encoding.BinaryMarshaler = (*LedgerCloseMetaV0)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerCloseMetaV0)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SendMore) xdrType() {} +func (s LedgerCloseMetaV0) xdrType() {} -var _ xdrType = (*SendMore)(nil) +var _ xdrType = (*LedgerCloseMetaV0)(nil) -// SendMoreExtended is an XDR Struct defines as: +// LedgerCloseMetaExtV1 is an XDR Struct defines as: // -// struct SendMoreExtended +// struct LedgerCloseMetaExtV1 // { -// uint32 numMessages; -// uint32 numBytes; +// ExtensionPoint ext; +// int64 sorobanFeeWrite1KB; // }; -type SendMoreExtended struct { - NumMessages Uint32 - NumBytes Uint32 +type LedgerCloseMetaExtV1 struct { + Ext ExtensionPoint + SorobanFeeWrite1Kb Int64 } // EncodeTo encodes this value using the Encoder. -func (s *SendMoreExtended) EncodeTo(e *xdr.Encoder) error { +func (s *LedgerCloseMetaExtV1) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.NumMessages.EncodeTo(e); err != nil { + if err = s.Ext.EncodeTo(e); err != nil { return err } - if err = s.NumBytes.EncodeTo(e); err != nil { + if err = s.SorobanFeeWrite1Kb.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*SendMoreExtended)(nil) +var _ decoderFrom = (*LedgerCloseMetaExtV1)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SendMoreExtended) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *LedgerCloseMetaExtV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SendMoreExtended: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerCloseMetaExtV1: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.NumMessages.DecodeFrom(d, maxDepth) + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding ExtensionPoint: %w", err) } - nTmp, err = s.NumBytes.DecodeFrom(d, maxDepth) + nTmp, err = s.SorobanFeeWrite1Kb.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding Int64: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SendMoreExtended) MarshalBinary() ([]byte, error) { +func (s LedgerCloseMetaExtV1) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -19095,7 +19432,7 @@ func (s SendMoreExtended) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SendMoreExtended) UnmarshalBinary(inp []byte) error { +func (s *LedgerCloseMetaExtV1) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -19105,74 +19442,141 @@ func (s *SendMoreExtended) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SendMoreExtended)(nil) - _ encoding.BinaryUnmarshaler = (*SendMoreExtended)(nil) + _ encoding.BinaryMarshaler = (*LedgerCloseMetaExtV1)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerCloseMetaExtV1)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SendMoreExtended) xdrType() {} +func (s LedgerCloseMetaExtV1) xdrType() {} -var _ xdrType = (*SendMoreExtended)(nil) +var _ xdrType = (*LedgerCloseMetaExtV1)(nil) -// AuthCert is an XDR Struct defines as: +// LedgerCloseMetaExt is an XDR Union defines as: // -// struct AuthCert +// union LedgerCloseMetaExt switch (int v) // { -// Curve25519Public pubkey; -// uint64 expiration; -// Signature sig; +// case 0: +// void; +// case 1: +// LedgerCloseMetaExtV1 v1; // }; -type AuthCert struct { - Pubkey Curve25519Public - Expiration Uint64 - Sig Signature +type LedgerCloseMetaExt struct { + V int32 + V1 *LedgerCloseMetaExtV1 +} + +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u LedgerCloseMetaExt) SwitchFieldName() string { + return "V" +} + +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of LedgerCloseMetaExt +func (u LedgerCloseMetaExt) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 0: + return "", true + case 1: + return "V1", true + } + return "-", false +} + +// NewLedgerCloseMetaExt creates a new LedgerCloseMetaExt. +func NewLedgerCloseMetaExt(v int32, value interface{}) (result LedgerCloseMetaExt, err error) { + result.V = v + switch int32(v) { + case 0: + // void + case 1: + tv, ok := value.(LedgerCloseMetaExtV1) + if !ok { + err = errors.New("invalid value, must be LedgerCloseMetaExtV1") + return + } + result.V1 = &tv + } + return +} + +// MustV1 retrieves the V1 value from the union, +// panicing if the value is not set. +func (u LedgerCloseMetaExt) MustV1() LedgerCloseMetaExtV1 { + val, ok := u.GetV1() + + if !ok { + panic("arm V1 is not set") + } + + return val +} + +// GetV1 retrieves the V1 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerCloseMetaExt) GetV1() (result LedgerCloseMetaExtV1, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) + + if armName == "V1" { + result = *u.V1 + ok = true + } + + return } // EncodeTo encodes this value using the Encoder. -func (s *AuthCert) EncodeTo(e *xdr.Encoder) error { +func (u LedgerCloseMetaExt) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Pubkey.EncodeTo(e); err != nil { - return err - } - if err = s.Expiration.EncodeTo(e); err != nil { + if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } - if err = s.Sig.EncodeTo(e); err != nil { - return err + switch int32(u.V) { + case 0: + // Void + return nil + case 1: + if err = (*u.V1).EncodeTo(e); err != nil { + return err + } + return nil } - return nil + return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerCloseMetaExt", u.V) } -var _ decoderFrom = (*AuthCert)(nil) +var _ decoderFrom = (*LedgerCloseMetaExt)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *AuthCert) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *LedgerCloseMetaExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding AuthCert: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerCloseMetaExt: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Pubkey.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Curve25519Public: %w", err) - } - nTmp, err = s.Expiration.DecodeFrom(d, maxDepth) + u.V, nTmp, err = d.DecodeInt() n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Int: %w", err) } - nTmp, err = s.Sig.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Signature: %w", err) + switch int32(u.V) { + case 0: + // Void + return n, nil + case 1: + u.V1 = new(LedgerCloseMetaExtV1) + nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerCloseMetaExtV1: %w", err) + } + return n, nil } - return n, nil + return n, fmt.Errorf("union LedgerCloseMetaExt has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s AuthCert) MarshalBinary() ([]byte, error) { +func (s LedgerCloseMetaExt) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -19180,7 +19584,7 @@ func (s AuthCert) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *AuthCert) UnmarshalBinary(inp []byte) error { +func (s *LedgerCloseMetaExt) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -19190,134 +19594,248 @@ func (s *AuthCert) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*AuthCert)(nil) - _ encoding.BinaryUnmarshaler = (*AuthCert)(nil) + _ encoding.BinaryMarshaler = (*LedgerCloseMetaExt)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerCloseMetaExt)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s AuthCert) xdrType() {} +func (s LedgerCloseMetaExt) xdrType() {} -var _ xdrType = (*AuthCert)(nil) +var _ xdrType = (*LedgerCloseMetaExt)(nil) -// Hello is an XDR Struct defines as: +// LedgerCloseMetaV1 is an XDR Struct defines as: // -// struct Hello +// struct LedgerCloseMetaV1 // { -// uint32 ledgerVersion; -// uint32 overlayVersion; -// uint32 overlayMinVersion; -// Hash networkID; -// string versionStr<100>; -// int listeningPort; -// NodeID peerID; -// AuthCert cert; -// uint256 nonce; +// LedgerCloseMetaExt ext; +// +// LedgerHeaderHistoryEntry ledgerHeader; +// +// GeneralizedTransactionSet txSet; +// +// // NB: transactions are sorted in apply order here +// // fees for all transactions are processed first +// // followed by applying transactions +// TransactionResultMeta txProcessing<>; +// +// // upgrades are applied last +// UpgradeEntryMeta upgradesProcessing<>; +// +// // other misc information attached to the ledger close +// SCPHistoryEntry scpInfo<>; +// +// // Size in bytes of BucketList, to support downstream +// // systems calculating storage fees correctly. +// uint64 totalByteSizeOfBucketList; +// +// // Temp keys that are being evicted at this ledger. +// LedgerKey evictedTemporaryLedgerKeys<>; +// +// // Archived restorable ledger entries that are being +// // evicted at this ledger. +// LedgerEntry evictedPersistentLedgerEntries<>; // }; -type Hello struct { - LedgerVersion Uint32 - OverlayVersion Uint32 - OverlayMinVersion Uint32 - NetworkId Hash - VersionStr string `xdrmaxsize:"100"` - ListeningPort int32 - PeerId NodeId - Cert AuthCert - Nonce Uint256 +type LedgerCloseMetaV1 struct { + Ext LedgerCloseMetaExt + LedgerHeader LedgerHeaderHistoryEntry + TxSet GeneralizedTransactionSet + TxProcessing []TransactionResultMeta + UpgradesProcessing []UpgradeEntryMeta + ScpInfo []ScpHistoryEntry + TotalByteSizeOfBucketList Uint64 + EvictedTemporaryLedgerKeys []LedgerKey + EvictedPersistentLedgerEntries []LedgerEntry } // EncodeTo encodes this value using the Encoder. -func (s *Hello) EncodeTo(e *xdr.Encoder) error { +func (s *LedgerCloseMetaV1) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.LedgerVersion.EncodeTo(e); err != nil { + if err = s.Ext.EncodeTo(e); err != nil { return err } - if err = s.OverlayVersion.EncodeTo(e); err != nil { + if err = s.LedgerHeader.EncodeTo(e); err != nil { return err } - if err = s.OverlayMinVersion.EncodeTo(e); err != nil { + if err = s.TxSet.EncodeTo(e); err != nil { return err } - if err = s.NetworkId.EncodeTo(e); err != nil { + if _, err = e.EncodeUint(uint32(len(s.TxProcessing))); err != nil { return err } - if _, err = e.EncodeString(string(s.VersionStr)); err != nil { + for i := 0; i < len(s.TxProcessing); i++ { + if err = s.TxProcessing[i].EncodeTo(e); err != nil { + return err + } + } + if _, err = e.EncodeUint(uint32(len(s.UpgradesProcessing))); err != nil { return err } - if _, err = e.EncodeInt(int32(s.ListeningPort)); err != nil { + for i := 0; i < len(s.UpgradesProcessing); i++ { + if err = s.UpgradesProcessing[i].EncodeTo(e); err != nil { + return err + } + } + if _, err = e.EncodeUint(uint32(len(s.ScpInfo))); err != nil { return err } - if err = s.PeerId.EncodeTo(e); err != nil { + for i := 0; i < len(s.ScpInfo); i++ { + if err = s.ScpInfo[i].EncodeTo(e); err != nil { + return err + } + } + if err = s.TotalByteSizeOfBucketList.EncodeTo(e); err != nil { return err } - if err = s.Cert.EncodeTo(e); err != nil { + if _, err = e.EncodeUint(uint32(len(s.EvictedTemporaryLedgerKeys))); err != nil { return err } - if err = s.Nonce.EncodeTo(e); err != nil { + for i := 0; i < len(s.EvictedTemporaryLedgerKeys); i++ { + if err = s.EvictedTemporaryLedgerKeys[i].EncodeTo(e); err != nil { + return err + } + } + if _, err = e.EncodeUint(uint32(len(s.EvictedPersistentLedgerEntries))); err != nil { return err } + for i := 0; i < len(s.EvictedPersistentLedgerEntries); i++ { + if err = s.EvictedPersistentLedgerEntries[i].EncodeTo(e); err != nil { + return err + } + } return nil } -var _ decoderFrom = (*Hello)(nil) +var _ decoderFrom = (*LedgerCloseMetaV1)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *Hello) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *LedgerCloseMetaV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding Hello: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerCloseMetaV1: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.LedgerVersion.DecodeFrom(d, maxDepth) + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding LedgerCloseMetaExt: %w", err) } - nTmp, err = s.OverlayVersion.DecodeFrom(d, maxDepth) + nTmp, err = s.LedgerHeader.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding LedgerHeaderHistoryEntry: %w", err) } - nTmp, err = s.OverlayMinVersion.DecodeFrom(d, maxDepth) + nTmp, err = s.TxSet.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding GeneralizedTransactionSet: %w", err) } - nTmp, err = s.NetworkId.DecodeFrom(d, maxDepth) + var l uint32 + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) + return n, fmt.Errorf("decoding TransactionResultMeta: %w", err) } - s.VersionStr, nTmp, err = d.DecodeString(100) + s.TxProcessing = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding TransactionResultMeta: length (%d) exceeds remaining input length (%d)", l, il) + } + s.TxProcessing = make([]TransactionResultMeta, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.TxProcessing[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TransactionResultMeta: %w", err) + } + } + } + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding VersionStr: %w", err) + return n, fmt.Errorf("decoding UpgradeEntryMeta: %w", err) } - s.ListeningPort, nTmp, err = d.DecodeInt() + s.UpgradesProcessing = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding UpgradeEntryMeta: length (%d) exceeds remaining input length (%d)", l, il) + } + s.UpgradesProcessing = make([]UpgradeEntryMeta, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.UpgradesProcessing[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding UpgradeEntryMeta: %w", err) + } + } + } + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding Int: %w", err) + return n, fmt.Errorf("decoding ScpHistoryEntry: %w", err) } - nTmp, err = s.PeerId.DecodeFrom(d, maxDepth) + s.ScpInfo = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding ScpHistoryEntry: length (%d) exceeds remaining input length (%d)", l, il) + } + s.ScpInfo = make([]ScpHistoryEntry, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.ScpInfo[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ScpHistoryEntry: %w", err) + } + } + } + nTmp, err = s.TotalByteSizeOfBucketList.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding NodeId: %w", err) + return n, fmt.Errorf("decoding Uint64: %w", err) } - nTmp, err = s.Cert.DecodeFrom(d, maxDepth) + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding AuthCert: %w", err) + return n, fmt.Errorf("decoding LedgerKey: %w", err) } - nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) + s.EvictedTemporaryLedgerKeys = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding LedgerKey: length (%d) exceeds remaining input length (%d)", l, il) + } + s.EvictedTemporaryLedgerKeys = make([]LedgerKey, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.EvictedTemporaryLedgerKeys[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerKey: %w", err) + } + } + } + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint256: %w", err) + return n, fmt.Errorf("decoding LedgerEntry: %w", err) + } + s.EvictedPersistentLedgerEntries = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding LedgerEntry: length (%d) exceeds remaining input length (%d)", l, il) + } + s.EvictedPersistentLedgerEntries = make([]LedgerEntry, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.EvictedPersistentLedgerEntries[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerEntry: %w", err) + } + } } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s Hello) MarshalBinary() ([]byte, error) { +func (s LedgerCloseMetaV1) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -19325,7 +19843,7 @@ func (s Hello) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *Hello) UnmarshalBinary(inp []byte) error { +func (s *LedgerCloseMetaV1) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -19335,272 +19853,114 @@ func (s *Hello) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*Hello)(nil) - _ encoding.BinaryUnmarshaler = (*Hello)(nil) + _ encoding.BinaryMarshaler = (*LedgerCloseMetaV1)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerCloseMetaV1)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s Hello) xdrType() {} - -var _ xdrType = (*Hello)(nil) +func (s LedgerCloseMetaV1) xdrType() {} -// AuthMsgFlagFlowControlBytesRequested is an XDR Const defines as: -// -// const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED = 200; -const AuthMsgFlagFlowControlBytesRequested = 200 +var _ xdrType = (*LedgerCloseMetaV1)(nil) -// Auth is an XDR Struct defines as: +// LedgerCloseMeta is an XDR Union defines as: // -// struct Auth +// union LedgerCloseMeta switch (int v) // { -// int flags; +// case 0: +// LedgerCloseMetaV0 v0; +// case 1: +// LedgerCloseMetaV1 v1; // }; -type Auth struct { - Flags int32 +type LedgerCloseMeta struct { + V int32 + V0 *LedgerCloseMetaV0 + V1 *LedgerCloseMetaV1 } -// EncodeTo encodes this value using the Encoder. -func (s *Auth) EncodeTo(e *xdr.Encoder) error { - var err error - if _, err = e.EncodeInt(int32(s.Flags)); err != nil { - return err - } - return nil +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u LedgerCloseMeta) SwitchFieldName() string { + return "V" } -var _ decoderFrom = (*Auth)(nil) - -// DecodeFrom decodes this value using the Decoder. -func (s *Auth) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { - if maxDepth == 0 { - return 0, fmt.Errorf("decoding Auth: %w", ErrMaxDecodingDepthReached) - } - maxDepth -= 1 - var err error - var n, nTmp int - s.Flags, nTmp, err = d.DecodeInt() - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Int: %w", err) +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of LedgerCloseMeta +func (u LedgerCloseMeta) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 0: + return "V0", true + case 1: + return "V1", true } - return n, nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (s Auth) MarshalBinary() ([]byte, error) { - b := bytes.Buffer{} - e := xdr.NewEncoder(&b) - err := s.EncodeTo(e) - return b.Bytes(), err + return "-", false } -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *Auth) UnmarshalBinary(inp []byte) error { - r := bytes.NewReader(inp) - o := xdr.DefaultDecodeOptions - o.MaxInputLen = len(inp) - d := xdr.NewDecoderWithOptions(r, o) - _, err := s.DecodeFrom(d, o.MaxDepth) - return err +// NewLedgerCloseMeta creates a new LedgerCloseMeta. +func NewLedgerCloseMeta(v int32, value interface{}) (result LedgerCloseMeta, err error) { + result.V = v + switch int32(v) { + case 0: + tv, ok := value.(LedgerCloseMetaV0) + if !ok { + err = errors.New("invalid value, must be LedgerCloseMetaV0") + return + } + result.V0 = &tv + case 1: + tv, ok := value.(LedgerCloseMetaV1) + if !ok { + err = errors.New("invalid value, must be LedgerCloseMetaV1") + return + } + result.V1 = &tv + } + return } -var ( - _ encoding.BinaryMarshaler = (*Auth)(nil) - _ encoding.BinaryUnmarshaler = (*Auth)(nil) -) +// MustV0 retrieves the V0 value from the union, +// panicing if the value is not set. +func (u LedgerCloseMeta) MustV0() LedgerCloseMetaV0 { + val, ok := u.GetV0() -// xdrType signals that this type represents XDR values defined by this package. -func (s Auth) xdrType() {} + if !ok { + panic("arm V0 is not set") + } -var _ xdrType = (*Auth)(nil) + return val +} -// IpAddrType is an XDR Enum defines as: -// -// enum IPAddrType -// { -// IPv4 = 0, -// IPv6 = 1 -// }; -type IpAddrType int32 +// GetV0 retrieves the V0 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerCloseMeta) GetV0() (result LedgerCloseMetaV0, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) -const ( - IpAddrTypeIPv4 IpAddrType = 0 - IpAddrTypeIPv6 IpAddrType = 1 -) + if armName == "V0" { + result = *u.V0 + ok = true + } -var ipAddrTypeMap = map[int32]string{ - 0: "IpAddrTypeIPv4", - 1: "IpAddrTypeIPv6", + return } -// ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for IpAddrType -func (e IpAddrType) ValidEnum(v int32) bool { - _, ok := ipAddrTypeMap[v] - return ok -} - -// String returns the name of `e` -func (e IpAddrType) String() string { - name, _ := ipAddrTypeMap[int32(e)] - return name -} - -// EncodeTo encodes this value using the Encoder. -func (e IpAddrType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := ipAddrTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid IpAddrType enum value", e) - } - _, err := enc.EncodeInt(int32(e)) - return err -} - -var _ decoderFrom = (*IpAddrType)(nil) - -// DecodeFrom decodes this value using the Decoder. -func (e *IpAddrType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { - if maxDepth == 0 { - return 0, fmt.Errorf("decoding IpAddrType: %w", ErrMaxDecodingDepthReached) - } - maxDepth -= 1 - v, n, err := d.DecodeInt() - if err != nil { - return n, fmt.Errorf("decoding IpAddrType: %w", err) - } - if _, ok := ipAddrTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid IpAddrType enum value", v) - } - *e = IpAddrType(v) - return n, nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (s IpAddrType) MarshalBinary() ([]byte, error) { - b := bytes.Buffer{} - e := xdr.NewEncoder(&b) - err := s.EncodeTo(e) - return b.Bytes(), err -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *IpAddrType) UnmarshalBinary(inp []byte) error { - r := bytes.NewReader(inp) - o := xdr.DefaultDecodeOptions - o.MaxInputLen = len(inp) - d := xdr.NewDecoderWithOptions(r, o) - _, err := s.DecodeFrom(d, o.MaxDepth) - return err -} - -var ( - _ encoding.BinaryMarshaler = (*IpAddrType)(nil) - _ encoding.BinaryUnmarshaler = (*IpAddrType)(nil) -) - -// xdrType signals that this type represents XDR values defined by this package. -func (s IpAddrType) xdrType() {} - -var _ xdrType = (*IpAddrType)(nil) - -// PeerAddressIp is an XDR NestedUnion defines as: -// -// union switch (IPAddrType type) -// { -// case IPv4: -// opaque ipv4[4]; -// case IPv6: -// opaque ipv6[16]; -// } -type PeerAddressIp struct { - Type IpAddrType - Ipv4 *[4]byte `xdrmaxsize:"4"` - Ipv6 *[16]byte `xdrmaxsize:"16"` -} - -// SwitchFieldName returns the field name in which this union's -// discriminant is stored -func (u PeerAddressIp) SwitchFieldName() string { - return "Type" -} - -// ArmForSwitch returns which field name should be used for storing -// the value for an instance of PeerAddressIp -func (u PeerAddressIp) ArmForSwitch(sw int32) (string, bool) { - switch IpAddrType(sw) { - case IpAddrTypeIPv4: - return "Ipv4", true - case IpAddrTypeIPv6: - return "Ipv6", true - } - return "-", false -} - -// NewPeerAddressIp creates a new PeerAddressIp. -func NewPeerAddressIp(aType IpAddrType, value interface{}) (result PeerAddressIp, err error) { - result.Type = aType - switch IpAddrType(aType) { - case IpAddrTypeIPv4: - tv, ok := value.([4]byte) - if !ok { - err = errors.New("invalid value, must be [4]byte") - return - } - result.Ipv4 = &tv - case IpAddrTypeIPv6: - tv, ok := value.([16]byte) - if !ok { - err = errors.New("invalid value, must be [16]byte") - return - } - result.Ipv6 = &tv - } - return -} - -// MustIpv4 retrieves the Ipv4 value from the union, -// panicing if the value is not set. -func (u PeerAddressIp) MustIpv4() [4]byte { - val, ok := u.GetIpv4() - - if !ok { - panic("arm Ipv4 is not set") - } - - return val -} - -// GetIpv4 retrieves the Ipv4 value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u PeerAddressIp) GetIpv4() (result [4]byte, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "Ipv4" { - result = *u.Ipv4 - ok = true - } - - return -} - -// MustIpv6 retrieves the Ipv6 value from the union, +// MustV1 retrieves the V1 value from the union, // panicing if the value is not set. -func (u PeerAddressIp) MustIpv6() [16]byte { - val, ok := u.GetIpv6() +func (u LedgerCloseMeta) MustV1() LedgerCloseMetaV1 { + val, ok := u.GetV1() if !ok { - panic("arm Ipv6 is not set") + panic("arm V1 is not set") } return val } -// GetIpv6 retrieves the Ipv6 value from the union, +// GetV1 retrieves the V1 value from the union, // returning ok if the union's switch indicated the value is valid. -func (u PeerAddressIp) GetIpv6() (result [16]byte, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) +func (u LedgerCloseMeta) GetV1() (result LedgerCloseMetaV1, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) - if armName == "Ipv6" { - result = *u.Ipv6 + if armName == "V1" { + result = *u.V1 ok = true } @@ -19608,156 +19968,64 @@ func (u PeerAddressIp) GetIpv6() (result [16]byte, ok bool) { } // EncodeTo encodes this value using the Encoder. -func (u PeerAddressIp) EncodeTo(e *xdr.Encoder) error { +func (u LedgerCloseMeta) EncodeTo(e *xdr.Encoder) error { var err error - if err = u.Type.EncodeTo(e); err != nil { + if _, err = e.EncodeInt(int32(u.V)); err != nil { return err } - switch IpAddrType(u.Type) { - case IpAddrTypeIPv4: - if _, err = e.EncodeFixedOpaque((*u.Ipv4)[:]); err != nil { + switch int32(u.V) { + case 0: + if err = (*u.V0).EncodeTo(e); err != nil { return err } return nil - case IpAddrTypeIPv6: - if _, err = e.EncodeFixedOpaque((*u.Ipv6)[:]); err != nil { + case 1: + if err = (*u.V1).EncodeTo(e); err != nil { return err } return nil } - return fmt.Errorf("Type (IpAddrType) switch value '%d' is not valid for union PeerAddressIp", u.Type) + return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerCloseMeta", u.V) } -var _ decoderFrom = (*PeerAddressIp)(nil) +var _ decoderFrom = (*LedgerCloseMeta)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *PeerAddressIp) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *LedgerCloseMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding PeerAddressIp: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerCloseMeta: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = u.Type.DecodeFrom(d, maxDepth) + u.V, nTmp, err = d.DecodeInt() n += nTmp if err != nil { - return n, fmt.Errorf("decoding IpAddrType: %w", err) + return n, fmt.Errorf("decoding Int: %w", err) } - switch IpAddrType(u.Type) { - case IpAddrTypeIPv4: - u.Ipv4 = new([4]byte) - nTmp, err = d.DecodeFixedOpaqueInplace((*u.Ipv4)[:]) + switch int32(u.V) { + case 0: + u.V0 = new(LedgerCloseMetaV0) + nTmp, err = (*u.V0).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Ipv4: %w", err) + return n, fmt.Errorf("decoding LedgerCloseMetaV0: %w", err) } return n, nil - case IpAddrTypeIPv6: - u.Ipv6 = new([16]byte) - nTmp, err = d.DecodeFixedOpaqueInplace((*u.Ipv6)[:]) + case 1: + u.V1 = new(LedgerCloseMetaV1) + nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Ipv6: %w", err) + return n, fmt.Errorf("decoding LedgerCloseMetaV1: %w", err) } return n, nil } - return n, fmt.Errorf("union PeerAddressIp has invalid Type (IpAddrType) switch value '%d'", u.Type) -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (s PeerAddressIp) MarshalBinary() ([]byte, error) { - b := bytes.Buffer{} - e := xdr.NewEncoder(&b) - err := s.EncodeTo(e) - return b.Bytes(), err -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *PeerAddressIp) UnmarshalBinary(inp []byte) error { - r := bytes.NewReader(inp) - o := xdr.DefaultDecodeOptions - o.MaxInputLen = len(inp) - d := xdr.NewDecoderWithOptions(r, o) - _, err := s.DecodeFrom(d, o.MaxDepth) - return err -} - -var ( - _ encoding.BinaryMarshaler = (*PeerAddressIp)(nil) - _ encoding.BinaryUnmarshaler = (*PeerAddressIp)(nil) -) - -// xdrType signals that this type represents XDR values defined by this package. -func (s PeerAddressIp) xdrType() {} - -var _ xdrType = (*PeerAddressIp)(nil) - -// PeerAddress is an XDR Struct defines as: -// -// struct PeerAddress -// { -// union switch (IPAddrType type) -// { -// case IPv4: -// opaque ipv4[4]; -// case IPv6: -// opaque ipv6[16]; -// } -// ip; -// uint32 port; -// uint32 numFailures; -// }; -type PeerAddress struct { - Ip PeerAddressIp - Port Uint32 - NumFailures Uint32 -} - -// EncodeTo encodes this value using the Encoder. -func (s *PeerAddress) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.Ip.EncodeTo(e); err != nil { - return err - } - if err = s.Port.EncodeTo(e); err != nil { - return err - } - if err = s.NumFailures.EncodeTo(e); err != nil { - return err - } - return nil -} - -var _ decoderFrom = (*PeerAddress)(nil) - -// DecodeFrom decodes this value using the Decoder. -func (s *PeerAddress) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { - if maxDepth == 0 { - return 0, fmt.Errorf("decoding PeerAddress: %w", ErrMaxDecodingDepthReached) - } - maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.Ip.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding PeerAddressIp: %w", err) - } - nTmp, err = s.Port.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.NumFailures.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - return n, nil + return n, fmt.Errorf("union LedgerCloseMeta has invalid V (int32) switch value '%d'", u.V) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s PeerAddress) MarshalBinary() ([]byte, error) { +func (s LedgerCloseMeta) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -19765,7 +20033,7 @@ func (s PeerAddress) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *PeerAddress) UnmarshalBinary(inp []byte) error { +func (s *LedgerCloseMeta) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -19775,154 +20043,86 @@ func (s *PeerAddress) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*PeerAddress)(nil) - _ encoding.BinaryUnmarshaler = (*PeerAddress)(nil) + _ encoding.BinaryMarshaler = (*LedgerCloseMeta)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerCloseMeta)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s PeerAddress) xdrType() {} +func (s LedgerCloseMeta) xdrType() {} -var _ xdrType = (*PeerAddress)(nil) +var _ xdrType = (*LedgerCloseMeta)(nil) -// MessageType is an XDR Enum defines as: +// ErrorCode is an XDR Enum defines as: // -// enum MessageType +// enum ErrorCode // { -// ERROR_MSG = 0, -// AUTH = 2, -// DONT_HAVE = 3, -// -// GET_PEERS = 4, // gets a list of peers this guy knows about -// PEERS = 5, -// -// GET_TX_SET = 6, // gets a particular txset by hash -// TX_SET = 7, -// GENERALIZED_TX_SET = 17, -// -// TRANSACTION = 8, // pass on a tx you have heard about -// -// // SCP -// GET_SCP_QUORUMSET = 9, -// SCP_QUORUMSET = 10, -// SCP_MESSAGE = 11, -// GET_SCP_STATE = 12, -// -// // new messages -// HELLO = 13, -// -// SURVEY_REQUEST = 14, -// SURVEY_RESPONSE = 15, -// -// SEND_MORE = 16, -// SEND_MORE_EXTENDED = 20, -// -// FLOOD_ADVERT = 18, -// FLOOD_DEMAND = 19, -// -// TIME_SLICED_SURVEY_REQUEST = 21, -// TIME_SLICED_SURVEY_RESPONSE = 22, -// TIME_SLICED_SURVEY_START_COLLECTING = 23, -// TIME_SLICED_SURVEY_STOP_COLLECTING = 24 +// ERR_MISC = 0, // Unspecific error +// ERR_DATA = 1, // Malformed data +// ERR_CONF = 2, // Misconfiguration error +// ERR_AUTH = 3, // Authentication failure +// ERR_LOAD = 4 // System overloaded // }; -type MessageType int32 +type ErrorCode int32 const ( - MessageTypeErrorMsg MessageType = 0 - MessageTypeAuth MessageType = 2 - MessageTypeDontHave MessageType = 3 - MessageTypeGetPeers MessageType = 4 - MessageTypePeers MessageType = 5 - MessageTypeGetTxSet MessageType = 6 - MessageTypeTxSet MessageType = 7 - MessageTypeGeneralizedTxSet MessageType = 17 - MessageTypeTransaction MessageType = 8 - MessageTypeGetScpQuorumset MessageType = 9 - MessageTypeScpQuorumset MessageType = 10 - MessageTypeScpMessage MessageType = 11 - MessageTypeGetScpState MessageType = 12 - MessageTypeHello MessageType = 13 - MessageTypeSurveyRequest MessageType = 14 - MessageTypeSurveyResponse MessageType = 15 - MessageTypeSendMore MessageType = 16 - MessageTypeSendMoreExtended MessageType = 20 - MessageTypeFloodAdvert MessageType = 18 - MessageTypeFloodDemand MessageType = 19 - MessageTypeTimeSlicedSurveyRequest MessageType = 21 - MessageTypeTimeSlicedSurveyResponse MessageType = 22 - MessageTypeTimeSlicedSurveyStartCollecting MessageType = 23 - MessageTypeTimeSlicedSurveyStopCollecting MessageType = 24 + ErrorCodeErrMisc ErrorCode = 0 + ErrorCodeErrData ErrorCode = 1 + ErrorCodeErrConf ErrorCode = 2 + ErrorCodeErrAuth ErrorCode = 3 + ErrorCodeErrLoad ErrorCode = 4 ) -var messageTypeMap = map[int32]string{ - 0: "MessageTypeErrorMsg", - 2: "MessageTypeAuth", - 3: "MessageTypeDontHave", - 4: "MessageTypeGetPeers", - 5: "MessageTypePeers", - 6: "MessageTypeGetTxSet", - 7: "MessageTypeTxSet", - 17: "MessageTypeGeneralizedTxSet", - 8: "MessageTypeTransaction", - 9: "MessageTypeGetScpQuorumset", - 10: "MessageTypeScpQuorumset", - 11: "MessageTypeScpMessage", - 12: "MessageTypeGetScpState", - 13: "MessageTypeHello", - 14: "MessageTypeSurveyRequest", - 15: "MessageTypeSurveyResponse", - 16: "MessageTypeSendMore", - 20: "MessageTypeSendMoreExtended", - 18: "MessageTypeFloodAdvert", - 19: "MessageTypeFloodDemand", - 21: "MessageTypeTimeSlicedSurveyRequest", - 22: "MessageTypeTimeSlicedSurveyResponse", - 23: "MessageTypeTimeSlicedSurveyStartCollecting", - 24: "MessageTypeTimeSlicedSurveyStopCollecting", +var errorCodeMap = map[int32]string{ + 0: "ErrorCodeErrMisc", + 1: "ErrorCodeErrData", + 2: "ErrorCodeErrConf", + 3: "ErrorCodeErrAuth", + 4: "ErrorCodeErrLoad", } // ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for MessageType -func (e MessageType) ValidEnum(v int32) bool { - _, ok := messageTypeMap[v] +// the Enum interface for ErrorCode +func (e ErrorCode) ValidEnum(v int32) bool { + _, ok := errorCodeMap[v] return ok } // String returns the name of `e` -func (e MessageType) String() string { - name, _ := messageTypeMap[int32(e)] +func (e ErrorCode) String() string { + name, _ := errorCodeMap[int32(e)] return name } // EncodeTo encodes this value using the Encoder. -func (e MessageType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := messageTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid MessageType enum value", e) +func (e ErrorCode) EncodeTo(enc *xdr.Encoder) error { + if _, ok := errorCodeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid ErrorCode enum value", e) } _, err := enc.EncodeInt(int32(e)) return err } -var _ decoderFrom = (*MessageType)(nil) +var _ decoderFrom = (*ErrorCode)(nil) // DecodeFrom decodes this value using the Decoder. -func (e *MessageType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *ErrorCode) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding MessageType: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ErrorCode: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding MessageType: %w", err) + return n, fmt.Errorf("decoding ErrorCode: %w", err) } - if _, ok := messageTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid MessageType enum value", v) + if _, ok := errorCodeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid ErrorCode enum value", v) } - *e = MessageType(v) + *e = ErrorCode(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s MessageType) MarshalBinary() ([]byte, error) { +func (s ErrorCode) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -19930,7 +20130,7 @@ func (s MessageType) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *MessageType) UnmarshalBinary(inp []byte) error { +func (s *ErrorCode) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -19940,64 +20140,64 @@ func (s *MessageType) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*MessageType)(nil) - _ encoding.BinaryUnmarshaler = (*MessageType)(nil) + _ encoding.BinaryMarshaler = (*ErrorCode)(nil) + _ encoding.BinaryUnmarshaler = (*ErrorCode)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s MessageType) xdrType() {} +func (s ErrorCode) xdrType() {} -var _ xdrType = (*MessageType)(nil) +var _ xdrType = (*ErrorCode)(nil) -// DontHave is an XDR Struct defines as: +// Error is an XDR Struct defines as: // -// struct DontHave +// struct Error // { -// MessageType type; -// uint256 reqHash; +// ErrorCode code; +// string msg<100>; // }; -type DontHave struct { - Type MessageType - ReqHash Uint256 +type Error struct { + Code ErrorCode + Msg string `xdrmaxsize:"100"` } // EncodeTo encodes this value using the Encoder. -func (s *DontHave) EncodeTo(e *xdr.Encoder) error { +func (s *Error) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Type.EncodeTo(e); err != nil { + if err = s.Code.EncodeTo(e); err != nil { return err } - if err = s.ReqHash.EncodeTo(e); err != nil { + if _, err = e.EncodeString(string(s.Msg)); err != nil { return err } return nil } -var _ decoderFrom = (*DontHave)(nil) +var _ decoderFrom = (*Error)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *DontHave) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *Error) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding DontHave: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding Error: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Type.DecodeFrom(d, maxDepth) + nTmp, err = s.Code.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding MessageType: %w", err) + return n, fmt.Errorf("decoding ErrorCode: %w", err) } - nTmp, err = s.ReqHash.DecodeFrom(d, maxDepth) + s.Msg, nTmp, err = d.DecodeString(100) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint256: %w", err) + return n, fmt.Errorf("decoding Msg: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s DontHave) MarshalBinary() ([]byte, error) { +func (s Error) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20005,7 +20205,7 @@ func (s DontHave) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *DontHave) UnmarshalBinary(inp []byte) error { +func (s *Error) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20015,77 +20215,54 @@ func (s *DontHave) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*DontHave)(nil) - _ encoding.BinaryUnmarshaler = (*DontHave)(nil) + _ encoding.BinaryMarshaler = (*Error)(nil) + _ encoding.BinaryUnmarshaler = (*Error)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s DontHave) xdrType() {} +func (s Error) xdrType() {} -var _ xdrType = (*DontHave)(nil) +var _ xdrType = (*Error)(nil) -// SurveyMessageCommandType is an XDR Enum defines as: +// SendMore is an XDR Struct defines as: // -// enum SurveyMessageCommandType +// struct SendMore // { -// SURVEY_TOPOLOGY = 0, -// TIME_SLICED_SURVEY_TOPOLOGY = 1 +// uint32 numMessages; // }; -type SurveyMessageCommandType int32 - -const ( - SurveyMessageCommandTypeSurveyTopology SurveyMessageCommandType = 0 - SurveyMessageCommandTypeTimeSlicedSurveyTopology SurveyMessageCommandType = 1 -) - -var surveyMessageCommandTypeMap = map[int32]string{ - 0: "SurveyMessageCommandTypeSurveyTopology", - 1: "SurveyMessageCommandTypeTimeSlicedSurveyTopology", -} - -// ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for SurveyMessageCommandType -func (e SurveyMessageCommandType) ValidEnum(v int32) bool { - _, ok := surveyMessageCommandTypeMap[v] - return ok -} - -// String returns the name of `e` -func (e SurveyMessageCommandType) String() string { - name, _ := surveyMessageCommandTypeMap[int32(e)] - return name +type SendMore struct { + NumMessages Uint32 } // EncodeTo encodes this value using the Encoder. -func (e SurveyMessageCommandType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := surveyMessageCommandTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid SurveyMessageCommandType enum value", e) +func (s *SendMore) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.NumMessages.EncodeTo(e); err != nil { + return err } - _, err := enc.EncodeInt(int32(e)) - return err + return nil } -var _ decoderFrom = (*SurveyMessageCommandType)(nil) +var _ decoderFrom = (*SendMore)(nil) // DecodeFrom decodes this value using the Decoder. -func (e *SurveyMessageCommandType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SendMore) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SurveyMessageCommandType: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SendMore: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - v, n, err := d.DecodeInt() + var err error + var n, nTmp int + nTmp, err = s.NumMessages.DecodeFrom(d, maxDepth) + n += nTmp if err != nil { - return n, fmt.Errorf("decoding SurveyMessageCommandType: %w", err) - } - if _, ok := surveyMessageCommandTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid SurveyMessageCommandType enum value", v) + return n, fmt.Errorf("decoding Uint32: %w", err) } - *e = SurveyMessageCommandType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SurveyMessageCommandType) MarshalBinary() ([]byte, error) { +func (s SendMore) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20093,7 +20270,7 @@ func (s SurveyMessageCommandType) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SurveyMessageCommandType) UnmarshalBinary(inp []byte) error { +func (s *SendMore) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20103,80 +20280,64 @@ func (s *SurveyMessageCommandType) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SurveyMessageCommandType)(nil) - _ encoding.BinaryUnmarshaler = (*SurveyMessageCommandType)(nil) + _ encoding.BinaryMarshaler = (*SendMore)(nil) + _ encoding.BinaryUnmarshaler = (*SendMore)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SurveyMessageCommandType) xdrType() {} +func (s SendMore) xdrType() {} -var _ xdrType = (*SurveyMessageCommandType)(nil) +var _ xdrType = (*SendMore)(nil) -// SurveyMessageResponseType is an XDR Enum defines as: +// SendMoreExtended is an XDR Struct defines as: // -// enum SurveyMessageResponseType +// struct SendMoreExtended // { -// SURVEY_TOPOLOGY_RESPONSE_V0 = 0, -// SURVEY_TOPOLOGY_RESPONSE_V1 = 1, -// SURVEY_TOPOLOGY_RESPONSE_V2 = 2 +// uint32 numMessages; +// uint32 numBytes; // }; -type SurveyMessageResponseType int32 - -const ( - SurveyMessageResponseTypeSurveyTopologyResponseV0 SurveyMessageResponseType = 0 - SurveyMessageResponseTypeSurveyTopologyResponseV1 SurveyMessageResponseType = 1 - SurveyMessageResponseTypeSurveyTopologyResponseV2 SurveyMessageResponseType = 2 -) - -var surveyMessageResponseTypeMap = map[int32]string{ - 0: "SurveyMessageResponseTypeSurveyTopologyResponseV0", - 1: "SurveyMessageResponseTypeSurveyTopologyResponseV1", - 2: "SurveyMessageResponseTypeSurveyTopologyResponseV2", -} - -// ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for SurveyMessageResponseType -func (e SurveyMessageResponseType) ValidEnum(v int32) bool { - _, ok := surveyMessageResponseTypeMap[v] - return ok -} - -// String returns the name of `e` -func (e SurveyMessageResponseType) String() string { - name, _ := surveyMessageResponseTypeMap[int32(e)] - return name +type SendMoreExtended struct { + NumMessages Uint32 + NumBytes Uint32 } // EncodeTo encodes this value using the Encoder. -func (e SurveyMessageResponseType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := surveyMessageResponseTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid SurveyMessageResponseType enum value", e) +func (s *SendMoreExtended) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.NumMessages.EncodeTo(e); err != nil { + return err } - _, err := enc.EncodeInt(int32(e)) - return err + if err = s.NumBytes.EncodeTo(e); err != nil { + return err + } + return nil } -var _ decoderFrom = (*SurveyMessageResponseType)(nil) +var _ decoderFrom = (*SendMoreExtended)(nil) // DecodeFrom decodes this value using the Decoder. -func (e *SurveyMessageResponseType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SendMoreExtended) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SurveyMessageResponseType: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SendMoreExtended: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - v, n, err := d.DecodeInt() + var err error + var n, nTmp int + nTmp, err = s.NumMessages.DecodeFrom(d, maxDepth) + n += nTmp if err != nil { - return n, fmt.Errorf("decoding SurveyMessageResponseType: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - if _, ok := surveyMessageResponseTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid SurveyMessageResponseType enum value", v) + nTmp, err = s.NumBytes.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) } - *e = SurveyMessageResponseType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SurveyMessageResponseType) MarshalBinary() ([]byte, error) { +func (s SendMoreExtended) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20184,7 +20345,7 @@ func (s SurveyMessageResponseType) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SurveyMessageResponseType) UnmarshalBinary(inp []byte) error { +func (s *SendMoreExtended) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20194,74 +20355,74 @@ func (s *SurveyMessageResponseType) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SurveyMessageResponseType)(nil) - _ encoding.BinaryUnmarshaler = (*SurveyMessageResponseType)(nil) + _ encoding.BinaryMarshaler = (*SendMoreExtended)(nil) + _ encoding.BinaryUnmarshaler = (*SendMoreExtended)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SurveyMessageResponseType) xdrType() {} +func (s SendMoreExtended) xdrType() {} -var _ xdrType = (*SurveyMessageResponseType)(nil) +var _ xdrType = (*SendMoreExtended)(nil) -// TimeSlicedSurveyStartCollectingMessage is an XDR Struct defines as: +// AuthCert is an XDR Struct defines as: // -// struct TimeSlicedSurveyStartCollectingMessage +// struct AuthCert // { -// NodeID surveyorID; -// uint32 nonce; -// uint32 ledgerNum; +// Curve25519Public pubkey; +// uint64 expiration; +// Signature sig; // }; -type TimeSlicedSurveyStartCollectingMessage struct { - SurveyorId NodeId - Nonce Uint32 - LedgerNum Uint32 +type AuthCert struct { + Pubkey Curve25519Public + Expiration Uint64 + Sig Signature } // EncodeTo encodes this value using the Encoder. -func (s *TimeSlicedSurveyStartCollectingMessage) EncodeTo(e *xdr.Encoder) error { +func (s *AuthCert) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.SurveyorId.EncodeTo(e); err != nil { + if err = s.Pubkey.EncodeTo(e); err != nil { return err } - if err = s.Nonce.EncodeTo(e); err != nil { + if err = s.Expiration.EncodeTo(e); err != nil { return err } - if err = s.LedgerNum.EncodeTo(e); err != nil { + if err = s.Sig.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*TimeSlicedSurveyStartCollectingMessage)(nil) +var _ decoderFrom = (*AuthCert)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TimeSlicedSurveyStartCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *AuthCert) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TimeSlicedSurveyStartCollectingMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding AuthCert: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.SurveyorId.DecodeFrom(d, maxDepth) + nTmp, err = s.Pubkey.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding NodeId: %w", err) + return n, fmt.Errorf("decoding Curve25519Public: %w", err) } - nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) + nTmp, err = s.Expiration.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding Uint64: %w", err) } - nTmp, err = s.LedgerNum.DecodeFrom(d, maxDepth) + nTmp, err = s.Sig.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding Signature: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TimeSlicedSurveyStartCollectingMessage) MarshalBinary() ([]byte, error) { +func (s AuthCert) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20269,7 +20430,7 @@ func (s TimeSlicedSurveyStartCollectingMessage) MarshalBinary() ([]byte, error) } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TimeSlicedSurveyStartCollectingMessage) UnmarshalBinary(inp []byte) error { +func (s *AuthCert) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20279,64 +20440,134 @@ func (s *TimeSlicedSurveyStartCollectingMessage) UnmarshalBinary(inp []byte) err } var ( - _ encoding.BinaryMarshaler = (*TimeSlicedSurveyStartCollectingMessage)(nil) - _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyStartCollectingMessage)(nil) + _ encoding.BinaryMarshaler = (*AuthCert)(nil) + _ encoding.BinaryUnmarshaler = (*AuthCert)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TimeSlicedSurveyStartCollectingMessage) xdrType() {} +func (s AuthCert) xdrType() {} -var _ xdrType = (*TimeSlicedSurveyStartCollectingMessage)(nil) +var _ xdrType = (*AuthCert)(nil) -// SignedTimeSlicedSurveyStartCollectingMessage is an XDR Struct defines as: +// Hello is an XDR Struct defines as: // -// struct SignedTimeSlicedSurveyStartCollectingMessage +// struct Hello // { -// Signature signature; -// TimeSlicedSurveyStartCollectingMessage startCollecting; +// uint32 ledgerVersion; +// uint32 overlayVersion; +// uint32 overlayMinVersion; +// Hash networkID; +// string versionStr<100>; +// int listeningPort; +// NodeID peerID; +// AuthCert cert; +// uint256 nonce; // }; -type SignedTimeSlicedSurveyStartCollectingMessage struct { - Signature Signature - StartCollecting TimeSlicedSurveyStartCollectingMessage +type Hello struct { + LedgerVersion Uint32 + OverlayVersion Uint32 + OverlayMinVersion Uint32 + NetworkId Hash + VersionStr string `xdrmaxsize:"100"` + ListeningPort int32 + PeerId NodeId + Cert AuthCert + Nonce Uint256 } // EncodeTo encodes this value using the Encoder. -func (s *SignedTimeSlicedSurveyStartCollectingMessage) EncodeTo(e *xdr.Encoder) error { +func (s *Hello) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Signature.EncodeTo(e); err != nil { + if err = s.LedgerVersion.EncodeTo(e); err != nil { return err } - if err = s.StartCollecting.EncodeTo(e); err != nil { + if err = s.OverlayVersion.EncodeTo(e); err != nil { + return err + } + if err = s.OverlayMinVersion.EncodeTo(e); err != nil { + return err + } + if err = s.NetworkId.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeString(string(s.VersionStr)); err != nil { + return err + } + if _, err = e.EncodeInt(int32(s.ListeningPort)); err != nil { + return err + } + if err = s.PeerId.EncodeTo(e); err != nil { + return err + } + if err = s.Cert.EncodeTo(e); err != nil { + return err + } + if err = s.Nonce.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) +var _ decoderFrom = (*Hello)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SignedTimeSlicedSurveyStartCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *Hello) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyStartCollectingMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding Hello: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Signature.DecodeFrom(d, maxDepth) + nTmp, err = s.LedgerVersion.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Signature: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.StartCollecting.DecodeFrom(d, maxDepth) + nTmp, err = s.OverlayVersion.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TimeSlicedSurveyStartCollectingMessage: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.OverlayMinVersion.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.NetworkId.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + s.VersionStr, nTmp, err = d.DecodeString(100) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding VersionStr: %w", err) + } + s.ListeningPort, nTmp, err = d.DecodeInt() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int: %w", err) + } + nTmp, err = s.PeerId.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding NodeId: %w", err) + } + nTmp, err = s.Cert.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding AuthCert: %w", err) + } + nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint256: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SignedTimeSlicedSurveyStartCollectingMessage) MarshalBinary() ([]byte, error) { +func (s Hello) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20344,7 +20575,7 @@ func (s SignedTimeSlicedSurveyStartCollectingMessage) MarshalBinary() ([]byte, e } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SignedTimeSlicedSurveyStartCollectingMessage) UnmarshalBinary(inp []byte) error { +func (s *Hello) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20354,74 +20585,59 @@ func (s *SignedTimeSlicedSurveyStartCollectingMessage) UnmarshalBinary(inp []byt } var ( - _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) + _ encoding.BinaryMarshaler = (*Hello)(nil) + _ encoding.BinaryUnmarshaler = (*Hello)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SignedTimeSlicedSurveyStartCollectingMessage) xdrType() {} +func (s Hello) xdrType() {} -var _ xdrType = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) +var _ xdrType = (*Hello)(nil) -// TimeSlicedSurveyStopCollectingMessage is an XDR Struct defines as: +// AuthMsgFlagFlowControlBytesRequested is an XDR Const defines as: // -// struct TimeSlicedSurveyStopCollectingMessage +// const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED = 200; +const AuthMsgFlagFlowControlBytesRequested = 200 + +// Auth is an XDR Struct defines as: +// +// struct Auth // { -// NodeID surveyorID; -// uint32 nonce; -// uint32 ledgerNum; +// int flags; // }; -type TimeSlicedSurveyStopCollectingMessage struct { - SurveyorId NodeId - Nonce Uint32 - LedgerNum Uint32 +type Auth struct { + Flags int32 } // EncodeTo encodes this value using the Encoder. -func (s *TimeSlicedSurveyStopCollectingMessage) EncodeTo(e *xdr.Encoder) error { +func (s *Auth) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.SurveyorId.EncodeTo(e); err != nil { - return err - } - if err = s.Nonce.EncodeTo(e); err != nil { - return err - } - if err = s.LedgerNum.EncodeTo(e); err != nil { + if _, err = e.EncodeInt(int32(s.Flags)); err != nil { return err } return nil } -var _ decoderFrom = (*TimeSlicedSurveyStopCollectingMessage)(nil) +var _ decoderFrom = (*Auth)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TimeSlicedSurveyStopCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *Auth) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TimeSlicedSurveyStopCollectingMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding Auth: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.SurveyorId.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding NodeId: %w", err) - } - nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.LedgerNum.DecodeFrom(d, maxDepth) + s.Flags, nTmp, err = d.DecodeInt() n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding Int: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TimeSlicedSurveyStopCollectingMessage) MarshalBinary() ([]byte, error) { +func (s Auth) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20429,7 +20645,7 @@ func (s TimeSlicedSurveyStopCollectingMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TimeSlicedSurveyStopCollectingMessage) UnmarshalBinary(inp []byte) error { +func (s *Auth) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20439,64 +20655,77 @@ func (s *TimeSlicedSurveyStopCollectingMessage) UnmarshalBinary(inp []byte) erro } var ( - _ encoding.BinaryMarshaler = (*TimeSlicedSurveyStopCollectingMessage)(nil) - _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyStopCollectingMessage)(nil) + _ encoding.BinaryMarshaler = (*Auth)(nil) + _ encoding.BinaryUnmarshaler = (*Auth)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TimeSlicedSurveyStopCollectingMessage) xdrType() {} +func (s Auth) xdrType() {} -var _ xdrType = (*TimeSlicedSurveyStopCollectingMessage)(nil) +var _ xdrType = (*Auth)(nil) -// SignedTimeSlicedSurveyStopCollectingMessage is an XDR Struct defines as: +// IpAddrType is an XDR Enum defines as: // -// struct SignedTimeSlicedSurveyStopCollectingMessage +// enum IPAddrType // { -// Signature signature; -// TimeSlicedSurveyStopCollectingMessage stopCollecting; +// IPv4 = 0, +// IPv6 = 1 // }; -type SignedTimeSlicedSurveyStopCollectingMessage struct { - Signature Signature - StopCollecting TimeSlicedSurveyStopCollectingMessage +type IpAddrType int32 + +const ( + IpAddrTypeIPv4 IpAddrType = 0 + IpAddrTypeIPv6 IpAddrType = 1 +) + +var ipAddrTypeMap = map[int32]string{ + 0: "IpAddrTypeIPv4", + 1: "IpAddrTypeIPv6", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for IpAddrType +func (e IpAddrType) ValidEnum(v int32) bool { + _, ok := ipAddrTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e IpAddrType) String() string { + name, _ := ipAddrTypeMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (s *SignedTimeSlicedSurveyStopCollectingMessage) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.Signature.EncodeTo(e); err != nil { - return err - } - if err = s.StopCollecting.EncodeTo(e); err != nil { - return err +func (e IpAddrType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := ipAddrTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid IpAddrType enum value", e) } - return nil + _, err := enc.EncodeInt(int32(e)) + return err } -var _ decoderFrom = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) +var _ decoderFrom = (*IpAddrType)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SignedTimeSlicedSurveyStopCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *IpAddrType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyStopCollectingMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding IpAddrType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.Signature.DecodeFrom(d, maxDepth) - n += nTmp + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding Signature: %w", err) + return n, fmt.Errorf("decoding IpAddrType: %w", err) } - nTmp, err = s.StopCollecting.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TimeSlicedSurveyStopCollectingMessage: %w", err) + if _, ok := ipAddrTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid IpAddrType enum value", v) } + *e = IpAddrType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SignedTimeSlicedSurveyStopCollectingMessage) MarshalBinary() ([]byte, error) { +func (s IpAddrType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20504,7 +20733,7 @@ func (s SignedTimeSlicedSurveyStopCollectingMessage) MarshalBinary() ([]byte, er } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SignedTimeSlicedSurveyStopCollectingMessage) UnmarshalBinary(inp []byte) error { +func (s *IpAddrType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20514,94 +20743,179 @@ func (s *SignedTimeSlicedSurveyStopCollectingMessage) UnmarshalBinary(inp []byte } var ( - _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) + _ encoding.BinaryMarshaler = (*IpAddrType)(nil) + _ encoding.BinaryUnmarshaler = (*IpAddrType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SignedTimeSlicedSurveyStopCollectingMessage) xdrType() {} +func (s IpAddrType) xdrType() {} -var _ xdrType = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) +var _ xdrType = (*IpAddrType)(nil) -// SurveyRequestMessage is an XDR Struct defines as: +// PeerAddressIp is an XDR NestedUnion defines as: // -// struct SurveyRequestMessage -// { -// NodeID surveyorPeerID; -// NodeID surveyedPeerID; -// uint32 ledgerNum; -// Curve25519Public encryptionKey; -// SurveyMessageCommandType commandType; -// }; -type SurveyRequestMessage struct { - SurveyorPeerId NodeId - SurveyedPeerId NodeId - LedgerNum Uint32 - EncryptionKey Curve25519Public - CommandType SurveyMessageCommandType +// union switch (IPAddrType type) +// { +// case IPv4: +// opaque ipv4[4]; +// case IPv6: +// opaque ipv6[16]; +// } +type PeerAddressIp struct { + Type IpAddrType + Ipv4 *[4]byte `xdrmaxsize:"4"` + Ipv6 *[16]byte `xdrmaxsize:"16"` } -// EncodeTo encodes this value using the Encoder. -func (s *SurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.SurveyorPeerId.EncodeTo(e); err != nil { - return err - } - if err = s.SurveyedPeerId.EncodeTo(e); err != nil { - return err - } - if err = s.LedgerNum.EncodeTo(e); err != nil { - return err - } - if err = s.EncryptionKey.EncodeTo(e); err != nil { - return err - } - if err = s.CommandType.EncodeTo(e); err != nil { - return err - } - return nil +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u PeerAddressIp) SwitchFieldName() string { + return "Type" } -var _ decoderFrom = (*SurveyRequestMessage)(nil) +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of PeerAddressIp +func (u PeerAddressIp) ArmForSwitch(sw int32) (string, bool) { + switch IpAddrType(sw) { + case IpAddrTypeIPv4: + return "Ipv4", true + case IpAddrTypeIPv6: + return "Ipv6", true + } + return "-", false +} + +// NewPeerAddressIp creates a new PeerAddressIp. +func NewPeerAddressIp(aType IpAddrType, value interface{}) (result PeerAddressIp, err error) { + result.Type = aType + switch IpAddrType(aType) { + case IpAddrTypeIPv4: + tv, ok := value.([4]byte) + if !ok { + err = errors.New("invalid value, must be [4]byte") + return + } + result.Ipv4 = &tv + case IpAddrTypeIPv6: + tv, ok := value.([16]byte) + if !ok { + err = errors.New("invalid value, must be [16]byte") + return + } + result.Ipv6 = &tv + } + return +} + +// MustIpv4 retrieves the Ipv4 value from the union, +// panicing if the value is not set. +func (u PeerAddressIp) MustIpv4() [4]byte { + val, ok := u.GetIpv4() + + if !ok { + panic("arm Ipv4 is not set") + } + + return val +} + +// GetIpv4 retrieves the Ipv4 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u PeerAddressIp) GetIpv4() (result [4]byte, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "Ipv4" { + result = *u.Ipv4 + ok = true + } + + return +} + +// MustIpv6 retrieves the Ipv6 value from the union, +// panicing if the value is not set. +func (u PeerAddressIp) MustIpv6() [16]byte { + val, ok := u.GetIpv6() + + if !ok { + panic("arm Ipv6 is not set") + } + + return val +} + +// GetIpv6 retrieves the Ipv6 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u PeerAddressIp) GetIpv6() (result [16]byte, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "Ipv6" { + result = *u.Ipv6 + ok = true + } + + return +} + +// EncodeTo encodes this value using the Encoder. +func (u PeerAddressIp) EncodeTo(e *xdr.Encoder) error { + var err error + if err = u.Type.EncodeTo(e); err != nil { + return err + } + switch IpAddrType(u.Type) { + case IpAddrTypeIPv4: + if _, err = e.EncodeFixedOpaque((*u.Ipv4)[:]); err != nil { + return err + } + return nil + case IpAddrTypeIPv6: + if _, err = e.EncodeFixedOpaque((*u.Ipv6)[:]); err != nil { + return err + } + return nil + } + return fmt.Errorf("Type (IpAddrType) switch value '%d' is not valid for union PeerAddressIp", u.Type) +} + +var _ decoderFrom = (*PeerAddressIp)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *PeerAddressIp) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SurveyRequestMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding PeerAddressIp: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.SurveyorPeerId.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding NodeId: %w", err) - } - nTmp, err = s.SurveyedPeerId.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding NodeId: %w", err) - } - nTmp, err = s.LedgerNum.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.EncryptionKey.DecodeFrom(d, maxDepth) + nTmp, err = u.Type.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Curve25519Public: %w", err) + return n, fmt.Errorf("decoding IpAddrType: %w", err) } - nTmp, err = s.CommandType.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding SurveyMessageCommandType: %w", err) + switch IpAddrType(u.Type) { + case IpAddrTypeIPv4: + u.Ipv4 = new([4]byte) + nTmp, err = d.DecodeFixedOpaqueInplace((*u.Ipv4)[:]) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Ipv4: %w", err) + } + return n, nil + case IpAddrTypeIPv6: + u.Ipv6 = new([16]byte) + nTmp, err = d.DecodeFixedOpaqueInplace((*u.Ipv6)[:]) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Ipv6: %w", err) + } + return n, nil } - return n, nil + return n, fmt.Errorf("union PeerAddressIp has invalid Type (IpAddrType) switch value '%d'", u.Type) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SurveyRequestMessage) MarshalBinary() ([]byte, error) { +func (s PeerAddressIp) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20609,7 +20923,7 @@ func (s SurveyRequestMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SurveyRequestMessage) UnmarshalBinary(inp []byte) error { +func (s *PeerAddressIp) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20619,75 +20933,72 @@ func (s *SurveyRequestMessage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SurveyRequestMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SurveyRequestMessage)(nil) + _ encoding.BinaryMarshaler = (*PeerAddressIp)(nil) + _ encoding.BinaryUnmarshaler = (*PeerAddressIp)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SurveyRequestMessage) xdrType() {} +func (s PeerAddressIp) xdrType() {} -var _ xdrType = (*SurveyRequestMessage)(nil) +var _ xdrType = (*PeerAddressIp)(nil) -// TimeSlicedSurveyRequestMessage is an XDR Struct defines as: +// PeerAddress is an XDR Struct defines as: // -// struct TimeSlicedSurveyRequestMessage +// struct PeerAddress // { -// SurveyRequestMessage request; -// uint32 nonce; -// uint32 inboundPeersIndex; -// uint32 outboundPeersIndex; +// union switch (IPAddrType type) +// { +// case IPv4: +// opaque ipv4[4]; +// case IPv6: +// opaque ipv6[16]; +// } +// ip; +// uint32 port; +// uint32 numFailures; // }; -type TimeSlicedSurveyRequestMessage struct { - Request SurveyRequestMessage - Nonce Uint32 - InboundPeersIndex Uint32 - OutboundPeersIndex Uint32 +type PeerAddress struct { + Ip PeerAddressIp + Port Uint32 + NumFailures Uint32 } // EncodeTo encodes this value using the Encoder. -func (s *TimeSlicedSurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { +func (s *PeerAddress) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Request.EncodeTo(e); err != nil { - return err - } - if err = s.Nonce.EncodeTo(e); err != nil { + if err = s.Ip.EncodeTo(e); err != nil { return err } - if err = s.InboundPeersIndex.EncodeTo(e); err != nil { + if err = s.Port.EncodeTo(e); err != nil { return err } - if err = s.OutboundPeersIndex.EncodeTo(e); err != nil { + if err = s.NumFailures.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*TimeSlicedSurveyRequestMessage)(nil) +var _ decoderFrom = (*PeerAddress)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TimeSlicedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *PeerAddress) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TimeSlicedSurveyRequestMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding PeerAddress: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Request.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding SurveyRequestMessage: %w", err) - } - nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) + nTmp, err = s.Ip.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding PeerAddressIp: %w", err) } - nTmp, err = s.InboundPeersIndex.DecodeFrom(d, maxDepth) + nTmp, err = s.Port.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.OutboundPeersIndex.DecodeFrom(d, maxDepth) + nTmp, err = s.NumFailures.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) @@ -20696,7 +21007,7 @@ func (s *TimeSlicedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uin } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TimeSlicedSurveyRequestMessage) MarshalBinary() ([]byte, error) { +func (s PeerAddress) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20704,7 +21015,7 @@ func (s TimeSlicedSurveyRequestMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TimeSlicedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { +func (s *PeerAddress) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20714,64 +21025,154 @@ func (s *TimeSlicedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TimeSlicedSurveyRequestMessage)(nil) - _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyRequestMessage)(nil) + _ encoding.BinaryMarshaler = (*PeerAddress)(nil) + _ encoding.BinaryUnmarshaler = (*PeerAddress)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TimeSlicedSurveyRequestMessage) xdrType() {} +func (s PeerAddress) xdrType() {} -var _ xdrType = (*TimeSlicedSurveyRequestMessage)(nil) +var _ xdrType = (*PeerAddress)(nil) -// SignedSurveyRequestMessage is an XDR Struct defines as: +// MessageType is an XDR Enum defines as: // -// struct SignedSurveyRequestMessage +// enum MessageType // { -// Signature requestSignature; -// SurveyRequestMessage request; +// ERROR_MSG = 0, +// AUTH = 2, +// DONT_HAVE = 3, +// +// GET_PEERS = 4, // gets a list of peers this guy knows about +// PEERS = 5, +// +// GET_TX_SET = 6, // gets a particular txset by hash +// TX_SET = 7, +// GENERALIZED_TX_SET = 17, +// +// TRANSACTION = 8, // pass on a tx you have heard about +// +// // SCP +// GET_SCP_QUORUMSET = 9, +// SCP_QUORUMSET = 10, +// SCP_MESSAGE = 11, +// GET_SCP_STATE = 12, +// +// // new messages +// HELLO = 13, +// +// SURVEY_REQUEST = 14, +// SURVEY_RESPONSE = 15, +// +// SEND_MORE = 16, +// SEND_MORE_EXTENDED = 20, +// +// FLOOD_ADVERT = 18, +// FLOOD_DEMAND = 19, +// +// TIME_SLICED_SURVEY_REQUEST = 21, +// TIME_SLICED_SURVEY_RESPONSE = 22, +// TIME_SLICED_SURVEY_START_COLLECTING = 23, +// TIME_SLICED_SURVEY_STOP_COLLECTING = 24 // }; -type SignedSurveyRequestMessage struct { - RequestSignature Signature - Request SurveyRequestMessage +type MessageType int32 + +const ( + MessageTypeErrorMsg MessageType = 0 + MessageTypeAuth MessageType = 2 + MessageTypeDontHave MessageType = 3 + MessageTypeGetPeers MessageType = 4 + MessageTypePeers MessageType = 5 + MessageTypeGetTxSet MessageType = 6 + MessageTypeTxSet MessageType = 7 + MessageTypeGeneralizedTxSet MessageType = 17 + MessageTypeTransaction MessageType = 8 + MessageTypeGetScpQuorumset MessageType = 9 + MessageTypeScpQuorumset MessageType = 10 + MessageTypeScpMessage MessageType = 11 + MessageTypeGetScpState MessageType = 12 + MessageTypeHello MessageType = 13 + MessageTypeSurveyRequest MessageType = 14 + MessageTypeSurveyResponse MessageType = 15 + MessageTypeSendMore MessageType = 16 + MessageTypeSendMoreExtended MessageType = 20 + MessageTypeFloodAdvert MessageType = 18 + MessageTypeFloodDemand MessageType = 19 + MessageTypeTimeSlicedSurveyRequest MessageType = 21 + MessageTypeTimeSlicedSurveyResponse MessageType = 22 + MessageTypeTimeSlicedSurveyStartCollecting MessageType = 23 + MessageTypeTimeSlicedSurveyStopCollecting MessageType = 24 +) + +var messageTypeMap = map[int32]string{ + 0: "MessageTypeErrorMsg", + 2: "MessageTypeAuth", + 3: "MessageTypeDontHave", + 4: "MessageTypeGetPeers", + 5: "MessageTypePeers", + 6: "MessageTypeGetTxSet", + 7: "MessageTypeTxSet", + 17: "MessageTypeGeneralizedTxSet", + 8: "MessageTypeTransaction", + 9: "MessageTypeGetScpQuorumset", + 10: "MessageTypeScpQuorumset", + 11: "MessageTypeScpMessage", + 12: "MessageTypeGetScpState", + 13: "MessageTypeHello", + 14: "MessageTypeSurveyRequest", + 15: "MessageTypeSurveyResponse", + 16: "MessageTypeSendMore", + 20: "MessageTypeSendMoreExtended", + 18: "MessageTypeFloodAdvert", + 19: "MessageTypeFloodDemand", + 21: "MessageTypeTimeSlicedSurveyRequest", + 22: "MessageTypeTimeSlicedSurveyResponse", + 23: "MessageTypeTimeSlicedSurveyStartCollecting", + 24: "MessageTypeTimeSlicedSurveyStopCollecting", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for MessageType +func (e MessageType) ValidEnum(v int32) bool { + _, ok := messageTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e MessageType) String() string { + name, _ := messageTypeMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (s *SignedSurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.RequestSignature.EncodeTo(e); err != nil { - return err - } - if err = s.Request.EncodeTo(e); err != nil { - return err +func (e MessageType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := messageTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid MessageType enum value", e) } - return nil + _, err := enc.EncodeInt(int32(e)) + return err } -var _ decoderFrom = (*SignedSurveyRequestMessage)(nil) +var _ decoderFrom = (*MessageType)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SignedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *MessageType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SignedSurveyRequestMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding MessageType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.RequestSignature.DecodeFrom(d, maxDepth) - n += nTmp + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding Signature: %w", err) + return n, fmt.Errorf("decoding MessageType: %w", err) } - nTmp, err = s.Request.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding SurveyRequestMessage: %w", err) + if _, ok := messageTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid MessageType enum value", v) } + *e = MessageType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SignedSurveyRequestMessage) MarshalBinary() ([]byte, error) { +func (s MessageType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20779,7 +21180,7 @@ func (s SignedSurveyRequestMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SignedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { +func (s *MessageType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20789,64 +21190,64 @@ func (s *SignedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SignedSurveyRequestMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SignedSurveyRequestMessage)(nil) + _ encoding.BinaryMarshaler = (*MessageType)(nil) + _ encoding.BinaryUnmarshaler = (*MessageType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SignedSurveyRequestMessage) xdrType() {} +func (s MessageType) xdrType() {} -var _ xdrType = (*SignedSurveyRequestMessage)(nil) +var _ xdrType = (*MessageType)(nil) -// SignedTimeSlicedSurveyRequestMessage is an XDR Struct defines as: +// DontHave is an XDR Struct defines as: // -// struct SignedTimeSlicedSurveyRequestMessage +// struct DontHave // { -// Signature requestSignature; -// TimeSlicedSurveyRequestMessage request; +// MessageType type; +// uint256 reqHash; // }; -type SignedTimeSlicedSurveyRequestMessage struct { - RequestSignature Signature - Request TimeSlicedSurveyRequestMessage +type DontHave struct { + Type MessageType + ReqHash Uint256 } // EncodeTo encodes this value using the Encoder. -func (s *SignedTimeSlicedSurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { +func (s *DontHave) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.RequestSignature.EncodeTo(e); err != nil { + if err = s.Type.EncodeTo(e); err != nil { return err } - if err = s.Request.EncodeTo(e); err != nil { + if err = s.ReqHash.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*SignedTimeSlicedSurveyRequestMessage)(nil) +var _ decoderFrom = (*DontHave)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SignedTimeSlicedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *DontHave) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyRequestMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding DontHave: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.RequestSignature.DecodeFrom(d, maxDepth) + nTmp, err = s.Type.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Signature: %w", err) + return n, fmt.Errorf("decoding MessageType: %w", err) } - nTmp, err = s.Request.DecodeFrom(d, maxDepth) + nTmp, err = s.ReqHash.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TimeSlicedSurveyRequestMessage: %w", err) + return n, fmt.Errorf("decoding Uint256: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SignedTimeSlicedSurveyRequestMessage) MarshalBinary() ([]byte, error) { +func (s DontHave) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20854,7 +21255,7 @@ func (s SignedTimeSlicedSurveyRequestMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SignedTimeSlicedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { +func (s *DontHave) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20864,54 +21265,77 @@ func (s *SignedTimeSlicedSurveyRequestMessage) UnmarshalBinary(inp []byte) error } var ( - _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyRequestMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyRequestMessage)(nil) + _ encoding.BinaryMarshaler = (*DontHave)(nil) + _ encoding.BinaryUnmarshaler = (*DontHave)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SignedTimeSlicedSurveyRequestMessage) xdrType() {} +func (s DontHave) xdrType() {} -var _ xdrType = (*SignedTimeSlicedSurveyRequestMessage)(nil) +var _ xdrType = (*DontHave)(nil) -// EncryptedBody is an XDR Typedef defines as: +// SurveyMessageCommandType is an XDR Enum defines as: // -// typedef opaque EncryptedBody<64000>; -type EncryptedBody []byte +// enum SurveyMessageCommandType +// { +// SURVEY_TOPOLOGY = 0, +// TIME_SLICED_SURVEY_TOPOLOGY = 1 +// }; +type SurveyMessageCommandType int32 -// XDRMaxSize implements the Sized interface for EncryptedBody -func (e EncryptedBody) XDRMaxSize() int { - return 64000 +const ( + SurveyMessageCommandTypeSurveyTopology SurveyMessageCommandType = 0 + SurveyMessageCommandTypeTimeSlicedSurveyTopology SurveyMessageCommandType = 1 +) + +var surveyMessageCommandTypeMap = map[int32]string{ + 0: "SurveyMessageCommandTypeSurveyTopology", + 1: "SurveyMessageCommandTypeTimeSlicedSurveyTopology", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for SurveyMessageCommandType +func (e SurveyMessageCommandType) ValidEnum(v int32) bool { + _, ok := surveyMessageCommandTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e SurveyMessageCommandType) String() string { + name, _ := surveyMessageCommandTypeMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (s EncryptedBody) EncodeTo(e *xdr.Encoder) error { - var err error - if _, err = e.EncodeOpaque(s[:]); err != nil { - return err +func (e SurveyMessageCommandType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := surveyMessageCommandTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid SurveyMessageCommandType enum value", e) } - return nil + _, err := enc.EncodeInt(int32(e)) + return err } -var _ decoderFrom = (*EncryptedBody)(nil) +var _ decoderFrom = (*SurveyMessageCommandType)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *EncryptedBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *SurveyMessageCommandType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding EncryptedBody: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SurveyMessageCommandType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - var err error - var n, nTmp int - (*s), nTmp, err = d.DecodeOpaque(64000) - n += nTmp + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding EncryptedBody: %w", err) + return n, fmt.Errorf("decoding SurveyMessageCommandType: %w", err) + } + if _, ok := surveyMessageCommandTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid SurveyMessageCommandType enum value", v) } + *e = SurveyMessageCommandType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s EncryptedBody) MarshalBinary() ([]byte, error) { +func (s SurveyMessageCommandType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20919,7 +21343,7 @@ func (s EncryptedBody) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *EncryptedBody) UnmarshalBinary(inp []byte) error { +func (s *SurveyMessageCommandType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20929,94 +21353,165 @@ func (s *EncryptedBody) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*EncryptedBody)(nil) - _ encoding.BinaryUnmarshaler = (*EncryptedBody)(nil) + _ encoding.BinaryMarshaler = (*SurveyMessageCommandType)(nil) + _ encoding.BinaryUnmarshaler = (*SurveyMessageCommandType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s EncryptedBody) xdrType() {} +func (s SurveyMessageCommandType) xdrType() {} -var _ xdrType = (*EncryptedBody)(nil) +var _ xdrType = (*SurveyMessageCommandType)(nil) -// SurveyResponseMessage is an XDR Struct defines as: +// SurveyMessageResponseType is an XDR Enum defines as: // -// struct SurveyResponseMessage +// enum SurveyMessageResponseType // { -// NodeID surveyorPeerID; -// NodeID surveyedPeerID; +// SURVEY_TOPOLOGY_RESPONSE_V0 = 0, +// SURVEY_TOPOLOGY_RESPONSE_V1 = 1, +// SURVEY_TOPOLOGY_RESPONSE_V2 = 2 +// }; +type SurveyMessageResponseType int32 + +const ( + SurveyMessageResponseTypeSurveyTopologyResponseV0 SurveyMessageResponseType = 0 + SurveyMessageResponseTypeSurveyTopologyResponseV1 SurveyMessageResponseType = 1 + SurveyMessageResponseTypeSurveyTopologyResponseV2 SurveyMessageResponseType = 2 +) + +var surveyMessageResponseTypeMap = map[int32]string{ + 0: "SurveyMessageResponseTypeSurveyTopologyResponseV0", + 1: "SurveyMessageResponseTypeSurveyTopologyResponseV1", + 2: "SurveyMessageResponseTypeSurveyTopologyResponseV2", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for SurveyMessageResponseType +func (e SurveyMessageResponseType) ValidEnum(v int32) bool { + _, ok := surveyMessageResponseTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e SurveyMessageResponseType) String() string { + name, _ := surveyMessageResponseTypeMap[int32(e)] + return name +} + +// EncodeTo encodes this value using the Encoder. +func (e SurveyMessageResponseType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := surveyMessageResponseTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid SurveyMessageResponseType enum value", e) + } + _, err := enc.EncodeInt(int32(e)) + return err +} + +var _ decoderFrom = (*SurveyMessageResponseType)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (e *SurveyMessageResponseType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SurveyMessageResponseType: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + v, n, err := d.DecodeInt() + if err != nil { + return n, fmt.Errorf("decoding SurveyMessageResponseType: %w", err) + } + if _, ok := surveyMessageResponseTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid SurveyMessageResponseType enum value", v) + } + *e = SurveyMessageResponseType(v) + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SurveyMessageResponseType) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SurveyMessageResponseType) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*SurveyMessageResponseType)(nil) + _ encoding.BinaryUnmarshaler = (*SurveyMessageResponseType)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SurveyMessageResponseType) xdrType() {} + +var _ xdrType = (*SurveyMessageResponseType)(nil) + +// TimeSlicedSurveyStartCollectingMessage is an XDR Struct defines as: +// +// struct TimeSlicedSurveyStartCollectingMessage +// { +// NodeID surveyorID; +// uint32 nonce; // uint32 ledgerNum; -// SurveyMessageCommandType commandType; -// EncryptedBody encryptedBody; // }; -type SurveyResponseMessage struct { - SurveyorPeerId NodeId - SurveyedPeerId NodeId - LedgerNum Uint32 - CommandType SurveyMessageCommandType - EncryptedBody EncryptedBody +type TimeSlicedSurveyStartCollectingMessage struct { + SurveyorId NodeId + Nonce Uint32 + LedgerNum Uint32 } // EncodeTo encodes this value using the Encoder. -func (s *SurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { +func (s *TimeSlicedSurveyStartCollectingMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.SurveyorPeerId.EncodeTo(e); err != nil { + if err = s.SurveyorId.EncodeTo(e); err != nil { return err } - if err = s.SurveyedPeerId.EncodeTo(e); err != nil { + if err = s.Nonce.EncodeTo(e); err != nil { return err } if err = s.LedgerNum.EncodeTo(e); err != nil { return err } - if err = s.CommandType.EncodeTo(e); err != nil { - return err - } - if err = s.EncryptedBody.EncodeTo(e); err != nil { - return err - } return nil } -var _ decoderFrom = (*SurveyResponseMessage)(nil) +var _ decoderFrom = (*TimeSlicedSurveyStartCollectingMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TimeSlicedSurveyStartCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SurveyResponseMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TimeSlicedSurveyStartCollectingMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.SurveyorPeerId.DecodeFrom(d, maxDepth) + nTmp, err = s.SurveyorId.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding NodeId: %w", err) } - nTmp, err = s.SurveyedPeerId.DecodeFrom(d, maxDepth) + nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding NodeId: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } nTmp, err = s.LedgerNum.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.CommandType.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding SurveyMessageCommandType: %w", err) - } - nTmp, err = s.EncryptedBody.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding EncryptedBody: %w", err) - } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SurveyResponseMessage) MarshalBinary() ([]byte, error) { +func (s TimeSlicedSurveyStartCollectingMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -21024,7 +21519,7 @@ func (s SurveyResponseMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SurveyResponseMessage) UnmarshalBinary(inp []byte) error { +func (s *TimeSlicedSurveyStartCollectingMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -21034,64 +21529,64 @@ func (s *SurveyResponseMessage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SurveyResponseMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SurveyResponseMessage)(nil) + _ encoding.BinaryMarshaler = (*TimeSlicedSurveyStartCollectingMessage)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyStartCollectingMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SurveyResponseMessage) xdrType() {} +func (s TimeSlicedSurveyStartCollectingMessage) xdrType() {} -var _ xdrType = (*SurveyResponseMessage)(nil) +var _ xdrType = (*TimeSlicedSurveyStartCollectingMessage)(nil) -// TimeSlicedSurveyResponseMessage is an XDR Struct defines as: +// SignedTimeSlicedSurveyStartCollectingMessage is an XDR Struct defines as: // -// struct TimeSlicedSurveyResponseMessage +// struct SignedTimeSlicedSurveyStartCollectingMessage // { -// SurveyResponseMessage response; -// uint32 nonce; +// Signature signature; +// TimeSlicedSurveyStartCollectingMessage startCollecting; // }; -type TimeSlicedSurveyResponseMessage struct { - Response SurveyResponseMessage - Nonce Uint32 +type SignedTimeSlicedSurveyStartCollectingMessage struct { + Signature Signature + StartCollecting TimeSlicedSurveyStartCollectingMessage } // EncodeTo encodes this value using the Encoder. -func (s *TimeSlicedSurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { +func (s *SignedTimeSlicedSurveyStartCollectingMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Response.EncodeTo(e); err != nil { + if err = s.Signature.EncodeTo(e); err != nil { return err } - if err = s.Nonce.EncodeTo(e); err != nil { + if err = s.StartCollecting.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*TimeSlicedSurveyResponseMessage)(nil) +var _ decoderFrom = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TimeSlicedSurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SignedTimeSlicedSurveyStartCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TimeSlicedSurveyResponseMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyStartCollectingMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Response.DecodeFrom(d, maxDepth) + nTmp, err = s.Signature.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding SurveyResponseMessage: %w", err) + return n, fmt.Errorf("decoding Signature: %w", err) } - nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) + nTmp, err = s.StartCollecting.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding TimeSlicedSurveyStartCollectingMessage: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TimeSlicedSurveyResponseMessage) MarshalBinary() ([]byte, error) { +func (s SignedTimeSlicedSurveyStartCollectingMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -21099,7 +21594,7 @@ func (s TimeSlicedSurveyResponseMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TimeSlicedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { +func (s *SignedTimeSlicedSurveyStartCollectingMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -21109,64 +21604,74 @@ func (s *TimeSlicedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TimeSlicedSurveyResponseMessage)(nil) - _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyResponseMessage)(nil) + _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TimeSlicedSurveyResponseMessage) xdrType() {} +func (s SignedTimeSlicedSurveyStartCollectingMessage) xdrType() {} -var _ xdrType = (*TimeSlicedSurveyResponseMessage)(nil) +var _ xdrType = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) -// SignedSurveyResponseMessage is an XDR Struct defines as: +// TimeSlicedSurveyStopCollectingMessage is an XDR Struct defines as: // -// struct SignedSurveyResponseMessage +// struct TimeSlicedSurveyStopCollectingMessage // { -// Signature responseSignature; -// SurveyResponseMessage response; +// NodeID surveyorID; +// uint32 nonce; +// uint32 ledgerNum; // }; -type SignedSurveyResponseMessage struct { - ResponseSignature Signature - Response SurveyResponseMessage +type TimeSlicedSurveyStopCollectingMessage struct { + SurveyorId NodeId + Nonce Uint32 + LedgerNum Uint32 } // EncodeTo encodes this value using the Encoder. -func (s *SignedSurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { +func (s *TimeSlicedSurveyStopCollectingMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.ResponseSignature.EncodeTo(e); err != nil { + if err = s.SurveyorId.EncodeTo(e); err != nil { return err } - if err = s.Response.EncodeTo(e); err != nil { + if err = s.Nonce.EncodeTo(e); err != nil { + return err + } + if err = s.LedgerNum.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*SignedSurveyResponseMessage)(nil) +var _ decoderFrom = (*TimeSlicedSurveyStopCollectingMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SignedSurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TimeSlicedSurveyStopCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SignedSurveyResponseMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TimeSlicedSurveyStopCollectingMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.ResponseSignature.DecodeFrom(d, maxDepth) + nTmp, err = s.SurveyorId.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Signature: %w", err) + return n, fmt.Errorf("decoding NodeId: %w", err) } - nTmp, err = s.Response.DecodeFrom(d, maxDepth) + nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding SurveyResponseMessage: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.LedgerNum.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SignedSurveyResponseMessage) MarshalBinary() ([]byte, error) { +func (s TimeSlicedSurveyStopCollectingMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -21174,7 +21679,7 @@ func (s SignedSurveyResponseMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SignedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { +func (s *TimeSlicedSurveyStopCollectingMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -21184,64 +21689,64 @@ func (s *SignedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SignedSurveyResponseMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SignedSurveyResponseMessage)(nil) + _ encoding.BinaryMarshaler = (*TimeSlicedSurveyStopCollectingMessage)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyStopCollectingMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SignedSurveyResponseMessage) xdrType() {} +func (s TimeSlicedSurveyStopCollectingMessage) xdrType() {} -var _ xdrType = (*SignedSurveyResponseMessage)(nil) +var _ xdrType = (*TimeSlicedSurveyStopCollectingMessage)(nil) -// SignedTimeSlicedSurveyResponseMessage is an XDR Struct defines as: +// SignedTimeSlicedSurveyStopCollectingMessage is an XDR Struct defines as: // -// struct SignedTimeSlicedSurveyResponseMessage +// struct SignedTimeSlicedSurveyStopCollectingMessage // { -// Signature responseSignature; -// TimeSlicedSurveyResponseMessage response; +// Signature signature; +// TimeSlicedSurveyStopCollectingMessage stopCollecting; // }; -type SignedTimeSlicedSurveyResponseMessage struct { - ResponseSignature Signature - Response TimeSlicedSurveyResponseMessage +type SignedTimeSlicedSurveyStopCollectingMessage struct { + Signature Signature + StopCollecting TimeSlicedSurveyStopCollectingMessage } // EncodeTo encodes this value using the Encoder. -func (s *SignedTimeSlicedSurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { +func (s *SignedTimeSlicedSurveyStopCollectingMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.ResponseSignature.EncodeTo(e); err != nil { + if err = s.Signature.EncodeTo(e); err != nil { return err } - if err = s.Response.EncodeTo(e); err != nil { + if err = s.StopCollecting.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*SignedTimeSlicedSurveyResponseMessage)(nil) +var _ decoderFrom = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SignedTimeSlicedSurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SignedTimeSlicedSurveyStopCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyResponseMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyStopCollectingMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.ResponseSignature.DecodeFrom(d, maxDepth) + nTmp, err = s.Signature.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Signature: %w", err) } - nTmp, err = s.Response.DecodeFrom(d, maxDepth) + nTmp, err = s.StopCollecting.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TimeSlicedSurveyResponseMessage: %w", err) + return n, fmt.Errorf("decoding TimeSlicedSurveyStopCollectingMessage: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SignedTimeSlicedSurveyResponseMessage) MarshalBinary() ([]byte, error) { +func (s SignedTimeSlicedSurveyStopCollectingMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -21249,7 +21754,7 @@ func (s SignedTimeSlicedSurveyResponseMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SignedTimeSlicedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { +func (s *SignedTimeSlicedSurveyStopCollectingMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -21259,196 +21764,94 @@ func (s *SignedTimeSlicedSurveyResponseMessage) UnmarshalBinary(inp []byte) erro } var ( - _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyResponseMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyResponseMessage)(nil) + _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SignedTimeSlicedSurveyResponseMessage) xdrType() {} +func (s SignedTimeSlicedSurveyStopCollectingMessage) xdrType() {} -var _ xdrType = (*SignedTimeSlicedSurveyResponseMessage)(nil) +var _ xdrType = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) -// PeerStats is an XDR Struct defines as: +// SurveyRequestMessage is an XDR Struct defines as: // -// struct PeerStats +// struct SurveyRequestMessage // { -// NodeID id; -// string versionStr<100>; -// uint64 messagesRead; -// uint64 messagesWritten; -// uint64 bytesRead; -// uint64 bytesWritten; -// uint64 secondsConnected; -// -// uint64 uniqueFloodBytesRecv; -// uint64 duplicateFloodBytesRecv; -// uint64 uniqueFetchBytesRecv; -// uint64 duplicateFetchBytesRecv; -// -// uint64 uniqueFloodMessageRecv; -// uint64 duplicateFloodMessageRecv; -// uint64 uniqueFetchMessageRecv; -// uint64 duplicateFetchMessageRecv; +// NodeID surveyorPeerID; +// NodeID surveyedPeerID; +// uint32 ledgerNum; +// Curve25519Public encryptionKey; +// SurveyMessageCommandType commandType; // }; -type PeerStats struct { - Id NodeId - VersionStr string `xdrmaxsize:"100"` - MessagesRead Uint64 - MessagesWritten Uint64 - BytesRead Uint64 - BytesWritten Uint64 - SecondsConnected Uint64 - UniqueFloodBytesRecv Uint64 - DuplicateFloodBytesRecv Uint64 - UniqueFetchBytesRecv Uint64 - DuplicateFetchBytesRecv Uint64 - UniqueFloodMessageRecv Uint64 - DuplicateFloodMessageRecv Uint64 - UniqueFetchMessageRecv Uint64 - DuplicateFetchMessageRecv Uint64 +type SurveyRequestMessage struct { + SurveyorPeerId NodeId + SurveyedPeerId NodeId + LedgerNum Uint32 + EncryptionKey Curve25519Public + CommandType SurveyMessageCommandType } // EncodeTo encodes this value using the Encoder. -func (s *PeerStats) EncodeTo(e *xdr.Encoder) error { +func (s *SurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Id.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeString(string(s.VersionStr)); err != nil { - return err - } - if err = s.MessagesRead.EncodeTo(e); err != nil { - return err - } - if err = s.MessagesWritten.EncodeTo(e); err != nil { - return err - } - if err = s.BytesRead.EncodeTo(e); err != nil { - return err - } - if err = s.BytesWritten.EncodeTo(e); err != nil { - return err - } - if err = s.SecondsConnected.EncodeTo(e); err != nil { - return err - } - if err = s.UniqueFloodBytesRecv.EncodeTo(e); err != nil { - return err - } - if err = s.DuplicateFloodBytesRecv.EncodeTo(e); err != nil { - return err - } - if err = s.UniqueFetchBytesRecv.EncodeTo(e); err != nil { - return err - } - if err = s.DuplicateFetchBytesRecv.EncodeTo(e); err != nil { + if err = s.SurveyorPeerId.EncodeTo(e); err != nil { return err } - if err = s.UniqueFloodMessageRecv.EncodeTo(e); err != nil { + if err = s.SurveyedPeerId.EncodeTo(e); err != nil { return err } - if err = s.DuplicateFloodMessageRecv.EncodeTo(e); err != nil { + if err = s.LedgerNum.EncodeTo(e); err != nil { return err } - if err = s.UniqueFetchMessageRecv.EncodeTo(e); err != nil { + if err = s.EncryptionKey.EncodeTo(e); err != nil { return err } - if err = s.DuplicateFetchMessageRecv.EncodeTo(e); err != nil { + if err = s.CommandType.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*PeerStats)(nil) +var _ decoderFrom = (*SurveyRequestMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *PeerStats) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding PeerStats: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SurveyRequestMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Id.DecodeFrom(d, maxDepth) + nTmp, err = s.SurveyorPeerId.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding NodeId: %w", err) } - s.VersionStr, nTmp, err = d.DecodeString(100) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding VersionStr: %w", err) - } - nTmp, err = s.MessagesRead.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - nTmp, err = s.MessagesWritten.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - nTmp, err = s.BytesRead.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - nTmp, err = s.BytesWritten.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - nTmp, err = s.SecondsConnected.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - nTmp, err = s.UniqueFloodBytesRecv.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - nTmp, err = s.DuplicateFloodBytesRecv.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - nTmp, err = s.UniqueFetchBytesRecv.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - nTmp, err = s.DuplicateFetchBytesRecv.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - nTmp, err = s.UniqueFloodMessageRecv.DecodeFrom(d, maxDepth) + nTmp, err = s.SurveyedPeerId.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding NodeId: %w", err) } - nTmp, err = s.DuplicateFloodMessageRecv.DecodeFrom(d, maxDepth) + nTmp, err = s.LedgerNum.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.UniqueFetchMessageRecv.DecodeFrom(d, maxDepth) + nTmp, err = s.EncryptionKey.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Curve25519Public: %w", err) } - nTmp, err = s.DuplicateFetchMessageRecv.DecodeFrom(d, maxDepth) + nTmp, err = s.CommandType.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding SurveyMessageCommandType: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s PeerStats) MarshalBinary() ([]byte, error) { +func (s SurveyRequestMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -21456,7 +21859,7 @@ func (s PeerStats) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *PeerStats) UnmarshalBinary(inp []byte) error { +func (s *SurveyRequestMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -21466,77 +21869,84 @@ func (s *PeerStats) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*PeerStats)(nil) - _ encoding.BinaryUnmarshaler = (*PeerStats)(nil) + _ encoding.BinaryMarshaler = (*SurveyRequestMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SurveyRequestMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s PeerStats) xdrType() {} +func (s SurveyRequestMessage) xdrType() {} -var _ xdrType = (*PeerStats)(nil) +var _ xdrType = (*SurveyRequestMessage)(nil) -// PeerStatList is an XDR Typedef defines as: +// TimeSlicedSurveyRequestMessage is an XDR Struct defines as: // -// typedef PeerStats PeerStatList<25>; -type PeerStatList []PeerStats - -// XDRMaxSize implements the Sized interface for PeerStatList -func (e PeerStatList) XDRMaxSize() int { - return 25 +// struct TimeSlicedSurveyRequestMessage +// { +// SurveyRequestMessage request; +// uint32 nonce; +// uint32 inboundPeersIndex; +// uint32 outboundPeersIndex; +// }; +type TimeSlicedSurveyRequestMessage struct { + Request SurveyRequestMessage + Nonce Uint32 + InboundPeersIndex Uint32 + OutboundPeersIndex Uint32 } // EncodeTo encodes this value using the Encoder. -func (s PeerStatList) EncodeTo(e *xdr.Encoder) error { +func (s *TimeSlicedSurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeUint(uint32(len(s))); err != nil { + if err = s.Request.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s); i++ { - if err = s[i].EncodeTo(e); err != nil { - return err - } + if err = s.Nonce.EncodeTo(e); err != nil { + return err + } + if err = s.InboundPeersIndex.EncodeTo(e); err != nil { + return err + } + if err = s.OutboundPeersIndex.EncodeTo(e); err != nil { + return err } return nil } -var _ decoderFrom = (*PeerStatList)(nil) +var _ decoderFrom = (*TimeSlicedSurveyRequestMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *PeerStatList) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TimeSlicedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding PeerStatList: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TimeSlicedSurveyRequestMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - var l uint32 - l, nTmp, err = d.DecodeUint() + nTmp, err = s.Request.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding PeerStats: %w", err) + return n, fmt.Errorf("decoding SurveyRequestMessage: %w", err) } - if l > 25 { - return n, fmt.Errorf("decoding PeerStats: data size (%d) exceeds size limit (25)", l) + nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) } - (*s) = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding PeerStats: length (%d) exceeds remaining input length (%d)", l, il) - } - (*s) = make([]PeerStats, l) - for i := uint32(0); i < l; i++ { - nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding PeerStats: %w", err) - } - } + nTmp, err = s.InboundPeersIndex.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.OutboundPeersIndex.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s PeerStatList) MarshalBinary() ([]byte, error) { +func (s TimeSlicedSurveyRequestMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -21544,7 +21954,7 @@ func (s PeerStatList) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *PeerStatList) UnmarshalBinary(inp []byte) error { +func (s *TimeSlicedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -21554,150 +21964,64 @@ func (s *PeerStatList) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*PeerStatList)(nil) - _ encoding.BinaryUnmarshaler = (*PeerStatList)(nil) + _ encoding.BinaryMarshaler = (*TimeSlicedSurveyRequestMessage)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyRequestMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s PeerStatList) xdrType() {} +func (s TimeSlicedSurveyRequestMessage) xdrType() {} -var _ xdrType = (*PeerStatList)(nil) +var _ xdrType = (*TimeSlicedSurveyRequestMessage)(nil) -// TimeSlicedNodeData is an XDR Struct defines as: +// SignedSurveyRequestMessage is an XDR Struct defines as: // -// struct TimeSlicedNodeData +// struct SignedSurveyRequestMessage // { -// uint32 addedAuthenticatedPeers; -// uint32 droppedAuthenticatedPeers; -// uint32 totalInboundPeerCount; -// uint32 totalOutboundPeerCount; -// -// // SCP stats -// uint32 p75SCPFirstToSelfLatencyMs; -// uint32 p75SCPSelfToOtherLatencyMs; -// -// // How many times the node lost sync in the time slice -// uint32 lostSyncCount; -// -// // Config data -// bool isValidator; -// uint32 maxInboundPeerCount; -// uint32 maxOutboundPeerCount; +// Signature requestSignature; +// SurveyRequestMessage request; // }; -type TimeSlicedNodeData struct { - AddedAuthenticatedPeers Uint32 - DroppedAuthenticatedPeers Uint32 - TotalInboundPeerCount Uint32 - TotalOutboundPeerCount Uint32 - P75ScpFirstToSelfLatencyMs Uint32 - P75ScpSelfToOtherLatencyMs Uint32 - LostSyncCount Uint32 - IsValidator bool - MaxInboundPeerCount Uint32 - MaxOutboundPeerCount Uint32 +type SignedSurveyRequestMessage struct { + RequestSignature Signature + Request SurveyRequestMessage } // EncodeTo encodes this value using the Encoder. -func (s *TimeSlicedNodeData) EncodeTo(e *xdr.Encoder) error { +func (s *SignedSurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.AddedAuthenticatedPeers.EncodeTo(e); err != nil { - return err - } - if err = s.DroppedAuthenticatedPeers.EncodeTo(e); err != nil { - return err - } - if err = s.TotalInboundPeerCount.EncodeTo(e); err != nil { - return err - } - if err = s.TotalOutboundPeerCount.EncodeTo(e); err != nil { - return err - } - if err = s.P75ScpFirstToSelfLatencyMs.EncodeTo(e); err != nil { - return err - } - if err = s.P75ScpSelfToOtherLatencyMs.EncodeTo(e); err != nil { - return err - } - if err = s.LostSyncCount.EncodeTo(e); err != nil { - return err - } - if _, err = e.EncodeBool(bool(s.IsValidator)); err != nil { - return err - } - if err = s.MaxInboundPeerCount.EncodeTo(e); err != nil { + if err = s.RequestSignature.EncodeTo(e); err != nil { return err } - if err = s.MaxOutboundPeerCount.EncodeTo(e); err != nil { + if err = s.Request.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*TimeSlicedNodeData)(nil) +var _ decoderFrom = (*SignedSurveyRequestMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TimeSlicedNodeData) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SignedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TimeSlicedNodeData: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SignedSurveyRequestMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.AddedAuthenticatedPeers.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.DroppedAuthenticatedPeers.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.TotalInboundPeerCount.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.TotalOutboundPeerCount.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.P75ScpFirstToSelfLatencyMs.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.P75ScpSelfToOtherLatencyMs.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.LostSyncCount.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - s.IsValidator, nTmp, err = d.DecodeBool() - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Bool: %w", err) - } - nTmp, err = s.MaxInboundPeerCount.DecodeFrom(d, maxDepth) + nTmp, err = s.RequestSignature.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding Signature: %w", err) } - nTmp, err = s.MaxOutboundPeerCount.DecodeFrom(d, maxDepth) + nTmp, err = s.Request.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding SurveyRequestMessage: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TimeSlicedNodeData) MarshalBinary() ([]byte, error) { +func (s SignedSurveyRequestMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -21705,7 +22029,7 @@ func (s TimeSlicedNodeData) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TimeSlicedNodeData) UnmarshalBinary(inp []byte) error { +func (s *SignedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -21715,64 +22039,64 @@ func (s *TimeSlicedNodeData) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TimeSlicedNodeData)(nil) - _ encoding.BinaryUnmarshaler = (*TimeSlicedNodeData)(nil) + _ encoding.BinaryMarshaler = (*SignedSurveyRequestMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedSurveyRequestMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TimeSlicedNodeData) xdrType() {} +func (s SignedSurveyRequestMessage) xdrType() {} -var _ xdrType = (*TimeSlicedNodeData)(nil) +var _ xdrType = (*SignedSurveyRequestMessage)(nil) -// TimeSlicedPeerData is an XDR Struct defines as: +// SignedTimeSlicedSurveyRequestMessage is an XDR Struct defines as: // -// struct TimeSlicedPeerData +// struct SignedTimeSlicedSurveyRequestMessage // { -// PeerStats peerStats; -// uint32 averageLatencyMs; +// Signature requestSignature; +// TimeSlicedSurveyRequestMessage request; // }; -type TimeSlicedPeerData struct { - PeerStats PeerStats - AverageLatencyMs Uint32 +type SignedTimeSlicedSurveyRequestMessage struct { + RequestSignature Signature + Request TimeSlicedSurveyRequestMessage } // EncodeTo encodes this value using the Encoder. -func (s *TimeSlicedPeerData) EncodeTo(e *xdr.Encoder) error { +func (s *SignedTimeSlicedSurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.PeerStats.EncodeTo(e); err != nil { + if err = s.RequestSignature.EncodeTo(e); err != nil { return err } - if err = s.AverageLatencyMs.EncodeTo(e); err != nil { + if err = s.Request.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*TimeSlicedPeerData)(nil) +var _ decoderFrom = (*SignedTimeSlicedSurveyRequestMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TimeSlicedPeerData) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SignedTimeSlicedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TimeSlicedPeerData: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyRequestMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.PeerStats.DecodeFrom(d, maxDepth) + nTmp, err = s.RequestSignature.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding PeerStats: %w", err) + return n, fmt.Errorf("decoding Signature: %w", err) } - nTmp, err = s.AverageLatencyMs.DecodeFrom(d, maxDepth) + nTmp, err = s.Request.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding TimeSlicedSurveyRequestMessage: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TimeSlicedPeerData) MarshalBinary() ([]byte, error) { +func (s SignedTimeSlicedSurveyRequestMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -21780,7 +22104,7 @@ func (s TimeSlicedPeerData) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TimeSlicedPeerData) UnmarshalBinary(inp []byte) error { +func (s *SignedTimeSlicedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -21790,77 +22114,54 @@ func (s *TimeSlicedPeerData) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TimeSlicedPeerData)(nil) - _ encoding.BinaryUnmarshaler = (*TimeSlicedPeerData)(nil) + _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyRequestMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyRequestMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TimeSlicedPeerData) xdrType() {} +func (s SignedTimeSlicedSurveyRequestMessage) xdrType() {} -var _ xdrType = (*TimeSlicedPeerData)(nil) +var _ xdrType = (*SignedTimeSlicedSurveyRequestMessage)(nil) -// TimeSlicedPeerDataList is an XDR Typedef defines as: +// EncryptedBody is an XDR Typedef defines as: // -// typedef TimeSlicedPeerData TimeSlicedPeerDataList<25>; -type TimeSlicedPeerDataList []TimeSlicedPeerData +// typedef opaque EncryptedBody<64000>; +type EncryptedBody []byte -// XDRMaxSize implements the Sized interface for TimeSlicedPeerDataList -func (e TimeSlicedPeerDataList) XDRMaxSize() int { - return 25 +// XDRMaxSize implements the Sized interface for EncryptedBody +func (e EncryptedBody) XDRMaxSize() int { + return 64000 } // EncodeTo encodes this value using the Encoder. -func (s TimeSlicedPeerDataList) EncodeTo(e *xdr.Encoder) error { +func (s EncryptedBody) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeUint(uint32(len(s))); err != nil { + if _, err = e.EncodeOpaque(s[:]); err != nil { return err } - for i := 0; i < len(s); i++ { - if err = s[i].EncodeTo(e); err != nil { - return err - } - } return nil } -var _ decoderFrom = (*TimeSlicedPeerDataList)(nil) +var _ decoderFrom = (*EncryptedBody)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TimeSlicedPeerDataList) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *EncryptedBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TimeSlicedPeerDataList: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding EncryptedBody: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - var l uint32 - l, nTmp, err = d.DecodeUint() + (*s), nTmp, err = d.DecodeOpaque(64000) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TimeSlicedPeerData: %w", err) - } - if l > 25 { - return n, fmt.Errorf("decoding TimeSlicedPeerData: data size (%d) exceeds size limit (25)", l) - } - (*s) = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding TimeSlicedPeerData: length (%d) exceeds remaining input length (%d)", l, il) - } - (*s) = make([]TimeSlicedPeerData, l) - for i := uint32(0); i < l; i++ { - nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TimeSlicedPeerData: %w", err) - } - } + return n, fmt.Errorf("decoding EncryptedBody: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TimeSlicedPeerDataList) MarshalBinary() ([]byte, error) { +func (s EncryptedBody) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -21868,7 +22169,7 @@ func (s TimeSlicedPeerDataList) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TimeSlicedPeerDataList) UnmarshalBinary(inp []byte) error { +func (s *EncryptedBody) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -21878,85 +22179,94 @@ func (s *TimeSlicedPeerDataList) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TimeSlicedPeerDataList)(nil) - _ encoding.BinaryUnmarshaler = (*TimeSlicedPeerDataList)(nil) + _ encoding.BinaryMarshaler = (*EncryptedBody)(nil) + _ encoding.BinaryUnmarshaler = (*EncryptedBody)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TimeSlicedPeerDataList) xdrType() {} +func (s EncryptedBody) xdrType() {} -var _ xdrType = (*TimeSlicedPeerDataList)(nil) +var _ xdrType = (*EncryptedBody)(nil) -// TopologyResponseBodyV0 is an XDR Struct defines as: +// SurveyResponseMessage is an XDR Struct defines as: // -// struct TopologyResponseBodyV0 +// struct SurveyResponseMessage // { -// PeerStatList inboundPeers; -// PeerStatList outboundPeers; -// -// uint32 totalInboundPeerCount; -// uint32 totalOutboundPeerCount; +// NodeID surveyorPeerID; +// NodeID surveyedPeerID; +// uint32 ledgerNum; +// SurveyMessageCommandType commandType; +// EncryptedBody encryptedBody; // }; -type TopologyResponseBodyV0 struct { - InboundPeers PeerStatList - OutboundPeers PeerStatList - TotalInboundPeerCount Uint32 - TotalOutboundPeerCount Uint32 +type SurveyResponseMessage struct { + SurveyorPeerId NodeId + SurveyedPeerId NodeId + LedgerNum Uint32 + CommandType SurveyMessageCommandType + EncryptedBody EncryptedBody } // EncodeTo encodes this value using the Encoder. -func (s *TopologyResponseBodyV0) EncodeTo(e *xdr.Encoder) error { +func (s *SurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.InboundPeers.EncodeTo(e); err != nil { + if err = s.SurveyorPeerId.EncodeTo(e); err != nil { return err } - if err = s.OutboundPeers.EncodeTo(e); err != nil { + if err = s.SurveyedPeerId.EncodeTo(e); err != nil { return err } - if err = s.TotalInboundPeerCount.EncodeTo(e); err != nil { + if err = s.LedgerNum.EncodeTo(e); err != nil { return err } - if err = s.TotalOutboundPeerCount.EncodeTo(e); err != nil { + if err = s.CommandType.EncodeTo(e); err != nil { + return err + } + if err = s.EncryptedBody.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*TopologyResponseBodyV0)(nil) +var _ decoderFrom = (*SurveyResponseMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TopologyResponseBodyV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TopologyResponseBodyV0: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SurveyResponseMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.InboundPeers.DecodeFrom(d, maxDepth) + nTmp, err = s.SurveyorPeerId.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding PeerStatList: %w", err) + return n, fmt.Errorf("decoding NodeId: %w", err) } - nTmp, err = s.OutboundPeers.DecodeFrom(d, maxDepth) + nTmp, err = s.SurveyedPeerId.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding PeerStatList: %w", err) + return n, fmt.Errorf("decoding NodeId: %w", err) } - nTmp, err = s.TotalInboundPeerCount.DecodeFrom(d, maxDepth) + nTmp, err = s.LedgerNum.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.TotalOutboundPeerCount.DecodeFrom(d, maxDepth) + nTmp, err = s.CommandType.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding SurveyMessageCommandType: %w", err) + } + nTmp, err = s.EncryptedBody.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding EncryptedBody: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TopologyResponseBodyV0) MarshalBinary() ([]byte, error) { +func (s SurveyResponseMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -21964,7 +22274,7 @@ func (s TopologyResponseBodyV0) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TopologyResponseBodyV0) UnmarshalBinary(inp []byte) error { +func (s *SurveyResponseMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -21974,97 +22284,55 @@ func (s *TopologyResponseBodyV0) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TopologyResponseBodyV0)(nil) - _ encoding.BinaryUnmarshaler = (*TopologyResponseBodyV0)(nil) + _ encoding.BinaryMarshaler = (*SurveyResponseMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SurveyResponseMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TopologyResponseBodyV0) xdrType() {} +func (s SurveyResponseMessage) xdrType() {} -var _ xdrType = (*TopologyResponseBodyV0)(nil) +var _ xdrType = (*SurveyResponseMessage)(nil) -// TopologyResponseBodyV1 is an XDR Struct defines as: +// TimeSlicedSurveyResponseMessage is an XDR Struct defines as: // -// struct TopologyResponseBodyV1 +// struct TimeSlicedSurveyResponseMessage // { -// PeerStatList inboundPeers; -// PeerStatList outboundPeers; -// -// uint32 totalInboundPeerCount; -// uint32 totalOutboundPeerCount; -// -// uint32 maxInboundPeerCount; -// uint32 maxOutboundPeerCount; +// SurveyResponseMessage response; +// uint32 nonce; // }; -type TopologyResponseBodyV1 struct { - InboundPeers PeerStatList - OutboundPeers PeerStatList - TotalInboundPeerCount Uint32 - TotalOutboundPeerCount Uint32 - MaxInboundPeerCount Uint32 - MaxOutboundPeerCount Uint32 +type TimeSlicedSurveyResponseMessage struct { + Response SurveyResponseMessage + Nonce Uint32 } // EncodeTo encodes this value using the Encoder. -func (s *TopologyResponseBodyV1) EncodeTo(e *xdr.Encoder) error { +func (s *TimeSlicedSurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.InboundPeers.EncodeTo(e); err != nil { - return err - } - if err = s.OutboundPeers.EncodeTo(e); err != nil { - return err - } - if err = s.TotalInboundPeerCount.EncodeTo(e); err != nil { - return err - } - if err = s.TotalOutboundPeerCount.EncodeTo(e); err != nil { - return err - } - if err = s.MaxInboundPeerCount.EncodeTo(e); err != nil { + if err = s.Response.EncodeTo(e); err != nil { return err } - if err = s.MaxOutboundPeerCount.EncodeTo(e); err != nil { + if err = s.Nonce.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*TopologyResponseBodyV1)(nil) +var _ decoderFrom = (*TimeSlicedSurveyResponseMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TopologyResponseBodyV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TimeSlicedSurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TopologyResponseBodyV1: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TimeSlicedSurveyResponseMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.InboundPeers.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding PeerStatList: %w", err) - } - nTmp, err = s.OutboundPeers.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding PeerStatList: %w", err) - } - nTmp, err = s.TotalInboundPeerCount.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.TotalOutboundPeerCount.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) - } - nTmp, err = s.MaxInboundPeerCount.DecodeFrom(d, maxDepth) + nTmp, err = s.Response.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding SurveyResponseMessage: %w", err) } - nTmp, err = s.MaxOutboundPeerCount.DecodeFrom(d, maxDepth) + nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) @@ -22073,7 +22341,7 @@ func (s *TopologyResponseBodyV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TopologyResponseBodyV1) MarshalBinary() ([]byte, error) { +func (s TimeSlicedSurveyResponseMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -22081,7 +22349,7 @@ func (s TopologyResponseBodyV1) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TopologyResponseBodyV1) UnmarshalBinary(inp []byte) error { +func (s *TimeSlicedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -22091,74 +22359,64 @@ func (s *TopologyResponseBodyV1) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TopologyResponseBodyV1)(nil) - _ encoding.BinaryUnmarshaler = (*TopologyResponseBodyV1)(nil) + _ encoding.BinaryMarshaler = (*TimeSlicedSurveyResponseMessage)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyResponseMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TopologyResponseBodyV1) xdrType() {} +func (s TimeSlicedSurveyResponseMessage) xdrType() {} -var _ xdrType = (*TopologyResponseBodyV1)(nil) +var _ xdrType = (*TimeSlicedSurveyResponseMessage)(nil) -// TopologyResponseBodyV2 is an XDR Struct defines as: +// SignedSurveyResponseMessage is an XDR Struct defines as: // -// struct TopologyResponseBodyV2 +// struct SignedSurveyResponseMessage // { -// TimeSlicedPeerDataList inboundPeers; -// TimeSlicedPeerDataList outboundPeers; -// TimeSlicedNodeData nodeData; +// Signature responseSignature; +// SurveyResponseMessage response; // }; -type TopologyResponseBodyV2 struct { - InboundPeers TimeSlicedPeerDataList - OutboundPeers TimeSlicedPeerDataList - NodeData TimeSlicedNodeData +type SignedSurveyResponseMessage struct { + ResponseSignature Signature + Response SurveyResponseMessage } // EncodeTo encodes this value using the Encoder. -func (s *TopologyResponseBodyV2) EncodeTo(e *xdr.Encoder) error { +func (s *SignedSurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.InboundPeers.EncodeTo(e); err != nil { - return err - } - if err = s.OutboundPeers.EncodeTo(e); err != nil { + if err = s.ResponseSignature.EncodeTo(e); err != nil { return err } - if err = s.NodeData.EncodeTo(e); err != nil { + if err = s.Response.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*TopologyResponseBodyV2)(nil) +var _ decoderFrom = (*SignedSurveyResponseMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TopologyResponseBodyV2) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SignedSurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TopologyResponseBodyV2: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SignedSurveyResponseMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.InboundPeers.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TimeSlicedPeerDataList: %w", err) - } - nTmp, err = s.OutboundPeers.DecodeFrom(d, maxDepth) + nTmp, err = s.ResponseSignature.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TimeSlicedPeerDataList: %w", err) + return n, fmt.Errorf("decoding Signature: %w", err) } - nTmp, err = s.NodeData.DecodeFrom(d, maxDepth) + nTmp, err = s.Response.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TimeSlicedNodeData: %w", err) + return n, fmt.Errorf("decoding SurveyResponseMessage: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TopologyResponseBodyV2) MarshalBinary() ([]byte, error) { +func (s SignedSurveyResponseMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -22166,7 +22424,7 @@ func (s TopologyResponseBodyV2) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TopologyResponseBodyV2) UnmarshalBinary(inp []byte) error { +func (s *SignedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -22176,229 +22434,64 @@ func (s *TopologyResponseBodyV2) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TopologyResponseBodyV2)(nil) - _ encoding.BinaryUnmarshaler = (*TopologyResponseBodyV2)(nil) + _ encoding.BinaryMarshaler = (*SignedSurveyResponseMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedSurveyResponseMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TopologyResponseBodyV2) xdrType() {} +func (s SignedSurveyResponseMessage) xdrType() {} -var _ xdrType = (*TopologyResponseBodyV2)(nil) +var _ xdrType = (*SignedSurveyResponseMessage)(nil) -// SurveyResponseBody is an XDR Union defines as: +// SignedTimeSlicedSurveyResponseMessage is an XDR Struct defines as: // -// union SurveyResponseBody switch (SurveyMessageResponseType type) +// struct SignedTimeSlicedSurveyResponseMessage // { -// case SURVEY_TOPOLOGY_RESPONSE_V0: -// TopologyResponseBodyV0 topologyResponseBodyV0; -// case SURVEY_TOPOLOGY_RESPONSE_V1: -// TopologyResponseBodyV1 topologyResponseBodyV1; -// case SURVEY_TOPOLOGY_RESPONSE_V2: -// TopologyResponseBodyV2 topologyResponseBodyV2; +// Signature responseSignature; +// TimeSlicedSurveyResponseMessage response; // }; -type SurveyResponseBody struct { - Type SurveyMessageResponseType - TopologyResponseBodyV0 *TopologyResponseBodyV0 - TopologyResponseBodyV1 *TopologyResponseBodyV1 - TopologyResponseBodyV2 *TopologyResponseBodyV2 -} - -// SwitchFieldName returns the field name in which this union's -// discriminant is stored -func (u SurveyResponseBody) SwitchFieldName() string { - return "Type" -} - -// ArmForSwitch returns which field name should be used for storing -// the value for an instance of SurveyResponseBody -func (u SurveyResponseBody) ArmForSwitch(sw int32) (string, bool) { - switch SurveyMessageResponseType(sw) { - case SurveyMessageResponseTypeSurveyTopologyResponseV0: - return "TopologyResponseBodyV0", true - case SurveyMessageResponseTypeSurveyTopologyResponseV1: - return "TopologyResponseBodyV1", true - case SurveyMessageResponseTypeSurveyTopologyResponseV2: - return "TopologyResponseBodyV2", true - } - return "-", false -} - -// NewSurveyResponseBody creates a new SurveyResponseBody. -func NewSurveyResponseBody(aType SurveyMessageResponseType, value interface{}) (result SurveyResponseBody, err error) { - result.Type = aType - switch SurveyMessageResponseType(aType) { - case SurveyMessageResponseTypeSurveyTopologyResponseV0: - tv, ok := value.(TopologyResponseBodyV0) - if !ok { - err = errors.New("invalid value, must be TopologyResponseBodyV0") - return - } - result.TopologyResponseBodyV0 = &tv - case SurveyMessageResponseTypeSurveyTopologyResponseV1: - tv, ok := value.(TopologyResponseBodyV1) - if !ok { - err = errors.New("invalid value, must be TopologyResponseBodyV1") - return - } - result.TopologyResponseBodyV1 = &tv - case SurveyMessageResponseTypeSurveyTopologyResponseV2: - tv, ok := value.(TopologyResponseBodyV2) - if !ok { - err = errors.New("invalid value, must be TopologyResponseBodyV2") - return - } - result.TopologyResponseBodyV2 = &tv - } - return -} - -// MustTopologyResponseBodyV0 retrieves the TopologyResponseBodyV0 value from the union, -// panicing if the value is not set. -func (u SurveyResponseBody) MustTopologyResponseBodyV0() TopologyResponseBodyV0 { - val, ok := u.GetTopologyResponseBodyV0() - - if !ok { - panic("arm TopologyResponseBodyV0 is not set") - } - - return val -} - -// GetTopologyResponseBodyV0 retrieves the TopologyResponseBodyV0 value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u SurveyResponseBody) GetTopologyResponseBodyV0() (result TopologyResponseBodyV0, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "TopologyResponseBodyV0" { - result = *u.TopologyResponseBodyV0 - ok = true - } - - return -} - -// MustTopologyResponseBodyV1 retrieves the TopologyResponseBodyV1 value from the union, -// panicing if the value is not set. -func (u SurveyResponseBody) MustTopologyResponseBodyV1() TopologyResponseBodyV1 { - val, ok := u.GetTopologyResponseBodyV1() - - if !ok { - panic("arm TopologyResponseBodyV1 is not set") - } - - return val -} - -// GetTopologyResponseBodyV1 retrieves the TopologyResponseBodyV1 value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u SurveyResponseBody) GetTopologyResponseBodyV1() (result TopologyResponseBodyV1, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "TopologyResponseBodyV1" { - result = *u.TopologyResponseBodyV1 - ok = true - } - - return -} - -// MustTopologyResponseBodyV2 retrieves the TopologyResponseBodyV2 value from the union, -// panicing if the value is not set. -func (u SurveyResponseBody) MustTopologyResponseBodyV2() TopologyResponseBodyV2 { - val, ok := u.GetTopologyResponseBodyV2() - - if !ok { - panic("arm TopologyResponseBodyV2 is not set") - } - - return val -} - -// GetTopologyResponseBodyV2 retrieves the TopologyResponseBodyV2 value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u SurveyResponseBody) GetTopologyResponseBodyV2() (result TopologyResponseBodyV2, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "TopologyResponseBodyV2" { - result = *u.TopologyResponseBodyV2 - ok = true - } - - return +type SignedTimeSlicedSurveyResponseMessage struct { + ResponseSignature Signature + Response TimeSlicedSurveyResponseMessage } // EncodeTo encodes this value using the Encoder. -func (u SurveyResponseBody) EncodeTo(e *xdr.Encoder) error { +func (s *SignedTimeSlicedSurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = u.Type.EncodeTo(e); err != nil { + if err = s.ResponseSignature.EncodeTo(e); err != nil { return err } - switch SurveyMessageResponseType(u.Type) { - case SurveyMessageResponseTypeSurveyTopologyResponseV0: - if err = (*u.TopologyResponseBodyV0).EncodeTo(e); err != nil { - return err - } - return nil - case SurveyMessageResponseTypeSurveyTopologyResponseV1: - if err = (*u.TopologyResponseBodyV1).EncodeTo(e); err != nil { - return err - } - return nil - case SurveyMessageResponseTypeSurveyTopologyResponseV2: - if err = (*u.TopologyResponseBodyV2).EncodeTo(e); err != nil { - return err - } - return nil + if err = s.Response.EncodeTo(e); err != nil { + return err } - return fmt.Errorf("Type (SurveyMessageResponseType) switch value '%d' is not valid for union SurveyResponseBody", u.Type) + return nil } -var _ decoderFrom = (*SurveyResponseBody)(nil) +var _ decoderFrom = (*SignedTimeSlicedSurveyResponseMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *SurveyResponseBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SignedTimeSlicedSurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SurveyResponseBody: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyResponseMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = u.Type.DecodeFrom(d, maxDepth) + nTmp, err = s.ResponseSignature.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding SurveyMessageResponseType: %w", err) + return n, fmt.Errorf("decoding Signature: %w", err) } - switch SurveyMessageResponseType(u.Type) { - case SurveyMessageResponseTypeSurveyTopologyResponseV0: - u.TopologyResponseBodyV0 = new(TopologyResponseBodyV0) - nTmp, err = (*u.TopologyResponseBodyV0).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TopologyResponseBodyV0: %w", err) - } - return n, nil - case SurveyMessageResponseTypeSurveyTopologyResponseV1: - u.TopologyResponseBodyV1 = new(TopologyResponseBodyV1) - nTmp, err = (*u.TopologyResponseBodyV1).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TopologyResponseBodyV1: %w", err) - } - return n, nil - case SurveyMessageResponseTypeSurveyTopologyResponseV2: - u.TopologyResponseBodyV2 = new(TopologyResponseBodyV2) - nTmp, err = (*u.TopologyResponseBodyV2).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TopologyResponseBodyV2: %w", err) - } - return n, nil + nTmp, err = s.Response.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedSurveyResponseMessage: %w", err) } - return n, fmt.Errorf("union SurveyResponseBody has invalid Type (SurveyMessageResponseType) switch value '%d'", u.Type) + return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SurveyResponseBody) MarshalBinary() ([]byte, error) { +func (s SignedTimeSlicedSurveyResponseMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -22406,7 +22499,7 @@ func (s SurveyResponseBody) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SurveyResponseBody) UnmarshalBinary(inp []byte) error { +func (s *SignedTimeSlicedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -22416,147 +22509,196 @@ func (s *SurveyResponseBody) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SurveyResponseBody)(nil) - _ encoding.BinaryUnmarshaler = (*SurveyResponseBody)(nil) + _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyResponseMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyResponseMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SurveyResponseBody) xdrType() {} +func (s SignedTimeSlicedSurveyResponseMessage) xdrType() {} -var _ xdrType = (*SurveyResponseBody)(nil) +var _ xdrType = (*SignedTimeSlicedSurveyResponseMessage)(nil) -// TxAdvertVectorMaxSize is an XDR Const defines as: +// PeerStats is an XDR Struct defines as: // -// const TX_ADVERT_VECTOR_MAX_SIZE = 1000; -const TxAdvertVectorMaxSize = 1000 - -// TxAdvertVector is an XDR Typedef defines as: +// struct PeerStats +// { +// NodeID id; +// string versionStr<100>; +// uint64 messagesRead; +// uint64 messagesWritten; +// uint64 bytesRead; +// uint64 bytesWritten; +// uint64 secondsConnected; // -// typedef Hash TxAdvertVector; -type TxAdvertVector []Hash - -// XDRMaxSize implements the Sized interface for TxAdvertVector -func (e TxAdvertVector) XDRMaxSize() int { - return 1000 +// uint64 uniqueFloodBytesRecv; +// uint64 duplicateFloodBytesRecv; +// uint64 uniqueFetchBytesRecv; +// uint64 duplicateFetchBytesRecv; +// +// uint64 uniqueFloodMessageRecv; +// uint64 duplicateFloodMessageRecv; +// uint64 uniqueFetchMessageRecv; +// uint64 duplicateFetchMessageRecv; +// }; +type PeerStats struct { + Id NodeId + VersionStr string `xdrmaxsize:"100"` + MessagesRead Uint64 + MessagesWritten Uint64 + BytesRead Uint64 + BytesWritten Uint64 + SecondsConnected Uint64 + UniqueFloodBytesRecv Uint64 + DuplicateFloodBytesRecv Uint64 + UniqueFetchBytesRecv Uint64 + DuplicateFetchBytesRecv Uint64 + UniqueFloodMessageRecv Uint64 + DuplicateFloodMessageRecv Uint64 + UniqueFetchMessageRecv Uint64 + DuplicateFetchMessageRecv Uint64 } // EncodeTo encodes this value using the Encoder. -func (s TxAdvertVector) EncodeTo(e *xdr.Encoder) error { +func (s *PeerStats) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeUint(uint32(len(s))); err != nil { + if err = s.Id.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s); i++ { - if err = s[i].EncodeTo(e); err != nil { - return err - } + if _, err = e.EncodeString(string(s.VersionStr)); err != nil { + return err + } + if err = s.MessagesRead.EncodeTo(e); err != nil { + return err + } + if err = s.MessagesWritten.EncodeTo(e); err != nil { + return err + } + if err = s.BytesRead.EncodeTo(e); err != nil { + return err + } + if err = s.BytesWritten.EncodeTo(e); err != nil { + return err + } + if err = s.SecondsConnected.EncodeTo(e); err != nil { + return err + } + if err = s.UniqueFloodBytesRecv.EncodeTo(e); err != nil { + return err + } + if err = s.DuplicateFloodBytesRecv.EncodeTo(e); err != nil { + return err + } + if err = s.UniqueFetchBytesRecv.EncodeTo(e); err != nil { + return err + } + if err = s.DuplicateFetchBytesRecv.EncodeTo(e); err != nil { + return err + } + if err = s.UniqueFloodMessageRecv.EncodeTo(e); err != nil { + return err + } + if err = s.DuplicateFloodMessageRecv.EncodeTo(e); err != nil { + return err + } + if err = s.UniqueFetchMessageRecv.EncodeTo(e); err != nil { + return err + } + if err = s.DuplicateFetchMessageRecv.EncodeTo(e); err != nil { + return err } return nil } -var _ decoderFrom = (*TxAdvertVector)(nil) +var _ decoderFrom = (*PeerStats)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TxAdvertVector) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *PeerStats) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TxAdvertVector: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding PeerStats: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - var l uint32 - l, nTmp, err = d.DecodeUint() + nTmp, err = s.Id.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) + return n, fmt.Errorf("decoding NodeId: %w", err) } - if l > 1000 { - return n, fmt.Errorf("decoding Hash: data size (%d) exceeds size limit (1000)", l) + s.VersionStr, nTmp, err = d.DecodeString(100) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding VersionStr: %w", err) } - (*s) = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding Hash: length (%d) exceeds remaining input length (%d)", l, il) - } - (*s) = make([]Hash, l) - for i := uint32(0); i < l; i++ { - nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - } + nTmp, err = s.MessagesRead.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) } - return n, nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (s TxAdvertVector) MarshalBinary() ([]byte, error) { - b := bytes.Buffer{} - e := xdr.NewEncoder(&b) - err := s.EncodeTo(e) - return b.Bytes(), err -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TxAdvertVector) UnmarshalBinary(inp []byte) error { - r := bytes.NewReader(inp) - o := xdr.DefaultDecodeOptions - o.MaxInputLen = len(inp) - d := xdr.NewDecoderWithOptions(r, o) - _, err := s.DecodeFrom(d, o.MaxDepth) - return err -} - -var ( - _ encoding.BinaryMarshaler = (*TxAdvertVector)(nil) - _ encoding.BinaryUnmarshaler = (*TxAdvertVector)(nil) -) - -// xdrType signals that this type represents XDR values defined by this package. -func (s TxAdvertVector) xdrType() {} - -var _ xdrType = (*TxAdvertVector)(nil) - -// FloodAdvert is an XDR Struct defines as: -// -// struct FloodAdvert -// { -// TxAdvertVector txHashes; -// }; -type FloodAdvert struct { - TxHashes TxAdvertVector -} - -// EncodeTo encodes this value using the Encoder. -func (s *FloodAdvert) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.TxHashes.EncodeTo(e); err != nil { - return err + nTmp, err = s.MessagesWritten.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) } - return nil -} - -var _ decoderFrom = (*FloodAdvert)(nil) - -// DecodeFrom decodes this value using the Decoder. -func (s *FloodAdvert) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { - if maxDepth == 0 { - return 0, fmt.Errorf("decoding FloodAdvert: %w", ErrMaxDecodingDepthReached) + nTmp, err = s.BytesRead.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) } - maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.TxHashes.DecodeFrom(d, maxDepth) + nTmp, err = s.BytesWritten.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TxAdvertVector: %w", err) + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.SecondsConnected.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.UniqueFloodBytesRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.DuplicateFloodBytesRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.UniqueFetchBytesRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.DuplicateFetchBytesRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.UniqueFloodMessageRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.DuplicateFloodMessageRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.UniqueFetchMessageRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.DuplicateFetchMessageRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s FloodAdvert) MarshalBinary() ([]byte, error) { +func (s PeerStats) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -22564,7 +22706,7 @@ func (s FloodAdvert) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *FloodAdvert) UnmarshalBinary(inp []byte) error { +func (s *PeerStats) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -22574,32 +22716,27 @@ func (s *FloodAdvert) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*FloodAdvert)(nil) - _ encoding.BinaryUnmarshaler = (*FloodAdvert)(nil) + _ encoding.BinaryMarshaler = (*PeerStats)(nil) + _ encoding.BinaryUnmarshaler = (*PeerStats)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s FloodAdvert) xdrType() {} - -var _ xdrType = (*FloodAdvert)(nil) +func (s PeerStats) xdrType() {} -// TxDemandVectorMaxSize is an XDR Const defines as: -// -// const TX_DEMAND_VECTOR_MAX_SIZE = 1000; -const TxDemandVectorMaxSize = 1000 +var _ xdrType = (*PeerStats)(nil) -// TxDemandVector is an XDR Typedef defines as: +// PeerStatList is an XDR Typedef defines as: // -// typedef Hash TxDemandVector; -type TxDemandVector []Hash +// typedef PeerStats PeerStatList<25>; +type PeerStatList []PeerStats -// XDRMaxSize implements the Sized interface for TxDemandVector -func (e TxDemandVector) XDRMaxSize() int { - return 1000 +// XDRMaxSize implements the Sized interface for PeerStatList +func (e PeerStatList) XDRMaxSize() int { + return 25 } // EncodeTo encodes this value using the Encoder. -func (s TxDemandVector) EncodeTo(e *xdr.Encoder) error { +func (s PeerStatList) EncodeTo(e *xdr.Encoder) error { var err error if _, err = e.EncodeUint(uint32(len(s))); err != nil { return err @@ -22612,12 +22749,12 @@ func (s TxDemandVector) EncodeTo(e *xdr.Encoder) error { return nil } -var _ decoderFrom = (*TxDemandVector)(nil) +var _ decoderFrom = (*PeerStatList)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TxDemandVector) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *PeerStatList) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TxDemandVector: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding PeerStatList: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -22626,22 +22763,22 @@ func (s *TxDemandVector) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) + return n, fmt.Errorf("decoding PeerStats: %w", err) } - if l > 1000 { - return n, fmt.Errorf("decoding Hash: data size (%d) exceeds size limit (1000)", l) + if l > 25 { + return n, fmt.Errorf("decoding PeerStats: data size (%d) exceeds size limit (25)", l) } (*s) = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding Hash: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding PeerStats: length (%d) exceeds remaining input length (%d)", l, il) } - (*s) = make([]Hash, l) + (*s) = make([]PeerStats, l) for i := uint32(0); i < l; i++ { nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) + return n, fmt.Errorf("decoding PeerStats: %w", err) } } } @@ -22649,7 +22786,1120 @@ func (s *TxDemandVector) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TxDemandVector) MarshalBinary() ([]byte, error) { +func (s PeerStatList) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *PeerStatList) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*PeerStatList)(nil) + _ encoding.BinaryUnmarshaler = (*PeerStatList)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s PeerStatList) xdrType() {} + +var _ xdrType = (*PeerStatList)(nil) + +// TimeSlicedNodeData is an XDR Struct defines as: +// +// struct TimeSlicedNodeData +// { +// uint32 addedAuthenticatedPeers; +// uint32 droppedAuthenticatedPeers; +// uint32 totalInboundPeerCount; +// uint32 totalOutboundPeerCount; +// +// // SCP stats +// uint32 p75SCPFirstToSelfLatencyMs; +// uint32 p75SCPSelfToOtherLatencyMs; +// +// // How many times the node lost sync in the time slice +// uint32 lostSyncCount; +// +// // Config data +// bool isValidator; +// uint32 maxInboundPeerCount; +// uint32 maxOutboundPeerCount; +// }; +type TimeSlicedNodeData struct { + AddedAuthenticatedPeers Uint32 + DroppedAuthenticatedPeers Uint32 + TotalInboundPeerCount Uint32 + TotalOutboundPeerCount Uint32 + P75ScpFirstToSelfLatencyMs Uint32 + P75ScpSelfToOtherLatencyMs Uint32 + LostSyncCount Uint32 + IsValidator bool + MaxInboundPeerCount Uint32 + MaxOutboundPeerCount Uint32 +} + +// EncodeTo encodes this value using the Encoder. +func (s *TimeSlicedNodeData) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.AddedAuthenticatedPeers.EncodeTo(e); err != nil { + return err + } + if err = s.DroppedAuthenticatedPeers.EncodeTo(e); err != nil { + return err + } + if err = s.TotalInboundPeerCount.EncodeTo(e); err != nil { + return err + } + if err = s.TotalOutboundPeerCount.EncodeTo(e); err != nil { + return err + } + if err = s.P75ScpFirstToSelfLatencyMs.EncodeTo(e); err != nil { + return err + } + if err = s.P75ScpSelfToOtherLatencyMs.EncodeTo(e); err != nil { + return err + } + if err = s.LostSyncCount.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeBool(bool(s.IsValidator)); err != nil { + return err + } + if err = s.MaxInboundPeerCount.EncodeTo(e); err != nil { + return err + } + if err = s.MaxOutboundPeerCount.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*TimeSlicedNodeData)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TimeSlicedNodeData) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TimeSlicedNodeData: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.AddedAuthenticatedPeers.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.DroppedAuthenticatedPeers.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.TotalInboundPeerCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.TotalOutboundPeerCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.P75ScpFirstToSelfLatencyMs.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.P75ScpSelfToOtherLatencyMs.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.LostSyncCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + s.IsValidator, nTmp, err = d.DecodeBool() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Bool: %w", err) + } + nTmp, err = s.MaxInboundPeerCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.MaxOutboundPeerCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TimeSlicedNodeData) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TimeSlicedNodeData) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TimeSlicedNodeData)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedNodeData)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TimeSlicedNodeData) xdrType() {} + +var _ xdrType = (*TimeSlicedNodeData)(nil) + +// TimeSlicedPeerData is an XDR Struct defines as: +// +// struct TimeSlicedPeerData +// { +// PeerStats peerStats; +// uint32 averageLatencyMs; +// }; +type TimeSlicedPeerData struct { + PeerStats PeerStats + AverageLatencyMs Uint32 +} + +// EncodeTo encodes this value using the Encoder. +func (s *TimeSlicedPeerData) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.PeerStats.EncodeTo(e); err != nil { + return err + } + if err = s.AverageLatencyMs.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*TimeSlicedPeerData)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TimeSlicedPeerData) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TimeSlicedPeerData: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.PeerStats.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding PeerStats: %w", err) + } + nTmp, err = s.AverageLatencyMs.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TimeSlicedPeerData) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TimeSlicedPeerData) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TimeSlicedPeerData)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedPeerData)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TimeSlicedPeerData) xdrType() {} + +var _ xdrType = (*TimeSlicedPeerData)(nil) + +// TimeSlicedPeerDataList is an XDR Typedef defines as: +// +// typedef TimeSlicedPeerData TimeSlicedPeerDataList<25>; +type TimeSlicedPeerDataList []TimeSlicedPeerData + +// XDRMaxSize implements the Sized interface for TimeSlicedPeerDataList +func (e TimeSlicedPeerDataList) XDRMaxSize() int { + return 25 +} + +// EncodeTo encodes this value using the Encoder. +func (s TimeSlicedPeerDataList) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeUint(uint32(len(s))); err != nil { + return err + } + for i := 0; i < len(s); i++ { + if err = s[i].EncodeTo(e); err != nil { + return err + } + } + return nil +} + +var _ decoderFrom = (*TimeSlicedPeerDataList)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TimeSlicedPeerDataList) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TimeSlicedPeerDataList: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedPeerData: %w", err) + } + if l > 25 { + return n, fmt.Errorf("decoding TimeSlicedPeerData: data size (%d) exceeds size limit (25)", l) + } + (*s) = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding TimeSlicedPeerData: length (%d) exceeds remaining input length (%d)", l, il) + } + (*s) = make([]TimeSlicedPeerData, l) + for i := uint32(0); i < l; i++ { + nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedPeerData: %w", err) + } + } + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TimeSlicedPeerDataList) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TimeSlicedPeerDataList) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TimeSlicedPeerDataList)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedPeerDataList)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TimeSlicedPeerDataList) xdrType() {} + +var _ xdrType = (*TimeSlicedPeerDataList)(nil) + +// TopologyResponseBodyV0 is an XDR Struct defines as: +// +// struct TopologyResponseBodyV0 +// { +// PeerStatList inboundPeers; +// PeerStatList outboundPeers; +// +// uint32 totalInboundPeerCount; +// uint32 totalOutboundPeerCount; +// }; +type TopologyResponseBodyV0 struct { + InboundPeers PeerStatList + OutboundPeers PeerStatList + TotalInboundPeerCount Uint32 + TotalOutboundPeerCount Uint32 +} + +// EncodeTo encodes this value using the Encoder. +func (s *TopologyResponseBodyV0) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.InboundPeers.EncodeTo(e); err != nil { + return err + } + if err = s.OutboundPeers.EncodeTo(e); err != nil { + return err + } + if err = s.TotalInboundPeerCount.EncodeTo(e); err != nil { + return err + } + if err = s.TotalOutboundPeerCount.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*TopologyResponseBodyV0)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TopologyResponseBodyV0) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TopologyResponseBodyV0: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.InboundPeers.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding PeerStatList: %w", err) + } + nTmp, err = s.OutboundPeers.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding PeerStatList: %w", err) + } + nTmp, err = s.TotalInboundPeerCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.TotalOutboundPeerCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TopologyResponseBodyV0) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TopologyResponseBodyV0) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TopologyResponseBodyV0)(nil) + _ encoding.BinaryUnmarshaler = (*TopologyResponseBodyV0)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TopologyResponseBodyV0) xdrType() {} + +var _ xdrType = (*TopologyResponseBodyV0)(nil) + +// TopologyResponseBodyV1 is an XDR Struct defines as: +// +// struct TopologyResponseBodyV1 +// { +// PeerStatList inboundPeers; +// PeerStatList outboundPeers; +// +// uint32 totalInboundPeerCount; +// uint32 totalOutboundPeerCount; +// +// uint32 maxInboundPeerCount; +// uint32 maxOutboundPeerCount; +// }; +type TopologyResponseBodyV1 struct { + InboundPeers PeerStatList + OutboundPeers PeerStatList + TotalInboundPeerCount Uint32 + TotalOutboundPeerCount Uint32 + MaxInboundPeerCount Uint32 + MaxOutboundPeerCount Uint32 +} + +// EncodeTo encodes this value using the Encoder. +func (s *TopologyResponseBodyV1) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.InboundPeers.EncodeTo(e); err != nil { + return err + } + if err = s.OutboundPeers.EncodeTo(e); err != nil { + return err + } + if err = s.TotalInboundPeerCount.EncodeTo(e); err != nil { + return err + } + if err = s.TotalOutboundPeerCount.EncodeTo(e); err != nil { + return err + } + if err = s.MaxInboundPeerCount.EncodeTo(e); err != nil { + return err + } + if err = s.MaxOutboundPeerCount.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*TopologyResponseBodyV1)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TopologyResponseBodyV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TopologyResponseBodyV1: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.InboundPeers.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding PeerStatList: %w", err) + } + nTmp, err = s.OutboundPeers.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding PeerStatList: %w", err) + } + nTmp, err = s.TotalInboundPeerCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.TotalOutboundPeerCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.MaxInboundPeerCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.MaxOutboundPeerCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TopologyResponseBodyV1) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TopologyResponseBodyV1) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TopologyResponseBodyV1)(nil) + _ encoding.BinaryUnmarshaler = (*TopologyResponseBodyV1)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TopologyResponseBodyV1) xdrType() {} + +var _ xdrType = (*TopologyResponseBodyV1)(nil) + +// TopologyResponseBodyV2 is an XDR Struct defines as: +// +// struct TopologyResponseBodyV2 +// { +// TimeSlicedPeerDataList inboundPeers; +// TimeSlicedPeerDataList outboundPeers; +// TimeSlicedNodeData nodeData; +// }; +type TopologyResponseBodyV2 struct { + InboundPeers TimeSlicedPeerDataList + OutboundPeers TimeSlicedPeerDataList + NodeData TimeSlicedNodeData +} + +// EncodeTo encodes this value using the Encoder. +func (s *TopologyResponseBodyV2) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.InboundPeers.EncodeTo(e); err != nil { + return err + } + if err = s.OutboundPeers.EncodeTo(e); err != nil { + return err + } + if err = s.NodeData.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*TopologyResponseBodyV2)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TopologyResponseBodyV2) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TopologyResponseBodyV2: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.InboundPeers.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedPeerDataList: %w", err) + } + nTmp, err = s.OutboundPeers.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedPeerDataList: %w", err) + } + nTmp, err = s.NodeData.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedNodeData: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TopologyResponseBodyV2) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TopologyResponseBodyV2) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TopologyResponseBodyV2)(nil) + _ encoding.BinaryUnmarshaler = (*TopologyResponseBodyV2)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TopologyResponseBodyV2) xdrType() {} + +var _ xdrType = (*TopologyResponseBodyV2)(nil) + +// SurveyResponseBody is an XDR Union defines as: +// +// union SurveyResponseBody switch (SurveyMessageResponseType type) +// { +// case SURVEY_TOPOLOGY_RESPONSE_V0: +// TopologyResponseBodyV0 topologyResponseBodyV0; +// case SURVEY_TOPOLOGY_RESPONSE_V1: +// TopologyResponseBodyV1 topologyResponseBodyV1; +// case SURVEY_TOPOLOGY_RESPONSE_V2: +// TopologyResponseBodyV2 topologyResponseBodyV2; +// }; +type SurveyResponseBody struct { + Type SurveyMessageResponseType + TopologyResponseBodyV0 *TopologyResponseBodyV0 + TopologyResponseBodyV1 *TopologyResponseBodyV1 + TopologyResponseBodyV2 *TopologyResponseBodyV2 +} + +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u SurveyResponseBody) SwitchFieldName() string { + return "Type" +} + +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of SurveyResponseBody +func (u SurveyResponseBody) ArmForSwitch(sw int32) (string, bool) { + switch SurveyMessageResponseType(sw) { + case SurveyMessageResponseTypeSurveyTopologyResponseV0: + return "TopologyResponseBodyV0", true + case SurveyMessageResponseTypeSurveyTopologyResponseV1: + return "TopologyResponseBodyV1", true + case SurveyMessageResponseTypeSurveyTopologyResponseV2: + return "TopologyResponseBodyV2", true + } + return "-", false +} + +// NewSurveyResponseBody creates a new SurveyResponseBody. +func NewSurveyResponseBody(aType SurveyMessageResponseType, value interface{}) (result SurveyResponseBody, err error) { + result.Type = aType + switch SurveyMessageResponseType(aType) { + case SurveyMessageResponseTypeSurveyTopologyResponseV0: + tv, ok := value.(TopologyResponseBodyV0) + if !ok { + err = errors.New("invalid value, must be TopologyResponseBodyV0") + return + } + result.TopologyResponseBodyV0 = &tv + case SurveyMessageResponseTypeSurveyTopologyResponseV1: + tv, ok := value.(TopologyResponseBodyV1) + if !ok { + err = errors.New("invalid value, must be TopologyResponseBodyV1") + return + } + result.TopologyResponseBodyV1 = &tv + case SurveyMessageResponseTypeSurveyTopologyResponseV2: + tv, ok := value.(TopologyResponseBodyV2) + if !ok { + err = errors.New("invalid value, must be TopologyResponseBodyV2") + return + } + result.TopologyResponseBodyV2 = &tv + } + return +} + +// MustTopologyResponseBodyV0 retrieves the TopologyResponseBodyV0 value from the union, +// panicing if the value is not set. +func (u SurveyResponseBody) MustTopologyResponseBodyV0() TopologyResponseBodyV0 { + val, ok := u.GetTopologyResponseBodyV0() + + if !ok { + panic("arm TopologyResponseBodyV0 is not set") + } + + return val +} + +// GetTopologyResponseBodyV0 retrieves the TopologyResponseBodyV0 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u SurveyResponseBody) GetTopologyResponseBodyV0() (result TopologyResponseBodyV0, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "TopologyResponseBodyV0" { + result = *u.TopologyResponseBodyV0 + ok = true + } + + return +} + +// MustTopologyResponseBodyV1 retrieves the TopologyResponseBodyV1 value from the union, +// panicing if the value is not set. +func (u SurveyResponseBody) MustTopologyResponseBodyV1() TopologyResponseBodyV1 { + val, ok := u.GetTopologyResponseBodyV1() + + if !ok { + panic("arm TopologyResponseBodyV1 is not set") + } + + return val +} + +// GetTopologyResponseBodyV1 retrieves the TopologyResponseBodyV1 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u SurveyResponseBody) GetTopologyResponseBodyV1() (result TopologyResponseBodyV1, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "TopologyResponseBodyV1" { + result = *u.TopologyResponseBodyV1 + ok = true + } + + return +} + +// MustTopologyResponseBodyV2 retrieves the TopologyResponseBodyV2 value from the union, +// panicing if the value is not set. +func (u SurveyResponseBody) MustTopologyResponseBodyV2() TopologyResponseBodyV2 { + val, ok := u.GetTopologyResponseBodyV2() + + if !ok { + panic("arm TopologyResponseBodyV2 is not set") + } + + return val +} + +// GetTopologyResponseBodyV2 retrieves the TopologyResponseBodyV2 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u SurveyResponseBody) GetTopologyResponseBodyV2() (result TopologyResponseBodyV2, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "TopologyResponseBodyV2" { + result = *u.TopologyResponseBodyV2 + ok = true + } + + return +} + +// EncodeTo encodes this value using the Encoder. +func (u SurveyResponseBody) EncodeTo(e *xdr.Encoder) error { + var err error + if err = u.Type.EncodeTo(e); err != nil { + return err + } + switch SurveyMessageResponseType(u.Type) { + case SurveyMessageResponseTypeSurveyTopologyResponseV0: + if err = (*u.TopologyResponseBodyV0).EncodeTo(e); err != nil { + return err + } + return nil + case SurveyMessageResponseTypeSurveyTopologyResponseV1: + if err = (*u.TopologyResponseBodyV1).EncodeTo(e); err != nil { + return err + } + return nil + case SurveyMessageResponseTypeSurveyTopologyResponseV2: + if err = (*u.TopologyResponseBodyV2).EncodeTo(e); err != nil { + return err + } + return nil + } + return fmt.Errorf("Type (SurveyMessageResponseType) switch value '%d' is not valid for union SurveyResponseBody", u.Type) +} + +var _ decoderFrom = (*SurveyResponseBody)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (u *SurveyResponseBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SurveyResponseBody: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = u.Type.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SurveyMessageResponseType: %w", err) + } + switch SurveyMessageResponseType(u.Type) { + case SurveyMessageResponseTypeSurveyTopologyResponseV0: + u.TopologyResponseBodyV0 = new(TopologyResponseBodyV0) + nTmp, err = (*u.TopologyResponseBodyV0).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TopologyResponseBodyV0: %w", err) + } + return n, nil + case SurveyMessageResponseTypeSurveyTopologyResponseV1: + u.TopologyResponseBodyV1 = new(TopologyResponseBodyV1) + nTmp, err = (*u.TopologyResponseBodyV1).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TopologyResponseBodyV1: %w", err) + } + return n, nil + case SurveyMessageResponseTypeSurveyTopologyResponseV2: + u.TopologyResponseBodyV2 = new(TopologyResponseBodyV2) + nTmp, err = (*u.TopologyResponseBodyV2).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TopologyResponseBodyV2: %w", err) + } + return n, nil + } + return n, fmt.Errorf("union SurveyResponseBody has invalid Type (SurveyMessageResponseType) switch value '%d'", u.Type) +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SurveyResponseBody) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SurveyResponseBody) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*SurveyResponseBody)(nil) + _ encoding.BinaryUnmarshaler = (*SurveyResponseBody)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SurveyResponseBody) xdrType() {} + +var _ xdrType = (*SurveyResponseBody)(nil) + +// TxAdvertVectorMaxSize is an XDR Const defines as: +// +// const TX_ADVERT_VECTOR_MAX_SIZE = 1000; +const TxAdvertVectorMaxSize = 1000 + +// TxAdvertVector is an XDR Typedef defines as: +// +// typedef Hash TxAdvertVector; +type TxAdvertVector []Hash + +// XDRMaxSize implements the Sized interface for TxAdvertVector +func (e TxAdvertVector) XDRMaxSize() int { + return 1000 +} + +// EncodeTo encodes this value using the Encoder. +func (s TxAdvertVector) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeUint(uint32(len(s))); err != nil { + return err + } + for i := 0; i < len(s); i++ { + if err = s[i].EncodeTo(e); err != nil { + return err + } + } + return nil +} + +var _ decoderFrom = (*TxAdvertVector)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TxAdvertVector) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TxAdvertVector: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + if l > 1000 { + return n, fmt.Errorf("decoding Hash: data size (%d) exceeds size limit (1000)", l) + } + (*s) = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding Hash: length (%d) exceeds remaining input length (%d)", l, il) + } + (*s) = make([]Hash, l) + for i := uint32(0); i < l; i++ { + nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + } + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TxAdvertVector) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TxAdvertVector) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TxAdvertVector)(nil) + _ encoding.BinaryUnmarshaler = (*TxAdvertVector)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TxAdvertVector) xdrType() {} + +var _ xdrType = (*TxAdvertVector)(nil) + +// FloodAdvert is an XDR Struct defines as: +// +// struct FloodAdvert +// { +// TxAdvertVector txHashes; +// }; +type FloodAdvert struct { + TxHashes TxAdvertVector +} + +// EncodeTo encodes this value using the Encoder. +func (s *FloodAdvert) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.TxHashes.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*FloodAdvert)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *FloodAdvert) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding FloodAdvert: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.TxHashes.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TxAdvertVector: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s FloodAdvert) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *FloodAdvert) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*FloodAdvert)(nil) + _ encoding.BinaryUnmarshaler = (*FloodAdvert)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s FloodAdvert) xdrType() {} + +var _ xdrType = (*FloodAdvert)(nil) + +// TxDemandVectorMaxSize is an XDR Const defines as: +// +// const TX_DEMAND_VECTOR_MAX_SIZE = 1000; +const TxDemandVectorMaxSize = 1000 + +// TxDemandVector is an XDR Typedef defines as: +// +// typedef Hash TxDemandVector; +type TxDemandVector []Hash + +// XDRMaxSize implements the Sized interface for TxDemandVector +func (e TxDemandVector) XDRMaxSize() int { + return 1000 +} + +// EncodeTo encodes this value using the Encoder. +func (s TxDemandVector) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeUint(uint32(len(s))); err != nil { + return err + } + for i := 0; i < len(s); i++ { + if err = s[i].EncodeTo(e); err != nil { + return err + } + } + return nil +} + +var _ decoderFrom = (*TxDemandVector)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TxDemandVector) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TxDemandVector: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + if l > 1000 { + return n, fmt.Errorf("decoding Hash: data size (%d) exceeds size limit (1000)", l) + } + (*s) = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding Hash: length (%d) exceeds remaining input length (%d)", l, il) + } + (*s) = make([]Hash, l) + for i := uint32(0); i < l; i++ { + nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + } + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TxDemandVector) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -27572,7 +28822,8 @@ var _ xdrType = (*LiquidityPoolWithdrawOp)(nil) // { // HOST_FUNCTION_TYPE_INVOKE_CONTRACT = 0, // HOST_FUNCTION_TYPE_CREATE_CONTRACT = 1, -// HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2 +// HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2, +// HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2 = 3 // }; type HostFunctionType int32 @@ -27580,12 +28831,14 @@ const ( HostFunctionTypeHostFunctionTypeInvokeContract HostFunctionType = 0 HostFunctionTypeHostFunctionTypeCreateContract HostFunctionType = 1 HostFunctionTypeHostFunctionTypeUploadContractWasm HostFunctionType = 2 + HostFunctionTypeHostFunctionTypeCreateContractV2 HostFunctionType = 3 ) var hostFunctionTypeMap = map[int32]string{ 0: "HostFunctionTypeHostFunctionTypeInvokeContract", 1: "HostFunctionTypeHostFunctionTypeCreateContract", 2: "HostFunctionTypeHostFunctionTypeUploadContractWasm", + 3: "HostFunctionTypeHostFunctionTypeCreateContractV2", } // ValidEnum validates a proposed value for this enum. Implements @@ -28089,6 +29342,112 @@ func (s CreateContractArgs) xdrType() {} var _ xdrType = (*CreateContractArgs)(nil) +// CreateContractArgsV2 is an XDR Struct defines as: +// +// struct CreateContractArgsV2 +// { +// ContractIDPreimage contractIDPreimage; +// ContractExecutable executable; +// // Arguments of the contract's constructor. +// SCVal constructorArgs<>; +// }; +type CreateContractArgsV2 struct { + ContractIdPreimage ContractIdPreimage + Executable ContractExecutable + ConstructorArgs []ScVal +} + +// EncodeTo encodes this value using the Encoder. +func (s *CreateContractArgsV2) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.ContractIdPreimage.EncodeTo(e); err != nil { + return err + } + if err = s.Executable.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeUint(uint32(len(s.ConstructorArgs))); err != nil { + return err + } + for i := 0; i < len(s.ConstructorArgs); i++ { + if err = s.ConstructorArgs[i].EncodeTo(e); err != nil { + return err + } + } + return nil +} + +var _ decoderFrom = (*CreateContractArgsV2)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *CreateContractArgsV2) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding CreateContractArgsV2: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.ContractIdPreimage.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ContractIdPreimage: %w", err) + } + nTmp, err = s.Executable.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ContractExecutable: %w", err) + } + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ScVal: %w", err) + } + s.ConstructorArgs = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding ScVal: length (%d) exceeds remaining input length (%d)", l, il) + } + s.ConstructorArgs = make([]ScVal, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.ConstructorArgs[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ScVal: %w", err) + } + } + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s CreateContractArgsV2) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *CreateContractArgsV2) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*CreateContractArgsV2)(nil) + _ encoding.BinaryUnmarshaler = (*CreateContractArgsV2)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s CreateContractArgsV2) xdrType() {} + +var _ xdrType = (*CreateContractArgsV2)(nil) + // InvokeContractArgs is an XDR Struct defines as: // // struct InvokeContractArgs { @@ -28203,12 +29562,15 @@ var _ xdrType = (*InvokeContractArgs)(nil) // CreateContractArgs createContract; // case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM: // opaque wasm<>; +// case HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2: +// CreateContractArgsV2 createContractV2; // }; type HostFunction struct { - Type HostFunctionType - InvokeContract *InvokeContractArgs - CreateContract *CreateContractArgs - Wasm *[]byte + Type HostFunctionType + InvokeContract *InvokeContractArgs + CreateContract *CreateContractArgs + Wasm *[]byte + CreateContractV2 *CreateContractArgsV2 } // SwitchFieldName returns the field name in which this union's @@ -28227,6 +29589,8 @@ func (u HostFunction) ArmForSwitch(sw int32) (string, bool) { return "CreateContract", true case HostFunctionTypeHostFunctionTypeUploadContractWasm: return "Wasm", true + case HostFunctionTypeHostFunctionTypeCreateContractV2: + return "CreateContractV2", true } return "-", false } @@ -28256,6 +29620,13 @@ func NewHostFunction(aType HostFunctionType, value interface{}) (result HostFunc return } result.Wasm = &tv + case HostFunctionTypeHostFunctionTypeCreateContractV2: + tv, ok := value.(CreateContractArgsV2) + if !ok { + err = errors.New("invalid value, must be CreateContractArgsV2") + return + } + result.CreateContractV2 = &tv } return } @@ -28335,6 +29706,31 @@ func (u HostFunction) GetWasm() (result []byte, ok bool) { return } +// MustCreateContractV2 retrieves the CreateContractV2 value from the union, +// panicing if the value is not set. +func (u HostFunction) MustCreateContractV2() CreateContractArgsV2 { + val, ok := u.GetCreateContractV2() + + if !ok { + panic("arm CreateContractV2 is not set") + } + + return val +} + +// GetCreateContractV2 retrieves the CreateContractV2 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u HostFunction) GetCreateContractV2() (result CreateContractArgsV2, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "CreateContractV2" { + result = *u.CreateContractV2 + ok = true + } + + return +} + // EncodeTo encodes this value using the Encoder. func (u HostFunction) EncodeTo(e *xdr.Encoder) error { var err error @@ -28357,6 +29753,11 @@ func (u HostFunction) EncodeTo(e *xdr.Encoder) error { return err } return nil + case HostFunctionTypeHostFunctionTypeCreateContractV2: + if err = (*u.CreateContractV2).EncodeTo(e); err != nil { + return err + } + return nil } return fmt.Errorf("Type (HostFunctionType) switch value '%d' is not valid for union HostFunction", u.Type) } @@ -28401,6 +29802,14 @@ func (u *HostFunction) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { return n, fmt.Errorf("decoding Wasm: %w", err) } return n, nil + case HostFunctionTypeHostFunctionTypeCreateContractV2: + u.CreateContractV2 = new(CreateContractArgsV2) + nTmp, err = (*u.CreateContractV2).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding CreateContractArgsV2: %w", err) + } + return n, nil } return n, fmt.Errorf("union HostFunction has invalid Type (HostFunctionType) switch value '%d'", u.Type) } @@ -28438,18 +29847,21 @@ var _ xdrType = (*HostFunction)(nil) // enum SorobanAuthorizedFunctionType // { // SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN = 0, -// SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1 +// SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1, +// SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN = 2 // }; type SorobanAuthorizedFunctionType int32 const ( - SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeContractFn SorobanAuthorizedFunctionType = 0 - SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeCreateContractHostFn SorobanAuthorizedFunctionType = 1 + SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeContractFn SorobanAuthorizedFunctionType = 0 + SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeCreateContractHostFn SorobanAuthorizedFunctionType = 1 + SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeCreateContractV2HostFn SorobanAuthorizedFunctionType = 2 ) var sorobanAuthorizedFunctionTypeMap = map[int32]string{ 0: "SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeContractFn", 1: "SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeCreateContractHostFn", + 2: "SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeCreateContractV2HostFn", } // ValidEnum validates a proposed value for this enum. Implements @@ -28527,13 +29939,20 @@ var _ xdrType = (*SorobanAuthorizedFunctionType)(nil) // { // case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: // InvokeContractArgs contractFn; +// // This variant of auth payload for creating new contract instances is no +// // longer accepted after protocol 22. // case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: // CreateContractArgs createContractHostFn; +// // This variant of auth payload for creating new contract instances +// // is only accepted in and after protocol 22. +// case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: +// CreateContractArgsV2 createContractV2HostFn; // }; type SorobanAuthorizedFunction struct { - Type SorobanAuthorizedFunctionType - ContractFn *InvokeContractArgs - CreateContractHostFn *CreateContractArgs + Type SorobanAuthorizedFunctionType + ContractFn *InvokeContractArgs + CreateContractHostFn *CreateContractArgs + CreateContractV2HostFn *CreateContractArgsV2 } // SwitchFieldName returns the field name in which this union's @@ -28550,6 +29969,8 @@ func (u SorobanAuthorizedFunction) ArmForSwitch(sw int32) (string, bool) { return "ContractFn", true case SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeCreateContractHostFn: return "CreateContractHostFn", true + case SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeCreateContractV2HostFn: + return "CreateContractV2HostFn", true } return "-", false } @@ -28572,6 +29993,13 @@ func NewSorobanAuthorizedFunction(aType SorobanAuthorizedFunctionType, value int return } result.CreateContractHostFn = &tv + case SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeCreateContractV2HostFn: + tv, ok := value.(CreateContractArgsV2) + if !ok { + err = errors.New("invalid value, must be CreateContractArgsV2") + return + } + result.CreateContractV2HostFn = &tv } return } @@ -28626,6 +30054,31 @@ func (u SorobanAuthorizedFunction) GetCreateContractHostFn() (result CreateContr return } +// MustCreateContractV2HostFn retrieves the CreateContractV2HostFn value from the union, +// panicing if the value is not set. +func (u SorobanAuthorizedFunction) MustCreateContractV2HostFn() CreateContractArgsV2 { + val, ok := u.GetCreateContractV2HostFn() + + if !ok { + panic("arm CreateContractV2HostFn is not set") + } + + return val +} + +// GetCreateContractV2HostFn retrieves the CreateContractV2HostFn value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u SorobanAuthorizedFunction) GetCreateContractV2HostFn() (result CreateContractArgsV2, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "CreateContractV2HostFn" { + result = *u.CreateContractV2HostFn + ok = true + } + + return +} + // EncodeTo encodes this value using the Encoder. func (u SorobanAuthorizedFunction) EncodeTo(e *xdr.Encoder) error { var err error @@ -28643,6 +30096,11 @@ func (u SorobanAuthorizedFunction) EncodeTo(e *xdr.Encoder) error { return err } return nil + case SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeCreateContractV2HostFn: + if err = (*u.CreateContractV2HostFn).EncodeTo(e); err != nil { + return err + } + return nil } return fmt.Errorf("Type (SorobanAuthorizedFunctionType) switch value '%d' is not valid for union SorobanAuthorizedFunction", u.Type) } @@ -28679,6 +30137,14 @@ func (u *SorobanAuthorizedFunction) DecodeFrom(d *xdr.Decoder, maxDepth uint) (i return n, fmt.Errorf("decoding CreateContractArgs: %w", err) } return n, nil + case SorobanAuthorizedFunctionTypeSorobanAuthorizedFunctionTypeCreateContractV2HostFn: + u.CreateContractV2HostFn = new(CreateContractArgsV2) + nTmp, err = (*u.CreateContractV2HostFn).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding CreateContractArgsV2: %w", err) + } + return n, nil } return n, fmt.Errorf("union SorobanAuthorizedFunction has invalid Type (SorobanAuthorizedFunctionType) switch value '%d'", u.Type) } @@ -31202,11 +32668,418 @@ func (s *HashIdPreimageContractId) DecodeFrom(d *xdr.Decoder, maxDepth uint) (in if err != nil { return n, fmt.Errorf("decoding ContractIdPreimage: %w", err) } - return n, nil + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s HashIdPreimageContractId) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *HashIdPreimageContractId) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*HashIdPreimageContractId)(nil) + _ encoding.BinaryUnmarshaler = (*HashIdPreimageContractId)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s HashIdPreimageContractId) xdrType() {} + +var _ xdrType = (*HashIdPreimageContractId)(nil) + +// HashIdPreimageSorobanAuthorization is an XDR NestedStruct defines as: +// +// struct +// { +// Hash networkID; +// int64 nonce; +// uint32 signatureExpirationLedger; +// SorobanAuthorizedInvocation invocation; +// } +type HashIdPreimageSorobanAuthorization struct { + NetworkId Hash + Nonce Int64 + SignatureExpirationLedger Uint32 + Invocation SorobanAuthorizedInvocation +} + +// EncodeTo encodes this value using the Encoder. +func (s *HashIdPreimageSorobanAuthorization) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.NetworkId.EncodeTo(e); err != nil { + return err + } + if err = s.Nonce.EncodeTo(e); err != nil { + return err + } + if err = s.SignatureExpirationLedger.EncodeTo(e); err != nil { + return err + } + if err = s.Invocation.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*HashIdPreimageSorobanAuthorization)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *HashIdPreimageSorobanAuthorization) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding HashIdPreimageSorobanAuthorization: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.NetworkId.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + nTmp, err = s.SignatureExpirationLedger.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.Invocation.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SorobanAuthorizedInvocation: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s HashIdPreimageSorobanAuthorization) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *HashIdPreimageSorobanAuthorization) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*HashIdPreimageSorobanAuthorization)(nil) + _ encoding.BinaryUnmarshaler = (*HashIdPreimageSorobanAuthorization)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s HashIdPreimageSorobanAuthorization) xdrType() {} + +var _ xdrType = (*HashIdPreimageSorobanAuthorization)(nil) + +// HashIdPreimage is an XDR Union defines as: +// +// union HashIDPreimage switch (EnvelopeType type) +// { +// case ENVELOPE_TYPE_OP_ID: +// struct +// { +// AccountID sourceAccount; +// SequenceNumber seqNum; +// uint32 opNum; +// } operationID; +// case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: +// struct +// { +// AccountID sourceAccount; +// SequenceNumber seqNum; +// uint32 opNum; +// PoolID liquidityPoolID; +// Asset asset; +// } revokeID; +// case ENVELOPE_TYPE_CONTRACT_ID: +// struct +// { +// Hash networkID; +// ContractIDPreimage contractIDPreimage; +// } contractID; +// case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: +// struct +// { +// Hash networkID; +// int64 nonce; +// uint32 signatureExpirationLedger; +// SorobanAuthorizedInvocation invocation; +// } sorobanAuthorization; +// }; +type HashIdPreimage struct { + Type EnvelopeType + OperationId *HashIdPreimageOperationId + RevokeId *HashIdPreimageRevokeId + ContractId *HashIdPreimageContractId + SorobanAuthorization *HashIdPreimageSorobanAuthorization +} + +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u HashIdPreimage) SwitchFieldName() string { + return "Type" +} + +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of HashIdPreimage +func (u HashIdPreimage) ArmForSwitch(sw int32) (string, bool) { + switch EnvelopeType(sw) { + case EnvelopeTypeEnvelopeTypeOpId: + return "OperationId", true + case EnvelopeTypeEnvelopeTypePoolRevokeOpId: + return "RevokeId", true + case EnvelopeTypeEnvelopeTypeContractId: + return "ContractId", true + case EnvelopeTypeEnvelopeTypeSorobanAuthorization: + return "SorobanAuthorization", true + } + return "-", false +} + +// NewHashIdPreimage creates a new HashIdPreimage. +func NewHashIdPreimage(aType EnvelopeType, value interface{}) (result HashIdPreimage, err error) { + result.Type = aType + switch EnvelopeType(aType) { + case EnvelopeTypeEnvelopeTypeOpId: + tv, ok := value.(HashIdPreimageOperationId) + if !ok { + err = errors.New("invalid value, must be HashIdPreimageOperationId") + return + } + result.OperationId = &tv + case EnvelopeTypeEnvelopeTypePoolRevokeOpId: + tv, ok := value.(HashIdPreimageRevokeId) + if !ok { + err = errors.New("invalid value, must be HashIdPreimageRevokeId") + return + } + result.RevokeId = &tv + case EnvelopeTypeEnvelopeTypeContractId: + tv, ok := value.(HashIdPreimageContractId) + if !ok { + err = errors.New("invalid value, must be HashIdPreimageContractId") + return + } + result.ContractId = &tv + case EnvelopeTypeEnvelopeTypeSorobanAuthorization: + tv, ok := value.(HashIdPreimageSorobanAuthorization) + if !ok { + err = errors.New("invalid value, must be HashIdPreimageSorobanAuthorization") + return + } + result.SorobanAuthorization = &tv + } + return +} + +// MustOperationId retrieves the OperationId value from the union, +// panicing if the value is not set. +func (u HashIdPreimage) MustOperationId() HashIdPreimageOperationId { + val, ok := u.GetOperationId() + + if !ok { + panic("arm OperationId is not set") + } + + return val +} + +// GetOperationId retrieves the OperationId value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u HashIdPreimage) GetOperationId() (result HashIdPreimageOperationId, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "OperationId" { + result = *u.OperationId + ok = true + } + + return +} + +// MustRevokeId retrieves the RevokeId value from the union, +// panicing if the value is not set. +func (u HashIdPreimage) MustRevokeId() HashIdPreimageRevokeId { + val, ok := u.GetRevokeId() + + if !ok { + panic("arm RevokeId is not set") + } + + return val +} + +// GetRevokeId retrieves the RevokeId value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u HashIdPreimage) GetRevokeId() (result HashIdPreimageRevokeId, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "RevokeId" { + result = *u.RevokeId + ok = true + } + + return +} + +// MustContractId retrieves the ContractId value from the union, +// panicing if the value is not set. +func (u HashIdPreimage) MustContractId() HashIdPreimageContractId { + val, ok := u.GetContractId() + + if !ok { + panic("arm ContractId is not set") + } + + return val +} + +// GetContractId retrieves the ContractId value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u HashIdPreimage) GetContractId() (result HashIdPreimageContractId, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "ContractId" { + result = *u.ContractId + ok = true + } + + return +} + +// MustSorobanAuthorization retrieves the SorobanAuthorization value from the union, +// panicing if the value is not set. +func (u HashIdPreimage) MustSorobanAuthorization() HashIdPreimageSorobanAuthorization { + val, ok := u.GetSorobanAuthorization() + + if !ok { + panic("arm SorobanAuthorization is not set") + } + + return val +} + +// GetSorobanAuthorization retrieves the SorobanAuthorization value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u HashIdPreimage) GetSorobanAuthorization() (result HashIdPreimageSorobanAuthorization, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "SorobanAuthorization" { + result = *u.SorobanAuthorization + ok = true + } + + return +} + +// EncodeTo encodes this value using the Encoder. +func (u HashIdPreimage) EncodeTo(e *xdr.Encoder) error { + var err error + if err = u.Type.EncodeTo(e); err != nil { + return err + } + switch EnvelopeType(u.Type) { + case EnvelopeTypeEnvelopeTypeOpId: + if err = (*u.OperationId).EncodeTo(e); err != nil { + return err + } + return nil + case EnvelopeTypeEnvelopeTypePoolRevokeOpId: + if err = (*u.RevokeId).EncodeTo(e); err != nil { + return err + } + return nil + case EnvelopeTypeEnvelopeTypeContractId: + if err = (*u.ContractId).EncodeTo(e); err != nil { + return err + } + return nil + case EnvelopeTypeEnvelopeTypeSorobanAuthorization: + if err = (*u.SorobanAuthorization).EncodeTo(e); err != nil { + return err + } + return nil + } + return fmt.Errorf("Type (EnvelopeType) switch value '%d' is not valid for union HashIdPreimage", u.Type) +} + +var _ decoderFrom = (*HashIdPreimage)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (u *HashIdPreimage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding HashIdPreimage: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = u.Type.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding EnvelopeType: %w", err) + } + switch EnvelopeType(u.Type) { + case EnvelopeTypeEnvelopeTypeOpId: + u.OperationId = new(HashIdPreimageOperationId) + nTmp, err = (*u.OperationId).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding HashIdPreimageOperationId: %w", err) + } + return n, nil + case EnvelopeTypeEnvelopeTypePoolRevokeOpId: + u.RevokeId = new(HashIdPreimageRevokeId) + nTmp, err = (*u.RevokeId).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding HashIdPreimageRevokeId: %w", err) + } + return n, nil + case EnvelopeTypeEnvelopeTypeContractId: + u.ContractId = new(HashIdPreimageContractId) + nTmp, err = (*u.ContractId).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding HashIdPreimageContractId: %w", err) + } + return n, nil + case EnvelopeTypeEnvelopeTypeSorobanAuthorization: + u.SorobanAuthorization = new(HashIdPreimageSorobanAuthorization) + nTmp, err = (*u.SorobanAuthorization).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding HashIdPreimageSorobanAuthorization: %w", err) + } + return n, nil + } + return n, fmt.Errorf("union HashIdPreimage has invalid Type (EnvelopeType) switch value '%d'", u.Type) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s HashIdPreimageContractId) MarshalBinary() ([]byte, error) { +func (s HashIdPreimage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -31214,7 +33087,7 @@ func (s HashIdPreimageContractId) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *HashIdPreimageContractId) UnmarshalBinary(inp []byte) error { +func (s *HashIdPreimage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -31224,84 +33097,86 @@ func (s *HashIdPreimageContractId) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*HashIdPreimageContractId)(nil) - _ encoding.BinaryUnmarshaler = (*HashIdPreimageContractId)(nil) + _ encoding.BinaryMarshaler = (*HashIdPreimage)(nil) + _ encoding.BinaryUnmarshaler = (*HashIdPreimage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s HashIdPreimageContractId) xdrType() {} +func (s HashIdPreimage) xdrType() {} -var _ xdrType = (*HashIdPreimageContractId)(nil) +var _ xdrType = (*HashIdPreimage)(nil) -// HashIdPreimageSorobanAuthorization is an XDR NestedStruct defines as: +// MemoType is an XDR Enum defines as: // -// struct -// { -// Hash networkID; -// int64 nonce; -// uint32 signatureExpirationLedger; -// SorobanAuthorizedInvocation invocation; -// } -type HashIdPreimageSorobanAuthorization struct { - NetworkId Hash - Nonce Int64 - SignatureExpirationLedger Uint32 - Invocation SorobanAuthorizedInvocation +// enum MemoType +// { +// MEMO_NONE = 0, +// MEMO_TEXT = 1, +// MEMO_ID = 2, +// MEMO_HASH = 3, +// MEMO_RETURN = 4 +// }; +type MemoType int32 + +const ( + MemoTypeMemoNone MemoType = 0 + MemoTypeMemoText MemoType = 1 + MemoTypeMemoId MemoType = 2 + MemoTypeMemoHash MemoType = 3 + MemoTypeMemoReturn MemoType = 4 +) + +var memoTypeMap = map[int32]string{ + 0: "MemoTypeMemoNone", + 1: "MemoTypeMemoText", + 2: "MemoTypeMemoId", + 3: "MemoTypeMemoHash", + 4: "MemoTypeMemoReturn", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for MemoType +func (e MemoType) ValidEnum(v int32) bool { + _, ok := memoTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e MemoType) String() string { + name, _ := memoTypeMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (s *HashIdPreimageSorobanAuthorization) EncodeTo(e *xdr.Encoder) error { - var err error - if err = s.NetworkId.EncodeTo(e); err != nil { - return err - } - if err = s.Nonce.EncodeTo(e); err != nil { - return err - } - if err = s.SignatureExpirationLedger.EncodeTo(e); err != nil { - return err - } - if err = s.Invocation.EncodeTo(e); err != nil { - return err +func (e MemoType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := memoTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid MemoType enum value", e) } - return nil + _, err := enc.EncodeInt(int32(e)) + return err } -var _ decoderFrom = (*HashIdPreimageSorobanAuthorization)(nil) +var _ decoderFrom = (*MemoType)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *HashIdPreimageSorobanAuthorization) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *MemoType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding HashIdPreimageSorobanAuthorization: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding MemoType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - var err error - var n, nTmp int - nTmp, err = s.NetworkId.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) - } - nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Int64: %w", err) - } - nTmp, err = s.SignatureExpirationLedger.DecodeFrom(d, maxDepth) - n += nTmp + v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding MemoType: %w", err) } - nTmp, err = s.Invocation.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding SorobanAuthorizedInvocation: %w", err) + if _, ok := memoTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid MemoType enum value", v) } + *e = MemoType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s HashIdPreimageSorobanAuthorization) MarshalBinary() ([]byte, error) { +func (s MemoType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -31309,7 +33184,7 @@ func (s HashIdPreimageSorobanAuthorization) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *HashIdPreimageSorobanAuthorization) UnmarshalBinary(inp []byte) error { +func (s *MemoType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -31319,301 +33194,645 @@ func (s *HashIdPreimageSorobanAuthorization) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*HashIdPreimageSorobanAuthorization)(nil) - _ encoding.BinaryUnmarshaler = (*HashIdPreimageSorobanAuthorization)(nil) + _ encoding.BinaryMarshaler = (*MemoType)(nil) + _ encoding.BinaryUnmarshaler = (*MemoType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s HashIdPreimageSorobanAuthorization) xdrType() {} +func (s MemoType) xdrType() {} -var _ xdrType = (*HashIdPreimageSorobanAuthorization)(nil) +var _ xdrType = (*MemoType)(nil) -// HashIdPreimage is an XDR Union defines as: +// Memo is an XDR Union defines as: // -// union HashIDPreimage switch (EnvelopeType type) +// union Memo switch (MemoType type) // { -// case ENVELOPE_TYPE_OP_ID: -// struct -// { -// AccountID sourceAccount; -// SequenceNumber seqNum; -// uint32 opNum; -// } operationID; -// case ENVELOPE_TYPE_POOL_REVOKE_OP_ID: -// struct -// { -// AccountID sourceAccount; -// SequenceNumber seqNum; -// uint32 opNum; -// PoolID liquidityPoolID; -// Asset asset; -// } revokeID; -// case ENVELOPE_TYPE_CONTRACT_ID: -// struct -// { -// Hash networkID; -// ContractIDPreimage contractIDPreimage; -// } contractID; -// case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION: -// struct -// { -// Hash networkID; -// int64 nonce; -// uint32 signatureExpirationLedger; -// SorobanAuthorizedInvocation invocation; -// } sorobanAuthorization; +// case MEMO_NONE: +// void; +// case MEMO_TEXT: +// string text<28>; +// case MEMO_ID: +// uint64 id; +// case MEMO_HASH: +// Hash hash; // the hash of what to pull from the content server +// case MEMO_RETURN: +// Hash retHash; // the hash of the tx you are rejecting // }; -type HashIdPreimage struct { - Type EnvelopeType - OperationId *HashIdPreimageOperationId - RevokeId *HashIdPreimageRevokeId - ContractId *HashIdPreimageContractId - SorobanAuthorization *HashIdPreimageSorobanAuthorization +type Memo struct { + Type MemoType + Text *string `xdrmaxsize:"28"` + Id *Uint64 + Hash *Hash + RetHash *Hash } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u HashIdPreimage) SwitchFieldName() string { +func (u Memo) SwitchFieldName() string { return "Type" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of HashIdPreimage -func (u HashIdPreimage) ArmForSwitch(sw int32) (string, bool) { - switch EnvelopeType(sw) { - case EnvelopeTypeEnvelopeTypeOpId: - return "OperationId", true - case EnvelopeTypeEnvelopeTypePoolRevokeOpId: - return "RevokeId", true - case EnvelopeTypeEnvelopeTypeContractId: - return "ContractId", true - case EnvelopeTypeEnvelopeTypeSorobanAuthorization: - return "SorobanAuthorization", true +// the value for an instance of Memo +func (u Memo) ArmForSwitch(sw int32) (string, bool) { + switch MemoType(sw) { + case MemoTypeMemoNone: + return "", true + case MemoTypeMemoText: + return "Text", true + case MemoTypeMemoId: + return "Id", true + case MemoTypeMemoHash: + return "Hash", true + case MemoTypeMemoReturn: + return "RetHash", true } return "-", false } -// NewHashIdPreimage creates a new HashIdPreimage. -func NewHashIdPreimage(aType EnvelopeType, value interface{}) (result HashIdPreimage, err error) { +// NewMemo creates a new Memo. +func NewMemo(aType MemoType, value interface{}) (result Memo, err error) { result.Type = aType - switch EnvelopeType(aType) { - case EnvelopeTypeEnvelopeTypeOpId: - tv, ok := value.(HashIdPreimageOperationId) + switch MemoType(aType) { + case MemoTypeMemoNone: + // void + case MemoTypeMemoText: + tv, ok := value.(string) if !ok { - err = errors.New("invalid value, must be HashIdPreimageOperationId") + err = errors.New("invalid value, must be string") return } - result.OperationId = &tv - case EnvelopeTypeEnvelopeTypePoolRevokeOpId: - tv, ok := value.(HashIdPreimageRevokeId) + result.Text = &tv + case MemoTypeMemoId: + tv, ok := value.(Uint64) if !ok { - err = errors.New("invalid value, must be HashIdPreimageRevokeId") + err = errors.New("invalid value, must be Uint64") return } - result.RevokeId = &tv - case EnvelopeTypeEnvelopeTypeContractId: - tv, ok := value.(HashIdPreimageContractId) + result.Id = &tv + case MemoTypeMemoHash: + tv, ok := value.(Hash) if !ok { - err = errors.New("invalid value, must be HashIdPreimageContractId") + err = errors.New("invalid value, must be Hash") return } - result.ContractId = &tv - case EnvelopeTypeEnvelopeTypeSorobanAuthorization: - tv, ok := value.(HashIdPreimageSorobanAuthorization) + result.Hash = &tv + case MemoTypeMemoReturn: + tv, ok := value.(Hash) if !ok { - err = errors.New("invalid value, must be HashIdPreimageSorobanAuthorization") + err = errors.New("invalid value, must be Hash") return } - result.SorobanAuthorization = &tv + result.RetHash = &tv } return } -// MustOperationId retrieves the OperationId value from the union, +// MustText retrieves the Text value from the union, // panicing if the value is not set. -func (u HashIdPreimage) MustOperationId() HashIdPreimageOperationId { - val, ok := u.GetOperationId() +func (u Memo) MustText() string { + val, ok := u.GetText() if !ok { - panic("arm OperationId is not set") + panic("arm Text is not set") } return val } -// GetOperationId retrieves the OperationId value from the union, +// GetText retrieves the Text value from the union, // returning ok if the union's switch indicated the value is valid. -func (u HashIdPreimage) GetOperationId() (result HashIdPreimageOperationId, ok bool) { +func (u Memo) GetText() (result string, ok bool) { armName, _ := u.ArmForSwitch(int32(u.Type)) - if armName == "OperationId" { - result = *u.OperationId + if armName == "Text" { + result = *u.Text ok = true } return } -// MustRevokeId retrieves the RevokeId value from the union, +// MustId retrieves the Id value from the union, // panicing if the value is not set. -func (u HashIdPreimage) MustRevokeId() HashIdPreimageRevokeId { - val, ok := u.GetRevokeId() +func (u Memo) MustId() Uint64 { + val, ok := u.GetId() if !ok { - panic("arm RevokeId is not set") + panic("arm Id is not set") + } + + return val +} + +// GetId retrieves the Id value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u Memo) GetId() (result Uint64, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "Id" { + result = *u.Id + ok = true + } + + return +} + +// MustHash retrieves the Hash value from the union, +// panicing if the value is not set. +func (u Memo) MustHash() Hash { + val, ok := u.GetHash() + + if !ok { + panic("arm Hash is not set") + } + + return val +} + +// GetHash retrieves the Hash value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u Memo) GetHash() (result Hash, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "Hash" { + result = *u.Hash + ok = true + } + + return +} + +// MustRetHash retrieves the RetHash value from the union, +// panicing if the value is not set. +func (u Memo) MustRetHash() Hash { + val, ok := u.GetRetHash() + + if !ok { + panic("arm RetHash is not set") + } + + return val +} + +// GetRetHash retrieves the RetHash value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u Memo) GetRetHash() (result Hash, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "RetHash" { + result = *u.RetHash + ok = true + } + + return +} + +// EncodeTo encodes this value using the Encoder. +func (u Memo) EncodeTo(e *xdr.Encoder) error { + var err error + if err = u.Type.EncodeTo(e); err != nil { + return err + } + switch MemoType(u.Type) { + case MemoTypeMemoNone: + // Void + return nil + case MemoTypeMemoText: + if _, err = e.EncodeString(string((*u.Text))); err != nil { + return err + } + return nil + case MemoTypeMemoId: + if err = (*u.Id).EncodeTo(e); err != nil { + return err + } + return nil + case MemoTypeMemoHash: + if err = (*u.Hash).EncodeTo(e); err != nil { + return err + } + return nil + case MemoTypeMemoReturn: + if err = (*u.RetHash).EncodeTo(e); err != nil { + return err + } + return nil + } + return fmt.Errorf("Type (MemoType) switch value '%d' is not valid for union Memo", u.Type) +} + +var _ decoderFrom = (*Memo)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (u *Memo) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding Memo: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = u.Type.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding MemoType: %w", err) + } + switch MemoType(u.Type) { + case MemoTypeMemoNone: + // Void + return n, nil + case MemoTypeMemoText: + u.Text = new(string) + (*u.Text), nTmp, err = d.DecodeString(28) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Text: %w", err) + } + return n, nil + case MemoTypeMemoId: + u.Id = new(Uint64) + nTmp, err = (*u.Id).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + return n, nil + case MemoTypeMemoHash: + u.Hash = new(Hash) + nTmp, err = (*u.Hash).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + return n, nil + case MemoTypeMemoReturn: + u.RetHash = new(Hash) + nTmp, err = (*u.RetHash).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Hash: %w", err) + } + return n, nil + } + return n, fmt.Errorf("union Memo has invalid Type (MemoType) switch value '%d'", u.Type) +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s Memo) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *Memo) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*Memo)(nil) + _ encoding.BinaryUnmarshaler = (*Memo)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s Memo) xdrType() {} + +var _ xdrType = (*Memo)(nil) + +// TimeBounds is an XDR Struct defines as: +// +// struct TimeBounds +// { +// TimePoint minTime; +// TimePoint maxTime; // 0 here means no maxTime +// }; +type TimeBounds struct { + MinTime TimePoint + MaxTime TimePoint +} + +// EncodeTo encodes this value using the Encoder. +func (s *TimeBounds) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.MinTime.EncodeTo(e); err != nil { + return err + } + if err = s.MaxTime.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*TimeBounds)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TimeBounds) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TimeBounds: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.MinTime.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimePoint: %w", err) + } + nTmp, err = s.MaxTime.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimePoint: %w", err) } - - return val + return n, nil } -// GetRevokeId retrieves the RevokeId value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u HashIdPreimage) GetRevokeId() (result HashIdPreimageRevokeId, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "RevokeId" { - result = *u.RevokeId - ok = true - } +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TimeBounds) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} - return +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TimeBounds) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err } -// MustContractId retrieves the ContractId value from the union, -// panicing if the value is not set. -func (u HashIdPreimage) MustContractId() HashIdPreimageContractId { - val, ok := u.GetContractId() +var ( + _ encoding.BinaryMarshaler = (*TimeBounds)(nil) + _ encoding.BinaryUnmarshaler = (*TimeBounds)(nil) +) - if !ok { - panic("arm ContractId is not set") - } +// xdrType signals that this type represents XDR values defined by this package. +func (s TimeBounds) xdrType() {} - return val -} +var _ xdrType = (*TimeBounds)(nil) -// GetContractId retrieves the ContractId value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u HashIdPreimage) GetContractId() (result HashIdPreimageContractId, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) +// LedgerBounds is an XDR Struct defines as: +// +// struct LedgerBounds +// { +// uint32 minLedger; +// uint32 maxLedger; // 0 here means no maxLedger +// }; +type LedgerBounds struct { + MinLedger Uint32 + MaxLedger Uint32 +} - if armName == "ContractId" { - result = *u.ContractId - ok = true +// EncodeTo encodes this value using the Encoder. +func (s *LedgerBounds) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.MinLedger.EncodeTo(e); err != nil { + return err } - - return + if err = s.MaxLedger.EncodeTo(e); err != nil { + return err + } + return nil } -// MustSorobanAuthorization retrieves the SorobanAuthorization value from the union, -// panicing if the value is not set. -func (u HashIdPreimage) MustSorobanAuthorization() HashIdPreimageSorobanAuthorization { - val, ok := u.GetSorobanAuthorization() +var _ decoderFrom = (*LedgerBounds)(nil) - if !ok { - panic("arm SorobanAuthorization is not set") +// DecodeFrom decodes this value using the Decoder. +func (s *LedgerBounds) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding LedgerBounds: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.MinLedger.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.MaxLedger.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) } + return n, nil +} - return val +// MarshalBinary implements encoding.BinaryMarshaler. +func (s LedgerBounds) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err } -// GetSorobanAuthorization retrieves the SorobanAuthorization value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u HashIdPreimage) GetSorobanAuthorization() (result HashIdPreimageSorobanAuthorization, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *LedgerBounds) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} - if armName == "SorobanAuthorization" { - result = *u.SorobanAuthorization - ok = true - } +var ( + _ encoding.BinaryMarshaler = (*LedgerBounds)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerBounds)(nil) +) - return +// xdrType signals that this type represents XDR values defined by this package. +func (s LedgerBounds) xdrType() {} + +var _ xdrType = (*LedgerBounds)(nil) + +// PreconditionsV2 is an XDR Struct defines as: +// +// 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; +// +// // If NULL, only valid when sourceAccount's sequence number +// // is seqNum - 1. Otherwise, valid when sourceAccount's +// // sequence number n satisfies minSeqNum <= n < tx.seqNum. +// // 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; +// +// // For the transaction to be valid, the current ledger time must +// // be at least minSeqAge greater than sourceAccount's seqTime. +// Duration minSeqAge; +// +// // For the transaction to be valid, the current ledger number +// // must be at least minSeqLedgerGap greater than sourceAccount's +// // seqLedger. +// uint32 minSeqLedgerGap; +// +// // For the transaction to be valid, there must be a signature +// // corresponding to every Signer in this array, even if the +// // signature is not otherwise required by the sourceAccount or +// // operations. +// SignerKey extraSigners<2>; +// }; +type PreconditionsV2 struct { + TimeBounds *TimeBounds + LedgerBounds *LedgerBounds + MinSeqNum *SequenceNumber + MinSeqAge Duration + MinSeqLedgerGap Uint32 + ExtraSigners []SignerKey `xdrmaxsize:"2"` } // EncodeTo encodes this value using the Encoder. -func (u HashIdPreimage) EncodeTo(e *xdr.Encoder) error { +func (s *PreconditionsV2) EncodeTo(e *xdr.Encoder) error { var err error - if err = u.Type.EncodeTo(e); err != nil { + if _, err = e.EncodeBool(s.TimeBounds != nil); err != nil { return err } - switch EnvelopeType(u.Type) { - case EnvelopeTypeEnvelopeTypeOpId: - if err = (*u.OperationId).EncodeTo(e); err != nil { + if s.TimeBounds != nil { + if err = (*s.TimeBounds).EncodeTo(e); err != nil { return err } - return nil - case EnvelopeTypeEnvelopeTypePoolRevokeOpId: - if err = (*u.RevokeId).EncodeTo(e); err != nil { + } + if _, err = e.EncodeBool(s.LedgerBounds != nil); err != nil { + return err + } + if s.LedgerBounds != nil { + if err = (*s.LedgerBounds).EncodeTo(e); err != nil { return err } - return nil - case EnvelopeTypeEnvelopeTypeContractId: - if err = (*u.ContractId).EncodeTo(e); err != nil { + } + if _, err = e.EncodeBool(s.MinSeqNum != nil); err != nil { + return err + } + if s.MinSeqNum != nil { + if err = (*s.MinSeqNum).EncodeTo(e); err != nil { return err } - return nil - case EnvelopeTypeEnvelopeTypeSorobanAuthorization: - if err = (*u.SorobanAuthorization).EncodeTo(e); err != nil { + } + if err = s.MinSeqAge.EncodeTo(e); err != nil { + return err + } + if err = s.MinSeqLedgerGap.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeUint(uint32(len(s.ExtraSigners))); err != nil { + return err + } + for i := 0; i < len(s.ExtraSigners); i++ { + if err = s.ExtraSigners[i].EncodeTo(e); err != nil { return err } - return nil } - return fmt.Errorf("Type (EnvelopeType) switch value '%d' is not valid for union HashIdPreimage", u.Type) + return nil } -var _ decoderFrom = (*HashIdPreimage)(nil) +var _ decoderFrom = (*PreconditionsV2)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *HashIdPreimage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *PreconditionsV2) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding HashIdPreimage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding PreconditionsV2: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = u.Type.DecodeFrom(d, maxDepth) + var b bool + b, nTmp, err = d.DecodeBool() n += nTmp if err != nil { - return n, fmt.Errorf("decoding EnvelopeType: %w", err) + return n, fmt.Errorf("decoding TimeBounds: %w", err) } - switch EnvelopeType(u.Type) { - case EnvelopeTypeEnvelopeTypeOpId: - u.OperationId = new(HashIdPreimageOperationId) - nTmp, err = (*u.OperationId).DecodeFrom(d, maxDepth) + s.TimeBounds = nil + if b { + s.TimeBounds = new(TimeBounds) + nTmp, err = s.TimeBounds.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding HashIdPreimageOperationId: %w", err) + return n, fmt.Errorf("decoding TimeBounds: %w", err) } - return n, nil - case EnvelopeTypeEnvelopeTypePoolRevokeOpId: - u.RevokeId = new(HashIdPreimageRevokeId) - nTmp, err = (*u.RevokeId).DecodeFrom(d, maxDepth) + } + b, nTmp, err = d.DecodeBool() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerBounds: %w", err) + } + s.LedgerBounds = nil + if b { + s.LedgerBounds = new(LedgerBounds) + nTmp, err = s.LedgerBounds.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding HashIdPreimageRevokeId: %w", err) + return n, fmt.Errorf("decoding LedgerBounds: %w", err) } - return n, nil - case EnvelopeTypeEnvelopeTypeContractId: - u.ContractId = new(HashIdPreimageContractId) - nTmp, err = (*u.ContractId).DecodeFrom(d, maxDepth) + } + b, nTmp, err = d.DecodeBool() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SequenceNumber: %w", err) + } + s.MinSeqNum = nil + if b { + s.MinSeqNum = new(SequenceNumber) + nTmp, err = s.MinSeqNum.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding HashIdPreimageContractId: %w", err) + return n, fmt.Errorf("decoding SequenceNumber: %w", err) } - return n, nil - case EnvelopeTypeEnvelopeTypeSorobanAuthorization: - u.SorobanAuthorization = new(HashIdPreimageSorobanAuthorization) - nTmp, err = (*u.SorobanAuthorization).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding HashIdPreimageSorobanAuthorization: %w", err) + } + nTmp, err = s.MinSeqAge.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Duration: %w", err) + } + nTmp, err = s.MinSeqLedgerGap.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SignerKey: %w", err) + } + if l > 2 { + return n, fmt.Errorf("decoding SignerKey: data size (%d) exceeds size limit (2)", l) + } + s.ExtraSigners = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding SignerKey: length (%d) exceeds remaining input length (%d)", l, il) + } + s.ExtraSigners = make([]SignerKey, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.ExtraSigners[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SignerKey: %w", err) + } } - return n, nil } - return n, fmt.Errorf("union HashIdPreimage has invalid Type (EnvelopeType) switch value '%d'", u.Type) + return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s HashIdPreimage) MarshalBinary() ([]byte, error) { +func (s PreconditionsV2) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -31621,7 +33840,7 @@ func (s HashIdPreimage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *HashIdPreimage) UnmarshalBinary(inp []byte) error { +func (s *PreconditionsV2) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -31631,86 +33850,80 @@ func (s *HashIdPreimage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*HashIdPreimage)(nil) - _ encoding.BinaryUnmarshaler = (*HashIdPreimage)(nil) + _ encoding.BinaryMarshaler = (*PreconditionsV2)(nil) + _ encoding.BinaryUnmarshaler = (*PreconditionsV2)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s HashIdPreimage) xdrType() {} +func (s PreconditionsV2) xdrType() {} -var _ xdrType = (*HashIdPreimage)(nil) +var _ xdrType = (*PreconditionsV2)(nil) -// MemoType is an XDR Enum defines as: +// PreconditionType is an XDR Enum defines as: // -// enum MemoType +// enum PreconditionType // { -// MEMO_NONE = 0, -// MEMO_TEXT = 1, -// MEMO_ID = 2, -// MEMO_HASH = 3, -// MEMO_RETURN = 4 +// PRECOND_NONE = 0, +// PRECOND_TIME = 1, +// PRECOND_V2 = 2 // }; -type MemoType int32 +type PreconditionType int32 const ( - MemoTypeMemoNone MemoType = 0 - MemoTypeMemoText MemoType = 1 - MemoTypeMemoId MemoType = 2 - MemoTypeMemoHash MemoType = 3 - MemoTypeMemoReturn MemoType = 4 + PreconditionTypePrecondNone PreconditionType = 0 + PreconditionTypePrecondTime PreconditionType = 1 + PreconditionTypePrecondV2 PreconditionType = 2 ) -var memoTypeMap = map[int32]string{ - 0: "MemoTypeMemoNone", - 1: "MemoTypeMemoText", - 2: "MemoTypeMemoId", - 3: "MemoTypeMemoHash", - 4: "MemoTypeMemoReturn", +var preconditionTypeMap = map[int32]string{ + 0: "PreconditionTypePrecondNone", + 1: "PreconditionTypePrecondTime", + 2: "PreconditionTypePrecondV2", } // ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for MemoType -func (e MemoType) ValidEnum(v int32) bool { - _, ok := memoTypeMap[v] +// the Enum interface for PreconditionType +func (e PreconditionType) ValidEnum(v int32) bool { + _, ok := preconditionTypeMap[v] return ok } // String returns the name of `e` -func (e MemoType) String() string { - name, _ := memoTypeMap[int32(e)] +func (e PreconditionType) String() string { + name, _ := preconditionTypeMap[int32(e)] return name } // EncodeTo encodes this value using the Encoder. -func (e MemoType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := memoTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid MemoType enum value", e) +func (e PreconditionType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := preconditionTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid PreconditionType enum value", e) } _, err := enc.EncodeInt(int32(e)) return err } -var _ decoderFrom = (*MemoType)(nil) +var _ decoderFrom = (*PreconditionType)(nil) // DecodeFrom decodes this value using the Decoder. -func (e *MemoType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (e *PreconditionType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding MemoType: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding PreconditionType: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 v, n, err := d.DecodeInt() if err != nil { - return n, fmt.Errorf("decoding MemoType: %w", err) + return n, fmt.Errorf("decoding PreconditionType: %w", err) } - if _, ok := memoTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid MemoType enum value", v) + if _, ok := preconditionTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid PreconditionType enum value", v) } - *e = MemoType(v) + *e = PreconditionType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s MemoType) MarshalBinary() ([]byte, error) { +func (s PreconditionType) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -31718,7 +33931,7 @@ func (s MemoType) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *MemoType) UnmarshalBinary(inp []byte) error { +func (s *PreconditionType) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -31728,194 +33941,120 @@ func (s *MemoType) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*MemoType)(nil) - _ encoding.BinaryUnmarshaler = (*MemoType)(nil) + _ encoding.BinaryMarshaler = (*PreconditionType)(nil) + _ encoding.BinaryUnmarshaler = (*PreconditionType)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s MemoType) xdrType() {} +func (s PreconditionType) xdrType() {} -var _ xdrType = (*MemoType)(nil) +var _ xdrType = (*PreconditionType)(nil) -// Memo is an XDR Union defines as: +// Preconditions is an XDR Union defines as: // -// union Memo switch (MemoType type) +// union Preconditions switch (PreconditionType type) // { -// case MEMO_NONE: +// case PRECOND_NONE: // void; -// case MEMO_TEXT: -// string text<28>; -// case MEMO_ID: -// uint64 id; -// case MEMO_HASH: -// Hash hash; // the hash of what to pull from the content server -// case MEMO_RETURN: -// Hash retHash; // the hash of the tx you are rejecting +// case PRECOND_TIME: +// TimeBounds timeBounds; +// case PRECOND_V2: +// PreconditionsV2 v2; // }; -type Memo struct { - Type MemoType - Text *string `xdrmaxsize:"28"` - Id *Uint64 - Hash *Hash - RetHash *Hash +type Preconditions struct { + Type PreconditionType + TimeBounds *TimeBounds + V2 *PreconditionsV2 } // SwitchFieldName returns the field name in which this union's -// discriminant is stored -func (u Memo) SwitchFieldName() string { - return "Type" -} - -// ArmForSwitch returns which field name should be used for storing -// the value for an instance of Memo -func (u Memo) ArmForSwitch(sw int32) (string, bool) { - switch MemoType(sw) { - case MemoTypeMemoNone: - return "", true - case MemoTypeMemoText: - return "Text", true - case MemoTypeMemoId: - return "Id", true - case MemoTypeMemoHash: - return "Hash", true - case MemoTypeMemoReturn: - return "RetHash", true - } - return "-", false -} - -// NewMemo creates a new Memo. -func NewMemo(aType MemoType, value interface{}) (result Memo, err error) { - result.Type = aType - switch MemoType(aType) { - case MemoTypeMemoNone: - // void - case MemoTypeMemoText: - tv, ok := value.(string) - if !ok { - err = errors.New("invalid value, must be string") - return - } - result.Text = &tv - case MemoTypeMemoId: - tv, ok := value.(Uint64) - if !ok { - err = errors.New("invalid value, must be Uint64") - return - } - result.Id = &tv - case MemoTypeMemoHash: - tv, ok := value.(Hash) - if !ok { - err = errors.New("invalid value, must be Hash") - return - } - result.Hash = &tv - case MemoTypeMemoReturn: - tv, ok := value.(Hash) - if !ok { - err = errors.New("invalid value, must be Hash") - return - } - result.RetHash = &tv - } - return -} - -// MustText retrieves the Text value from the union, -// panicing if the value is not set. -func (u Memo) MustText() string { - val, ok := u.GetText() - - if !ok { - panic("arm Text is not set") - } - - return val -} - -// GetText retrieves the Text value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u Memo) GetText() (result string, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "Text" { - result = *u.Text - ok = true - } - - return +// discriminant is stored +func (u Preconditions) SwitchFieldName() string { + return "Type" } -// MustId retrieves the Id value from the union, -// panicing if the value is not set. -func (u Memo) MustId() Uint64 { - val, ok := u.GetId() - - if !ok { - panic("arm Id is not set") +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of Preconditions +func (u Preconditions) ArmForSwitch(sw int32) (string, bool) { + switch PreconditionType(sw) { + case PreconditionTypePrecondNone: + return "", true + case PreconditionTypePrecondTime: + return "TimeBounds", true + case PreconditionTypePrecondV2: + return "V2", true } - - return val + return "-", false } -// GetId retrieves the Id value from the union, -// returning ok if the union's switch indicated the value is valid. -func (u Memo) GetId() (result Uint64, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) - - if armName == "Id" { - result = *u.Id - ok = true +// NewPreconditions creates a new Preconditions. +func NewPreconditions(aType PreconditionType, value interface{}) (result Preconditions, err error) { + result.Type = aType + switch PreconditionType(aType) { + case PreconditionTypePrecondNone: + // void + case PreconditionTypePrecondTime: + tv, ok := value.(TimeBounds) + if !ok { + err = errors.New("invalid value, must be TimeBounds") + return + } + result.TimeBounds = &tv + case PreconditionTypePrecondV2: + tv, ok := value.(PreconditionsV2) + if !ok { + err = errors.New("invalid value, must be PreconditionsV2") + return + } + result.V2 = &tv } - return } -// MustHash retrieves the Hash value from the union, +// MustTimeBounds retrieves the TimeBounds value from the union, // panicing if the value is not set. -func (u Memo) MustHash() Hash { - val, ok := u.GetHash() +func (u Preconditions) MustTimeBounds() TimeBounds { + val, ok := u.GetTimeBounds() if !ok { - panic("arm Hash is not set") + panic("arm TimeBounds is not set") } return val } -// GetHash retrieves the Hash value from the union, +// GetTimeBounds retrieves the TimeBounds value from the union, // returning ok if the union's switch indicated the value is valid. -func (u Memo) GetHash() (result Hash, ok bool) { +func (u Preconditions) GetTimeBounds() (result TimeBounds, ok bool) { armName, _ := u.ArmForSwitch(int32(u.Type)) - if armName == "Hash" { - result = *u.Hash + if armName == "TimeBounds" { + result = *u.TimeBounds ok = true } return } -// MustRetHash retrieves the RetHash value from the union, +// MustV2 retrieves the V2 value from the union, // panicing if the value is not set. -func (u Memo) MustRetHash() Hash { - val, ok := u.GetRetHash() +func (u Preconditions) MustV2() PreconditionsV2 { + val, ok := u.GetV2() if !ok { - panic("arm RetHash is not set") + panic("arm V2 is not set") } return val } -// GetRetHash retrieves the RetHash value from the union, +// GetV2 retrieves the V2 value from the union, // returning ok if the union's switch indicated the value is valid. -func (u Memo) GetRetHash() (result Hash, ok bool) { +func (u Preconditions) GetV2() (result PreconditionsV2, ok bool) { armName, _ := u.ArmForSwitch(int32(u.Type)) - if armName == "RetHash" { - result = *u.RetHash + if armName == "V2" { + result = *u.V2 ok = true } @@ -31923,45 +34062,35 @@ func (u Memo) GetRetHash() (result Hash, ok bool) { } // EncodeTo encodes this value using the Encoder. -func (u Memo) EncodeTo(e *xdr.Encoder) error { +func (u Preconditions) EncodeTo(e *xdr.Encoder) error { var err error if err = u.Type.EncodeTo(e); err != nil { return err } - switch MemoType(u.Type) { - case MemoTypeMemoNone: + switch PreconditionType(u.Type) { + case PreconditionTypePrecondNone: // Void return nil - case MemoTypeMemoText: - if _, err = e.EncodeString(string((*u.Text))); err != nil { - return err - } - return nil - case MemoTypeMemoId: - if err = (*u.Id).EncodeTo(e); err != nil { - return err - } - return nil - case MemoTypeMemoHash: - if err = (*u.Hash).EncodeTo(e); err != nil { + case PreconditionTypePrecondTime: + if err = (*u.TimeBounds).EncodeTo(e); err != nil { return err } return nil - case MemoTypeMemoReturn: - if err = (*u.RetHash).EncodeTo(e); err != nil { + case PreconditionTypePrecondV2: + if err = (*u.V2).EncodeTo(e); err != nil { return err } return nil } - return fmt.Errorf("Type (MemoType) switch value '%d' is not valid for union Memo", u.Type) + return fmt.Errorf("Type (PreconditionType) switch value '%d' is not valid for union Preconditions", u.Type) } -var _ decoderFrom = (*Memo)(nil) +var _ decoderFrom = (*Preconditions)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *Memo) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *Preconditions) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding Memo: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding Preconditions: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -31969,50 +34098,34 @@ func (u *Memo) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { nTmp, err = u.Type.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding MemoType: %w", err) + return n, fmt.Errorf("decoding PreconditionType: %w", err) } - switch MemoType(u.Type) { - case MemoTypeMemoNone: + switch PreconditionType(u.Type) { + case PreconditionTypePrecondNone: // Void return n, nil - case MemoTypeMemoText: - u.Text = new(string) - (*u.Text), nTmp, err = d.DecodeString(28) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Text: %w", err) - } - return n, nil - case MemoTypeMemoId: - u.Id = new(Uint64) - nTmp, err = (*u.Id).DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) - } - return n, nil - case MemoTypeMemoHash: - u.Hash = new(Hash) - nTmp, err = (*u.Hash).DecodeFrom(d, maxDepth) + case PreconditionTypePrecondTime: + u.TimeBounds = new(TimeBounds) + nTmp, err = (*u.TimeBounds).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) + return n, fmt.Errorf("decoding TimeBounds: %w", err) } return n, nil - case MemoTypeMemoReturn: - u.RetHash = new(Hash) - nTmp, err = (*u.RetHash).DecodeFrom(d, maxDepth) + case PreconditionTypePrecondV2: + u.V2 = new(PreconditionsV2) + nTmp, err = (*u.V2).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Hash: %w", err) + return n, fmt.Errorf("decoding PreconditionsV2: %w", err) } return n, nil } - return n, fmt.Errorf("union Memo has invalid Type (MemoType) switch value '%d'", u.Type) + return n, fmt.Errorf("union Preconditions has invalid Type (PreconditionType) switch value '%d'", u.Type) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s Memo) MarshalBinary() ([]byte, error) { +func (s Preconditions) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -32020,7 +34133,7 @@ func (s Memo) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *Memo) UnmarshalBinary(inp []byte) error { +func (s *Preconditions) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -32030,64 +34143,103 @@ func (s *Memo) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*Memo)(nil) - _ encoding.BinaryUnmarshaler = (*Memo)(nil) + _ encoding.BinaryMarshaler = (*Preconditions)(nil) + _ encoding.BinaryUnmarshaler = (*Preconditions)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s Memo) xdrType() {} +func (s Preconditions) xdrType() {} -var _ xdrType = (*Memo)(nil) +var _ xdrType = (*Preconditions)(nil) -// TimeBounds is an XDR Struct defines as: +// LedgerFootprint is an XDR Struct defines as: // -// struct TimeBounds +// struct LedgerFootprint // { -// TimePoint minTime; -// TimePoint maxTime; // 0 here means no maxTime +// LedgerKey readOnly<>; +// LedgerKey readWrite<>; // }; -type TimeBounds struct { - MinTime TimePoint - MaxTime TimePoint +type LedgerFootprint struct { + ReadOnly []LedgerKey + ReadWrite []LedgerKey } // EncodeTo encodes this value using the Encoder. -func (s *TimeBounds) EncodeTo(e *xdr.Encoder) error { +func (s *LedgerFootprint) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.MinTime.EncodeTo(e); err != nil { + if _, err = e.EncodeUint(uint32(len(s.ReadOnly))); err != nil { return err } - if err = s.MaxTime.EncodeTo(e); err != nil { + for i := 0; i < len(s.ReadOnly); i++ { + if err = s.ReadOnly[i].EncodeTo(e); err != nil { + return err + } + } + if _, err = e.EncodeUint(uint32(len(s.ReadWrite))); err != nil { return err } + for i := 0; i < len(s.ReadWrite); i++ { + if err = s.ReadWrite[i].EncodeTo(e); err != nil { + return err + } + } return nil } -var _ decoderFrom = (*TimeBounds)(nil) +var _ decoderFrom = (*LedgerFootprint)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *TimeBounds) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *LedgerFootprint) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding TimeBounds: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding LedgerFootprint: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.MinTime.DecodeFrom(d, maxDepth) + var l uint32 + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding TimePoint: %w", err) + return n, fmt.Errorf("decoding LedgerKey: %w", err) } - nTmp, err = s.MaxTime.DecodeFrom(d, maxDepth) + s.ReadOnly = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding LedgerKey: length (%d) exceeds remaining input length (%d)", l, il) + } + s.ReadOnly = make([]LedgerKey, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.ReadOnly[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerKey: %w", err) + } + } + } + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding TimePoint: %w", err) + return n, fmt.Errorf("decoding LedgerKey: %w", err) + } + s.ReadWrite = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding LedgerKey: length (%d) exceeds remaining input length (%d)", l, il) + } + s.ReadWrite = make([]LedgerKey, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.ReadWrite[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerKey: %w", err) + } + } } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s TimeBounds) MarshalBinary() ([]byte, error) { +func (s LedgerFootprint) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -32095,7 +34247,7 @@ func (s TimeBounds) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *TimeBounds) UnmarshalBinary(inp []byte) error { +func (s *LedgerFootprint) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -32105,64 +34257,152 @@ func (s *TimeBounds) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*TimeBounds)(nil) - _ encoding.BinaryUnmarshaler = (*TimeBounds)(nil) + _ encoding.BinaryMarshaler = (*LedgerFootprint)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerFootprint)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s TimeBounds) xdrType() {} +func (s LedgerFootprint) xdrType() {} -var _ xdrType = (*TimeBounds)(nil) +var _ xdrType = (*LedgerFootprint)(nil) -// LedgerBounds is an XDR Struct defines as: +// ArchivalProofType is an XDR Enum defines as: // -// struct LedgerBounds +// enum ArchivalProofType // { -// uint32 minLedger; -// uint32 maxLedger; // 0 here means no maxLedger +// EXISTENCE = 0, +// NONEXISTENCE = 1 // }; -type LedgerBounds struct { - MinLedger Uint32 - MaxLedger Uint32 +type ArchivalProofType int32 + +const ( + ArchivalProofTypeExistence ArchivalProofType = 0 + ArchivalProofTypeNonexistence ArchivalProofType = 1 +) + +var archivalProofTypeMap = map[int32]string{ + 0: "ArchivalProofTypeExistence", + 1: "ArchivalProofTypeNonexistence", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for ArchivalProofType +func (e ArchivalProofType) ValidEnum(v int32) bool { + _, ok := archivalProofTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e ArchivalProofType) String() string { + name, _ := archivalProofTypeMap[int32(e)] + return name } // EncodeTo encodes this value using the Encoder. -func (s *LedgerBounds) EncodeTo(e *xdr.Encoder) error { +func (e ArchivalProofType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := archivalProofTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid ArchivalProofType enum value", e) + } + _, err := enc.EncodeInt(int32(e)) + return err +} + +var _ decoderFrom = (*ArchivalProofType)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (e *ArchivalProofType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding ArchivalProofType: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + v, n, err := d.DecodeInt() + if err != nil { + return n, fmt.Errorf("decoding ArchivalProofType: %w", err) + } + if _, ok := archivalProofTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid ArchivalProofType enum value", v) + } + *e = ArchivalProofType(v) + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s ArchivalProofType) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *ArchivalProofType) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*ArchivalProofType)(nil) + _ encoding.BinaryUnmarshaler = (*ArchivalProofType)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s ArchivalProofType) xdrType() {} + +var _ xdrType = (*ArchivalProofType)(nil) + +// ArchivalProofNode is an XDR Struct defines as: +// +// struct ArchivalProofNode +// { +// uint32 index; +// Hash hash; +// }; +type ArchivalProofNode struct { + Index Uint32 + Hash Hash +} + +// EncodeTo encodes this value using the Encoder. +func (s *ArchivalProofNode) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.MinLedger.EncodeTo(e); err != nil { + if err = s.Index.EncodeTo(e); err != nil { return err } - if err = s.MaxLedger.EncodeTo(e); err != nil { + if err = s.Hash.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*LedgerBounds)(nil) +var _ decoderFrom = (*ArchivalProofNode)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *LedgerBounds) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ArchivalProofNode) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerBounds: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ArchivalProofNode: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.MinLedger.DecodeFrom(d, maxDepth) + nTmp, err = s.Index.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.MaxLedger.DecodeFrom(d, maxDepth) + nTmp, err = s.Hash.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + return n, fmt.Errorf("decoding Hash: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerBounds) MarshalBinary() ([]byte, error) { +func (s ArchivalProofNode) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -32170,7 +34410,7 @@ func (s LedgerBounds) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerBounds) UnmarshalBinary(inp []byte) error { +func (s *ArchivalProofNode) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -32180,185 +34420,178 @@ func (s *LedgerBounds) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerBounds)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerBounds)(nil) + _ encoding.BinaryMarshaler = (*ArchivalProofNode)(nil) + _ encoding.BinaryUnmarshaler = (*ArchivalProofNode)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerBounds) xdrType() {} +func (s ArchivalProofNode) xdrType() {} -var _ xdrType = (*LedgerBounds)(nil) +var _ xdrType = (*ArchivalProofNode)(nil) -// PreconditionsV2 is an XDR Struct defines as: -// -// 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; -// -// // If NULL, only valid when sourceAccount's sequence number -// // is seqNum - 1. Otherwise, valid when sourceAccount's -// // sequence number n satisfies minSeqNum <= n < tx.seqNum. -// // 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; -// -// // For the transaction to be valid, the current ledger time must -// // be at least minSeqAge greater than sourceAccount's seqTime. -// Duration minSeqAge; -// -// // For the transaction to be valid, the current ledger number -// // must be at least minSeqLedgerGap greater than sourceAccount's -// // seqLedger. -// uint32 minSeqLedgerGap; +// ProofLevel is an XDR Typedef defines as: // -// // For the transaction to be valid, there must be a signature -// // corresponding to every Signer in this array, even if the -// // signature is not otherwise required by the sourceAccount or -// // operations. -// SignerKey extraSigners<2>; -// }; -type PreconditionsV2 struct { - TimeBounds *TimeBounds - LedgerBounds *LedgerBounds - MinSeqNum *SequenceNumber - MinSeqAge Duration - MinSeqLedgerGap Uint32 - ExtraSigners []SignerKey `xdrmaxsize:"2"` -} +// typedef ArchivalProofNode ProofLevel<>; +type ProofLevel []ArchivalProofNode // EncodeTo encodes this value using the Encoder. -func (s *PreconditionsV2) EncodeTo(e *xdr.Encoder) error { +func (s ProofLevel) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeBool(s.TimeBounds != nil); err != nil { + if _, err = e.EncodeUint(uint32(len(s))); err != nil { return err } - if s.TimeBounds != nil { - if err = (*s.TimeBounds).EncodeTo(e); err != nil { + for i := 0; i < len(s); i++ { + if err = s[i].EncodeTo(e); err != nil { return err } } - if _, err = e.EncodeBool(s.LedgerBounds != nil); err != nil { - return err + return nil +} + +var _ decoderFrom = (*ProofLevel)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *ProofLevel) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding ProofLevel: %w", ErrMaxDecodingDepthReached) } - if s.LedgerBounds != nil { - if err = (*s.LedgerBounds).EncodeTo(e); err != nil { - return err + maxDepth -= 1 + var err error + var n, nTmp int + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ArchivalProofNode: %w", err) + } + (*s) = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding ArchivalProofNode: length (%d) exceeds remaining input length (%d)", l, il) + } + (*s) = make([]ArchivalProofNode, l) + for i := uint32(0); i < l; i++ { + nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ArchivalProofNode: %w", err) + } } } - if _, err = e.EncodeBool(s.MinSeqNum != nil); err != nil { + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s ProofLevel) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *ProofLevel) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*ProofLevel)(nil) + _ encoding.BinaryUnmarshaler = (*ProofLevel)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s ProofLevel) xdrType() {} + +var _ xdrType = (*ProofLevel)(nil) + +// NonexistenceProofBody is an XDR Struct defines as: +// +// struct NonexistenceProofBody +// { +// ColdArchiveBucketEntry entriesToProve<>; +// +// // Vector of vectors, where proofLevels[level] +// // contains all HashNodes that correspond with that level +// ProofLevel proofLevels<>; +// }; +type NonexistenceProofBody struct { + EntriesToProve []ColdArchiveBucketEntry + ProofLevels []ProofLevel +} + +// EncodeTo encodes this value using the Encoder. +func (s *NonexistenceProofBody) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeUint(uint32(len(s.EntriesToProve))); err != nil { return err } - if s.MinSeqNum != nil { - if err = (*s.MinSeqNum).EncodeTo(e); err != nil { + for i := 0; i < len(s.EntriesToProve); i++ { + if err = s.EntriesToProve[i].EncodeTo(e); err != nil { return err } } - if err = s.MinSeqAge.EncodeTo(e); err != nil { - return err - } - if err = s.MinSeqLedgerGap.EncodeTo(e); err != nil { + if _, err = e.EncodeUint(uint32(len(s.ProofLevels))); err != nil { return err } - if _, err = e.EncodeUint(uint32(len(s.ExtraSigners))); err != nil { - return err - } - for i := 0; i < len(s.ExtraSigners); i++ { - if err = s.ExtraSigners[i].EncodeTo(e); err != nil { + for i := 0; i < len(s.ProofLevels); i++ { + if err = s.ProofLevels[i].EncodeTo(e); err != nil { return err } } return nil } -var _ decoderFrom = (*PreconditionsV2)(nil) +var _ decoderFrom = (*NonexistenceProofBody)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *PreconditionsV2) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *NonexistenceProofBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding PreconditionsV2: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding NonexistenceProofBody: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - var b bool - b, nTmp, err = d.DecodeBool() - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TimeBounds: %w", err) - } - s.TimeBounds = nil - if b { - s.TimeBounds = new(TimeBounds) - nTmp, err = s.TimeBounds.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding TimeBounds: %w", err) - } - } - b, nTmp, err = d.DecodeBool() - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerBounds: %w", err) - } - s.LedgerBounds = nil - if b { - s.LedgerBounds = new(LedgerBounds) - nTmp, err = s.LedgerBounds.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerBounds: %w", err) - } - } - b, nTmp, err = d.DecodeBool() - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding SequenceNumber: %w", err) - } - s.MinSeqNum = nil - if b { - s.MinSeqNum = new(SequenceNumber) - nTmp, err = s.MinSeqNum.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding SequenceNumber: %w", err) - } - } - nTmp, err = s.MinSeqAge.DecodeFrom(d, maxDepth) + var l uint32 + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding Duration: %w", err) + return n, fmt.Errorf("decoding ColdArchiveBucketEntry: %w", err) } - nTmp, err = s.MinSeqLedgerGap.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint32: %w", err) + s.EntriesToProve = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding ColdArchiveBucketEntry: length (%d) exceeds remaining input length (%d)", l, il) + } + s.EntriesToProve = make([]ColdArchiveBucketEntry, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.EntriesToProve[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ColdArchiveBucketEntry: %w", err) + } + } } - var l uint32 l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding SignerKey: %w", err) - } - if l > 2 { - return n, fmt.Errorf("decoding SignerKey: data size (%d) exceeds size limit (2)", l) + return n, fmt.Errorf("decoding ProofLevel: %w", err) } - s.ExtraSigners = nil + s.ProofLevels = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding SignerKey: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding ProofLevel: length (%d) exceeds remaining input length (%d)", l, il) } - s.ExtraSigners = make([]SignerKey, l) + s.ProofLevels = make([]ProofLevel, l) for i := uint32(0); i < l; i++ { - nTmp, err = s.ExtraSigners[i].DecodeFrom(d, maxDepth) + nTmp, err = s.ProofLevels[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding SignerKey: %w", err) + return n, fmt.Errorf("decoding ProofLevel: %w", err) } } } @@ -32366,7 +34599,7 @@ func (s *PreconditionsV2) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s PreconditionsV2) MarshalBinary() ([]byte, error) { +func (s NonexistenceProofBody) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -32374,7 +34607,7 @@ func (s PreconditionsV2) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *PreconditionsV2) UnmarshalBinary(inp []byte) error { +func (s *NonexistenceProofBody) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -32384,80 +34617,167 @@ func (s *PreconditionsV2) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*PreconditionsV2)(nil) - _ encoding.BinaryUnmarshaler = (*PreconditionsV2)(nil) + _ encoding.BinaryMarshaler = (*NonexistenceProofBody)(nil) + _ encoding.BinaryUnmarshaler = (*NonexistenceProofBody)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s PreconditionsV2) xdrType() {} +func (s NonexistenceProofBody) xdrType() {} -var _ xdrType = (*PreconditionsV2)(nil) +var _ xdrType = (*NonexistenceProofBody)(nil) -// PreconditionType is an XDR Enum defines as: +// ExistenceProofBody is an XDR Struct defines as: // -// enum PreconditionType +// struct ExistenceProofBody // { -// PRECOND_NONE = 0, -// PRECOND_TIME = 1, -// PRECOND_V2 = 2 +// LedgerKey keysToProve<>; +// +// // Bounds for each key being proved, where bound[n] +// // corresponds to keysToProve[n] +// ColdArchiveBucketEntry lowBoundEntries<>; +// ColdArchiveBucketEntry highBoundEntries<>; +// +// // Vector of vectors, where proofLevels[level] +// // contains all HashNodes that correspond with that level +// ProofLevel proofLevels<>; // }; -type PreconditionType int32 - -const ( - PreconditionTypePrecondNone PreconditionType = 0 - PreconditionTypePrecondTime PreconditionType = 1 - PreconditionTypePrecondV2 PreconditionType = 2 -) - -var preconditionTypeMap = map[int32]string{ - 0: "PreconditionTypePrecondNone", - 1: "PreconditionTypePrecondTime", - 2: "PreconditionTypePrecondV2", -} - -// ValidEnum validates a proposed value for this enum. Implements -// the Enum interface for PreconditionType -func (e PreconditionType) ValidEnum(v int32) bool { - _, ok := preconditionTypeMap[v] - return ok -} - -// String returns the name of `e` -func (e PreconditionType) String() string { - name, _ := preconditionTypeMap[int32(e)] - return name +type ExistenceProofBody struct { + KeysToProve []LedgerKey + LowBoundEntries []ColdArchiveBucketEntry + HighBoundEntries []ColdArchiveBucketEntry + ProofLevels []ProofLevel } // EncodeTo encodes this value using the Encoder. -func (e PreconditionType) EncodeTo(enc *xdr.Encoder) error { - if _, ok := preconditionTypeMap[int32(e)]; !ok { - return fmt.Errorf("'%d' is not a valid PreconditionType enum value", e) +func (s *ExistenceProofBody) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeUint(uint32(len(s.KeysToProve))); err != nil { + return err } - _, err := enc.EncodeInt(int32(e)) - return err + for i := 0; i < len(s.KeysToProve); i++ { + if err = s.KeysToProve[i].EncodeTo(e); err != nil { + return err + } + } + if _, err = e.EncodeUint(uint32(len(s.LowBoundEntries))); err != nil { + return err + } + for i := 0; i < len(s.LowBoundEntries); i++ { + if err = s.LowBoundEntries[i].EncodeTo(e); err != nil { + return err + } + } + if _, err = e.EncodeUint(uint32(len(s.HighBoundEntries))); err != nil { + return err + } + for i := 0; i < len(s.HighBoundEntries); i++ { + if err = s.HighBoundEntries[i].EncodeTo(e); err != nil { + return err + } + } + if _, err = e.EncodeUint(uint32(len(s.ProofLevels))); err != nil { + return err + } + for i := 0; i < len(s.ProofLevels); i++ { + if err = s.ProofLevels[i].EncodeTo(e); err != nil { + return err + } + } + return nil } -var _ decoderFrom = (*PreconditionType)(nil) +var _ decoderFrom = (*ExistenceProofBody)(nil) // DecodeFrom decodes this value using the Decoder. -func (e *PreconditionType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ExistenceProofBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding PreconditionType: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ExistenceProofBody: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 - v, n, err := d.DecodeInt() + var err error + var n, nTmp int + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp if err != nil { - return n, fmt.Errorf("decoding PreconditionType: %w", err) + return n, fmt.Errorf("decoding LedgerKey: %w", err) } - if _, ok := preconditionTypeMap[v]; !ok { - return n, fmt.Errorf("'%d' is not a valid PreconditionType enum value", v) + s.KeysToProve = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding LedgerKey: length (%d) exceeds remaining input length (%d)", l, il) + } + s.KeysToProve = make([]LedgerKey, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.KeysToProve[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerKey: %w", err) + } + } + } + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ColdArchiveBucketEntry: %w", err) + } + s.LowBoundEntries = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding ColdArchiveBucketEntry: length (%d) exceeds remaining input length (%d)", l, il) + } + s.LowBoundEntries = make([]ColdArchiveBucketEntry, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.LowBoundEntries[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ColdArchiveBucketEntry: %w", err) + } + } + } + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ColdArchiveBucketEntry: %w", err) + } + s.HighBoundEntries = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding ColdArchiveBucketEntry: length (%d) exceeds remaining input length (%d)", l, il) + } + s.HighBoundEntries = make([]ColdArchiveBucketEntry, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.HighBoundEntries[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ColdArchiveBucketEntry: %w", err) + } + } + } + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ProofLevel: %w", err) + } + s.ProofLevels = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding ProofLevel: length (%d) exceeds remaining input length (%d)", l, il) + } + s.ProofLevels = make([]ProofLevel, l) + for i := uint32(0); i < l; i++ { + nTmp, err = s.ProofLevels[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ProofLevel: %w", err) + } + } } - *e = PreconditionType(v) return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s PreconditionType) MarshalBinary() ([]byte, error) { +func (s ExistenceProofBody) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -32465,7 +34785,7 @@ func (s PreconditionType) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *PreconditionType) UnmarshalBinary(inp []byte) error { +func (s *ExistenceProofBody) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -32475,120 +34795,114 @@ func (s *PreconditionType) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*PreconditionType)(nil) - _ encoding.BinaryUnmarshaler = (*PreconditionType)(nil) + _ encoding.BinaryMarshaler = (*ExistenceProofBody)(nil) + _ encoding.BinaryUnmarshaler = (*ExistenceProofBody)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s PreconditionType) xdrType() {} +func (s ExistenceProofBody) xdrType() {} -var _ xdrType = (*PreconditionType)(nil) +var _ xdrType = (*ExistenceProofBody)(nil) -// Preconditions is an XDR Union defines as: +// ArchivalProofBody is an XDR NestedUnion defines as: // -// union Preconditions switch (PreconditionType type) -// { -// case PRECOND_NONE: -// void; -// case PRECOND_TIME: -// TimeBounds timeBounds; -// case PRECOND_V2: -// PreconditionsV2 v2; -// }; -type Preconditions struct { - Type PreconditionType - TimeBounds *TimeBounds - V2 *PreconditionsV2 +// union switch (ArchivalProofType t) +// { +// case EXISTENCE: +// NonexistenceProofBody nonexistenceProof; +// case NONEXISTENCE: +// ExistenceProofBody existenceProof; +// } +type ArchivalProofBody struct { + T ArchivalProofType + NonexistenceProof *NonexistenceProofBody + ExistenceProof *ExistenceProofBody } // SwitchFieldName returns the field name in which this union's // discriminant is stored -func (u Preconditions) SwitchFieldName() string { - return "Type" +func (u ArchivalProofBody) SwitchFieldName() string { + return "T" } // ArmForSwitch returns which field name should be used for storing -// the value for an instance of Preconditions -func (u Preconditions) ArmForSwitch(sw int32) (string, bool) { - switch PreconditionType(sw) { - case PreconditionTypePrecondNone: - return "", true - case PreconditionTypePrecondTime: - return "TimeBounds", true - case PreconditionTypePrecondV2: - return "V2", true +// the value for an instance of ArchivalProofBody +func (u ArchivalProofBody) ArmForSwitch(sw int32) (string, bool) { + switch ArchivalProofType(sw) { + case ArchivalProofTypeExistence: + return "NonexistenceProof", true + case ArchivalProofTypeNonexistence: + return "ExistenceProof", true } return "-", false } -// NewPreconditions creates a new Preconditions. -func NewPreconditions(aType PreconditionType, value interface{}) (result Preconditions, err error) { - result.Type = aType - switch PreconditionType(aType) { - case PreconditionTypePrecondNone: - // void - case PreconditionTypePrecondTime: - tv, ok := value.(TimeBounds) +// NewArchivalProofBody creates a new ArchivalProofBody. +func NewArchivalProofBody(t ArchivalProofType, value interface{}) (result ArchivalProofBody, err error) { + result.T = t + switch ArchivalProofType(t) { + case ArchivalProofTypeExistence: + tv, ok := value.(NonexistenceProofBody) if !ok { - err = errors.New("invalid value, must be TimeBounds") + err = errors.New("invalid value, must be NonexistenceProofBody") return } - result.TimeBounds = &tv - case PreconditionTypePrecondV2: - tv, ok := value.(PreconditionsV2) + result.NonexistenceProof = &tv + case ArchivalProofTypeNonexistence: + tv, ok := value.(ExistenceProofBody) if !ok { - err = errors.New("invalid value, must be PreconditionsV2") + err = errors.New("invalid value, must be ExistenceProofBody") return } - result.V2 = &tv + result.ExistenceProof = &tv } return } -// MustTimeBounds retrieves the TimeBounds value from the union, +// MustNonexistenceProof retrieves the NonexistenceProof value from the union, // panicing if the value is not set. -func (u Preconditions) MustTimeBounds() TimeBounds { - val, ok := u.GetTimeBounds() +func (u ArchivalProofBody) MustNonexistenceProof() NonexistenceProofBody { + val, ok := u.GetNonexistenceProof() if !ok { - panic("arm TimeBounds is not set") + panic("arm NonexistenceProof is not set") } return val } -// GetTimeBounds retrieves the TimeBounds value from the union, +// GetNonexistenceProof retrieves the NonexistenceProof value from the union, // returning ok if the union's switch indicated the value is valid. -func (u Preconditions) GetTimeBounds() (result TimeBounds, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) +func (u ArchivalProofBody) GetNonexistenceProof() (result NonexistenceProofBody, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.T)) - if armName == "TimeBounds" { - result = *u.TimeBounds + if armName == "NonexistenceProof" { + result = *u.NonexistenceProof ok = true } return } -// MustV2 retrieves the V2 value from the union, +// MustExistenceProof retrieves the ExistenceProof value from the union, // panicing if the value is not set. -func (u Preconditions) MustV2() PreconditionsV2 { - val, ok := u.GetV2() +func (u ArchivalProofBody) MustExistenceProof() ExistenceProofBody { + val, ok := u.GetExistenceProof() if !ok { - panic("arm V2 is not set") + panic("arm ExistenceProof is not set") } return val } -// GetV2 retrieves the V2 value from the union, +// GetExistenceProof retrieves the ExistenceProof value from the union, // returning ok if the union's switch indicated the value is valid. -func (u Preconditions) GetV2() (result PreconditionsV2, ok bool) { - armName, _ := u.ArmForSwitch(int32(u.Type)) +func (u ArchivalProofBody) GetExistenceProof() (result ExistenceProofBody, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.T)) - if armName == "V2" { - result = *u.V2 + if armName == "ExistenceProof" { + result = *u.ExistenceProof ok = true } @@ -32596,70 +34910,64 @@ func (u Preconditions) GetV2() (result PreconditionsV2, ok bool) { } // EncodeTo encodes this value using the Encoder. -func (u Preconditions) EncodeTo(e *xdr.Encoder) error { +func (u ArchivalProofBody) EncodeTo(e *xdr.Encoder) error { var err error - if err = u.Type.EncodeTo(e); err != nil { + if err = u.T.EncodeTo(e); err != nil { return err } - switch PreconditionType(u.Type) { - case PreconditionTypePrecondNone: - // Void - return nil - case PreconditionTypePrecondTime: - if err = (*u.TimeBounds).EncodeTo(e); err != nil { + switch ArchivalProofType(u.T) { + case ArchivalProofTypeExistence: + if err = (*u.NonexistenceProof).EncodeTo(e); err != nil { return err } return nil - case PreconditionTypePrecondV2: - if err = (*u.V2).EncodeTo(e); err != nil { + case ArchivalProofTypeNonexistence: + if err = (*u.ExistenceProof).EncodeTo(e); err != nil { return err } return nil } - return fmt.Errorf("Type (PreconditionType) switch value '%d' is not valid for union Preconditions", u.Type) + return fmt.Errorf("T (ArchivalProofType) switch value '%d' is not valid for union ArchivalProofBody", u.T) } -var _ decoderFrom = (*Preconditions)(nil) +var _ decoderFrom = (*ArchivalProofBody)(nil) // DecodeFrom decodes this value using the Decoder. -func (u *Preconditions) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (u *ArchivalProofBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding Preconditions: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ArchivalProofBody: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = u.Type.DecodeFrom(d, maxDepth) + nTmp, err = u.T.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding PreconditionType: %w", err) + return n, fmt.Errorf("decoding ArchivalProofType: %w", err) } - switch PreconditionType(u.Type) { - case PreconditionTypePrecondNone: - // Void - return n, nil - case PreconditionTypePrecondTime: - u.TimeBounds = new(TimeBounds) - nTmp, err = (*u.TimeBounds).DecodeFrom(d, maxDepth) + switch ArchivalProofType(u.T) { + case ArchivalProofTypeExistence: + u.NonexistenceProof = new(NonexistenceProofBody) + nTmp, err = (*u.NonexistenceProof).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding TimeBounds: %w", err) + return n, fmt.Errorf("decoding NonexistenceProofBody: %w", err) } return n, nil - case PreconditionTypePrecondV2: - u.V2 = new(PreconditionsV2) - nTmp, err = (*u.V2).DecodeFrom(d, maxDepth) + case ArchivalProofTypeNonexistence: + u.ExistenceProof = new(ExistenceProofBody) + nTmp, err = (*u.ExistenceProof).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding PreconditionsV2: %w", err) + return n, fmt.Errorf("decoding ExistenceProofBody: %w", err) } return n, nil } - return n, fmt.Errorf("union Preconditions has invalid Type (PreconditionType) switch value '%d'", u.Type) + return n, fmt.Errorf("union ArchivalProofBody has invalid T (ArchivalProofType) switch value '%d'", u.T) } // MarshalBinary implements encoding.BinaryMarshaler. -func (s Preconditions) MarshalBinary() ([]byte, error) { +func (s ArchivalProofBody) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -32667,7 +34975,7 @@ func (s Preconditions) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *Preconditions) UnmarshalBinary(inp []byte) error { +func (s *ArchivalProofBody) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -32677,103 +34985,71 @@ func (s *Preconditions) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*Preconditions)(nil) - _ encoding.BinaryUnmarshaler = (*Preconditions)(nil) + _ encoding.BinaryMarshaler = (*ArchivalProofBody)(nil) + _ encoding.BinaryUnmarshaler = (*ArchivalProofBody)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s Preconditions) xdrType() {} +func (s ArchivalProofBody) xdrType() {} -var _ xdrType = (*Preconditions)(nil) +var _ xdrType = (*ArchivalProofBody)(nil) -// LedgerFootprint is an XDR Struct defines as: +// ArchivalProof is an XDR Struct defines as: // -// struct LedgerFootprint +// struct ArchivalProof // { -// LedgerKey readOnly<>; -// LedgerKey readWrite<>; +// uint32 epoch; // AST Subtree for this proof +// +// union switch (ArchivalProofType t) +// { +// case EXISTENCE: +// NonexistenceProofBody nonexistenceProof; +// case NONEXISTENCE: +// ExistenceProofBody existenceProof; +// } body; // }; -type LedgerFootprint struct { - ReadOnly []LedgerKey - ReadWrite []LedgerKey +type ArchivalProof struct { + Epoch Uint32 + Body ArchivalProofBody } // EncodeTo encodes this value using the Encoder. -func (s *LedgerFootprint) EncodeTo(e *xdr.Encoder) error { +func (s *ArchivalProof) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeUint(uint32(len(s.ReadOnly))); err != nil { + if err = s.Epoch.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s.ReadOnly); i++ { - if err = s.ReadOnly[i].EncodeTo(e); err != nil { - return err - } - } - if _, err = e.EncodeUint(uint32(len(s.ReadWrite))); err != nil { + if err = s.Body.EncodeTo(e); err != nil { return err } - for i := 0; i < len(s.ReadWrite); i++ { - if err = s.ReadWrite[i].EncodeTo(e); err != nil { - return err - } - } return nil } -var _ decoderFrom = (*LedgerFootprint)(nil) +var _ decoderFrom = (*ArchivalProof)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *LedgerFootprint) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *ArchivalProof) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding LedgerFootprint: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding ArchivalProof: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - var l uint32 - l, nTmp, err = d.DecodeUint() + nTmp, err = s.Epoch.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerKey: %w", err) - } - s.ReadOnly = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding LedgerKey: length (%d) exceeds remaining input length (%d)", l, il) - } - s.ReadOnly = make([]LedgerKey, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.ReadOnly[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerKey: %w", err) - } - } + return n, fmt.Errorf("decoding Uint32: %w", err) } - l, nTmp, err = d.DecodeUint() + nTmp, err = s.Body.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding LedgerKey: %w", err) - } - s.ReadWrite = nil - if l > 0 { - if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding LedgerKey: length (%d) exceeds remaining input length (%d)", l, il) - } - s.ReadWrite = make([]LedgerKey, l) - for i := uint32(0); i < l; i++ { - nTmp, err = s.ReadWrite[i].DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding LedgerKey: %w", err) - } - } + return n, fmt.Errorf("decoding ArchivalProofBody: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s LedgerFootprint) MarshalBinary() ([]byte, error) { +func (s ArchivalProof) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -32781,7 +35057,7 @@ func (s LedgerFootprint) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *LedgerFootprint) UnmarshalBinary(inp []byte) error { +func (s *ArchivalProof) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -32791,14 +35067,14 @@ func (s *LedgerFootprint) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*LedgerFootprint)(nil) - _ encoding.BinaryUnmarshaler = (*LedgerFootprint)(nil) + _ encoding.BinaryMarshaler = (*ArchivalProof)(nil) + _ encoding.BinaryUnmarshaler = (*ArchivalProof)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s LedgerFootprint) xdrType() {} +func (s ArchivalProof) xdrType() {} -var _ xdrType = (*LedgerFootprint)(nil) +var _ xdrType = (*ArchivalProof)(nil) // SorobanResources is an XDR Struct defines as: // @@ -48935,6 +51211,313 @@ func (s HmacSha256Mac) xdrType() {} var _ xdrType = (*HmacSha256Mac)(nil) +// ShortHashSeed is an XDR Struct defines as: +// +// struct ShortHashSeed +// { +// opaque seed[16]; +// }; +type ShortHashSeed struct { + Seed [16]byte `xdrmaxsize:"16"` +} + +// EncodeTo encodes this value using the Encoder. +func (s *ShortHashSeed) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeFixedOpaque(s.Seed[:]); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*ShortHashSeed)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *ShortHashSeed) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding ShortHashSeed: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = d.DecodeFixedOpaqueInplace(s.Seed[:]) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Seed: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s ShortHashSeed) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *ShortHashSeed) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*ShortHashSeed)(nil) + _ encoding.BinaryUnmarshaler = (*ShortHashSeed)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s ShortHashSeed) xdrType() {} + +var _ xdrType = (*ShortHashSeed)(nil) + +// BinaryFuseFilterType is an XDR Enum defines as: +// +// enum BinaryFuseFilterType +// { +// BINARY_FUSE_FILTER_8_BIT = 0, +// BINARY_FUSE_FILTER_16_BIT = 1, +// BINARY_FUSE_FILTER_32_BIT = 2 +// }; +type BinaryFuseFilterType int32 + +const ( + BinaryFuseFilterTypeBinaryFuseFilter8Bit BinaryFuseFilterType = 0 + BinaryFuseFilterTypeBinaryFuseFilter16Bit BinaryFuseFilterType = 1 + BinaryFuseFilterTypeBinaryFuseFilter32Bit BinaryFuseFilterType = 2 +) + +var binaryFuseFilterTypeMap = map[int32]string{ + 0: "BinaryFuseFilterTypeBinaryFuseFilter8Bit", + 1: "BinaryFuseFilterTypeBinaryFuseFilter16Bit", + 2: "BinaryFuseFilterTypeBinaryFuseFilter32Bit", +} + +// ValidEnum validates a proposed value for this enum. Implements +// the Enum interface for BinaryFuseFilterType +func (e BinaryFuseFilterType) ValidEnum(v int32) bool { + _, ok := binaryFuseFilterTypeMap[v] + return ok +} + +// String returns the name of `e` +func (e BinaryFuseFilterType) String() string { + name, _ := binaryFuseFilterTypeMap[int32(e)] + return name +} + +// EncodeTo encodes this value using the Encoder. +func (e BinaryFuseFilterType) EncodeTo(enc *xdr.Encoder) error { + if _, ok := binaryFuseFilterTypeMap[int32(e)]; !ok { + return fmt.Errorf("'%d' is not a valid BinaryFuseFilterType enum value", e) + } + _, err := enc.EncodeInt(int32(e)) + return err +} + +var _ decoderFrom = (*BinaryFuseFilterType)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (e *BinaryFuseFilterType) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding BinaryFuseFilterType: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + v, n, err := d.DecodeInt() + if err != nil { + return n, fmt.Errorf("decoding BinaryFuseFilterType: %w", err) + } + if _, ok := binaryFuseFilterTypeMap[v]; !ok { + return n, fmt.Errorf("'%d' is not a valid BinaryFuseFilterType enum value", v) + } + *e = BinaryFuseFilterType(v) + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s BinaryFuseFilterType) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *BinaryFuseFilterType) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*BinaryFuseFilterType)(nil) + _ encoding.BinaryUnmarshaler = (*BinaryFuseFilterType)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s BinaryFuseFilterType) xdrType() {} + +var _ xdrType = (*BinaryFuseFilterType)(nil) + +// SerializedBinaryFuseFilter is an XDR Struct defines as: +// +// struct SerializedBinaryFuseFilter +// { +// BinaryFuseFilterType type; +// +// // Seed used to hash input to filter +// ShortHashSeed inputHashSeed; +// +// // Seed used for internal filter hash operations +// ShortHashSeed filterSeed; +// uint32 segmentLength; +// uint32 segementLengthMask; +// uint32 segmentCount; +// uint32 segmentCountLength; +// uint32 fingerprintLength; // Length in terms of element count, not bytes +// +// // Array of uint8_t, uint16_t, or uint32_t depending on filter type +// opaque fingerprints<>; +// }; +type SerializedBinaryFuseFilter struct { + Type BinaryFuseFilterType + InputHashSeed ShortHashSeed + FilterSeed ShortHashSeed + SegmentLength Uint32 + SegementLengthMask Uint32 + SegmentCount Uint32 + SegmentCountLength Uint32 + FingerprintLength Uint32 + Fingerprints []byte +} + +// EncodeTo encodes this value using the Encoder. +func (s *SerializedBinaryFuseFilter) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Type.EncodeTo(e); err != nil { + return err + } + if err = s.InputHashSeed.EncodeTo(e); err != nil { + return err + } + if err = s.FilterSeed.EncodeTo(e); err != nil { + return err + } + if err = s.SegmentLength.EncodeTo(e); err != nil { + return err + } + if err = s.SegementLengthMask.EncodeTo(e); err != nil { + return err + } + if err = s.SegmentCount.EncodeTo(e); err != nil { + return err + } + if err = s.SegmentCountLength.EncodeTo(e); err != nil { + return err + } + if err = s.FingerprintLength.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeOpaque(s.Fingerprints[:]); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*SerializedBinaryFuseFilter)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *SerializedBinaryFuseFilter) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SerializedBinaryFuseFilter: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Type.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding BinaryFuseFilterType: %w", err) + } + nTmp, err = s.InputHashSeed.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ShortHashSeed: %w", err) + } + nTmp, err = s.FilterSeed.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ShortHashSeed: %w", err) + } + nTmp, err = s.SegmentLength.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.SegementLengthMask.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.SegmentCount.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.SegmentCountLength.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.FingerprintLength.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + s.Fingerprints, nTmp, err = d.DecodeOpaque(0) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Fingerprints: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SerializedBinaryFuseFilter) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SerializedBinaryFuseFilter) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*SerializedBinaryFuseFilter)(nil) + _ encoding.BinaryUnmarshaler = (*SerializedBinaryFuseFilter)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SerializedBinaryFuseFilter) xdrType() {} + +var _ xdrType = (*SerializedBinaryFuseFilter)(nil) + // ScEnvMetaKind is an XDR Enum defines as: // // enum SCEnvMetaKind