me={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "uniswap-v2",
action: "swap",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
tokenOut: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
amountIn: "1000000000000000000", // 1 WETH (18 decimals)
primaryAddress: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", // Uniswap V2 Router
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Receiver
slippage: "100", // Optional: 1% slippage (100 basis points)
poolFee: "3000", // Optional: Pool fee in basis points (e.g., 3000 for 0.3%)
},
},
],
);
```
| Parameter | Description | Required |
| - | - | - |
| `tokenIn` | Address of token to swap from | Yes |
| `tokenOut` | Address of token to swap to | Yes |
| `amountIn` | Amount of `tokenIn` to swap in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the router or pool contract | No |
| `receiver` | Address to receive the output tokens | Yes |
| `slippage` | Slippage tolerance in basis points (100 = 1%) | No |
| `poolFee` | Optional pool fee in basis points when using specific pools | No |
| `poolId` | The ID to identify the liquidity pool | No |
### `deposit`
Deposits tokens into a protocol to receive a position token or add liquidity.
<Tabs>
<Tab title="Morpho">
Use the optional `positionId` to deposit into.
```js theme={null}
{
protocol: "morpho-markets-v1",
action: "deposit",
args: {
amountIn: { useOutputOfCallAt: 0 },
tokenIn: TOKEN_IN_ADDRESS,
receiver: WALLET_ADDRESS,
primaryAddress: MORPHO,
positionId: MORPHO_POSITION_ID,
},
}
```
</Tab>
<Tab title="Aave">
```js theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH address
tokenOut: "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8", // aWETH address (optional)
amountIn: "1000000000000000000", // Amount in wei (1 WETH)
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", // Aave V3 pool
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver address
},
},
],
);
```
</Tab>
</Tabs>
| Parameter | Description | Required |
| - | - | - |
| `tokenIn` | Address of token to deposit. Can be a single address or an array for multiple tokens | Yes |
| `tokenOut` | Address of token to receive. Can be a single address or an array for multiple tokens. Omit if position is not represented by a token. | No |
| `amountIn` | Amount of `tokenIn` to deposit in wei (with full decimals). Can be a single value or an array for multiple tokens | Yes |
| `primaryAddress` | Address of the protocol contract to interact with | Yes |
| `receiver` | Address to receive the output tokens if not the caller | No |
| `positionId` | Position ID to deposit into (e.g. Morpho Markets' positions) | No |
### `redeem`
Redeems underlying assets from a protocol by exchanging shares or tokens. Use it to exit a position and retrieve the desired tokens.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
// Step 1: First deposit into the ERC4626 vault to get shares
{
protocol: "erc4626",
action: "deposit",
args: {
tokenIn: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI (underlying asset)
tokenOut: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // yvDAI (vault shares)
amountIn: "1000000000000000000", // 1 DAI
primaryAddress: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // Vault address
},
},
// Step 2: Now redeem the shares we just received
{
protocol: "erc4626",
action: "redeem",
args: {
tokenIn: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // yvDAI shares
tokenOut: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI (underlying asset)
amountIn: { useOutputOfCallAt: 0 }, // Use the shares from the deposit
primaryAddress: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // Vault address
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver
},
},
],
);
```
| Parameter | Description | Required |
| - | - | - |
| `tokenIn` | Address of shares/tokens to redeem | No |
| `tokenOut` | Address of token(s) to receive upon redemption. Can be a single address or an array | Yes |
| `amountIn` | Amount of shares/tokens to redeem in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the contract to interact with | Yes |
| `receiver` | Address to receive the output tokens if not the caller | No |
## Bridging
The `bridge` action lets you perform transactions spanning multiple chains.
It relies on Stargate and LayerZero to coordinate interactions.
### `bridge`
Facilitates cross-chain token transfers using various bridge protocols with optional callback actions on the destination chain.
When used with callback actions (`callback` array), it can execute a destination-chain sequence after tokens arrive. Source bridging and destination execution are asynchronous; callback failure cannot revert a finalized source-chain bridge. Monitor the transfer through [Bridge Status](/pages/build/get-started/bridge-status).
<Note>
**Important**: When using callbacks, the callback bundle MUST start with a
balance action to check the bridged token balance on the destination chain.
</Note>
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
spender: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
routingStrategy: "router",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC on mainnet
amountIn: "1000000000", // 1000 USDC
tokenOut: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // ETH
},
},
{
protocol: "enso",
action: "fee",
args: {
token: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
amount: { useOutputOfCallAt: 0 },
bps: 25,
receiver: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11", // Fee receiver
},
},
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: "0x77b2043768d28e9c9ab44e1abfc95944bce57931",
destinationChainId: 8453,
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
amountIn: { useOutputOfCallAt: 1 },
receiver: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
callback: [
{
protocol: "enso",
action: "balance",
args: {
token: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
},
},
{
protocol: "enso",
action: "split",
args: {
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
tokenOut: [
"0x50c5725949a6f0c72e6c4a641f24049a917db0cb",
"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
],
amountIn: { useOutputOfCallAt: 0 },
},
},
{
protocol: "enso",
action: "slippage",
args: {
amountOut: { useOutputOfCallAt: 1, index: 0 },
bps: 50,
},
},
{
protocol: "enso",
action: "slippage",
args: {
amountOut: { useOutputOfCallAt: 1, index: 1 },
bps: 50,
},
},
{
protocol: "uniswap-v4",
action: "depositclmm",
args: {
tokenOut: "0x7c5f5a4bbd8fd63184577525326123b519429bdc",
ticks: [-276842, -275842],
tokenIn: [
"0x50c5725949a6f0c72e6c4a641f24049a917db0cb",
"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
],
poolFee: "100",
amountIn: [
{ useOutputOfCallAt: 1, index: 0 },
{ useOutputOfCallAt: 1, index: 1 },
],
},
},
],
},
},
],
);
```
| Parameter | Description | Required |
| - | - | - |
| `primaryAddress` | Source bridge pool address | Yes |
| `destinationChainId` | Target blockchain network ID | Yes |
| `tokenIn` | Token address to bridge from source chain | Yes |
| `amountIn` | Amount to bridge (with full decimals) or a reference to a previous action's output | Yes |
| `receiver` | Address to receive bridged tokens on destination chain | Yes |
| `callback` | Array of actions to execute on the destination chain after bridging (must start with balance action) | No |
| `callbackValue` | Additional value passed to the callback (in addition to bridge token) | No |
| `protocolArgs` | Provider-specific options such as CCTP transfer type and forward-fee level | No |
Bridge providers do not all support the same callback shapes. Use [Crosschain Routing](/pages/build/get-started/crosschain-routing) for provider-specific constraints.
## Slippage protection
The `route` action accepts its own `slippage` or explicit minimum settings. For direct protocol actions and internal routes used by composition actions, add `slippage` or `minamountout` checks where the flow requires explicit protection.
### `slippage`
Derives a quote-backed minimum for a previously produced output and adds an on-chain check. The transaction reverts when the received amount is below that minimum.
The referenced output must already exist. In `split -> slippage -> depositclmm` flows, the slippage checks intentionally sit before `depositclmm` because they protect the internal routes that prepare its inputs.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "uniswap-v2",
action: "swap",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
tokenOut: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
amountIn: "1000000000000000000",
primaryAddress: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
},
},
{
protocol: "enso",
action: "slippage",
args: {
bps: "100",
amountOut: { useOutputOfCallAt: 0 },
},
},
],
);
```
| Parameter | Description | Required |
| - | - | - |
| `amountOut` | Expected output amount - **must** be output of one of previous actions `useOutputOfCallAt` | Yes |
| `bps` | Maximum acceptable slippage in basis points (1 bps = 0.01%, 100 bps = 1%) | Yes |
### `minAmountOut`
Applies slippage protection specified in absolute amount (`minAmountOut`) to ensure the received amount is within the acceptable range of the expected output.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
// First action to get an output
{
protocol: "uniswap-v2",
action: "swap",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
tokenOut: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
amountIn: "1000000000000000000", // 1 WETH
primaryAddress: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", // Uniswap V2 Router
receiver: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
},
},
// Now apply minAmountOut check
{
protocol: "enso",
action: "minamountout",
args: {
amountOut: { useOutputOfCallAt: 0 }, // Reference to first action's output
minAmountOut: "1940000", // Minimum amount (1.94 USDC)
},
},
],
);
```
| Parameter | Description | Required |
| - | - | - |
| `amountOut` | Expected output amount - **must** be output of one of previous actions `useOutputOfCallAt` | Yes |
| `minAmountOut` | Minimum acceptable amount of out token | Yes |
`minamountout` is an assertion-only action. Do not use its position as a downstream token-amount reference.
## Deposit & Redeem Actions
### `depositCLMM`
Deposits tokens into a Concentrated Liquidity Market Maker pool (like Uniswap V3).
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
spender: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
routingStrategy: "router",
},
[
{
protocol: "uniswap-v4",
action: "depositclmm",
args: {
tokenOut: "0xbd216513d74c8cf14cf4747e6aaa6420ff64ee9e",
ticks: [-887270, 887270],
tokenIn: [
"0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT
"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", // WBTC
],
poolFee: "500",
amountIn: ["1000000000", "100000000"], // 1000 USDT (6 decimals), 1 WBTC (8 decimals)
},
},
],
);
```
| Parameter | Description | Required |
| - | - | - |
| `tokenIn` | Array of addresses of tokens to deposit (usually 2 tokens) | Yes |
| `tokenOut` | Address of the position NFT to receive | Yes |
| `amountIn` | Array of amounts to deposit in wei (with full decimals). Must match the length of `tokenIn` array | Yes |
| `ticks` | Array containing lower and upper tick bounds defining the price range | Yes |
| `poolFee` | Pool fee tier in basis points (e.g., 3000 for 0.3%) | Yes |
| `receiver` | Address to receive the position NFT if not the caller | No |
| `tickSpacing` | The minimum gap between valid price points for adding liquidity | No |
| `hook` | The hook address for Uniswap V4 pools | No |
### `redeemCLMM`
Redeems tokens from a Concentrated Liquidity Market Maker position (like Uniswap V3).
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "uniswap-v3",
action: "redeemclmm",
args: {
tokenIn: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", // UNI-V3-POS NFT
tokenOut: [
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
],
liquidity: "1000000000000", // Liquidity amount to withdraw
tokenId: "123456", // The NFT token ID
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver
},
},
],
);
```
| Parameter | Description | Required |
| - | - | - |
| `tokenIn` | Address of the position NFT token | Yes |
| `tokenOut` | Array of addresses of tokens to receive | Yes |
| `liquidity` | Amount of liquidity to withdraw | Yes |
| `tokenId` | ID of the position NFT | Yes |
| `receiver` | Address to receive the underlying tokens if not the caller | No |
### `singleDeposit`
Deposits a single token into a protocol. This is a specialized version of the `deposit` action for single token deposits.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "yearn",
action: "singledeposit",
args: {
tokenIn: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI address
tokenOut: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // yvDAI address
amountIn: "10000000000000000000", // 10 DAI (18 decimals)
primaryAddress: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // Yearn vault
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver
},
},
],
);
```
| Parameter | Description | Required |
| - | - | - |
| `tokenIn` | Address of the single token to deposit | Yes |
| `tokenOut` | Address of the token to receive (usually a receipt or share token) | No |
| `amountIn` | Amount of `tokenIn` to deposit in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the protocol contract to interact with | Yes |
| `receiver` | Address to receive the output tokens if not the caller | No |
### `multiDeposit`
Deposits multiple tokens into a protocol (like Curve or Balancer) in a single operation.
```ts theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "curve",
action: "multideposit",
args: {
tokenIn: [
"0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT
],
tokenOut: "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", // 3Crv LP token
amountIn: [
"10000000000000000000", // 10 DAI (18 decimals)
"10000000", // 10 USDC (6 decimals)
"10000000", // 10 USDT (6 decimals)
],
primaryAddress: "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7", // Curve 3pool
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver
},
},
],
);
console.log(JSON.stringify(bundle, null, 2));
```
| Parameter | Description | Required |
| - | - | - |
| `tokenIn` | Array of addresses of tokens to deposit | Yes |
| `tokenOut` | Address of the LP token or receipt token to receive | No |
| `amountIn` | Array of amounts to deposit in wei (with full decimals). Must match the length of `tokenIn` array | Yes |
| `primaryAddress` | Address of the pool or protocol contract to interact with | Yes |
| `receiver` | Address to receive the LP tokens if not the caller | No |
### `tokenizedSingleDeposit`
<Warning>
**Deprecation Notice:** This action is deprecated in favor of using
`singleDeposit` with the appropriate protocol. It will be removed in a future
API version.
</Warning>
Deposits a single token and receives a tokenized position.
```json theme={null}
{
"protocol": "compound-v3",
"action": "tokenizedsingledeposit",
"args": {
"tokenIn": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"tokenOut": "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // cUSDCv3
"amountIn": "10000000", // 10 USDC (6 decimals)
"primaryAddress": "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // Compound market
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" // Optional: Receiver
}
}
```
| Parameter | Description | Required |
| - | - | - |
| `tokenIn` | Address of token to deposit | Yes |
| `tokenOut` | Address of tokenized position to receive | Yes |
| `amountIn` | Amount of `tokenIn` to deposit in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the protocol contract to interact with | Yes |
| `receiver` | Address to receive the position tokens if not the caller | No |
### `tokenizedMultiDeposit`
<Warning>
**Deprecation Notice:** This action is deprecated in favor of using
`multiDeposit` with the appropriate protocol. It will be removed in a future
API version.
</Warning>
Deposits multiple tokens and receives a tokenized position.
```json theme={null}
{
"protocol": "balancer-v2",
"action": "tokenizedmultideposit",
"args": {
"tokenIn": [
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", // WBTC
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" // WETH
],
"tokenOut": "0x8353157092ED8Be69a9DF8F95af097bbF33Cb2aF", // BPT token
"amountIn": [
"100000", // 0.01 WBTC (8 decimals)
"10000000000000000" // 0.01 WETH (18 decimals)
],
"primaryAddress": "0x8353157092ED8Be69a9DF8F95af097bbF33Cb2aF", // Balancer Pool
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" // Optional: Receiver
}
}
```
| Parameter | Description | Required |
| - | - | - |
| `tokenIn` | Array of addresses of tokens to deposit | Yes |
| `tokenOut` | Address of the tokenized position to receive | Yes |
| `amountIn` | Array of amounts to deposit in wei (with full decimals). Must match the length of `tokenIn` array | Yes |
| `primaryAddress` | Address of the protocol contract to interact with | Yes |
| `receiver` | Address to receive the position token if not the caller | No |
### `multiOutSingleDeposit`
Deposits a single token and receives multiple output tokens (typically used for certain AMM positions).
```ts theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "uniswap-v3",
action: "multioutsingledeposit",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
tokenOut: [
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", // WBTC
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
],
amountIn: "1000000000000000000", // 1 WETH (18 decimals)
primaryAddress: "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640", // Uniswap pool
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver
},
},
],
);
console.log(JSON.stringify(bundle, null, 2));
```
| Parameter | Description | Required |
| - | - | - |
| `tokenIn` | Address of the single token to deposit | Yes |
| `tokenOut` | Array of프로젝트로 돌아가기