fetchTransactions method

Future<List<EtherscanTransaction>> fetchTransactions({
  1. required String address,
  2. int? startblock,
  3. int? endblock,
  4. int? page,
  5. int? offset,
  6. Sorting? sorting,
})

Fetch all Transactions for the given token on the given address

Implementation

Future<List<EtherscanTransaction>> fetchTransactions({
  required String address,
  int? startblock,
  int? endblock,
  int? page,
  int? offset,
  Sorting? sorting,
}) async {
  final endpoint = buildTransactionEndpoint(
    address: address,
    startblock: startblock,
    endblock: endblock,
    page: page,
    offset: offset,
    sorting: sorting,
  );

  final txResults = await fetchEtherscanWithRatelimitRetries(endpoint);
  return [
    for (final tx in txResults)
      EtherscanTransaction.fromJson(
        tx,
        token: currency,
        address: address,
      )
  ];
}