decimals method

Future<int> decimals()

decimals gets the number of decimals of a token

Implementation

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