Skip to main content
Choose the execution model first, then keep pricing, preparation, signing, and confirmation distinct.

TypeScript SDK

Quote, verify the route, and build the swap transaction in a few calls.

Runnable example

A complete HTTP-only lifecycle: quote, sign, submit, and confirm.

Pick your integration

  1. Load token metadata and deployment configuration; keep canonical IDs and network identity.
  2. Quote without a sender for display. Cancel or ignore responses from superseded user input.
  3. At confirmation, requote with explicit slippage, the selected referral, and sender. Verify the net amounts and fee disclosure.
  4. Inspect transaction.envelopeXdr. When transaction.simulated is true, the server already populated the account sequence and prepared resources, fees, and authorizations. Otherwise populate the sequence and prepare Soroban resources first.
  5. Sign through the wallet, submit, and poll for a final result. Show success only after successful execution.
A quote is not proof of balances, authorization, or final settlement. Decode and verify the actual envelope before asking the wallet to sign.

Confirmation checklist

Network, router, source account, and canonical token IDs match the intended deployment and wallet.
Atomic input, net output, fee disclosure, and minimum output match what the user confirmed.
The payload or envelope comes from the current quote, with explicit slippage.
Simulation status is read from the transaction object, and the complete outer transaction is prepared for composition.
Submission is tracked through final execution, including failures and uncertain responses.
Quote phases · Execution models · Error recovery