Skip to main content

How do I attach destination actions after a bridge?

Use a Bundle bridge action with a callback that starts with a balance action, then the destination deposit or swap, chaining amounts with useOutputOfCallAt.

J
Written by Javier Diaz

Use a Bundle bridge action with a callback that starts with a balance action, then the destination deposit or swap, chaining amounts with useOutputOfCallAt.

Definition

Destination actions are the steps that should run on the destination chain after the bridged tokens arrive — for example, a deposit into a vault. They execute in a later destination-chain transaction, not in the same atomic transaction as the source-chain bridge.

How it works

  • Specify a bridge action in a bundle, including destinationChainId, the token and amount to send, and the receiver.

  • Add a callback array for the destination chain. Start it with a balance check on the delivered token.

  • Add the destination swap or deposit next, and point its amountIn at the balance output with useOutputOfCallAt.

  • After the user signs the source transaction, track delivery and callback status with bridge status. A failed callback cannot revert the source transfer.

How Enso does this

Call POST https://api.enso.build/api/v1/shortcuts/bundle. On the bridge action, set callback so the first item is { "protocol": "enso", "action": "balance" } for the delivered token, then the destination actions. Callback references are local to that array. On supported chains, Route can run destination steps through an intent route by default; use Bundle when you need this explicit callback. Destination callbacks are not available when Solana is the destination. See Crosschain Routing.

FAQ

Can I attach destination actions on a Route request?

Route can run destination steps through an intent route by default on supported chains. Use a Bundle bridge callback when you need to specify the destination actions yourself.

Why did my destination deposit never run?

The source transfer can succeed while the callback fails. Check bridge status, confirm the callback starts with a balance action, and remember that destination failure cannot undo the source transaction.

Related articles

  • What is a bridge callback?

  • What happens if a cross-chain callback fails?

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

  • Are cross-chain transactions atomic?

  • Can I route assets to Solana with Enso?

Sources

Did this answer your question?