balanceOf method
balanceOf gets the balance of the given address
Implementation
Future<BigInt> balanceOf(String address) async {
final params = Args();
params.addString(address);
const targetFunction = "balanceOf";
final functionParameters = params.serialise();
const maximumGas = GasLimit.MAX_GAS_CALL;
final smartContracAddress = getTokenAddress(token, grpc.isBuildnet);
final response = await grpc.scReadOnlyCall(
maximumGas: maximumGas.value / 1e9,
smartContracAddress: smartContracAddress,
functionName: targetFunction,
functionParameters: functionParameters,
);
final responseArg = Args(initialData: response);
final balance = responseArg.nextU256();
return balance;
}