const [nativeFee, bridgeFee] = await tedProtocol.estimateFees({
tokenIn: USDT_ADDRESS,
tokenOut: USDC_ADDRESS,
amountIn: ethers.parseUnits("1000", 6),
minAmountOut: ethers.parseUnits("990", 6),
srcChainId: 1,
dstChainId: 42161,
recipient: userAddress,
deadline: Math.floor(Date.now() / 1000) + 3600,
bridgeOptions: "0x"
});
const tx = await tedProtocol.crossChainSwap(
{
tokenIn: USDT_ADDRESS,
tokenOut: USDC_ADDRESS,
amountIn: ethers.parseUnits("1000", 6),
minAmountOut: ethers.parseUnits("990", 6),
srcChainId: 1,
dstChainId: 42161,
recipient: userAddress,
deadline: Math.floor(Date.now() / 1000) + 3600,
bridgeOptions: "0x"
},
{ value: nativeFee }
);
await tx.wait();