Skip to main content
This guide shows you how to let a customer, or your own backend, convert a token on one network into a different token on another in a single intent. You set the source and destination; the route covers the swap, the bridge, and gas. You need an OMS publishable key (pk_...) and the SDK installed.

Add a swap

Render Swap with the source and destination. Set from.amount to fix what the customer spends, or to.amount to fix what they receive.
Use exact output (to.amount) when the receiving side needs a precise amount, such as a settlement or invoice. Use exact input (from.amount) for conversions where the sender controls the spend. Set slippageTolerance to cap price movement, for example 0.005 for 0.5%.

Accept USDT on Tron

To let a customer pay from a Tron wallet, install @0xtrails/tvm and pass tronAdapter() in adapters. The widget detects installed Tron wallets and offers Tron as a source.
If you already pass EVM adapters, add tronAdapter() to the same array. The same prop works on Fund and Pay. For server-side Tron flows, see Tron and Solana in the API reference.

Build your own swap UI

useQuote returns a live quote and a send function, so you can render your own interface. It requires TrailsProvider; see React hooks.
Amounts are human-readable decimal strings. The hook does not poll for new quotes, so call refetchQuote before executing a quote the customer has been viewing.

From your server

For treasury movements and settlement between networks, such as USDT on Tron to USDC on Polygon, quote and execute the intent with the API. Tron and Solana are supported as origins and destinations alongside EVM networks. See quotes and execution. By default, routing balances cost and speed. To favor one, set preference in the quote options to FASTEST or CHEAPEST. The preference is best effort: if no route matches it, OMS returns the best available route instead.