TxRep

public final class TxRep : Sendable

TxRep is a human-readable text format for Stellar transactions.

TxRep provides a readable low-level representation of Stellar transactions that can be used for debugging, auditing, or manual transaction construction. It converts between the standard base64-encoded XDR format and a human-readable key-value format.

Example:

let txEnvelopeXdr = "AAAAAC..." // Base64 XDR
let txRep = try TxRep.toTxRep(transactionEnvelope: txEnvelopeXdr)
// Returns human-readable format:
// type: ENVELOPE_TYPE_TX
// tx.sourceAccount: GBZX...
// tx.fee: 100
// ...

// Convert back to XDR
let xdrAgain = try TxRep.fromTxRep(txRep: txRep)

See: SEP-0011 for the TxRep specification.

  • Undocumented

    Declaration

    Swift

    public init()
  • Converts a transaction envelope XDR to TxRep format.

    Takes a base64-encoded transaction envelope XDR and converts it to a human-readable TxRep representation. Supports V0, V1, and fee-bump envelopes per SEP-0011.

    Throws

    TxRepError if the XDR cannot be parsed.

    Declaration

    Swift

    public static func toTxRep(transactionEnvelope: String) throws -> String

    Parameters

    transactionEnvelope

    Base64-encoded transaction envelope XDR.

    Return Value

    Human-readable TxRep string with key-value pairs, lines separated by \n.

  • Converts a TxRep string to a base64-encoded transaction envelope XDR.

    Parses the human-readable TxRep representation and encodes the result as a base64-encoded XDR transaction envelope. Supports V0, V1, and fee-bump envelopes. Handles legacy preconditions format and unsigned transactions.

    Throws

    TxRepError on missing or invalid values.

    Declaration

    Swift

    public static func fromTxRep(txRep: String) throws -> String

    Parameters

    txRep

    Human-readable TxRep string.

    Return Value

    Base64-encoded transaction envelope XDR.