Skip to main content

Get Swap Quote

GET /quotes/swap Get a quote for swapping tokens when depositing into or withdrawing from a DeFi instrument. Returns the expected output amount, token information, minimum output with slippage protection, and price impact.

Request

Query Parameters

Response

Response Fields

Notes

  • When needsSwap is false, no swap is needed - the input amount equals output amount
  • The minAmountOut applies 0.5% slippage tolerance for transaction protection
  • Price impact is calculated based on current Uniswap V4 pool liquidity
  • Use toToken.decimals to format amounts for display (e.g., divide by 10^decimals)

Examples

Deposit Quote (USDC → GHO)

Response:
Convert to human-readable:
  • Input: 10 USDC (10000000 ÷ 10^6)
  • Output: ~10.001 GHO (10001276903584562876 ÷ 10^18)
  • Price: 1 USDC ≈ 1.0001 GHO

Withdraw Quote (GHO → USDC)

No Swap Needed (USDC instrument)

When depositing USDC into a USDC-based instrument:

TypeScript Example


Error Responses


Next Steps

Instruments API

Query available instruments

Positions API

Check user positions

How It Works

Understand the transaction flow

Integration Guide

Full integration walkthrough