getHistoryTransaction function

Future<ForgedTransaction?> getHistoryTransaction(
  1. String transactionId
)

GET request to the /transactions-history/:transactionId endpoint. Returns a specific forged transaction @param {string} transactionId - The ID for the specific transaction @returns {object} Response data with the transaction

Implementation

Future<ForgedTransaction?> getHistoryTransaction(String transactionId) async {
  final response =
      await get(baseApiUrl, TRANSACTIONS_HISTORY_URL + '/' + transactionId);
  if (response.statusCode == 200) {
    final jsonResponse = await extractJSON(response);
    final ForgedTransaction forgedTransaction =
        ForgedTransaction.fromJson(json.decode(jsonResponse));
    return forgedTransaction;
  } else {
    return null;
  }
}