Quote a swap, build the transaction, and send it through the connected wallet.Documentation Index
Fetch the complete documentation index at: https://companyname-a7d5b98e-feature-fumodocs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
How it works
TheSwapManager routes each quote and build call to a single registered swap provider — by default the first one you registered, or the one you pass as providerId. setDefaultProvider on the manager overrides the default; an unknown providerId throws. A quote is the chosen provider’s current offer for a route — input asset, output asset, amount, fees, and execution assumptions — and useBuildSwapTransaction turns an accepted quote into a TransactionRequest. AppKit does not price markets itself; the provider does.
The quote is provider-supplied data and can expire. Refresh it close to the moment the user confirms, and treat the displayed toAmount as an estimate, not a guarantee. The wallet still owns approval, signing, and rejection on the final send.
Before you begin
You need a connected wallet and at least one swap provider registered on the AppKit instance. Omniston and DeDust ship bundled — see Providers → How they are registered.Hooks
| Hook | Purpose |
|---|---|
useSwapQuote | Fetch a swap quote. |
useBuildSwapTransaction | Build a TransactionRequest from a quote. |
useSwapQuote is a query hook ({ data, isLoading, isError, refetch }); useBuildSwapTransaction is a mutation hook ({ mutate, mutateAsync, isPending, error }). Pass the built TransactionRequest to <Send /> from @ton/appkit-react, which exposes loading/error state.
Quote a swap
useSwapQuote takes the asset pair and amount and returns the provider’s current offer. Pass network, slippageBps, and an optional providerId to pin a specific provider.
Build and send the transaction
useBuildSwapTransaction is the mutation that turns an accepted quote into a TransactionRequest. Wrap it in a request callback and hand it to <Send />; the component exposes loading/error state.
After the send
After the send completes, pass the response togetTransactionStatus to confirm settlement before updating balances, orders, or inventory. The response carries either a boc or a normalizedHash; pass whichever is set.
Tips
- Refresh a quote before building if the user paused on the confirmation screen — the route can move while the modal is open.
- Provider responses are external data; treat
toAmountas an estimate, not a guarantee. minReceivedis the slippage-protected lower bound on the output afterslippageBpsis applied. Compare against your product floor before letting the user sign.- Slippage protection is provider-specific.
slippageBpscaps price drift; pass provider-specific fields throughproviderOptionswhen a provider needs more.