Recommended swap composition
How to layer quoting, execution and managed swap methods.
For the best user experience, we recommend splitting swap concerns into clear layers:
Quoting layer (
getQuote,getLiquidity,getSupportedChains): pre-trade UI state, chain selection and route previews.Execution layer (
buildSwap,getApproveTransaction,checkApprovals): fine-grained control over approval UX and the transaction lifecycle.Managed layer (
executeSwap): the SDK orchestrates the full flow and returns the final transaction hashes.
Notes
executeSwapis generic and depends entirely on yourexecuteTransactionimplementation.EVM approval orchestration, including revoke-then-approve for USDT-like tokens, is handled internally.
When using
readableAmount, token decimals must be supplied by your application or a metadata service.
Last updated