optInTokenTransfer method

Future<String> optInTokenTransfer(
  1. AptosAccount sender,
  2. bool optIn, {
  3. BigInt? maxGasAmount,
  4. BigInt? gasUnitPrice,
  5. BigInt? expireTimestamp,
})

User opt-in or out direct transfer through a boolean flag, return the hash of the transaction submitted to the API.

Implementation

Future<String> optInTokenTransfer(
  AptosAccount sender,
  bool optIn, {
  BigInt? maxGasAmount,
  BigInt? gasUnitPrice,
  BigInt? expireTimestamp
}) {
  final payload = transactionBuilder.buildTransactionPayload("0x3::token::opt_in_direct_transfer", [], [optIn]);
  return aptosClient.generateSignSubmitTransaction(
    sender,
    payload,
    maxGasAmount: maxGasAmount,
    gasUnitPrice: gasUnitPrice,
    expireTimestamp: expireTimestamp
  );
}