USDT_ETH -->|route| syrupUSDT((syrupUSDT))
end
syrupUSDT -.->|ccip<br/>bridge| C1
subgraph plasma ["🟣 Plasma"]
C1(( )) -->|aave-v3<br/>deposit| asUSDT((asUSDT))
end
```
```typescript mixedBridgeProtocols.ts theme={null}
const PLASMA_CHAIN_ID = 9745;
const ETHEREUM_ID = 1;
const WALLET_ADDRESS = "0x...";
// Token addresses
const USDT_PLASMA = "0x...";
const USDT_ETHEREUM = "0xdac17f958d2ee523a2206206994597c13d831ec7";
const SYRUP_USDT_ETHEREUM = "0x...";
const SYRUP_USDT_PLASMA = "0x...";
const client = new EnsoClient({ apiKey: process.env.ENSO_API_KEY! });
// Get pool addresses for both bridges
const stargatePool = await client.getLayerZeroPool({
chainId: PLASMA_CHAIN_ID,
token: USDT_PLASMA,
destinationChainId: ETHEREUM_ID + "",
});
const ccipRouter = await client.getCcipRouter({
chainId: ETHEREUM_ID,
});
const bundle = await client.getBundleData(
{
chainId: PLASMA_CHAIN_ID,
fromAddress: WALLET_ADDRESS,
routingStrategy: "router",
},
[
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: stargatePool[0].pool,
destinationChainId: ETHEREUM_ID,
tokenIn: USDT_PLASMA,
amountIn: "1000000000", // 1000 USDT
receiver: WALLET_ADDRESS,
callback: [
// Step 1: Check USDT balance on Ethereum
{
protocol: "enso",
action: "balance",
args: { token: USDT_ETHEREUM },
},
// Step 2: Swap USDT to syrupUSDT on Ethereum
{
protocol: "enso",
action: "route",
args: {
tokenIn: USDT_ETHEREUM,
tokenOut: SYRUP_USDT_ETHEREUM,
amountIn: { useOutputOfCallAt: 0 },
},
},
// Step 3: Bridge syrupUSDT back to Plasma via CCIP
{
protocol: "ccip",
action: "bridge",
args: {
primaryAddress: ccipRouter.router,
destinationChainId: PLASMA_CHAIN_ID,
tokenIn: SYRUP_USDT_ETHEREUM,
amountIn: { useOutputOfCallAt: 1 },
receiver: WALLET_ADDRESS,
// Callback on Plasma after CCIP bridge
callback: [
{
protocol: "enso",
action: "balance",
args: { token: SYRUP_USDT_PLASMA },
},
{
protocol: "aave-v3",
action: "deposit",
args: {
primaryAddress: "0x...", // AAVE V3 Plasma pool
tokenIn: SYRUP_USDT_PLASMA,
amountIn: { useOutputOfCallAt: 0 },
receiver: WALLET_ADDRESS,
},
},
],
},
},
],
},
},
],
);
```
### 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.
```mermaid theme={null}
flowchart LR
subgraph ethereum ["🌐 Ethereum"]
USDC((USDC)) -->|route| ETH_ETH((ETH))
ETH_ETH --> A1(( ))
end
A1 -.->|relay<br/>bridge| B1
subgraph arbitrum ["🔷 Arbitrum"]
B1(( )) -->|balance| ETH_ARB((ETH))
ETH_ARB -->|wrap| WETH((WETH))
end
```
```typescript relayBridge.ts theme={null}
const ETHEREUM_ID = 1;
const ARBITRUM_ID = 42161;
const WALLET_ADDRESS = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const USDC_ETHEREUM = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
const WETH_ARBITRUM = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
const NATIVE_TOKEN = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const client = new EnsoClient({ apiKey: process.env.ENSO_API_KEY! });
const bundle = await client.getBundleData(
{
chainId: ETHEREUM_ID,
fromAddress: WALLET_ADDRESS,
routingStrategy: "router",
},
[
// Step 1: Swap USDC to ETH on Ethereum
{
protocol: "enso",
action: "route",
args: {
tokenIn: USDC_ETHEREUM,
tokenOut: NATIVE_TOKEN,
amountIn: "10000000", // 10 USDC
},
},
// Step 2: Bridge ETH to Arbitrum via Relay
{
protocol: "relay",
action: "bridge",
args: {
primaryAddress: "0xa5f565650890fba1824ee0f21ebbbf660a179934",
destinationChainId: ARBITRUM_ID,
tokenIn: NATIVE_TOKEN, // Relay supports native tokens
amountIn: { useOutputOfCallAt: 0 },
receiver: WALLET_ADDRESS,
callback: [
// Step 3: Check ETH balance on Arbitrum
{
protocol: "enso",
action: "balance",
args: { token: NATIVE_TOKEN },
},
// Step 4: Wrap ETH to WETH on Arbitrum
{
protocol: "wrapped-native",
action: "deposit",
args: {
primaryAddress: WETH_ARBITRUM,
tokenIn: NATIVE_TOKEN,
tokenOut: WETH_ARBITRUM,
amountIn: { useOutputOfCallAt: 0 },
},
},
],
},
},
],
);
```
### 8. CCTP Bridge
Bridge native USDC across chains with Circle's CCTP — burn on the source, mint on the destination. Both fast and standard transfers are auto-relayed by Circle's Forwarding Service, so the receiver never needs destination gas.
```mermaid theme={null}
flowchart LR
subgraph ethereum ["🌐 Ethereum"]
USDC_ETH((USDC)) --> A1(( ))
end
A1 -.->|cctp<br/>burn + forward| B1
subgraph arbitrum ["🔷 Arbitrum"]
B1(( )) -->|mint| USDC_ARB((USDC))
end
```
<Tip>
Use the [GET
`/api/v1/cctp/bridge/tokenmessengerv2`](/pages/build/get-started/bridge-status)
API to fetch the `TokenMessengerV2` address for the source chain.
</Tip>
```typescript cctpBridge.ts theme={null}
import { EnsoClient } from "@ensofinance/sdk";
const ETHEREUM_ID = 1;
const ARBITRUM_ID = 42161;
const WALLET_ADDRESS = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const USDC_ETHEREUM = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const client = new EnsoClient({ apiKey: process.env.ENSO_API_KEY! });
// Fetch TokenMessengerV2 for the source chain
const { address: cctpTokenMessenger } = await fetch(
`https://api.enso.finance/api/v1/cctp/bridge/tokenmessengerv2?chainId=${ETHEREUM_ID}`,
{ headers: { Authorization: `Bearer ${process.env.ENSO_API_KEY}` } },
).then((r) => r.json());
const bundle = await client.getBundleData(
{
chainId: ETHEREUM_ID,
fromAddress: WALLET_ADDRESS,
receiver: WALLET_ADDRESS,
routingStrategy: "router",
},
[
{
protocol: "cctp",
action: "bridge",
args: {
primaryAddress: cctpTokenMessenger,
destinationChainId: ARBITRUM_ID,
tokenIn: USDC_ETHEREUM,
amountIn: "1000000000", // 1,000 USDC (6 decimals)
receiver: WALLET_ADDRESS,
},
},
],
);
await wallet.sendTransaction(bundle.tx);
```
See [CCTP Bridge](/pages/use-cases/bridges/cctp-bridge) for the full fee model, fast vs standard trade-offs, and the manual claim/recovery flow.
## Reference
### Bridge Action Parameters
All bridge protocols share a common set of parameters:
| Parameter | Description | Required |
| - | - | - |
| `protocol` | Bridge protocol: `"ccip"`, `"cctp"`, `"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` is not a generic bridge-action argument. Route-level dust/refund fields and recovery behavior depend on the selected endpoint and bridge provider.
### Protocol-Specific Parameters
<Tabs>
<Tab title="CCIP">
**`primaryAddress`**: CCIP Router address from `GET /api/v1/ccip/router?chainId={chainId}`
**Callback limits**:
* Data limit: \~30KB
* Gas limit: 200k minimum; Chainlink sets the maximum for each lane
**Notes**:
* ERC20 tokens only (no native token bridging)
* Fee paid in native token
```typescript theme={null}
// Get CCIP Router for the source chain
const ccipRouter = await client.getCcipRouter({
chainId: sourceChainId,
});
// Use: primaryAddress: ccipRouter.router
```
</Tab>
<Tab title="CCTP">
**`primaryAddress`**: `TokenMessengerV2` for the source chain from [`/cctp/bridge/tokenmessengerv2`](/pages/build/get-started/bridge-status)
**Callback limits**:
* Only `[enso:balance, hypercore-spot:deposit]` is supported for USDC to HyperCore via chain `999`; other CCTP callbacks are rejected
**Notes**:
* USDC only — `tokenIn` must be the source-chain USDC
* Auto-relayed by Circle's Forwarding Service on both fast and standard modes
* Fees deducted from minted USDC: protocol fee (Fast only, dynamic) + forwarding fee (`low`/`med`/`high`, always)
* Optional args: `protocolArgs.transferType` (`"fast"` | `"standard"`, default `fast` where supported else falls back to `standard`), `protocolArgs.forwardFee` (`"low"` | `"med"` | `"high"`, default `med`)
```typescript theme={null}
// Get TokenMessengerV2 for the source chain
const { address: cctpTokenMessenger } = await fetch(
`https://api.enso.finance/api/v1/cctp/bridge/tokenmessengerv2?chainId=${sourceChainId}`,
{ headers: { Authorization: `Bearer ${process.env.ENSO_API_KEY}` } },
).then((r) => r.json());
// Use: primaryAddress: cctpTokenMessenger
```
</Tab>
<Tab title="Relay">
**`primaryAddress`**: Token address being bridged
**Callback limits**:
* Data limit: Unlimited (uses placeholder-based design)
* Gas limit: Dynamic (calculated at execution)
**Notes**:
* Supports native token bridging (`0xeeee...eeee`)
* Fee taken from bridged token amount
* API-based quote system
```typescript theme={null}
// For Relay, primaryAddress is the token itself
// Use: primaryAddress: tokenAddress
```
</Tab>
<Tab title="Stargate">
**`primaryAddress`**: OFT pool address from [`/layerzero/pool`](/api-reference/integration/layerzero-pool) API
**Callback limits**:
* Data limit: \~9.5KB (keep callbacks concise)
* Gas limit: 300k base
**Notes**:
* Supports native token bridging (`0xeeee...eeee`)
* Fee paid in native token
* Uses LayerZero messaging
```typescript theme={null}
// Get Stargate pool
const pools = await client.getLayerZeroPool({
chainId: sourceChainId,
token: tokenAddress,
destinationChainId: targetChainId + "",
});
// Use: primaryAddress: pools[0].pool
```
</Tab>
</Tabs>
### Callback Requirements
<Warning>
**Critical**: All callback sequences must begin with a balance check action to
verify the bridged token amount on the destination chain.
</Warning>
1. **First action must be the `balance` action**:
```json theme={null}
{
"protocol": "enso",
"action": "balance",
"args": { "token": "bridged_token_address" }
}
```
2. **Reference previous outputs**: Use `useOutputOfCallAt` to chain actions together
```json theme={null}
{ "useOutputOfCallAt": 0 }
```
Or with specific output index:
```json theme={null}
{ "useOutputOfCallAt": 0, "index": 1 }
```
3. **Nested callbacks**: Bridge actions within callbacks enable multi-hop workflows across multiple chains
4. **Callback data limits**: Keep callbacks concise for Stargate (\~9.5KB limit). CCIP supports larger payloads (\~30KB). Relay has no practical limit. CCTP supports only the HyperCore deposit callback shape.
### Protocol Discovery APIs
| Protocol | API Endpoint | Returns |
| - | - | - |
| CCIP | `GET /api/v1/ccip/router?chainId={chainId}` | CCIP Router address |
| CCTP | [`GET /cctp/bridge/tokenmessengerv2`](/pages/build/get-started/bridge-status) | `TokenMessengerV2` address per chain |
| Relay | Not needed — use the bridged token address as `primaryAddress` | — |
| Stargate | [`GET /layerzero/pool`](/api-reference/integration/layerzero-pool) | OFT pool address |
<div>
<p>Updated </p>
</div>
```
```
# Get Started
Source: https://docs.enso.build/pages/build/get-started/overview
Choose the right Enso API path for swaps, zaps, Earn products, cross-chain execution, custom workflows, and third-party transaction validation.
Enso helps you build DeFi flows by returning transaction data your user can sign. First [create and verify an API key](/pages/build/get-started/authentication), then choose the product path that matches what you are building.
## What Are You Building?
| Product goal | Start here | Use these APIs |
| - | - | - |
| Add swaps, zaps, or direct deposits to a wallet | [Route](/pages/build/get-started/route) | `POST /v1/shortcuts/route`, token data, balances |
| Build an Earn tab or yield marketplace | [Enso Earn](/pages/earn/overview) | `GET /v1/tokens`, `GET /v1/wallet/balances`, `POST /v1/shortcuts/route`, conditional `GET /v1/wallet/approve` |
| Move a user into a tokenized position from any supported asset | [Route](/pages/build/get-started/route) | Route plus token metadata and refreshed balances |
| Build a cross-chain deposit or bridge flow | [Crosschain Routing](/pages/build/get-started/crosschain-routing) | Route, `destinationChainId`, bridge callback parameters, bridge status |
| Create a custom multi-action workflow | [Bundle API](/pages/build/get-started/bundling-actions) | `POST /v1/shortcuts/bundle`, actions, dynamic outputs, checks |
| Show current assets and DeFi positions | [Balances](/pages/build/get-started/balances) | `GET /v1/wallet/balances` plus token metadata |
| Discover supported protocols and yield destinations | [Protocol Data](/pages/build/get-started/protocol-data) | `GET /v1/tokens`, protocols, standards |
| Validate a transaction generated outside Enso | [Quoter](/pages/quoter/overview) | Quoter simulate and validate endpoints |
| Earn a fee on your users' trades | [Fees](/pages/build/reference/fees) | Developer portal **Fees** tab; `feeAmount` and `feeBreakdown` in responses |
## Standard Integration Flow
1. Discover available chains, tokens, protocols, and destination positions.
2. Read the user's balances to decide what they can spend or migrate.
3. Request a Route when Enso should find the path, or request a Bundle when your product controls the ordered actions.
4. Request approval only when spending an ERC-20 through the router and allowance is insufficient.
5. Submit the returned transaction as-is.
6. Poll bridge status only for async cross-chain routes.
7. Refresh balances and token metadata for the final UI state.
## Route API vs Bundle API
| Use case | Use Route | Use Bundle |
| - | - | - |
| Token swap | Yes | Rarely |
| Zap into one vault, LP, or tokenized position | Yes | Only when custom actions are required |
| Withdraw or redeem one position | Yes | Only when follow-up actions are required |
| Position migration | Yes | Use Bundle if fixed action order matters |
| Harvest, borrow, repay, leverage, or claim | No | Yes |
| Cross-chain route into a destination token or position | Yes | Use Bundle only for custom post-bridge logic |
| Multiple checks, dynamic outputs, or custom callbacks | No | Yes |
The **Route API** is the standalone `/shortcuts/route` endpoint: Enso selects the path and returns one signer-ready transaction. The **Bundle API** accepts an ordered array of actions selected by your product. Inside a Bundle request, `protocol: "enso", action: "route"` is the **`enso:route` bundle action**, not the standalone Route API.
## Core Guides
<CardGroup>
<Card title="Core Concepts" icon="book-open" href="/pages/build/get-started/core-concepts">
Learn the Enso primitives: token data, balances, route, bundle, approval, bridge status, and Quoter.
</Card>
<Card title="Route" icon="route" href="/pages/build/get-started/route">
Find optimal paths for swaps, zaps, deposits, withdrawals, migrations, and simple cross-chain flows.
</Card>
<Card title="Bundle API" icon="layer-group" href="/pages/build/get-started/bundling-actions">
Build product-controlled multi-action workflows with dynamic outputs and checks.
</Card>
<Card title="Protocol Data" icon="coins" href="/pages/build/get-started/protocol-data">
Discover supported tokens, protocols, yield metadata, APY, TVL, underlying assets, and logos.
</Card>
<Card title="Balances" icon="wallet" href="/pages/build/get-started/balances">
Show current wallet assets, DeFi positions, and post-execution balances.
</Card>
<Card title="Crosschain Routing" icon="bridge" href="/pages/build/get-started/crosschain-routing">
Route from a source chain into a destination chain token or position.
</Card>
</CardGroup>
## What To Show Users
| Moment | Show this | Source |
| - | - | - |
| Before action | Available source assets, current positions, APY, TVL, protocol, chain, token metadata | Balances and tokens |
| Quote review | Expected output, minimum output, gas, price impact, route path, approval requirement | Route or Bundle response |
| Signing | The returned transaction exactly as provided by Enso | `tx` |
| After confirmation | New source balance, new destination position, current APY, remaining dust, bridge status if cross-chain | Balances, token metadata, bridge status |
<div>
<p>Updated </p>
</div>
# Get Protocol Data
Source: https://docs.enso.build/pages/build/get-started/protocol-data
Access DeFi protocols and tokens data through Enso's API
With Enso API, you can retrieve detailed information about DeFi protocols, tokens, and user balances.
These endpoints enable you to build data-rich applications with comprehensive DeFi protocol information.
## Protocol Information
The Protocol API endpoints provide access to DeFi protocol data, standards, and volume metrics.
### Get Supported Protocols
Retrieve a list of all protocols supported by Enso, including names, logos, and supported chains.
**API Reference:** [GET `/v1/protocols`](/api-reference/integration/all-protocols)
<CodeGroup>
```ts EnsoSDK theme={null}
import { EnsoClient } from '@ensofinance/sdk';
// Initialize the client with your API key
const enso = new EnsoClient({
apiKey: 'YOUR_API_KEY' // Replace with your actual API key
});
// Get all supported protocols
async function getAllProtocols() {
try {
const protocols = await enso.getProtocolData();
console.log('Supported protocols:', protocols);
return protocols;
} catch (error) {
console.error('Error fetching protocols:', error);
throw error;
}
}
getAllProtocols();
```
```bash cURL theme={null}
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.build/api/v1/protocols" \
| jq
```
</CodeGroup>
### Get Protocol Standards and Actions
Access detailed information about protocols' supported actions and standards.
This helps you understand which operations can be performed with specific protocols.
**API Reference:** [GET `/v1/standards`](/api-reference/integration/standards)
<CodeGroup>
```ts EnsoSDK theme={null}
// Get all available standards (protocols and their actions)
async function getProtocolStandards() {
try {
const response = await fetch('https://api.enso.build/api/v1/standards', {
headers: {
'Authorization': `Bearer ${enso.apiKey}`,
'Content-Type': 'application/json'
}
});
const standards = await response.json();
console.log('Protocol standards and actions:', standards);
return standards;
} catch (error) {
console.error('Error fetching standards:', error);
throw error;
}
}
// Get specific protocol standard
async function getProtocolStandardBySlug(slug) {
try {
const response = await fetch(`https://api.enso.build/api/v1/integration/${slug}`, {
headers: {
'Authorization': `Bearer ${enso.apiKey}`,
'Content-Type': 'application/json'
}
});
const standard = await response.json();
console.log(`Standard for ${slug}:`, standard);
return standard;
} catch (error) {
console.error(`Error fetching standard for ${slug}:`, error);
throw error;
}
}
getProtocolStandards();
getProtocolStandardBySlug('aave-v3');
```
```bash cURL theme={null}
# Get all standards
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.build/api/v1/standards" \
| jq
# Get specific protocol standard
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.build/api/v1/integration/aave-v3" \
| jq
```
</CodeGroup>
### Get Protocol Volume Data
Retrieve transaction volume on a given chain.
**API Reference:** [GET `/volume/{chainId}`](/api-reference/defi/chain-and-transactions-volume)
<CodeGroup>
```ts EnsoSDK theme={null}
// Get protocol volume data for a specific chain
async function getChainVolume(chainId: number) {
try {
const response = await fetch(`https://api.enso.build/api/v1/volume/${chainId}`, {
headers: {
'Authorization': `Bearer ${enso.apiKey}`,
'Content-Type': 'application/json'
}
프로젝트로 돌아가기