get Transaction By Version
abstract suspend fun getTransactionByVersion(ledgerVersion: Long): Result<TransactionResponse, AptosSdkError>
Retrieves a committed on-chain transaction by its version number.
Usage
val resolution = aptos.getTransactionByVersion(123456789)
when (resolution) {
is Result.Ok -> {
val transaction = resolution.value
println("Transaction hash: ${transaction.hash}")
}
is Result.Err -> {
println("Error fetching transaction: ${resolution.error.message}")
}
}Content copied to clipboard
Return
A Result containing the TransactionResponse or an AptosSdkError.
Parameters
ledger Version
The version of the transaction to retrieve.