getAccountHistory method

Future<List<AccountHistoryEntry>> getAccountHistory(
  1. String accountName, {
  2. int start = 0,
  3. int size = 20,
  4. int? operationFilterLow,
  5. int? operationFilterHigh,
})

Implementation

Future<List<AccountHistoryEntry>> getAccountHistory(
  String accountName, {
  int start = 0,
  int size = 20,
  int? operationFilterLow,
  int? operationFilterHigh,
}) async {
  if (operationFilterHigh != null && operationFilterLow == null) {
    throw Exception(
      'Must set operationFilterLow if operationFilterHigh is set',
    );
  }
  final params = [accountName, start, size];
  if (operationFilterLow != null) {
    params.add(operationFilterLow);
  }
  if (operationFilterHigh != null) {
    params.add(operationFilterHigh);
  }

  final bodyJson = await _fetchPostData(
    method: 'condenser_api.get_account_history',
    params: params,
  );

  final json = bodyJson['result'] as List<dynamic>;

  // See samples/accounts_history.json
  return [
    for (final entry in json)
      AccountHistoryEntry.fromJson(entry as List<dynamic>)
  ];
}