totalSupply method

Future<BigInt> totalSupply()

totalSupply gets the balance of the given address

Implementation

Future<BigInt> totalSupply() async {
  final params = Args();
  const targetFunction = "totalSupply";
  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 totalSupply = responseArg.nextU256();
  return totalSupply;
}