fetchTokenBalance method
Implementation
Future<BigInt> fetchTokenBalance({
required String address,
required String contractAddress,
}) async {
final endpoint = buildTokenBalanceEndpoint(address, contractAddress);
final result = await fetchEtherscanWithRatelimitRetries<String>(endpoint);
final balance = BigInt.tryParse(result);
if (balance == null) {
throw Exception('Failed to parse balance: $result');
}
return balance;
}