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);