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

# Transaction Bundling

> Combine multiple DeFi actions into a single atomic transaction. Swap, deposit, withdraw, and rebalance in one signature.

## Why This Matters

Save gas and reduce user friction by combining actions.

**The problem**: Traditional DeFi requires separate transactions for each action. Swap ETH to USDC? One transaction. Deposit USDC into a vault? Another transaction. Each requires a signature, gas payment, and confirmation wait. Users drop off at every step.

**What Compass enables**: Bundle multiple actions into a single atomic transaction. Users sign once, and all actions execute together.

**UX example**: User wants to Earn on USDC venue, but only holds ETH. Without bundle: swap tokens and deposit into a vault. With bundling: 1 transaction, 1 signature.

***

## How It Works

**Example: Swap and deposit in one transaction**

1. Call [/earn/bundle](https://docs.compasslabs.ai/v2/api-reference/earn/execute-multiple-earn-actions) with a list of actions
2. API returns a single transaction that executes all actions in order
3. User signs once
4. All actions execute atomically.

**Result**: User swaps ETH to USDC and deposits USDC into a vault with one signature.

***

## Supported Actions

The bundle endpoint supports these action types:

| Action Type | What it does                                             |
| ----------- | -------------------------------------------------------- |
| `V2_SWAP`   | Swap tokens within the Earn Account                      |
| `V2_MANAGE` | Deposit or withdraw from ERC-4626 vaults or Aave markets |

Actions execute in the order provided. This matters when one action depends on another (e.g., swap first, then deposit the swapped tokens).

Missing an action? We can add it!

***

## Combining with Other Features

### With Gas Sponsorship

Set `gas_sponsorship=true` to get EIP-712 typed data. The owner signs off-chain, and a sender broadcasts the transaction paying gas.

Then submit the signature to [/gas\_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).

### With Embedded Fees

Add fees to individual `V2_MANAGE` actions (coming soon - for now, use individual endpoints for fee collection).

***

## Next Steps

Start building bundled transactions:

<CardGroup cols={3}>
  <Card title="Earn" icon="chart-line" href="/v2/Products/Earn">
    Explore vaults and Aave markets you can bundle actions for.
  </Card>

  <Card title="Gas Sponsorship" icon="gas-pump" href="/v2/Products/gas-sponsorship">
    Combine bundling with gas sponsorship for the best UX.
  </Card>

  <Card title="Product Accounts" icon="wallet" href="/v2/Products/Accounts">
    Bundling requires an Earn Account: learn how to create one.
  </Card>
</CardGroup>
