Implementation of the EntryPoint v0.6.0 contract interface. Handles user operations, simulation, and interaction with ERC-4337 compatible smart accounts.

const entryPoint = new EntryPointV6(rpcClient);
const result = await entryPoint.simulateHandleOp({
userOperation,
targetAddress: '0x123...',
targetCallData: '0x456...'
});

Hierarchy (View Summary)

Constructors

Properties

abi: readonly [
    {
        inputs: readonly [
            { internalType: "uint256"; name: "preOpGas"; type: "uint256" },
            { internalType: "uint256"; name: "paid"; type: "uint256" },
            { internalType: "uint48"; name: "validAfter"; type: "uint48" },
            { internalType: "uint48"; name: "validUntil"; type: "uint48" },
            { internalType: "bool"; name: "targetSuccess"; type: "bool" },
            { internalType: "bytes"; name: "targetResult"; type: "bytes" },
        ];
        name: "ExecutionResult";
        type: "error";
    },
    {
        inputs: readonly [
            { internalType: "uint256"; name: "opIndex"; type: "uint256" },
            { internalType: "string"; name: "reason"; type: "string" },
        ];
        name: "FailedOp";
        type: "error";
    },
    {
        inputs: readonly [
            { internalType: "address"; name: "sender"; type: "address" },
        ];
        name: "SenderAddressResult";
        type: "error";
    },
    {
        inputs: readonly [
            { internalType: "address"; name: "aggregator"; type: "address" },
        ];
        name: "SignatureValidationFailed";
        type: "error";
    },
    {
        inputs: readonly [
            {
                components: readonly [
                    { internalType: "uint256"; name: "preOpGas"; type: "uint256" },
                    { internalType: "uint256"; name: "prefund"; type: "uint256" },
                    { internalType: "bool"; name: "sigFailed"; type: "bool" },
                    { internalType: "uint48"; name: "validAfter"; type: "uint48" },
                    { internalType: "uint48"; name: "validUntil"; type: "uint48" },
                    { internalType: "bytes"; name: "paymasterContext"; type: "bytes" },
                ];
                internalType: "struct IEntryPoint.ReturnInfo";
                name: "returnInfo";
                type: "tuple";
            },
            {
                components: readonly [
                    { internalType: "uint256"; name: "stake"; type: "uint256" },
                    { internalType: "uint256"; name: "unstakeDelaySec"; type: "uint256" },
                ];
                internalType: "struct IStakeManager.StakeInfo";
                name: "senderInfo";
                type: "tuple";
            },
            {
                components: readonly [
                    { internalType: "uint256"; name: "stake"; type: "uint256" },
                    { internalType: "uint256"; name: "unstakeDelaySec"; type: "uint256" },
                ];
                internalType: "struct IStakeManager.StakeInfo";
                name: "factoryInfo";
                type: "tuple";
            },
            {
                components: readonly [
                    { internalType: "uint256"; name: "stake"; type: "uint256" },
                    { internalType: "uint256"; name: "unstakeDelaySec"; type: "uint256" },
                ];
                internalType: "struct IStakeManager.StakeInfo";
                name: "paymasterInfo";
                type: "tuple";
            },
        ];
        name: "ValidationResult";
        type: "error";
    },
    {
        inputs: readonly [
            {
                components: readonly [
                    { internalType: "uint256"; name: "preOpGas"; type: "uint256" },
                    { internalType: "uint256"; name: "prefund"; type: "uint256" },
                    { internalType: "bool"; name: "sigFailed"; type: "bool" },
                    { internalType: "uint48"; name: "validAfter"; type: "uint48" },
                    { internalType: "uint48"; name: "validUntil"; type: "uint48" },
                    { internalType: "bytes"; name: "paymasterContext"; type: "bytes" },
                ];
                internalType: "struct IEntryPoint.ReturnInfo";
                name: "returnInfo";
                type: "tuple";
            },
            {
                components: readonly [
                    { internalType: "uint256"; name: "stake"; type: "uint256" },
                    { internalType: "uint256"; name: "unstakeDelaySec"; type: "uint256" },
                ];
                internalType: "struct IStakeManager.StakeInfo";
                name: "senderInfo";
                type: "tuple";
            },
            {
                components: readonly [
                    { internalType: "uint256"; name: "stake"; type: "uint256" },
                    { internalType: "uint256"; name: "unstakeDelaySec"; type: "uint256" },
                ];
                internalType: "struct IStakeManager.StakeInfo";
                name: "factoryInfo";
                type: "tuple";
            },
            {
                components: readonly [
                    { internalType: "uint256"; name: "stake"; type: "uint256" },
                    { internalType: "uint256"; name: "unstakeDelaySec"; type: "uint256" },
                ];
                internalType: "struct IStakeManager.StakeInfo";
                name: "paymasterInfo";
                type: "tuple";
            },
            {
                components: readonly [
                    { internalType: "address"; name: "aggregator"; type: "address" },
                    {
                        components: readonly [
                            { internalType: "uint256"; name: "stake"; type: "uint256" },
                            { internalType: "uint256"; name: "unstakeDelaySec"; type: "uint256" },
                        ];
                        internalType: "struct IStakeManager.StakeInfo";
                        name: "stakeInfo";
                        type: "tuple";
                    },
                ];
                internalType: "struct IEntryPoint.AggregatorStakeInfo";
                name: "aggregatorInfo";
                type: "tuple";
            },
        ];
        name: "ValidationResultWithAggregation";
        type: "error";
    },
    {
        anonymous: false;
        inputs: readonly [
            {
                indexed: true;
                internalType: "bytes32";
                name: "userOpHash";
                type: "bytes32";
            },
            {
                indexed: true;
                internalType: "address";
                name: "sender";
                type: "address";
            },
            {
                indexed: false;
                internalType: "address";
                name: "factory";
                type: "address";
            },
            {
                indexed: false;
                internalType: "address";
                name: "paymaster";
                type: "address";
            },
        ];
        name: "AccountDeployed";
        type: "event";
    },
    {
        anonymous: false;
        inputs: readonly [];
        name: "BeforeExecution";
        type: "event";
    },
    {
        anonymous: false;
        inputs: readonly [
            {
                indexed: true;
                internalType: "address";
                name: "account";
                type: "address";
            },
            {
                indexed: false;
                internalType: "uint256";
                name: "totalDeposit";
                type: "uint256";
            },
        ];
        name: "Deposited";
        type: "event";
    },
    {
        anonymous: false;
        inputs: readonly [
            {
                indexed: true;
                internalType: "address";
                name: "aggregator";
                type: "address";
            },
        ];
        name: "SignatureAggregatorChanged";
        type: "event";
    },
    {
        anonymous: false;
        inputs: readonly [
            {
                indexed: true;
                internalType: "address";
                name: "account";
                type: "address";
            },
            {
                indexed: false;
                internalType: "uint256";
                name: "totalStaked";
                type: "uint256";
            },
            {
                indexed: false;
                internalType: "uint256";
                name: "unstakeDelaySec";
                type: "uint256";
            },
        ];
        name: "StakeLocked";
        type: "event";
    },
    {
        anonymous: false;
        inputs: readonly [
            {
                indexed: true;
                internalType: "address";
                name: "account";
                type: "address";
            },
            {
                indexed: false;
                internalType: "uint256";
                name: "withdrawTime";
                type: "uint256";
            },
        ];
        name: "StakeUnlocked";
        type: "event";
    },
    {
        anonymous: false;
        inputs: readonly [
            {
                indexed: true;
                internalType: "address";
                name: "account";
                type: "address";
            },
            {
                indexed: false;
                internalType: "address";
                name: "withdrawAddress";
                type: "address";
            },
            {
                indexed: false;
                internalType: "uint256";
                name: "amount";
                type: "uint256";
            },
        ];
        name: "StakeWithdrawn";
        type: "event";
    },
    {
        anonymous: false;
        inputs: readonly [
            {
                indexed: true;
                internalType: "bytes32";
                name: "userOpHash";
                type: "bytes32";
            },
            {
                indexed: true;
                internalType: "address";
                name: "sender";
                type: "address";
            },
            {
                indexed: true;
                internalType: "address";
                name: "paymaster";
                type: "address";
            },
            {
                indexed: false;
                internalType: "uint256";
                name: "nonce";
                type: "uint256";
            },
            { indexed: false; internalType: "bool"; name: "success"; type: "bool" },
            {
                indexed: false;
                internalType: "uint256";
                name: "actualGasCost";
                type: "uint256";
            },
            {
                indexed: false;
                internalType: "uint256";
                name: "actualGasUsed";
                type: "uint256";
            },
        ];
        name: "UserOperationEvent";
        type: "event";
    },
    {
        anonymous: false;
        inputs: readonly [
            {
                indexed: true;
                internalType: "bytes32";
                name: "userOpHash";
                type: "bytes32";
            },
            {
                indexed: true;
                internalType: "address";
                name: "sender";
                type: "address";
            },
            {
                indexed: false;
                internalType: "uint256";
                name: "nonce";
                type: "uint256";
            },
            {
                indexed: false;
                internalType: "bytes";
                name: "revertReason";
                type: "bytes";
            },
        ];
        name: "UserOperationRevertReason";
        type: "event";
    },
    {
        anonymous: false;
        inputs: readonly [
            {
                indexed: true;
                internalType: "address";
                name: "account";
                type: "address";
            },
            {
                indexed: false;
                internalType: "address";
                name: "withdrawAddress";
                type: "address";
            },
            {
                indexed: false;
                internalType: "uint256";
                name: "amount";
                type: "uint256";
            },
        ];
        name: "Withdrawn";
        type: "event";
    },
    {
        inputs: readonly [];
        name: "SIG_VALIDATION_FAILED";
        outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256" }];
        stateMutability: "view";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "bytes"; name: "initCode"; type: "bytes" },
            { internalType: "address"; name: "sender"; type: "address" },
            { internalType: "bytes"; name: "paymasterAndData"; type: "bytes" },
        ];
        name: "_validateSenderAndPaymaster";
        outputs: readonly [];
        stateMutability: "view";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "uint32"; name: "unstakeDelaySec"; type: "uint32" },
        ];
        name: "addStake";
        outputs: readonly [];
        stateMutability: "payable";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "address"; name: "account"; type: "address" },
        ];
        name: "balanceOf";
        outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256" }];
        stateMutability: "view";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "address"; name: "account"; type: "address" },
        ];
        name: "depositTo";
        outputs: readonly [];
        stateMutability: "payable";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "address"; name: ""; type: "address" },
        ];
        name: "deposits";
        outputs: readonly [
            { internalType: "uint112"; name: "deposit"; type: "uint112" },
            { internalType: "bool"; name: "staked"; type: "bool" },
            { internalType: "uint112"; name: "stake"; type: "uint112" },
            { internalType: "uint32"; name: "unstakeDelaySec"; type: "uint32" },
            { internalType: "uint48"; name: "withdrawTime"; type: "uint48" },
        ];
        stateMutability: "view";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "address"; name: "account"; type: "address" },
        ];
        name: "getDepositInfo";
        outputs: readonly [
            {
                components: readonly [
                    { internalType: "uint112"; name: "deposit"; type: "uint112" },
                    { internalType: "bool"; name: "staked"; type: "bool" },
                    { internalType: "uint112"; name: "stake"; type: "uint112" },
                    { internalType: "uint32"; name: "unstakeDelaySec"; type: "uint32" },
                    { internalType: "uint48"; name: "withdrawTime"; type: "uint48" },
                ];
                internalType: "struct IStakeManager.DepositInfo";
                name: "info";
                type: "tuple";
            },
        ];
        stateMutability: "view";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "address"; name: "sender"; type: "address" },
            { internalType: "uint192"; name: "key"; type: "uint192" },
        ];
        name: "getNonce";
        outputs: readonly [
            { internalType: "uint256"; name: "nonce"; type: "uint256" },
        ];
        stateMutability: "view";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "bytes"; name: "initCode"; type: "bytes" },
        ];
        name: "getSenderAddress";
        outputs: readonly [];
        stateMutability: "nonpayable";
        type: "function";
    },
    {
        inputs: readonly [
            {
                components: readonly [
                    { internalType: "address"; name: "sender"; type: "address" },
                    { internalType: "uint256"; name: "nonce"; type: "uint256" },
                    { internalType: "bytes"; name: "initCode"; type: "bytes" },
                    { internalType: "bytes"; name: "callData"; type: "bytes" },
                    { internalType: "uint256"; name: "callGasLimit"; type: "uint256" },
                    {
                        internalType: "uint256";
                        name: "verificationGasLimit";
                        type: "uint256";
                    },
                    {
                        internalType: "uint256";
                        name: "preVerificationGas";
                        type: "uint256";
                    },
                    { internalType: "uint256"; name: "maxFeePerGas"; type: "uint256" },
                    {
                        internalType: "uint256";
                        name: "maxPriorityFeePerGas";
                        type: "uint256";
                    },
                    { internalType: "bytes"; name: "paymasterAndData"; type: "bytes" },
                    { internalType: "bytes"; name: "signature"; type: "bytes" },
                ];
                internalType: "struct UserOperation";
                name: "userOp";
                type: "tuple";
            },
        ];
        name: "getUserOpHash";
        outputs: readonly [{ internalType: "bytes32"; name: ""; type: "bytes32" }];
        stateMutability: "view";
        type: "function";
    },
    {
        inputs: readonly [
            {
                components: readonly [
                    {
                        components: readonly [
                            { internalType: "address"; name: "sender"; type: "address" },
                            { internalType: "uint256"; name: "nonce"; type: "uint256" },
                            { internalType: "bytes"; name: "initCode"; type: "bytes" },
                            { internalType: "bytes"; name: "callData"; type: "bytes" },
                            { internalType: "uint256"; name: "callGasLimit"; type: "uint256" },
                            {
                                internalType: "uint256";
                                name: "verificationGasLimit";
                                type: "uint256";
                            },
                            {
                                internalType: "uint256";
                                name: "preVerificationGas";
                                type: "uint256";
                            },
                            { internalType: "uint256"; name: "maxFeePerGas"; type: "uint256" },
                            {
                                internalType: "uint256";
                                name: "maxPriorityFeePerGas";
                                type: "uint256";
                            },
                            { internalType: "bytes"; name: "paymasterAndData"; type: "bytes" },
                            { internalType: "bytes"; name: "signature"; type: "bytes" },
                        ];
                        internalType: "struct UserOperation[]";
                        name: "userOps";
                        type: "tuple[]";
                    },
                    {
                        internalType: "contract IAggregator";
                        name: "aggregator";
                        type: "address";
                    },
                    { internalType: "bytes"; name: "signature"; type: "bytes" },
                ];
                internalType: "struct IEntryPoint.UserOpsPerAggregator[]";
                name: "opsPerAggregator";
                type: "tuple[]";
            },
            { internalType: "address payable"; name: "beneficiary"; type: "address" },
        ];
        name: "handleAggregatedOps";
        outputs: readonly [];
        stateMutability: "nonpayable";
        type: "function";
    },
    {
        inputs: readonly [
            {
                components: readonly [
                    { internalType: "address"; name: "sender"; type: "address" },
                    { internalType: "uint256"; name: "nonce"; type: "uint256" },
                    { internalType: "bytes"; name: "initCode"; type: "bytes" },
                    { internalType: "bytes"; name: "callData"; type: "bytes" },
                    { internalType: "uint256"; name: "callGasLimit"; type: "uint256" },
                    {
                        internalType: "uint256";
                        name: "verificationGasLimit";
                        type: "uint256";
                    },
                    {
                        internalType: "uint256";
                        name: "preVerificationGas";
                        type: "uint256";
                    },
                    { internalType: "uint256"; name: "maxFeePerGas"; type: "uint256" },
                    {
                        internalType: "uint256";
                        name: "maxPriorityFeePerGas";
                        type: "uint256";
                    },
                    { internalType: "bytes"; name: "paymasterAndData"; type: "bytes" },
                    { internalType: "bytes"; name: "signature"; type: "bytes" },
                ];
                internalType: "struct UserOperation[]";
                name: "ops";
                type: "tuple[]";
            },
            { internalType: "address payable"; name: "beneficiary"; type: "address" },
        ];
        name: "handleOps";
        outputs: readonly [];
        stateMutability: "nonpayable";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "uint192"; name: "key"; type: "uint192" },
        ];
        name: "incrementNonce";
        outputs: readonly [];
        stateMutability: "nonpayable";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "bytes"; name: "callData"; type: "bytes" },
            {
                components: readonly [
                    {
                        components: readonly [
                            { internalType: "address"; name: "sender"; type: "address" },
                            { internalType: "uint256"; name: "nonce"; type: "uint256" },
                            { internalType: "uint256"; name: "callGasLimit"; type: "uint256" },
                            {
                                internalType: "uint256";
                                name: "verificationGasLimit";
                                type: "uint256";
                            },
                            {
                                internalType: "uint256";
                                name: "preVerificationGas";
                                type: "uint256";
                            },
                            { internalType: "address"; name: "paymaster"; type: "address" },
                            { internalType: "uint256"; name: "maxFeePerGas"; type: "uint256" },
                            {
                                internalType: "uint256";
                                name: "maxPriorityFeePerGas";
                                type: "uint256";
                            },
                        ];
                        internalType: "struct EntryPoint.MemoryUserOp";
                        name: "mUserOp";
                        type: "tuple";
                    },
                    { internalType: "bytes32"; name: "userOpHash"; type: "bytes32" },
                    { internalType: "uint256"; name: "prefund"; type: "uint256" },
                    { internalType: "uint256"; name: "contextOffset"; type: "uint256" },
                    { internalType: "uint256"; name: "preOpGas"; type: "uint256" },
                ];
                internalType: "struct EntryPoint.UserOpInfo";
                name: "opInfo";
                type: "tuple";
            },
            { internalType: "bytes"; name: "context"; type: "bytes" },
        ];
        name: "innerHandleOp";
        outputs: readonly [
            { internalType: "uint256"; name: "actualGasCost"; type: "uint256" },
        ];
        stateMutability: "nonpayable";
        type: "function";
    },
    {
        inputs: readonly [
            { internalType: "address"; name: ""; type: "address" },
            { internalType: "uint192"; name: ""; type: "uint192" },
        ];
        name: "nonceSequenceNumber";
        outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256" }];
        stateMutability: "view";
        type: "function";
    },
    {
        inputs: readonly [
            {
                components: readonly [
                    { internalType: "address"; name: "sender"; type: "address" },
                    { internalType: "uint256"; name: "nonce"; type: "uint256" },
                    { internalType: "bytes"; name: "initCode"; type: "bytes" },
                    { internalType: "bytes"; name: "callData"; type: "bytes" },
                    { internalType: "uint256"; name: "callGasLimit"; type: "uint256" },
                    {
                        internalType: "uint256";
                        name: "verificationGasLimit";
                        type: "uint256";
                    },
                    {
                        internalType: "uint256";
                        name: "preVerificationGas";
                        type: "uint256";
                    },
                    { internalType: "uint256"; name: "maxFeePerGas"; type: "uint256" },
                    {
                        internalType: "uint256";
                        name: "maxPriorityFeePerGas";
                        type: "uint256";
                    },
                    { internalType: "bytes"; name: "paymasterAndData"; type: "bytes" },
                    { internalType: "bytes"; name: "signature"; type: "bytes" },
                ];
                internalType: "struct UserOperation";
                name: "op";
                type: "tuple";
            },
            { internalType: "address"; name: "target"; type: "address" },
            { internalType: "bytes"; name: "targetCallData"; type: "bytes" },
        ];
        name: "simulateHandleOp";
        outputs: readonly [];
        stateMutability: "nonpayable";
        type: "function";
    },
    {
        inputs: readonly [
            {
                components: readonly [
                    { internalType: "address"; name: "sender"; type: "address" },
                    { internalType: "uint256"; name: "nonce"; type: "uint256" },
                    { internalType: "bytes"; name: "initCode"; type: "bytes" },
                    { internalType: "bytes"; name: "callData"; type: "bytes" },
                    { internalType: "uint256"; name: "callGasLimit"; type: "uint256" },
                    {
                        internalType: "uint256";
                        name: "verificationGasLimit";
                        type: "uint256";
                    },
                    {
                        internalType: "uint256";
                        name: "preVerificationGas";
                        type: "uint256";
                    },
                    { internalType: "uint256"; name: "maxFeePerGas"; type: "uint256" },
                    {
                        internalType: "uint256";
                        name: "maxPriorityFeePerGas";
                        type: "uint256";
                    },
                    { internalType: "bytes"; name: "paymasterAndData"; type: "bytes" },
                    { internalType: "bytes"; name: "signature"; type: "bytes" },
                ];
                internalType: "struct UserOperation";
                name: "userOp";
                type: "tuple";
            },
        ];
        name: "simulateValidation";
        outputs: readonly [];
        stateMutability: "nonpayable";
        type: "function";
    },
    {
        inputs: readonly [];
        name: "unlockStake";
        outputs: readonly [];
        stateMutability: "nonpayable";
        type: "function";
    },
    {
        inputs: readonly [
            {
                internalType: "address payable";
                name: "withdrawAddress";
                type: "address";
            },
        ];
        name: "withdrawStake";
        outputs: readonly [];
        stateMutability: "nonpayable";
        type: "function";
    },
    {
        inputs: readonly [
            {
                internalType: "address payable";
                name: "withdrawAddress";
                type: "address";
            },
            { internalType: "uint256"; name: "withdrawAmount"; type: "uint256" },
        ];
        name: "withdrawTo";
        outputs: readonly [];
        stateMutability: "nonpayable";
        type: "function";
    },
    { stateMutability: "payable"; type: "receive" },
] = ENTRYPOINT_V6_ABI
address: `0x${string}` = ENTRYPOINT_V6_ADDRESS

The EntryPoint contract address, defaults to ENTRYPOINT_V6_ADDRESS

The RPC client used to interact with the blockchain

version: EntryPointVersion = EntryPointVersion.v060

Methods

  • Encodes the function data for handling user operations.

    Parameters

    • userOperation: {
          callData: `0x${string}`;
          callGasLimit: bigint;
          initCode: `0x${string}`;
          maxFeePerGas: bigint;
          maxPriorityFeePerGas: bigint;
          nonce: bigint;
          paymasterAndData: `0x${string}`;
          preVerificationGas: bigint;
          sender: `0x${string}`;
          signature: `0x${string}`;
          verificationGasLimit: bigint;
      }

      The user operation to encode

      • callData: `0x${string}`
      • callGasLimit: bigint

        Gas limit for the main execution call

      • initCode: `0x${string}`
      • maxFeePerGas: bigint

        Maximum total fee per gas unit

      • maxPriorityFeePerGas: bigint

        Maximum priority fee per gas unit

      • nonce: bigint

        Account nonce

      • paymasterAndData: `0x${string}`
      • preVerificationGas: bigint

        Gas overhead for pre-verification operations

      • sender: `0x${string}`
      • signature: `0x${string}`
      • verificationGasLimit: bigint

        Gas limit for the verification phase

    • beneficiary: `0x${string}`

      The address that will receive the gas refund

    Returns `0x${string}`

    The encoded function data as a hex string

    const encodedData = entryPoint.encodeHandleOpsFunctionData(
    userOperation,
    '0x123...' // beneficiary address
    );
  • Retrieves the nonce for a smart account at the specified key.

    Parameters

    • smartAccountAddress: `0x${string}`

      The address of the smart account

    • key: bigint = 0n

      Optional key for the nonce, defaults to 0n

    Returns Promise<bigint>

    The current nonce value as a bigint

    const nonce = await entryPoint.getNonce('0x123...');
    const nonceAtKey = await entryPoint.getNonce('0x123...', 1n);
  • Parses RPC request error data from various error formats observed across different networks and RPC providers.

    Parameters

    • err: unknown

      The unknown error format to parse

    Returns `0x${string}`

    The parsed error data as a hex string

    ParseError if the error cannot be parsed

    try {
    // ... RPC call
    } catch (err) {
    const data = entryPoint.parseRpcRequestErrorData(err);
    }
  • Parses the execution result from simulateHandleOp's revert data.

    Parameters

    • data: `0x${string}`

      The revert data from simulateHandleOp

    Returns {
        paid: bigint;
        preOpGas: bigint;
        targetResult: `0x${string}`;
        targetSuccess: boolean;
        validAfter: number;
        validUntil: number;
    }

    The parsed execution result

    • paid: bigint

      Total amount paid by the user for the operation

    • preOpGas: bigint

      Gas consumed before the actual user operation execution

    • targetResult: `0x${string}`

      The return data from the target contract call

    • targetSuccess: boolean

      Whether the target contract call was successful

    • validAfter: number

      Timestamp after which the operation becomes valid

    • validUntil: number

      Timestamp until which the operation remains valid

    SimulateHandleOpError if the simulation failed with an error

    ParseError if the result cannot be parsed

    const result = entryPoint.parseSimulateHandleOpExecutionResult('0x...');
    
  • Simulates the execution of a user operation. This method always reverts by design, and the execution result is parsed from the revert data.

    Parameters

    • params: SimulateHandleOpParamsV6

      The simulation parameters

      Parameters for the simulateHandleOp method

      • OptionalstateOverrides?: StateOverrideSet

        Optional state overrides to modify blockchain state during simulation

      • targetAddress: `0x${string}`

        The target contract address for the simulation

      • targetCallData: `0x${string}`

        The calldata to be executed on the target contract

      • userOperation: {
            callData: `0x${string}`;
            callGasLimit: bigint;
            initCode: `0x${string}`;
            maxFeePerGas: bigint;
            maxPriorityFeePerGas: bigint;
            nonce: bigint;
            paymasterAndData: `0x${string}`;
            preVerificationGas: bigint;
            sender: `0x${string}`;
            signature: `0x${string}`;
            verificationGasLimit: bigint;
        }

        The user operation to simulate

        • callData: `0x${string}`
        • callGasLimit: bigint

          Gas limit for the main execution call

        • initCode: `0x${string}`
        • maxFeePerGas: bigint

          Maximum total fee per gas unit

        • maxPriorityFeePerGas: bigint

          Maximum priority fee per gas unit

        • nonce: bigint

          Account nonce

        • paymasterAndData: `0x${string}`
        • preVerificationGas: bigint

          Gas overhead for pre-verification operations

        • sender: `0x${string}`
        • signature: `0x${string}`
        • verificationGasLimit: bigint

          Gas limit for the verification phase

    Returns Promise<
        {
            paid: bigint;
            preOpGas: bigint;
            targetResult: `0x${string}`;
            targetSuccess: boolean;
            validAfter: number;
            validUntil: number;
        },
    >

    The execution result containing validation and execution details

    ParseError if the error data cannot be parsed

    SimulateHandleOpError if the simulation fails with an error

    const result = await entryPoint.simulateHandleOp({
    userOperation: {
    sender: '0x123...',
    nonce: '0x1',
    // ... other UserOperation fields
    },
    targetAddress: '0x456...',
    targetCallData: '0x789...',
    stateOverrides: {
    // Optional state modifications
    }
    });