get Transaction By Hash
open suspend override fun getTransactionByHash(transactionHash: String): Result<TransactionResponse, AptosSdkError>
Retrieves a transaction by its hash.
Note: This function can return both pending (mempool) and committed transactions.
Usage
val hash = "0x..."
val resolution = aptos.getTransactionByHash(hash)
when (resolution) {
is Result.Ok -> {
val transaction = resolution.value
println("Transaction success status: ${transaction.success}")
}
is Result.Err -> {
println("Error fetching transaction: ${resolution.error.message}")
}
}Content copied to clipboard
Return
A Result containing the TransactionResponse or an AptosSdkError.
Parameters
transaction Hash
The hex-encoded hash of the transaction.