tokenApproveOperation static method
- EthereumAddress contractAddress,
- EthereumAddress owner,
- EthereumAddress spender,
- EtherAmount amount
Returns the UserOperation for an ERC20 approval.
contractAddress
: The 4337 wallet address.owner
: The address of the approved owner.spender
: The address of the approved spender.amount
: The amount to approve for the spender.
Returns the UserOperation.
Implementation
static UserOperation tokenApproveOperation(
EthereumAddress contractAddress,
EthereumAddress owner,
EthereumAddress spender,
EtherAmount amount,
) {
final callData = execute(owner,
to: contractAddress,
innerCallData:
encodeERC20ApproveCall(contractAddress, spender, amount));
return UserOperation.partial(callData: hexlify(callData));
}