Skip to main content

How do I add a cross-chain deposit, not just a swap?

Request a cross-chain Route whose tokenOut is the destination position, not only a destination token, then track delivery with bridge status.

J
Written by Javier Diaz

To add a cross-chain deposit, not just a swap, request a cross-chain Route whose tokenOut is the destination position — for example a vault share — then track destination delivery separately. A swap lands in a token. A deposit lands in a position.

Definition

A cross-chain deposit is a route from an asset on one chain into a position on another. The user should not have to bridge first and then deposit in a second manual step. The source transaction and destination execution are still separate stages.

How it works

  1. Discover destination position tokens with the live tokens or protocols endpoints, and offer only what your product is willing to show.

  2. Request a Route with tokenIn, amountIn, tokenOut (the position token), slippage, and destinationChainId.

  3. Show the quote, collect any required approval, and submit the source-chain transaction as-is.

  4. Poll bridge status with the source chain ID and source transaction hash. A source receipt is not a completed deposit.

  5. Refresh balances and destination metadata after delivery, failure, or a documented refund.

Use Bundle if you must specify the bridge or attach a custom post-bridge action sequence.

How Enso does this

Create a key in the Developer Portal. Call POST https://api.enso.build/api/v1/shortcuts/route with destinationChainId and a position token as tokenOut. Track completion with bridge status. See Crosschain Routing and Enso Earn.

FAQ

How is this different from a cross-chain swap?

The destination of a swap is a token. The destination of a deposit is a position token.

Is the deposit atomic with the source bridge?

No. A destination failure cannot revert a finalized source-chain bridge.

Related articles

  • How do I let users deposit into yield from another chain?

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

  • What is a zap in DeFi?

  • How do I track a cross-chain transaction after the user signs?

  • Are cross-chain transactions atomic?

Sources

Did this answer your question?