# User Endpoints

As per [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337), User Operations is a structure that describes a transaction to be sent on behalf of a user. To avoid confusion, it is not named “transaction”.

* Like a transaction, it contains “sender”, “to”, “calldata”, “maxFeePerGas”, “maxPriorityFee”, “signature”, “nonce”
* unlike a transaction, it contains several other fields, described below
* also, the “signature” field usage is not defined by the protocol, but by each account implementation

### Utilize the following APIs to get the signature message & the user operation.

### /getsignaturemessage

## Get the signature message, which needs to be signed.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/aa/getsignaturemessage`

#### Query Parameters

| Name                                     | Type   | Description                                                                                                                                            |
| ---------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| chainId                                  | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                                                                   |
| chainSymbol                              | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                                                                   |
| sender<mark style="color:red;">\*</mark> | String | On-chain wallet address.                                                                                                                               |
| rpc                                      | String | Remote procedural call URL.                                                                                                                            |
| nonce                                    | String | Anti-replay parameter.                                                                                                                                 |
| initCode                                 | String | The initCode of the account. (needed if and only if the account is not yet on-chain and needs to be created)                                           |
| preVerificationGas                       | String | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata.                                                    |
| verificationGasLimit                     | String | The amount of gas to allocate for the verification step.                                                                                               |
| gasLimit                                 | String | Maximum gas limit provided by the sender, for the transaction.                                                                                         |
| callGasLimit                             | String | The amount of gas to allocate the main execution call.                                                                                                 |
| callData                                 | String | Encoded data for executing the primary function call or operation within the user's transaction.                                                       |
| maxPriorityFeePerGas                     | String | Maximum priority fee per gas. (similar to EIP-1559 `max_priority_fee_per_gas`)                                                                         |
| maxFeePerGas                             | String | The maximum fee per gas to pay for the execution of this operation. (similar to [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) `max_fee_per_gas`) |
| signature                                | String | Data passed into the account along with the nonce during the verification step.                                                                        |
| paymasterAndData                         | String | Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster. (empty for self-sponsored transaction)               |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/aa/getsignaturemessage?sender=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&chainId=1&callData=0x38ed173900000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000063056e00436da25bcf48a40dfbbdcc708935100600000000000000000000000000000000000000000000000000000000634d00ee0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b4fbf271143f4fbf7b91a5ded31805e42b2208d600000000000000000000000011fe4b6ae13d2a6055c8d9cf65c55bac32b5d844
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "messageToBeSigned": "0x4617338a3acd06271c356d52f8cfc260519e8e2115f0af41eb79b7ac13b1963c"
    }
}
```

{% endtab %}
{% endtabs %}

### /getuserops

## Get the user operation, which can be signed and sent to the bundler.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/aa/getuserops`

#### Query Parameters

| Name                                     | Type   | Description                                                                                                                                            |
| ---------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| chainId                                  | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                                                                   |
| chainSymbol                              | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                                                                   |
| sender<mark style="color:red;">\*</mark> | String | On-chain wallet address.                                                                                                                               |
| rpc                                      | String | Remote procedural call URL.                                                                                                                            |
| nonce                                    | String | Anti-replay parameter.                                                                                                                                 |
| initCode                                 | String | The initCode of the account. (needed if and only if the account is not yet on-chain and needs to be created)                                           |
| preVerificationGas                       | String | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata.                                                    |
| verificationGasLimit                     | String | The amount of gas to allocate for the verification step.                                                                                               |
| gasLimit                                 | String | Maximum gas limit provided by the sender, for the transaction.                                                                                         |
| callGasLimit                             | String | The amount of gas to allocate the main execution call.                                                                                                 |
| callData                                 | String | Encoded data for executing the primary function call or operation within the user's transaction.                                                       |
| maxPriorityFeePerGas                     | String | Maximum priority fee per gas. (similar to EIP-1559 `max_priority_fee_per_gas`)                                                                         |
| maxFeePerGas                             | String | The maximum fee per gas to pay for the execution of this operation. (similar to [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) `max_fee_per_gas`) |
| signature                                | String | Data passed into the account along with the nonce during the verification step.                                                                        |
| paymasterAndData                         | String | Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster. (empty for self-sponsored transaction)               |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/aa/getuserops?sender=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&chainId=1&callData=0x38ed173900000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000063056e00436da25bcf48a40dfbbdcc708935100600000000000000000000000000000000000000000000000000000000634d00ee0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b4fbf271143f4fbf7b91a5ded31805e42b2208d600000000000000000000000011fe4b6ae13d2a6055c8d9cf65c55bac32b5d844
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "sender": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "nonce": "0",
        "initCode": "0x",
        "callData": "0x38ed173900000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000063056e00436da25bcf48a40dfbbdcc708935100600000000000000000000000000000000000000000000000000000000634d00ee0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b4fbf271143f4fbf7b91a5ded31805e42b2208d600000000000000000000000011fe4b6ae13d2a6055c8d9cf65c55bac32b5d844",
        "callGasLimit": "260611",
        "gasLimit": "362451",
        "verificationGasLimit": "362451",
        "preVerificationGas": "53576",
        "maxFeePerGas": "29964445250",
        "maxPriorityFeePerGas": "100000000",
        "paymasterAndData": "0x",
        "signature": "0x"
    }
}
```

{% endtab %}
{% endtabs %}
