encodeERC20ApproveCall static method

Uint8List encodeERC20ApproveCall(
  1. EthereumAddress address,
  2. EthereumAddress spender,
  3. EtherAmount amount
)

Encodes the calldata for ERC20 approval.

  • address: The 4337 wallet address.
  • spender: The address of the approved spender.
  • amount: The amount to approve for the spender.

Returns a Uint8List representing the calldata.

Implementation

static Uint8List encodeERC20ApproveCall(
  EthereumAddress address,
  EthereumAddress spender,
  EtherAmount amount,
) {
  return encodeFunctionCall(
    'approve',
    address,
    ContractAbis.get('ERC20'),
    [spender, amount.getInWei],
  );
}