Skip to main content

How do I add a same-asset bridge, not a swap?

Call Route with destinationChainId and set tokenOut to the destination-chain address of the same asset. A direct-delivery path can stay a plain bridge transfer.

J
Written by Javier Diaz

Call the Route API with destinationChainId and set tokenOut to the destination-chain address of the same asset the user is sending. Review the quote: a candidate that delivers tokenOut directly can stay a plain bridge transfer, without destination execution.

Definition

A same-asset bridge moves a token from one chain to the same token on another chain. It is still a cross-chain route, but tokenOut is not a different destination asset or vault. Each chain still has its own token address.

How it works

  • Set tokenIn to the source-chain token and tokenOut to that asset’s destination-chain address, not the source address reused.

  • Include receiver, slippage or minAmountOut (not both, and follow Solana rules when Solana is the destination), and refundReceiver when you need it.

  • Review the route hops. If the path is a direct delivery of tokenOut, you should not expect a destination swap.

  • If the user actually wants a different destination token, change tokenOut — that becomes a bridge-and-swap.

  • Submit tx and poll status until delivery is complete. The user still does not sign on the destination chain.

How Enso does this

POST https://api.enso.build/api/v1/shortcuts/route. Crosschain Routing notes that a candidate whose bridge delivers tokenOut directly stays a plain bridge transfer. Use Bundle only if you must specify the provider or a callback.

FAQ

Can I pass the same contract address for tokenIn and tokenOut?

Only if that address is actually valid on both chains, which is unusual. Use the destination-chain token address for tokenOut.

Will Enso still swap if I wanted a same-asset transfer?

Set tokenOut correctly and review the returned route. If the quote includes unexpected hops, do not submit it; adjust the request or use Bundle when you need a fixed path.

Related articles

  • How do I bridge and swap in one flow?

  • How do I add cross-chain swaps to my app?

  • How do I tell which bridge a Route response selected?

  • What is a destinationChainId?

  • Cross-chain routing vs a simple token bridge

Sources

Did this answer your question?