getAllTransactions function

List<TransactionInfoRow> getAllTransactions()

Implementation

List<TransactionInfoRow> getAllTransactions() {
  final errorBoxPointer1 = monero_flutter.buildErrorBoxPointer();
  final size = monero_flutter.bindings.transactions_count(errorBoxPointer1);
  final errorInfo1 = monero_flutter.extractErrorInfo(errorBoxPointer1);

  if (0 != errorInfo1.code) {
    throw Exception(errorInfo1.getErrorMessage());
  }

  final errorBoxPointer2 = monero_flutter.buildErrorBoxPointer();
  final transactionsPointer =
      monero_flutter.bindings.transactions_get_all(errorBoxPointer2);
  final transactionsAddresses = transactionsPointer.asTypedList(size);
  final errorInfo2 = monero_flutter.extractErrorInfo(errorBoxPointer2);

  if (0 != errorInfo2.code) {
    throw Exception(errorInfo2.getErrorMessage());
  }

  var result = transactionsAddresses
      .map((addr) => Pointer<TransactionInfoRow>.fromAddress(addr).ref)
      .toList();

  monero_flutter.bindings.free_block_of_transactions(transactionsPointer, size);

  return result;
}