Documentation Index
Fetch the complete documentation index at: https://docs.enso.build/llms.txt
Use this file to discover all available pages before exploring further.
Enso GET route API allows withdrawing (redeeming) from a curated vault position to an arbitrary DeFi or base asset.
Withdraw PT and swap to USDC
This route redeems ezETH PT into USDC, performing any necessary withdrawals and swaps.
Try this route →
Route mechanics:
- Redeem from
PT_ezETH to get SY_ezETH
- Redeem from
SY_ezETH to obtain the deposited ezETH
- Swap
ezETH to desired USDC
const PT_ezETH_25APR2024 = "0xeEE8aED1957ca1545a0508AfB51b53cCA7e3c0d1";
const USDC: Address = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const amountIn = parseUnits("10", 18).toString();
const chainId = 1;
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const routeParams: RouteParams = {
chainId,
amountIn: [amountIn],
fromAddress,
tokenIn: [PT_ezETH_25APR2024],
tokenOut: [USDC],
routingStrategy: "router",
receiver: fromAddress,
slippage: "500",
};
const route = await client.getRouteData(routeParams);
console.log(JSON.stringify(route, null, 2));
const approvalData = await client.getApprovalData({
chainId,
fromAddress,
amount: amountIn,
tokenAddress: PT_ezETH_25APR2024,
});
await sendEoa(approvalData.tx, approvalData.gas);
// sending the actual transaction
await sendEoa(route.tx, route.gas);
Withdraw ADAI to USDC
This sample withdraws ADAI and swaps it to USDC in a single transaction.
Try this route →
Route mechanics:
- Withdraw deposited
ADAI to the underlying DAI
- Swaps
DAI to USDC
- The
receiver gets the resulting funds
const ADAI_ADDRESS = "0x018008bfb33d285247A21d44E50697654f754e63";
const USDC: Address = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const amountIn = parseUnits("100", 18).toString();
const chainId = 1;
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const routeParams: RouteParams = {
chainId,
destinationChainId: chainId,
amountIn: [amountIn],
fromAddress,
tokenIn: [ADAI_ADDRESS],
tokenOut: [USDC],
routingStrategy: "router",
receiver: fromAddress,
slippage: "500",
};
const route = await client.getRouteData(routeParams);
console.log(JSON.stringify(route, null, 2));
const approvalData = await client.getApprovalData({
chainId,
fromAddress,
amount: amountIn,
tokenAddress: ADAI_ADDRESS,
});
await sendEoa(approvalData.tx, approvalData.gas);
// sending the actual transaction
await sendEoa(route.tx, route.gas);