Automatically convert any token into the required vault token and deposit as collateral in a single transaction. In this example, we’re zapping WETH to an AAVE aUSDT position.
const WETH: Address = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; // WETH
const aUSDT: Address = "0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a";
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;

const routeParams: RouteParams = {
  tokenIn: [WETH],
  tokenOut: [aUSDT],
  amountIn: ["1000000000000000000"],
  chainId: 1,
  routingStrategy: "router",
  fromAddress,
};

const approvalData = await client.getApprovalData({
  amount: routeParams.amountIn[0],
  chainId: 1,
  tokenAddress: WETH,
  fromAddress,
});
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(approvalData.tx, approvalData.gas);
await sendEoa(route.tx, route.gas);

Zap Deposits

Zap ETH to lend on Aave V3 on Arbitrum

Deposit WETH into Aave on Arbitrum. Try this route → Route Mechanics:
  • Deposit into Aave V3: The input WETH is deposited into the Aave V3 protocol, and in return, you receive aWETH, representing your lending position.
const WETH = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
const aWETH = "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8";

const routeParams = {
  fromAddress: userAddress,
  receiver: userAddress,
  chainId: 42161, // Arbitrum
  amountIn: ["1000000000000000000"], // 1 WETH
  tokenIn: [WETH],
  tokenOut: [aWETH],
  routingStrategy: "router",
};

const route = await client.getRouteData(routeParams);

const approval = await client.getApprovalData({
  chainId: 42161,
  fromAddress: userAddress,
  amount: "1000000000000000000",
  tokenAddress: WETH,
});

// Approval transaction for `router` strategy
await sendEoa(approval.tx, approval.gas);
// Sending the actual transaction
await sendEoa(route.tx, route.gas);

Zap ETH to lend on Euler V2 on Mainnet

Supply ETH to the Euler V2 lending market on the Ethereum Mainnet. This route provides a seamless way to start earning interest on your ETH. Try this route → Route Mechanics:
  • Wrap: The input ETH is first wrapped into WETH.
  • Deposit: The WETH is then deposited into the Euler V2 protocol, and you receive eWETH in return.
const ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const eWETH = "0xb3b36220fA7d12f7055dab5c9FD18E860e9a6bF8";

const routeParams = {
  fromAddress: userAddress,
  receiver: userAddress,
  chainId: 1, // Ethereum
  amountIn: ["1000000000000000000"], // 1 ETH
  tokenIn: [ETH],
  tokenOut: [eWETH],
  routingStrategy: "router",
};

const route = await client.getRouteData(routeParams);
// Approval transaction for `router` strategy

const approval = await client.getApprovalData({
  chainId: 1,
  fromAddress: userAddress,
  amount: "1000000000000000000",
  tokenAddress: ETH,
});

// Approval transaction for `router` strategy
await sendEoa(approval.tx, approval.gas);

// Sending the actual transaction
await sendEoa(route.tx, route.gas);

Lend USDC on Spark on Gnosis

Supply USDC to Spark’s money market on the Gnosis chain. This route provides a direct way to enter a lending position. Try this route → Route Mechanics:
  • Deposit into Spark: Your USDC is deposited into the Spark-lend protocol, and you receive spUSDC in return, which represents your share in the lending pool.
const USDC = "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83";
const spUSDC = "0x5850d127a04ed0b4f1fcdfb051b3409fb9fe6b90";

const routeParams = {
  fromAddress: userAddress,
  receiver: userAddress,
  chainId: 100, // Gnosis
  amountIn: ["100000000"], // 100 USDC
  tokenIn: [USDC],
  tokenOut: [spUSDC],
  routingStrategy: "router",
};


const route = await client.getRouteData(routeParams);

// approval TX
const approvalData = await client.getApprovalData({
  chainId: 100,
  fromAddress: userAddress,
  amount: "100000000",
  tokenAddress: USDC,
});
await sendEoa(approvalData.tx, approvalData.gas);



// Sending the actual transaction
await sendEoa(route.tx, route.gas);