fetchERC20Transactions method

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

Fetch all ERC20 Transactions for a given token and address

Implementation

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

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