poll Transaction
Polls for transaction completion.
Repeatedly calls getTransaction until the transaction reaches a final state (SUCCESS or FAILED) or the maximum attempts is reached.
Example
// Poll with defaults (30 attempts, 1 second between)
val result = server.pollTransaction(hash)
// Custom polling strategy
val result = server.pollTransaction(
hash = hash,
maxAttempts = 60,
sleepStrategy = { attempt -> (attempt * 500).toLong() } // Exponential backoff
)Failed attempts (network errors, RPC errors) are retried until maxAttempts is reached; only coroutine cancellation and fatal platform errors abort the poll early. When at least one attempt returned a response, the last response is returned even if later attempts failed. When every attempt failed, the last per-attempt failure is thrown.
Return
Final transaction response (may still be NOT_FOUND if max attempts reached)
Parameters
Transaction hash as hex string
Maximum number of polling attempts (default: 30)
Function mapping attempt number to sleep duration in milliseconds
Throws
If maxAttempts is less than or equal to 0
The last per-attempt failure when every polling attempt failed — e.g. SorobanRpcException for RPC errors or com.soneso.stellar.sdk.horizon.exceptions.ConnectionErrorException for connectivity failures