Overview
The quote methods return swap quotes with pricing, presets, and auction parameters for cross-chain swaps. A quote must have enableEstimate: true to be used for creating orders.
getQuote
Get a quote for a cross-chain swap.
Parameters
Quote request parameters Source chain ID (e.g., 1 for Ethereum, 137 for Polygon)
Source token contract address. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native tokens.
Destination token contract address
Amount to swap in the token’s smallest unit (wei for ETH, etc.)
Wallet address of the maker (swap initiator)
If true, returns a quoteId required for creating orders. Set to true when you plan to create an order from this quote.
Permit signature for gasless token approvals (EIP-2612)
Integrator fee configuration Address that will receive the integrator fee
Fee amount in basis points (100 = 1%)
Source identifier for analytics and tracking
Use Permit2 for token approvals instead of standard ERC20 approve
Response
Quote object containing swap details Quote ID for tracking (only present when enableEstimate: true)
Exact source token amount to be swapped
Estimated destination token amount to be received
Available preset configurations (fast, medium, slow, custom)
Recommended preset for this swap (fast, medium, or slow)
srcEscrowFactory
EvmAddress | SolanaAddress
Source chain escrow factory address
dstEscrowFactory
EvmAddress | SolanaAddress
Destination chain escrow factory address
Time lock parameters for the swap
Safety deposit required on source chain
Safety deposit required on destination chain
Whitelisted resolver addresses (EVM only)
Token prices in USD Source token price in USD
Destination token price in USD
Estimated slippage (autoK)
Native order factory (present for native token swaps)
Integrator fee parameters from API
Example
import { SDK } from '@1inch/cross-chain-sdk'
const sdk = new SDK ({
url: 'https://api.1inch.dev/fusion-plus' ,
authKey: 'your-api-key'
})
// Get a quote for swapping USDC from Ethereum to Polygon
const quote = await sdk . getQuote ({
srcChainId: 1 , // Ethereum
dstChainId: 137 , // Polygon
srcTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' , // USDC on Ethereum
dstTokenAddress: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' , // USDC on Polygon
amount: '1000000' , // 1 USDC (6 decimals)
walletAddress: '0x1234567890123456789012345678901234567890' ,
enableEstimate: true // Required to create an order
})
console . log ( 'Quote ID:' , quote . quoteId )
console . log ( 'Source amount:' , quote . srcTokenAmount . toString ())
console . log ( 'Destination amount:' , quote . dstTokenAmount . toString ())
console . log ( 'Recommended preset:' , quote . recommendedPreset )
getQuoteWithCustomPreset
Get a quote with custom auction parameters instead of using the standard presets.
Parameters
Quote request parameters (same as getQuote)
body
QuoteCustomPresetParams
required
Custom preset configuration Custom auction preset parameters Duration of the Dutch auction in seconds. The auction price starts at auctionStartAmount and decreases to auctionEndAmount over this duration.
Starting amount for the destination token auction (in smallest unit). This is the minimum amount you’re willing to accept at auction start.
Ending amount for the destination token auction (in smallest unit). This is the maximum amount you could receive if resolved at auction end.
Custom points defining the auction curve. If not provided, a linear curve is used. Show array item properties
Destination token amount at this point
Time offset from auction start in seconds
Response
Quote object with custom preset applied. The presets.custom field will contain your custom preset.
Example
const quote = await sdk . getQuoteWithCustomPreset (
{
srcChainId: 1 ,
dstChainId: 137 ,
srcTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' ,
dstTokenAddress: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' ,
amount: '1000000' ,
walletAddress: '0x1234567890123456789012345678901234567890' ,
enableEstimate: true
},
{
customPreset: {
auctionDuration: 180 , // 3 minutes
auctionStartAmount: '990000' , // Start at 0.99 USDC
auctionEndAmount: '980000' , // End at 0.98 USDC
points: [
{ toTokenAmount: '985000' , delay: 90 }, // 0.985 USDC at 90 seconds
{ toTokenAmount: '982000' , delay: 150 } // 0.982 USDC at 150 seconds
]
}
}
)
console . log ( 'Custom preset:' , quote . presets . custom )
Presets
Every quote includes preset configurations that define the auction parameters:
PresetEnum
Available preset types:
fast - Quick execution with lower potential returns
medium - Balanced speed and returns (usually recommended)
slow - Slower execution with potentially better returns
custom - Custom auction parameters (only when using getQuoteWithCustomPreset)
Preset Properties
Each preset contains:
Duration of the Dutch auction in seconds
Delay before auction starts (in seconds)
Initial rate bump percentage
Destination token amount at auction start
Destination token amount including gas bump
Destination token amount at auction end
Estimated cost in destination tokens
Points defining the auction curve
Whether partial fills are allowed
Whether multiple fills are allowed
Address of exclusive resolver (if any)
Number of secrets required for this preset
Example: Using Presets
const quote = await sdk . getQuote ({
srcChainId: 1 ,
dstChainId: 137 ,
srcTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' ,
dstTokenAddress: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' ,
amount: '1000000' ,
walletAddress: '0x...' ,
enableEstimate: true
})
// Access preset information
console . log ( 'Recommended:' , quote . recommendedPreset ) // e.g., 'medium'
const fastPreset = quote . getPreset ( 'fast' )
console . log ( 'Fast auction duration:' , fastPreset . auctionDuration )
console . log ( 'Fast allows partial fills:' , fastPreset . allowPartialFills )
const mediumPreset = quote . getPreset ( 'medium' )
const slowPreset = quote . getPreset ( 'slow' )
// Use recommended preset
const recommendedPreset = quote . getPreset ( quote . recommendedPreset )
Understanding the Quote Response
Token Amounts
All token amounts are returned as bigint in the token’s smallest unit:
const quote = await sdk . getQuote ({ /* ... */ })
// For a token with 6 decimals (like USDC)
const srcAmount = quote . srcTokenAmount // 1000000n = 1 USDC
const dstAmount = quote . dstTokenAmount // 995000n = 0.995 USDC
// Convert to human-readable format
const srcUSDC = Number ( srcAmount ) / 1e6 // 1.0
const dstUSDC = Number ( dstAmount ) / 1e6 // 0.995
Auction Mechanics
Cross-chain swaps use a Dutch auction mechanism:
Auction Start : The order becomes available to resolvers at auctionStartAmount
Price Improvement : The price gradually improves (destination amount increases) following the points curve
Auction End : After auctionDuration seconds, the price reaches auctionEndAmount
Resolution : Resolvers compete to fill the order, typically resolving quickly for better margins
Time Locks
Time locks define safety windows for the atomic swap:
const timeLocks = quote . timeLocks
// Source chain time locks (in seconds)
console . log ( timeLocks . srcWithdrawal ) // Time before maker can withdraw
console . log ( timeLocks . srcPublicWithdrawal ) // Time before anyone can withdraw
console . log ( timeLocks . srcCancellation ) // Time before order can be cancelled
console . log ( timeLocks . srcPublicCancellation ) // Time before public cancellation
// Destination chain time locks
console . log ( timeLocks . dstWithdrawal ) // Time before withdrawal on dst
console . log ( timeLocks . dstPublicWithdrawal ) // Time before public withdrawal
console . log ( timeLocks . dstCancellation ) // Time before cancellation on dst
Safety Deposits
Safety deposits ensure both parties have skin in the game:
const quote = await sdk . getQuote ({ /* ... */ })
console . log ( 'Source deposit:' , quote . srcSafetyDeposit )
console . log ( 'Destination deposit:' , quote . dstSafetyDeposit )
These deposits are refunded upon successful completion of the swap.