TransactionResponse
public struct TransactionResponse : Decodable, Sendable
Represents a transaction on the Stellar network with all its details and metadata.
Contains complete transaction information including operations, fees, signatures, source account, and XDR-encoded transaction data. Returned when querying transaction details or lists from Horizon.
A transaction is a collection of operations that are atomically applied to the ledger. If any operation fails, the entire transaction fails and no changes are made.
Example usage:
let sdk = StellarSDK()
let response = await sdk.transactions.getTransactionDetails(transactionHash: "abc123...")
switch response {
case .success(let tx):
print("Transaction Hash: \(tx.transactionHash)")
print("Source Account: \(tx.sourceAccount)")
print("Fee Charged: \(tx.feeCharged ?? "N/A") stroops")
print("Operations: \(tx.operationCount)")
print("Ledger: \(tx.ledger)")
if let memo = tx.memo {
print("Memo: \(memo)")
}
// Check if fee bump transaction
if let feeBump = tx.feeBumpTransactionResponse {
print("Fee Bump Hash: \(feeBump.transactionHash)")
}
case .failure(let error):
print("Error: \(error)")
}
See also:
- Stellar developer docs
- TransactionsService for querying transactions
-
Navigation links related to this transaction (self, account, ledger, operations, effects, precedes, succeeds).
Declaration
Swift
public let links: TransactionLinksResponse -
Unique identifier for this transaction in Horizon’s database.
Declaration
Swift
public let id: String -
Paging token for cursor-based pagination.
Declaration
Swift
public let pagingToken: String -
Hex-encoded SHA-256 hash of the transaction’s XDR-encoded form. This is the transaction ID.
Declaration
Swift
public let transactionHash: String -
Ledger sequence number in which this transaction was included and applied.
Declaration
Swift
public let ledger: Int -
Timestamp when this transaction was included in the ledger (ISO 8601).
Declaration
Swift
public let createdAt: Date -
Account ID (public key) that originated this transaction.
Declaration
Swift
public let sourceAccount: String -
Multiplexed account address if the source account uses muxed accounts. Nil otherwise.
Declaration
Swift
public let sourceAccountMuxed: String? -
Muxed account ID component if the source account uses muxed accounts. Nil otherwise.
Declaration
Swift
public let sourceAccountMuxedId: String? -
Sequence number of the source account when this transaction was submitted.
Declaration
Swift
public let sourceAccountSequence: String -
Maximum fee (in stroops) the source account was willing to pay for this transaction.
Declaration
Swift
public let maxFee: String? -
Actual fee (in stroops) charged for this transaction. May be less than maxFee.
Declaration
Swift
public let feeCharged: String? -
Account that paid the transaction fee. Usually same as source account unless fee bump was used.
Declaration
Swift
public let feeAccount: String -
Multiplexed account address if the fee account uses muxed accounts. Nil otherwise.
Declaration
Swift
public let feeAccountMuxed: String? -
Muxed account ID component if the fee account uses muxed accounts. Nil otherwise.
Declaration
Swift
public let feeAccountMuxedId: String? -
Number of operations contained in this transaction.
Declaration
Swift
public let operationCount: Int -
Type of memo attached to this transaction: “none”, “text”, “id”, “hash”, or “return”.
Declaration
Swift
public let memoType: String -
Parsed memo object. Nil for memo type “none”.
Declaration
Swift
public let memo: Memo? -
Array of base64-encoded signatures (decorated signatures) for this transaction.
Declaration
Swift
public let signatures: [String] -
Complete transaction envelope containing the transaction and all signatures (XDR decoded).
Declaration
Swift
public let transactionEnvelope: TransactionEnvelopeXDR -
Result of transaction execution indicating success or specific error codes (XDR decoded).
Declaration
Swift
public let transactionResult: TransactionResultXDR -
Metadata about ledger state changes caused by this transaction (XDR decoded). Nil if not available.
Declaration
Swift
public let transactionMeta: TransactionMetaXDR? -
Metadata about ledger changes from paying the transaction fee (XDR decoded). Nil if not available.
Declaration
Swift
public let feeMeta: LedgerEntryChangesXDR? -
Details about the fee bump transaction if this transaction was wrapped in a fee bump. Nil otherwise.
Declaration
Swift
public let feeBumpTransactionResponse: FeeBumpTransactionResponse? -
Details about the inner transaction if this response is for a fee bump transaction. Nil otherwise.
Declaration
Swift
public let innerTransactionResponse: InnerTransactionResponse? -
Preconditions that must be met for this transaction to be valid (time bounds, ledger bounds, etc.). Nil if none.
Declaration
Swift
public let preconditions: TransactionPreconditionsResponse? -
Declaration
Swift
public init(from decoder: Decoder) throws
View on GitHub
Install in Dash