For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

  • executeSwap is generic and depends entirely on your executeTransaction implementation.

  • 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