poll Transaction
suspend fun pollTransaction(hash: String, maxAttempts: Int = 30, sleepStrategy: (Int) -> Long = { 1000L }): GetTransactionResponse
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
)Content copied to clipboard
Return
Final transaction response (may still be NOT_FOUND if max attempts reached)
Parameters
hash
Transaction hash as hex string
max Attempts
Maximum number of polling attempts (default: 30)
sleep Strategy
Function mapping attempt number to sleep duration in milliseconds
Throws
If maxAttempts is less than or equal to 0
If any RPC request fails