I want to generate a simple transaction from a Smart Wallet (Account Abstraction - ERC4337) but I also want to pay for gas fees on behalf of the user.

By looking at the UserOperation struct...

struct UserOperation {
    address sender;
    uint256 nonce;
    bytes initCode;
    bytes callData;
    uint256 callGasLimit;
    uint256 verificationGasLimit;
    uint256 preVerificationGas;
    uint256 maxFeePerGas;
    uint256 maxPriorityFeePerGas;
    bytes paymasterAndData;
    bytes signature;

...I understand that I have to set paymasterAndData up in order to be able to sponsor transactions. How can I do that when I create the UserOperation using ethers?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.