# eth\_sendUserOperation

`eth_sendUserOperation` is the ERC-4337 bundler JSON-RPC method that submits a signed user operation to the bundler for inclusion onchain and returns its `userOpHash`.

Submits a user operation to be included on-chain and returns the `userOpHash` if successful (or queued). If the operation is not successful, it will return an error.

## EntryPoint 0.7 & 0.8

:::warning[Warning]
The EntryPoint 0.7 & 0.8 API expects an `UnpackedUserOperation` instead of a `PackedUserOperation`.
According to the spec it is bundler's responsibility to pack the userOp before sending it to the EntryPoint.
So make sure to send an `UnpackedUserOperation` to the bundler.
:::

:::warning[Warning]
For entryPoint v0.7, we will not be reverting if the execution of the `callData` field in the user operation fails.
We revert only when you are calling `eth_estimateUserOperationGas`.
:::

### Usage

```json
{
    "jsonrpc": "2.0",
    "method": "eth_sendUserOperation",
    "params": [
        {
            "sender": "0x5a6b47F4131bf1feAFA56A05573314BcF44C9149",
            "nonce": "0x845ADB2C711129D4F3966735ED98A9F09FC4CE5700000000000000000000",
            "factory": "0xd703aaE79538628d27099B8c4f621bE4CCd142d5",
            "factoryData": "0xc5265d5d000000000000000000000000aac5d4240af87249b3f71bc8e4a2cae074a3e419...",
            "callData": "0xe9ae5c5300000000000000000000000000000000000000000000000000000000000000000000000000...",
            "callGasLimit": "0x13880",
            "verificationGasLimit": "0x60B01",
            "preVerificationGas": "0xD3E3",
            "maxPriorityFeePerGas": "0x3B9ACA00",
            "maxFeePerGas": "0x7A5CF70D5",
            "paymaster": "0x",
            "paymasterVerificationGasLimit": "0x0",
            "paymasterPostOpGasLimit": "0x0",
            "paymasterData": null,
            "signature": "0xa6cc6589c8bd561cfd68d7b6b0757ef6f208e7438782939938498eee7d703260137856c840c491b3d415956265e81bf5c2184a725be2abfc365f7536b6af525e1c"
        },
        "0x0000000071727De22E5E9d8BAf0edAc6f37da032"
    ],
    "id": 1
}
```

### Returns

* **Type:** `HexString32Bytes`

The hash of the user operation (`userOpHash`). This hash uniquely identifies the user operation and can be used to track its status.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x4c31ae84205a9c862dd8d0822f427fb516448451850ee6f65351951f6a2b2154"
}
```

### Parameters

The method accepts an array with the following parameters:

1. **userOperation** - `Object`: The user operation object containing the following fields:

   * **sender** - `Address`: The account making the operation.

   * **nonce** - `HexString`: Unique identifier for the request from this sender. For v0.7, this includes the key and sequence number.

   * **factory** - `Address (optional)`: The factory contract address that will deploy the smart account if it doesn't exist yet.

   * **factoryData** - `HexData (optional)`: The data that will be passed to the factory contract to deploy the smart account.

   * **callData** - `HexData`: The data to pass to the sender during the main execution call.

   * **callGasLimit** - `HexNumber`: The amount of gas to allocate the main execution call.

   * **verificationGasLimit** - `HexNumber`: The amount of gas to allocate for the verification step.

   * **preVerificationGas** - `HexNumber`: The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata.

   * **maxFeePerGas** - `HexNumber`: Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas).

   * **maxPriorityFeePerGas** - `HexNumber`: Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas).

   * **paymaster** - `Address (optional)`: Address of paymaster sponsoring the transaction, or null if none.

   * **paymasterVerificationGasLimit** - `HexNumber (optional)`: The amount of gas to allocate for the verification step of the paymaster, or null if no paymaster.

   * **paymasterPostOpGasLimit** - `HexNumber (optional)`: The amount of gas to allocate for the post-operation step of the paymaster, or null if no paymaster.

   * **paymasterData** - `HexData (optional)`: The data to pass to the paymaster during the verification step, or null if no paymaster.

   * **signature** - `HexData`: The signature data.

   * **eip7702Auth** - `SignedAuthorization (optional)`: The EIP-7702 authorization data. `SignedAuthorization Type`:

     ```typescript
     {
         address: Address,      // addressSchema - The contract address for the authorization
         chainId: Hex,                  // hexNumberSchema transformed to Hex - The chain ID
         nonce: Hex,                    // hexNumberSchema transformed to Hex - The nonce
         r: Hex,                        // hexData32Schema transformed to Hex - The r component of the signature
         s: Hex,                        // hexData32Schema transformed to Hex - The s component of the signature
         v: HexString,                  // hexNumberSchema - The v component of the signature
         yParity: HexNumber             // hexNumberSchema transformed to Hex - The y-parity value
     }
     ```

2. **entryPoint** - `Address`: The entry point contract address (`0x0000000071727De22E5E9d8BAf0edAc6f37da032`).

## EntryPoint 0.6

### Usage

```json
{
    "jsonrpc": "2.0",
    "method": "eth_sendUserOperation",
    "params": [
        {
            "sender":"0xb341FEAFaF71b09089d03B7D114599f8F491EE45",
            "nonce":"0x0",
            "initCode":"0x5de4839a76cf55d0c90e2061ef4386d962E15ae3296601cd0000000000000000000000000da6a956b9488ed4dd761e59f52fdc6c8068e6b5...",
            "callData":"0x5194544700000000000000000000000000000000000000000000000000000000000000000000000000...",
            "callGasLimit":"0x115b5c0",
            "verificationGasLimit":"0x249f0",
            "preVerificationGas":"0xeb11",
            "maxPriorityFeePerGas":"0x12a05f200",
            "maxFeePerGas":"0x5b08082fa",
            "paymasterAndData":"0x",
            "signature":"0xa6cc6589c8bd561cfd68d7b6b0757ef6f208e7438782939938498eee7d703260137856c840c491b3d415956265e81bf5c2184a725be2abfc365f7536b6af525e1c"
        },
        "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
    ],
    "id": 1
}
```

### Returns

* **Type:** `HexString32Bytes`

The hash of the user operation (`userOpHash`). This hash uniquely identifies the user operation and can be used to track its status.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x4c31ae84205a9c862dd8d0822f427fb516448451850ee6f65351951f6a2b2154"
}
```

### Parameters

The method accepts an array with the following parameters:

1. **userOperation** - `Object`: The user operation object containing the following fields:

   * **sender** - `Address`: The account making the operation.

   * **nonce** - `HexString`: Unique identifier for the request from this sender.

   * **initCode** - `HexData`: The initialization code for the smart account if it doesn't exist yet.

   * **callData** - `HexData`: The data to pass to the sender during the main execution call.

   * **callGasLimit** - `HexNumber`: The amount of gas to allocate the main execution call.

   * **verificationGasLimit** - `HexNumber`: The amount of gas to allocate for the verification step.

   * **preVerificationGas** - `HexNumber`: The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata.

   * **maxFeePerGas** - `HexNumber`: Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas).

   * **maxPriorityFeePerGas** - `HexNumber`: Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas).

   * **paymasterAndData** - `HexData`: The address of the paymaster contract and the data that will be passed to it.

   * **signature** - `HexData`: The signature data.

   * **eip7702Auth** - `SignedAuthorization (optional)`: The EIP-7702 authorization data. `SignedAuthorization Type`:

     ```typescript
     {
         address: Address,      // addressSchema - The contract address for the authorization
         chainId: Hex,                  // hexNumberSchema transformed to Hex - The chain ID
         nonce: Hex,                    // hexNumberSchema transformed to Hex - The nonce
         r: Hex,                        // hexData32Schema transformed to Hex - The r component of the signature
         s: Hex,                        // hexData32Schema transformed to Hex - The s component of the signature
         v: HexString,                  // hexNumberSchema - The v component of the signature
         yParity: HexNumber             // hexNumberSchema transformed to Hex - The y-parity value
     }
     ```

2. **entryPoint** - `Address`: The entry point contract address (`0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789`).
