route and bundle API operate in crosschain mode.
For custom bundles, use the bridge action to facilitate cross-chain token transfers using one of three supported bridge protocols: CCIP, Relay, or Stargate.
For example: bridge assets to chains where protocols exist, execute operations such as minting, then optionally bridge results back to your origin chain and deposit them in a yield-bearing position.
Quick Start
- Crosschain Stablecoin Minting (Stargate)
- Crosschain Swap
Core Concepts
Bridge Protocols
Enso supports three bridge protocols: CCIP (Chainlink), Relay, and Stargate (LayerZero). Each has different characteristics for callback limits, native token support, and fee handling.
Protocol Discovery
Use protocol-specific APIs to discover bridge addresses:
/ccip/router for CCIP, /layerzero/pool for Stargate.Native Drop
Parent bridge calls calculate gas fees required for all child bridge operations and include these costs in the initial transaction fee.
Post-Bridge Execution
Callback arrays of Enso Actions execute on the destination chain after bridge completion. All actions within a bundle execute atomically.
Bridge Protocols
Enso supports three bridge protocols, each with different characteristics:| Feature | CCIP | Relay | Stargate |
|---|---|---|---|
| Provider | Chainlink | Relay | LayerZero |
| Callback Data Limit | 30KB | Unlimited | ~9.5KB |
| Native Token Bridging | No (ERC20 only) | Yes | Yes |
| Callback Gas Limit | 200k–3M | Dynamic | 300k base |
| Fee Token | Native | Token itself | Native |
| Finalization | Waits for finality (varies by chain) | Fast | Fast |
| Discovery API | /ccip/router | Coming soon | /layerzero/pool |
When to Use Each Bridge
CCIP (Chainlink)
CCIP (Chainlink)
Best for: High-security transfers requiring source chain finalization guarantees.
- Higher callback data limit (30KB) allows complex post-bridge operations
- Waits for source chain finality before executing callbacks, ensuring transaction irreversibility
- Does not support native token bridging (use wrapped tokens)
Relay
Relay
Best for: Flexible bridging with dynamic amounts and native token support.
- Uses placeholder-based design for dynamic amount resolution
- No callback data limit (amounts resolved at execution time)
- Supports both ERC20 and native token bridging
- API-based fee calculation
Stargate (LayerZero)
Stargate (LayerZero)
Best for: Native token bridging and LayerZero ecosystem integration.
- Full native token support
- Tight callback data limit (~9.5KB) - keep callbacks concise
- Uses LayerZero messaging for cross-chain communication
When to use Route vs Bundle API?
Use Route API for: Limitations: Defaults to Stargate bridge - bridge protocol cannot be selected. Cannot handle custom post-bridge logic or multi-step protocol interactions. Use Bundle API for:- crosschain position minting
- crosschain yield strategies
- CCIP bridging with callbacks
- mixed bridge protocols
Examples
1. Simple Cross-Chain Swap
Use Route API for basic cross-chain operations with automatic pathfinding.SDK
2. Crosschain Vault Zap
In this example, we’ll bridge ETH from Ethereum to zap it to a Ether.fiweETH vault on Base.
Try this route →
3. Cross-Chain Position Minting
Crosschain routing enables you to mint positions on different chains and bridge them back, while signing only once. In this example, we’ll bridge USDC from Berachain to Ethereum, mint e-rUSD using Reservoir protocol, then bridge rUSD back to Berachain. About Reservoir: Reservoir is a stablecoin protocol that mints rUSD (a USD-pegged stablecoin) by accepting USDC as collateral on Ethereum mainnet.Use the GET
layerzero/pool API or client.getLayerZeroPool() from the SDK
to find the correct pool address and use it as the primaryAddress for stargate.bridge operation.-
Atomic Safety: All callback actions execute as a single atomic transaction on the destination chain. If any action fails, the entire callback transaction reverts and bridged tokens are sent to the
refundReceiveraddress. Funds never get stuck in an intermediate state. - Gas Management: The initial transaction on the source chain calculates and pays for all destination chain gas costs using LayerZero’s native drop feature. You don’t need to hold native tokens on every destination chain.
- Output Chaining: Callbacks can reference outputs from previous callback actions using useOutputOfCallAt, enabling complex multi-step workflows that adapt to actual bridged amounts rather than fixed values.
mintOnBeraFromMainnet.ts
4. Crosschain Yield Strategy
Nested callbacks enable multi-hop workflows, allowing operations that span multiple chains where different protocols exist. In this example, we’ll do an Euler deposit of rUSD tokens minted on a Berachain by using Ethereum Mainnet assets. The user starts with USDC on Berachain and ends with yield-generating vault shares with a single signature.mintOnBeraDepositOnMainnet.ts
5. CCIP Bridge with Callback
Use CCIP for ERC20 token bridging with larger callback payloads. This example bridges SolvBTC from BNB Chain to Base, then swaps it to native ETH.Use the GET
/ccip/router API to get the CCIP Router address for the primaryAddress parameter.ccipBridgeWithCallback.ts
6. Mixed Bridge Protocols
Combine different bridge protocols in a single workflow. This example uses Stargate for the outbound bridge and CCIP for the return bridge, useful when different protocols support different token pairs.mixedBridgeProtocols.ts
7. Relay Bridge with Callback
Use Relay for bridging with dynamic amount resolution. This example bridges ETH from Ethereum to Arbitrum and wraps it to WETH.relayBridge.ts
Reference
Bridge Action Parameters
All bridge protocols share a common set of parameters:| Parameter | Description | Required |
|---|---|---|
protocol | Bridge protocol: "ccip", "relay", or "stargate" | Yes |
action | Always "bridge" | Yes |
primaryAddress | Protocol-specific address (see below) | Yes |
destinationChainId | Target blockchain network ID | Yes |
tokenIn | Token address to bridge from source chain | Yes |
amountIn | Amount to bridge (with full decimals) or reference to previous action output | Yes |
receiver | Address to receive bridged tokens on destination chain | Yes |
callback | Array of actions to execute on destination chain after bridging | No |
refundReceiver | Address to receive bridged tokens if callback execution fails. Defaults to receiver. | No |
Protocol-Specific Parameters
- CCIP
- Relay
- Stargate
primaryAddress: CCIP Router address from /ccip/router APICallback limits:- Data limit: ~30KB
- Gas limit: 200k (default) to 3M (max)
- ERC20 tokens only (no native token bridging)
- Fee paid in native token
Callback Requirements
- First action must be the
balanceaction:
- Reference previous outputs: Use
useOutputOfCallAtto chain actions together
- Nested callbacks: Bridge actions within callbacks enable multi-hop workflows across multiple chains
- Callback data limits: Keep callbacks concise for Stargate (~9.5KB limit). CCIP supports larger payloads (~30KB). Relay has no practical limit.
Protocol Discovery APIs
| Protocol | API Endpoint | Returns |
|---|---|---|
| CCIP | GET /ccip/router | CCIP Router address |
| Stargate | GET /layerzero/pool | OFT pool address |
| Relay | Coming soon | Token peer addresses |
Updated
