SendTransactionResponse
public struct SendTransactionResponse : Decodable, Sendable
Response from submitting a transaction to the Stellar network.
After calling sendTransaction, this response indicates whether the transaction was accepted for processing. Note that acceptance does not mean the transaction has executed - you must poll with getTransaction to check final status.
Status values:
- PENDING: Transaction accepted and waiting to be included in a ledger
- DUPLICATE: Transaction already submitted (same hash exists)
- TRY_AGAIN_LATER: Server is busy, retry the submission
- ERROR: Transaction rejected (check error field for details)
After receiving a PENDING status, use getTransaction with the returned transactionId (hash) to poll for completion.
Example:
let sendResponse = await server.sendTransaction(transaction: signedTx)
switch sendResponse {
case .success(let result):
switch result.status {
case SendTransactionResponse.STATUS_PENDING:
print("Transaction submitted: \(result.transactionId)")
// Poll for status with getTransaction
case SendTransactionResponse.STATUS_ERROR:
print("Transaction rejected: \(result.error?.message ?? "unknown")")
default:
print("Status: \(result.status)")
}
case .failure(let error):
print("RPC error: \(error)")
}
See also:
- [SorobanServer.sendTransaction] for submitting transactions
- [GetTransactionResponse] for polling transaction status
- Stellar developer docs
-
Transaction pending in queue.
Declaration
Swift
public static let STATUS_PENDING: String -
Transaction is a duplicate submission.
Declaration
Swift
public static let STATUS_DUPLICATE: String -
Temporary failure, retry submission.
Declaration
Swift
public static let STATUS_TRY_AGAIN_LATER: String -
Transaction submission error.
Declaration
Swift
public static let STATUS_ERROR: String -
The transaction hash identifier.
Declaration
Swift
public let transactionId: String -
the current status of the transaction by hash, one of: PENDING, DUPLICATE, TRY_AGAIN_LATER, ERROR
Declaration
Swift
public let status: String -
The latest ledger known to Soroban-RPC at the time it handled the sendTransaction() request.
Declaration
Swift
public let latestLedger: Int -
The unix timestamp of the close time of the latest ledger known to Soroban-RPC at the time it handled the sendTransaction() request.
Declaration
Swift
public let latestLedgerCloseTime: String -
(optional) If the transaction was rejected immediately, this will be an error object.
Declaration
Swift
public let error: TransactionStatusError? -
(optional) If the transaction status is ERROR, this will be the raw TransactionResult XDR struct containing details on why stellar-core rejected the transaction.
Declaration
Swift
public let errorResult: TransactionResultXDR? -
Base64-encoded XDR of the transaction error result if the transaction failed.
Declaration
Swift
public let errorResultXdr: String? -
(optional) If the transaction status is ERROR, this field may be present. Each entry is a raw DiagnosticEvent XDR struct containing details on why stellar-core rejected the transaction.
Declaration
Swift
public let diagnosticEvents: [DiagnosticEventXDR]? -
Declaration
Swift
public init(from decoder: Decoder) throws
View on GitHub
Install in Dash