Interface XdrElement

All Known Implementing Classes:
AccountEntry, AccountEntry.AccountEntryExt, AccountEntryExtensionV1, AccountEntryExtensionV1.AccountEntryExtensionV1Ext, AccountEntryExtensionV2, AccountEntryExtensionV2.AccountEntryExtensionV2Ext, AccountEntryExtensionV3, AccountFlags, AccountID, AccountMergeResult, AccountMergeResultCode, AllowTrustOp, AllowTrustResult, AllowTrustResultCode, AlphaNum12, AlphaNum4, Asset, AssetCode, AssetCode12, AssetCode4, AssetType, Auth, AuthCert, AuthenticatedMessage, AuthenticatedMessage.AuthenticatedMessageV0, BeginSponsoringFutureReservesOp, BeginSponsoringFutureReservesResult, BeginSponsoringFutureReservesResultCode, BinaryFuseFilterType, BucketEntry, BucketEntryType, BucketListType, BucketMetadata, BucketMetadata.BucketMetadataExt, BumpSequenceOp, BumpSequenceResult, BumpSequenceResultCode, ChangeTrustAsset, ChangeTrustOp, ChangeTrustResult, ChangeTrustResultCode, ClaimableBalanceEntry, ClaimableBalanceEntry.ClaimableBalanceEntryExt, ClaimableBalanceEntryExtensionV1, ClaimableBalanceEntryExtensionV1.ClaimableBalanceEntryExtensionV1Ext, ClaimableBalanceFlags, ClaimableBalanceID, ClaimableBalanceIDType, Claimant, Claimant.ClaimantV0, ClaimantType, ClaimAtom, ClaimAtomType, ClaimClaimableBalanceOp, ClaimClaimableBalanceResult, ClaimClaimableBalanceResultCode, ClaimLiquidityAtom, ClaimOfferAtom, ClaimOfferAtomV0, ClaimPredicate, ClaimPredicateType, ClawbackClaimableBalanceOp, ClawbackClaimableBalanceResult, ClawbackClaimableBalanceResultCode, ClawbackOp, ClawbackResult, ClawbackResultCode, ConfigSettingContractBandwidthV0, ConfigSettingContractComputeV0, ConfigSettingContractEventsV0, ConfigSettingContractExecutionLanesV0, ConfigSettingContractHistoricalDataV0, ConfigSettingContractLedgerCostExtV0, ConfigSettingContractLedgerCostV0, ConfigSettingContractParallelComputeV0, ConfigSettingEntry, ConfigSettingID, ConfigSettingSCPTiming, ConfigUpgradeSet, ConfigUpgradeSetKey, ContractCodeCostInputs, ContractCodeEntry, ContractCodeEntry.ContractCodeEntryExt, ContractCodeEntry.ContractCodeEntryExt.ContractCodeEntryV1, ContractCostParamEntry, ContractCostParams, ContractCostType, ContractDataDurability, ContractDataEntry, ContractEvent, ContractEvent.ContractEventBody, ContractEvent.ContractEventBody.ContractEventV0, ContractEventType, ContractExecutable, ContractExecutableType, ContractID, ContractIDPreimage, ContractIDPreimage.ContractIDPreimageFromAddress, ContractIDPreimageType, CreateAccountOp, CreateAccountResult, CreateAccountResultCode, CreateClaimableBalanceOp, CreateClaimableBalanceResult, CreateClaimableBalanceResultCode, CreateContractArgs, CreateContractArgsV2, CreatePassiveSellOfferOp, CryptoKeyType, Curve25519Public, Curve25519Secret, DataEntry, DataEntry.DataEntryExt, DataValue, DecoratedSignature, DependentTxCluster, DiagnosticEvent, DontHave, Duration, EncodedLedgerKey, EncryptedBody, EndSponsoringFutureReservesResult, EndSponsoringFutureReservesResultCode, EnvelopeType, Error, ErrorCode, EvictionIterator, ExtendFootprintTTLOp, ExtendFootprintTTLResult, ExtendFootprintTTLResultCode, ExtensionPoint, FeeBumpTransaction, FeeBumpTransaction.FeeBumpTransactionExt, FeeBumpTransaction.FeeBumpTransactionInnerTx, FeeBumpTransactionEnvelope, FloodAdvert, FloodDemand, FreezeBypassTxs, FreezeBypassTxsDelta, FrozenLedgerKeys, FrozenLedgerKeysDelta, GeneralizedTransactionSet, Hash, HashIDPreimage, HashIDPreimage.HashIDPreimageContractID, HashIDPreimage.HashIDPreimageOperationID, HashIDPreimage.HashIDPreimageRevokeID, HashIDPreimage.HashIDPreimageSorobanAuthorization, HashIDPreimage.HashIDPreimageSorobanAuthorizationWithAddress, Hello, HmacSha256Key, HmacSha256Mac, HostFunction, HostFunctionType, HotArchiveBucketEntry, HotArchiveBucketEntryType, InflationPayout, InflationResult, InflationResultCode, InnerTransactionResult, InnerTransactionResult.InnerTransactionResultExt, InnerTransactionResult.InnerTransactionResultResult, InnerTransactionResultPair, Int128Parts, Int256Parts, Int32, Int64, InvokeContractArgs, InvokeHostFunctionOp, InvokeHostFunctionResult, InvokeHostFunctionResultCode, InvokeHostFunctionSuccessPreImage, IPAddrType, LedgerBounds, LedgerCloseMeta, LedgerCloseMetaBatch, LedgerCloseMetaExt, LedgerCloseMetaExtV1, LedgerCloseMetaV0, LedgerCloseMetaV1, LedgerCloseMetaV2, LedgerCloseValueSignature, LedgerEntry, LedgerEntry.LedgerEntryData, LedgerEntry.LedgerEntryExt, LedgerEntryChange, LedgerEntryChanges, LedgerEntryChangeType, LedgerEntryExtensionV1, LedgerEntryExtensionV1.LedgerEntryExtensionV1Ext, LedgerEntryType, LedgerFootprint, LedgerHeader, LedgerHeader.LedgerHeaderExt, LedgerHeaderExtensionV1, LedgerHeaderExtensionV1.LedgerHeaderExtensionV1Ext, LedgerHeaderFlags, LedgerHeaderHistoryEntry, LedgerHeaderHistoryEntry.LedgerHeaderHistoryEntryExt, LedgerKey, LedgerKey.LedgerKeyAccount, LedgerKey.LedgerKeyClaimableBalance, LedgerKey.LedgerKeyConfigSetting, LedgerKey.LedgerKeyContractCode, LedgerKey.LedgerKeyContractData, LedgerKey.LedgerKeyData, LedgerKey.LedgerKeyLiquidityPool, LedgerKey.LedgerKeyOffer, LedgerKey.LedgerKeyTrustLine, LedgerKey.LedgerKeyTtl, LedgerSCPMessages, LedgerUpgrade, LedgerUpgradeType, Liabilities, LiquidityPoolConstantProductParameters, LiquidityPoolDepositOp, LiquidityPoolDepositResult, LiquidityPoolDepositResultCode, LiquidityPoolEntry, LiquidityPoolEntry.LiquidityPoolEntryBody, LiquidityPoolEntry.LiquidityPoolEntryBody.LiquidityPoolEntryConstantProduct, LiquidityPoolParameters, LiquidityPoolType, LiquidityPoolWithdrawOp, LiquidityPoolWithdrawResult, LiquidityPoolWithdrawResultCode, ManageBuyOfferOp, ManageBuyOfferResult, ManageBuyOfferResultCode, ManageDataOp, ManageDataResult, ManageDataResultCode, ManageOfferEffect, ManageOfferSuccessResult, ManageOfferSuccessResult.ManageOfferSuccessResultOffer, ManageSellOfferOp, ManageSellOfferResult, ManageSellOfferResultCode, Memo, MemoType, MessageType, MuxedAccount, MuxedAccount.MuxedAccountMed25519, MuxedEd25519Account, NodeID, OfferEntry, OfferEntry.OfferEntryExt, OfferEntryFlags, Operation, Operation.OperationBody, OperationMeta, OperationMetaV2, OperationResult, OperationResult.OperationResultTr, OperationResultCode, OperationType, ParallelTxExecutionStage, ParallelTxsComponent, PathPaymentStrictReceiveOp, PathPaymentStrictReceiveResult, PathPaymentStrictReceiveResult.PathPaymentStrictReceiveResultSuccess, PathPaymentStrictReceiveResultCode, PathPaymentStrictSendOp, PathPaymentStrictSendResult, PathPaymentStrictSendResult.PathPaymentStrictSendResultSuccess, PathPaymentStrictSendResultCode, PaymentOp, PaymentResult, PaymentResultCode, PeerAddress, PeerAddress.PeerAddressIp, PeerStats, PersistedSCPState, PersistedSCPStateV0, PersistedSCPStateV1, PoolID, Preconditions, PreconditionsV2, PreconditionType, Price, PublicKey, PublicKeyType, RestoreFootprintOp, RestoreFootprintResult, RestoreFootprintResultCode, RevokeSponsorshipOp, RevokeSponsorshipOp.RevokeSponsorshipOpSigner, RevokeSponsorshipResult, RevokeSponsorshipResultCode, RevokeSponsorshipType, SCAddress, SCAddressType, SCBytes, SCContractInstance, SCEnvMetaEntry, SCEnvMetaEntry.SCEnvMetaEntryInterfaceVersion, SCEnvMetaKind, SCError, SCErrorCode, SCErrorType, SCMap, SCMapEntry, SCMetaEntry, SCMetaKind, SCMetaV0, SCNonceKey, SCPBallot, SCPEnvelope, SCPHistoryEntry, SCPHistoryEntryV0, SCPNomination, SCPQuorumSet, SCPStatement, SCPStatement.SCPStatementPledges, SCPStatement.SCPStatementPledges.SCPStatementConfirm, SCPStatement.SCPStatementPledges.SCPStatementExternalize, SCPStatement.SCPStatementPledges.SCPStatementPrepare, SCPStatementType, SCSpecEntry, SCSpecEntryKind, SCSpecEventDataFormat, SCSpecEventParamLocationV0, SCSpecEventParamV0, SCSpecEventV0, SCSpecFunctionInputV0, SCSpecFunctionV0, SCSpecType, SCSpecTypeBytesN, SCSpecTypeDef, SCSpecTypeMap, SCSpecTypeOption, SCSpecTypeResult, SCSpecTypeTuple, SCSpecTypeUDT, SCSpecTypeVec, SCSpecUDTEnumCaseV0, SCSpecUDTEnumV0, SCSpecUDTErrorEnumCaseV0, SCSpecUDTErrorEnumV0, SCSpecUDTStructFieldV0, SCSpecUDTStructV0, SCSpecUDTUnionCaseTupleV0, SCSpecUDTUnionCaseV0, SCSpecUDTUnionCaseV0Kind, SCSpecUDTUnionCaseVoidV0, SCSpecUDTUnionV0, SCString, SCSymbol, SCVal, SCValType, SCVec, SendMore, SendMoreExtended, SequenceNumber, SerializedBinaryFuseFilter, SetOptionsOp, SetOptionsResult, SetOptionsResultCode, SetTrustLineFlagsOp, SetTrustLineFlagsResult, SetTrustLineFlagsResultCode, ShortHashSeed, Signature, SignatureHint, SignedTimeSlicedSurveyRequestMessage, SignedTimeSlicedSurveyResponseMessage, SignedTimeSlicedSurveyStartCollectingMessage, SignedTimeSlicedSurveyStopCollectingMessage, Signer, SignerKey, SignerKey.SignerKeyEd25519SignedPayload, SignerKeyType, SimplePaymentResult, SorobanAddressCredentials, SorobanAddressCredentialsWithDelegates, SorobanAuthorizationEntries, SorobanAuthorizationEntry, SorobanAuthorizedFunction, SorobanAuthorizedFunctionType, SorobanAuthorizedInvocation, SorobanCredentials, SorobanCredentialsType, SorobanDelegateSignature, SorobanResources, SorobanResourcesExtV0, SorobanTransactionData, SorobanTransactionData.SorobanTransactionDataExt, SorobanTransactionMeta, SorobanTransactionMetaExt, SorobanTransactionMetaExtV1, SorobanTransactionMetaV2, SponsorshipDescriptor, StateArchivalSettings, StellarMessage, StellarValue, StellarValue.StellarValueExt, StellarValueType, StoredDebugTransactionSet, StoredTransactionSet, String32, String64, SurveyMessageCommandType, SurveyMessageResponseType, SurveyRequestMessage, SurveyResponseBody, SurveyResponseMessage, ThresholdIndexes, Thresholds, TimeBounds, TimePoint, TimeSlicedNodeData, TimeSlicedPeerData, TimeSlicedPeerDataList, TimeSlicedSurveyRequestMessage, TimeSlicedSurveyResponseMessage, TimeSlicedSurveyStartCollectingMessage, TimeSlicedSurveyStopCollectingMessage, TopologyResponseBodyV2, Transaction, Transaction.TransactionExt, TransactionEnvelope, TransactionEvent, TransactionEventStage, TransactionHistoryEntry, TransactionHistoryEntry.TransactionHistoryEntryExt, TransactionHistoryResultEntry, TransactionHistoryResultEntry.TransactionHistoryResultEntryExt, TransactionMeta, TransactionMetaV1, TransactionMetaV2, TransactionMetaV3, TransactionMetaV4, TransactionPhase, TransactionResult, TransactionResult.TransactionResultExt, TransactionResult.TransactionResultResult, TransactionResultCode, TransactionResultMeta, TransactionResultMetaV1, TransactionResultPair, TransactionResultSet, TransactionSet, TransactionSetV1, TransactionSignaturePayload, TransactionSignaturePayload.TransactionSignaturePayloadTaggedTransaction, TransactionV0, TransactionV0.TransactionV0Ext, TransactionV0Envelope, TransactionV1Envelope, TrustLineAsset, TrustLineEntry, TrustLineEntry.TrustLineEntryExt, TrustLineEntry.TrustLineEntryExt.TrustLineEntryV1, TrustLineEntry.TrustLineEntryExt.TrustLineEntryV1.TrustLineEntryV1Ext, TrustLineEntryExtensionV2, TrustLineEntryExtensionV2.TrustLineEntryExtensionV2Ext, TrustLineFlags, TTLEntry, TxAdvertVector, TxDemandVector, TxSetComponent, TxSetComponent.TxSetComponentTxsMaybeDiscountedFee, TxSetComponentType, UInt128Parts, Uint256, UInt256Parts, Uint32, Uint64, UpgradeEntryMeta, UpgradeType, Value, XdrString, XdrUnsignedHyperInteger, XdrUnsignedInteger

public interface XdrElement
Common parent interface for all generated classes.
  • Field Details

    • gson

      static final com.google.gson.Gson gson
      Shared Gson instance used by generated XDR classes for JSON serialization.
  • Method Details

    • encode

      void encode(XdrDataOutputStream stream) throws IOException
      Encodes this value to XDR and writes it to the provided stream.
      Parameters:
      stream - the destination XDR output stream
      Throws:
      IOException - if an I/O error occurs while writing the value
    • toXdrBase64

      default String toXdrBase64() throws IOException
      Encodes this value to XDR and returns the base64-encoded result.
      Returns:
      the base64-encoded XDR representation
      Throws:
      IOException - if an I/O error occurs while encoding the value
    • toXdrByteArray

      default byte[] toXdrByteArray() throws IOException
      Encodes this value to XDR and returns the raw bytes.
      Returns:
      the raw XDR byte representation
      Throws:
      IOException - if an I/O error occurs while encoding the value
    • toJson

      String toJson()
      Serializes this value to JSON.
      Returns:
      the JSON representation of this value
    • bytesToHex

      static String bytesToHex(byte[] bytes)
      Returns the lowercase hexadecimal representation of a byte array.
      Parameters:
      bytes - the bytes to encode
      Returns:
      the lowercase hexadecimal representation
    • hexToBytes

      static byte[] hexToBytes(String hex)
      Decodes a hexadecimal string into bytes.
      Parameters:
      hex - the hexadecimal string to decode
      Returns:
      the decoded bytes
      Throws:
      IllegalArgumentException - if the input length is odd or contains non-hex characters
    • bytesToEscapedAscii

      static String bytesToEscapedAscii(byte[] data)
      Converts a byte array to an escaped ASCII string suitable for JSON serialization.
      Parameters:
      data - the bytes to encode
      Returns:
      the escaped ASCII representation
    • escapedAsciiToBytes

      static byte[] escapedAsciiToBytes(String s)
      Decodes an escaped ASCII string produced by bytesToEscapedAscii(byte[]).
      Parameters:
      s - the escaped ASCII string to decode
      Returns:
      the decoded bytes
      Throws:
      IllegalArgumentException - if the input contains invalid escape sequences or characters
    • jsonToLong

      static long jsonToLong(Object json)
      Converts a JSON scalar into a Java long.
      Parameters:
      json - the JSON value to convert
      Returns:
      the converted long value
      Throws:
      IllegalArgumentException - if the JSON value is not a string or number
    • jsonToBigInteger

      static BigInteger jsonToBigInteger(Object json)
      Converts a JSON scalar into a BigInteger.
      Parameters:
      json - the JSON value to convert
      Returns:
      the converted BigInteger value
      Throws:
      IllegalArgumentException - if the JSON value is not a string or number
    • arrayToJsonArray

      static <T> List<Object> arrayToJsonArray(T[] array, IntFunction<Object> mapper)
      Converts a Java array into a JSON array using the provided mapper.
      Type Parameters:
      T - the Java element type
      Parameters:
      array - the array to convert
      mapper - maps each element index to a JSON-compatible value
      Returns:
      the converted JSON array
    • jsonArrayToArray

      static <T> T[] jsonArrayToArray(List<Object> list, Class<T> clazz, Function<Object,T> mapper)
      Converts a JSON array into a Java array using the provided mapper.
      Type Parameters:
      T - the Java element type
      Parameters:
      list - the JSON array to convert
      clazz - the Java array component type
      mapper - maps each JSON value to the target Java type
      Returns:
      the converted Java array