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
TxRepErrorif the XDR cannot be parsed.Declaration
Swift
public static func toTxRep(transactionEnvelope: String) throws -> StringParameters
transactionEnvelopeBase64-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
TxRepErroron missing or invalid values.Declaration
Swift
public static func fromTxRep(txRep: String) throws -> StringParameters
txRepHuman-readable TxRep string.
Return Value
Base64-encoded transaction envelope XDR.
View on GitHub
Install in Dash