Crosschain Swaps
Swap supported tokens on one or more chains into a token on another chain, by exact input or exact output.
A crosschain swap converts tokens on one or more source chains into a token on a destination chain, in a single intent. Tokens are identified by chain ID and contract address, not symbol.
The Nexus middleware quotes each swap. It picks the source balances and one provider (
How swaps are routed
nexus-v2, mayan, or relay) that fills the whole swap from source to destination. The quote names it in quote.provider and is fixed once the user approves.
You do not choose or combine routes. To steer a quote, restrict its sources; see liquidity routing.
Before quoting, the catalog shows which tokens can pair:
getAvailableSourceTokens(destination)lists sources that can reach a destination, grouped by provider.getAvailableDestinationTokens(sources)lists destinations reachable from the given sources.confirmRouteExists(sources, destination)checks catalog compatibility. It does not guarantee a quote.
Exact input
swapWithExactIn spends a fixed raw amount from every source. The output varies with price and fees. All sources and the destination must share one provider.
Exact output
swapWithExactOut delivers a fixed raw amount on the destination chain. Omit sources to let the quote draw from any wallet balance, or pass candidate tokens to restrict it. The quote decides how much to take from each.
Slippage
slippageBps defaults to 50 (0.5%) and accepts 0 to 10000 or 'auto'. The user receives at least quote.output.minAmountRaw.
Swap and execute
swapAndExecute swaps into the destination token, then calls a contract with it. See Bridge, Transfer & Execute.
Read the swap methods reference for parameters and examples.