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 both regular transactions and fee bump transactions.
Throws
TxRepError if the XDR cannot be parsedExample:
let xdr = "AAAAAC..." // Base64 XDR let txRep = try TxRep.toTxRep(transactionEnvelope: xdr) print(txRep) // Output: // type: ENVELOPE_TYPE_TX // tx.sourceAccount: GBZX... // tx.fee: 100 // ...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
-
This function parses txrep and returns the corresponding transaction envelope xdr (base64 encoded)
Declaration
Swift
public static func fromTxRep(txRep: String) throws -> StringParameters
txRephuman-readable low-level representation of Stellar transaction to be parsed
Return Value
base64 encoded transaction envelope xdr
View on GitHub
Install in Dash