> ## Documentation Index
> Fetch the complete documentation index at: https://spiceflow-docs.spicenet.io/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /transaction/submit

> Submit a cross-chain transaction with EIP-7702 authorization and intent execution

# POST /transaction/submit

Submit a cross-chain transaction with EIP-7702 authorization and intent execution.

## Endpoint

```http theme={null}
POST /transaction/submit
```

## Description

This endpoint allows you to submit transactions that will be executed across multiple chains. The system validates the transaction, saves it to the database, and returns tracking information. Execution is performed asynchronously by a solver.

## Request Body

```typescript theme={null}
{
  address: Address;            // User wallet address
  authorization: [{
    chainId: number;
    address: string;
    nonce: number;
    r: string;
    s: string;
    yParity: number;
  }];
  intentAuthorization: {
    signature: string;
    chainBatches: Array<{
      hash: string;
      chainId: number | bigint;
      calls: Array<{ to: string; value: string | number | bigint; data: string }>;
      recentBlock?: number | bigint;
    }>;
  };
  tokenTransfers: Array<Array<{
    tokenAddress: Address;
    tokenAmount: bigint;
    sender?: Address;
    receiver?: Address;
  }>>;
}
```

### Parameters

| Field                              | Type     | Required | Description                             |
| ---------------------------------- | -------- | -------- | --------------------------------------- |
| `address`                          | `string` | Yes      | User wallet address                     |
| `authorization`                    | `array`  | Yes      | Array of EIP-7702 authorization objects |
| `authorization[].chainId`          | `number` | Yes      | Chain ID for the authorization          |
| `authorization[].address`          | `string` | Yes      | Address being authorized                |
| `authorization[].nonce`            | `number` | Yes      | Authorization nonce                     |
| `authorization[].r`                | `string` | Yes      | ECDSA signature R value                 |
| `authorization[].s`                | `string` | Yes      | ECDSA signature S value                 |
| `authorization[].yParity`          | `number` | Yes      | ECDSA signature Y parity                |
| `intentAuthorization.signature`    | `string` | Yes      | Intent signature (becomes intent ID)    |
| `intentAuthorization.chainBatches` | `array`  | Yes      | Array of chain batches with calls       |
| `tokenTransfers`                   | `array`  | Yes      | 2D array of transfers per chain batch   |

## Response

### Success Response (200)

```json theme={null}
{
  "success": true,
  "data": {
    "status": "created",
    "intentId": "0xabcdef1234567890...",
    "transactionId": "uuid-generated-id"
  }
}
```

### Response Fields

| Field           | Type     | Description                                               |
| --------------- | -------- | --------------------------------------------------------- |
| `status`        | `string` | Submission status (always `created` on success)           |
| `intentId`      | `string` | Intent identifier (same as intentAuthorization.signature) |
| `transactionId` | `string` | Generated transaction ID for tracking                     |

## Error Responses

### 400 Bad Request

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Missing authorization or intentAuthorization"
  }
}
```

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Token transfers do not match calls"
  }
}
```

<Note>
  The API validates that `tokenTransfers` match the `calls` in each chain batch. Each transfer must correspond to the expected call data.
</Note>

### 500 Internal Server Error

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Internal server error"
  }
}
```

## Example Request

```bash theme={null}
curl -X POST /transaction/submit \
  -H "Content-Type: application/json" \
  -d '{
    "authorization": [
      {
        "chainId": 1,
        "address": "0x742d35Cc6634C0532925a3b8D8D428C83c76a4B",
        "nonce": 42,
        "r": "0x1234567890abcdef...",
        "s": "0xfedcba0987654321...",
        "yParity": 1
      },
      {
        "chainId": 137,
        "address": "0x742d35Cc6634C0532925a3b8D8D428C83c76a4B",
        "nonce": 43,
        "r": "0xabcdef1234567890...",
        "s": "0x0987654321fedcba...",
        "yParity": 0
      }
    ],
    "intentAuthorization": {
      "signature": "0xabcdef1234567890...",
      "chainBatches": [
        {
          "hash": "0x9876543210fedcba...",
          "chainId": 1,
          "calls": [
            {
              "to": "0x123...abc",
              "value": 0,
              "data": "0xa9059cbb..."
            }
          ],
          "recentBlock": 18500000
        }
      ]
    }
  }'
```

## Workflow

1. **Transaction Validation**: Validates authorization array and intentAuthorization are provided and properly formatted
2. **Database Storage**: Saves the intent and all chain authorizations to the database for reliable tracking
3. **Chain Broadcast**: Broadcasts the transaction to the appropriate blockchain network
4. **Response**: Returns transaction hash and intent ID for subsequent step execution

## Next Steps

After successful submission:

1. **Track Progress**: Use the returned `intentId` to execute individual steps
2. **Execute Steps**: Call `POST /intent/{intentId}/execute/{stepId}` for each step (0, 1, 2, ...)
3. **Monitor Results**: Each step execution returns detailed results and status

## Example Workflow

```bash theme={null}
# 1. Submit the intent with multiple authorizations
curl -X POST /transaction/submit -d '{
  "authorization": [
    {"chainId": 1, "address": "0x742...", "nonce": 42, ...},
    {"chainId": 137, "address": "0x742...", "nonce": 43, ...}
  ],
  "intentAuthorization": {...}
}'
# Returns: {"success": true, "data": {"transactionHash": "0x123...", "intentId": "0xabc..."}}

# 2. Execute step 0
curl -X POST /intent/0xabc.../execute/0 -d '{"executeOptions": {...}}'
# Returns: execution results for first chain authorization

# 3. Execute step 1
curl -X POST /intent/0xabc.../execute/1 -d '{"executeOptions": {...}}'
# Returns: execution results for second chain authorization

# Continue for all steps...
```

## Notes

* Intent ID is derived from `intentAuthorization.signature`
* Authorization array can contain multiple EIP-7702 authorizations for different chains/addresses
* All data is persisted to database for reliability and recovery
* Step execution is triggered separately via the intent execution endpoint
* Failed submissions can be debugged using the transaction hash
* The system supports resumable execution for complex multi-step intents
