const chainId = 42161; // Arbitrum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token and Protocol Addresses
const tokenIn_AAVE = "0xba5ddd1f9d7f570dc94a51479a000e3bce967196";
const tokenOut_WETH = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1";
const uniswapManager = "0xc36442b4a4522e871399cd717abdd847ab11fe88";
// Define amount
const amountIn = parseUnits("10", 18); // 10 AAVE
const bundle = await client.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "router",
},
[
{
// Split AAVE into 2 equal parts
// Converts the first half into WETH
// needed for AAVE/WETH pool
protocol: "enso",
action: "split",
args: {
tokenIn: tokenIn_AAVE,
tokenOut: [tokenOut_WETH, tokenIn_AAVE],
amountIn: amountIn.toString(),
},
},
{
protocol: "uniswap-v3",
action: "depositclmm",
args: {
tokenOut: uniswapManager,
ticks: [25320, 25980],
tokenIn: [tokenOut_WETH, tokenIn_AAVE],
poolFee: "3000",
amountIn: [
// use output from the split call
{ useOutputOfCallAt: 0, index: 0 },
{ useOutputOfCallAt: 0, index: 1 },
],
},
},
]
);
const approvalData = await client.getApprovalData({
amount: amountIn.toString(),
chainId,
fromAddress,
tokenAddress: tokenIn_AAVE,
});