transfer method

Future<void> transfer(
  1. String toAddress,
  2. double amount
)

Implementation

Future<void> transfer(String toAddress, double amount) async {
  final params = Args();
  params.addString(toAddress);
  params.addU256(BigInt.from(doubleToMassaInt(amount)));
  const targetFunction = "transfer";
  final functionParameters = params.serialise();
  const maximumGas = GasLimit.MAX_GAS_CALL;
  final smartContracAddress = getTokenAddress(token, grpc.isBuildnet);

  await grpc.scCall(
    account: grpc.account,
    fee: 0.01,
    coins: 0.0,
    maximumGas: maximumGas.value / 1e9,
    smartContracAddress: smartContracAddress,
    functionName: targetFunction,
    functionParameters: functionParameters,
  );
}