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

Swap one token for another from inside the Risk Yield Account.

There is no aggregator on this chain, so the route is a Uniswap v3 pool. The API quotes every enabled fee tier and takes whichever returns the most — a 1% pool with depth beats a 0.05% pool with none, and here that is the common case.

owner
string
default:0x06A9aF046187895AcFc7258450B15397CAc67400
required

The wallet that owns the Risk Yield Account.

Example:

"0x06A9aF046187895AcFc7258450B15397CAc67400"

token_in
string
default:USDG
required

What you are spending.

Examples:

"USDC"

"WETH"

"0xA0b86a33E6441ccF30EE5DdEF1E9b652C91ac1c8"

token_out
string
default:WETH
required

What you want.

Examples:

"USDC"

"WETH"

"0xA0b86a33E6441ccF30EE5DdEF1E9b652C91ac1c8"

amount_in
default:100
required

In token units, not wei.

Required range: x > 0
Example:

"100"

chain
enum<string>
default:robinhood

Risk Yield is available on Robinhood Chain only.

Available options:
robinhood
Example:

"robinhood"

gas_sponsorship
boolean
default:false

Return EIP-712 typed data for the owner to sign instead of a transaction, so a sponsor can broadcast it.

preview
boolean
default:false

Return the plan and its simulation without building a transaction. Nothing is signed and nothing can be broadcast.

slippage_pct
default:0.5

How far the executed amounts may fall short of the quote before the transaction reverts. Memecoin pools move between the quote and the block that includes the transaction.

Required range: 0 < x <= 10
deadline_seconds
integer
default:300

How long the transaction stays valid once built.

Required range: 30 <= x <= 3600
fee_ppm
integer | null

Pin the route to one fee tier. Leave unset to let the API pick the tier that returns the most.

Required range: 0 <= x <= 1000000

Response

Successful Response

transaction
UnsignedTransaction · object | null

Null when preview was set, or when the plan is a no-op.

Example:
swap
SwapPlan · object | null

The swap leg of an entry or a rebalance.

steps
PlanStep · object[]

What the single transaction does, in order.

simulation
Simulation · object | null

The result of executing this against current state. A failure here is the only warning you get about a token that taxes transfers, blocks an address, or is paused.

warnings
string[]