getTransaction method

Future<RosettaTransaction> getTransaction(
  1. String transactionHash
)

Return the Transaction object with the specified hash. @param {string} transactionHash The hash of the transaction to return. @returns {Transaction|null} The Transaction object with the specified hash, or a TransactionError for error.

Implementation

Future<RosettaTransaction> getTransaction(String transactionHash) async {
  final responseTransactions = await transactionsByHash(transactionHash);
  if (responseTransactions.transactions.isEmpty) {
    throw TransactionError('Transaction not found.', 500);
  }
  return RosettaTransaction(
    responseTransactions.transactions[0].transaction,
    responseTransactions.transactions[0].blockIdentifier.index,
  );
}