Method | Use Case | Function |
---|---|---|
Quick estimate | UI displays, real-time rates, liquidity checks | - getSwapPrice (Ts)- get_swap_price (Py) |
Swap quote | Pre-execution, approvals, custom handling | - quoteSwap (Ts)- quote_swap (Py) |
More on slippage protection
slippageBps: 100
in TypeScript or slippage_bps: 100
in Python), meaning the trade will only execute if the final price is within 1% of the expected price.This protects you from unfavorable trades if the price moves significantly between when you submit the transaction and when it’s executed.getSwapPrice
for Typescript and get_swap_price
for Python provide estimates only and do not reserve funds. They are suitable for frequent price updates but may be less precise than creating a swap quote.account.swap()
:taker
userOpHash
instead of transactionHash
taker
:
smartAccount.swap()
:getSwapPrice
and quoteSwap
) without a CDP account.
📖 Full examples: TypeScript | Python