getTxnStatus method

Future<TransactionStatusResponse?> getTxnStatus(
  1. String txId
)

Implementation

Future<TransactionStatusResponse?> getTxnStatus(String txId) async {
  final resp = await _layer1ApiGet('/transactions/$txId');

  if (resp.statusCode == HttpStatus.ok) {
    final body = json.decode(resp.body);
    return TransactionStatusResponse.fromJson(body['data']);
  } else if (resp.statusCode == HttpStatus.notFound) {
    return null;
  }

  return Future.error(HttpResponseError(resp.statusCode, resp.body));
}