tokenTransferOperation static method

UserOperation tokenTransferOperation(
  1. EthereumAddress contractAddress,
  2. EthereumAddress owner,
  3. EthereumAddress recipient,
  4. EtherAmount amount
)

Returns the UserOperation for an ERC20 transfer.

  • contractAddress: The 4337 wallet address.
  • owner: The address of the sender.
  • recipient: The address of the recipient.
  • amount: The amount to transfer.

Returns the UserOperation.

Implementation

static UserOperation tokenTransferOperation(EthereumAddress contractAddress,
    EthereumAddress owner, EthereumAddress recipient, EtherAmount amount) {
  final callData = execute(owner,
      to: contractAddress,
      innerCallData:
          encodeERC20TransferCall(contractAddress, recipient, amount));
  return UserOperation.partial(callData: hexlify(callData));
}