wait For Transaction
open suspend override fun waitForTransaction(transactionHash: HexInput, options: WaitForTransactionOptions): Result<TransactionResponse, Exception>
Waits for a transaction to be successfully processed and included in the blockchain.
Usage
val hash = HexInput.fromString("0x...")
val resolution = aptos.waitForTransaction(hash)
when (resolution) {
is Result.Ok -> {
val transaction = resolution.value
println("Transaction confirmed in version ${transaction.version}")
}
is Result.Err -> {
println("Error waiting for transaction: ${resolution.error.message}")
}
}Content copied to clipboard
Return
A Result containing the confirmed TransactionResponse or an Exception.
Parameters
transaction Hash
The hash of the transaction to wait for.
options
Optional configuration for the wait, such as timeout.