getTransactionHistory method

Future<List<TransactionInformation>> getTransactionHistory(
  1. EthereumAddress address, {
  2. required int pageIndex,
  3. required int pageSize,
  4. required bool fullTx,
  5. required String txType,
  6. required String order,
})

Returns the transactions history for an address address.

Implementation

Future<List<TransactionInformation>> getTransactionHistory(
    EthereumAddress address,
    {required int pageIndex,
    required int pageSize,
    required bool fullTx,
    required String txType,
    required String order}) {
  final params = <String, dynamic>{
    'address': address.hex,
    'pageIndex': pageIndex,
    'pageSize': pageSize,
    'fullTx': fullTx,
    'txType': txType,
    'order': order
  };
  return makeRPCCall<Map<String, dynamic>>(
      'eth_getTransactionsHistory', [params]).then((response) {
    final transactions = response['transactions'] as List<dynamic>;
    return transactions
        .map((transaction) => TransactionInformation.fromMap(
            transaction as Map<String, dynamic>))
        .toList();
  });
}