Skip to main content
POST
Python (SDK)

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Body

application/json

Request to execute multiple earn actions in a single atomic transaction.

Supported Action Types

  • V2_TRANSFER_FROM_EOA: Transfer tokens from the owner's EOA to the product account using Permit2. Requires a signed Permit2 message.
  • V2_TRANSFER_TO_EOA: Transfer tokens from the product account back to the owner's EOA. No signature required (product account owns the tokens).
  • V2_TRANSFER_TO_ADDRESS: Transfer ERC20 tokens from the product account to any specified recipient address. No signature required (product account owns the tokens).
  • V2_SWAP: Swap tokens within the product account using 1inch aggregator.
  • V2_MANAGE: Deposit or withdraw from DeFi venues (Aave, Morpho, Vaults, etc.)

Using V2_TRANSFER_FROM_EOA (Deposit to Product Account)

To include a transfer from EOA in your bundle, follow these steps:

  1. One-time setup: Approve Permit2 to spend the token by calling POST /v2/gas_sponsorship/approve_transfer and executing the returned transaction.

  2. Get Permit2 signature: Call POST /v2/earn/transfer with:

    • action: "DEPOSIT"
    • gas_sponsorship: true
    • spender: omit this field (defaults to product account address for bundle use)

    This returns EIP-712 typed data. Sign it with the owner's wallet.

  3. Include in bundle: Add a V2_TRANSFER_FROM_EOA action with the signature and nonce/deadline from the typed data.

The bundle will atomically: pull tokens from EOA → execute subsequent actions.

Using V2_TRANSFER_TO_EOA (Withdraw to EOA)

To transfer tokens from the product account back to the owner's EOA, simply add a V2_TRANSFER_TO_EOA action to your bundle. No signature is required since the product account already owns the tokens.

Specify the exact token amount to transfer.

owner
string
default:0x06A9aF046187895AcFc7258450B15397CAc67400
required

The owner's wallet address that controls the Earn Account.

Example:

"0x06A9aF046187895AcFc7258450B15397CAc67400"

chain
enum<string>
default:ethereum
required

Target blockchain network where the bundled actions will execute.

Available options:
base,
ethereum,
arbitrum,
hyperevm,
tempo,
bsc
Example:

"ethereum"

actions
V2UserOperation · object[]
required

List of actions to bundle. Actions are executed in order.

Minimum array length: 1
Example:
gas_sponsorship
boolean
default:false

If true, returns EIP-712 typed data for gas sponsorship. The owner must sign this data and submit to /gas_sponsorship/prepare.

Example:

false

Response

Successful Response

actions_count
integer
required

Number of individual transactions bundled in this execution.

transaction
UnsignedTransaction · object | null

Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false.

Example:
eip_712
BatchedSafeOperationsResponse · object | null

EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true. Owner must sign and submit to /gas_sponsorship/prepare.

Example: