fetchBalance method

Future<BigInt> fetchBalance({
  1. required String address,
})

Implementation

Future<BigInt> fetchBalance({
  required String address,
}) async {
  final endpoint = buildBalanceEndpoint(address);
  final result = await fetchEtherscanWithRatelimitRetries<String>(endpoint);

  final balance = BigInt.tryParse(result);

  if (balance == null) {
    throw Exception('Failed to parse balance: $result');
  }

  return balance;
}