This has already been reported here in the old repo:
https://github.com/Uniswap/v3-sdk/issues/199
here I'll provide a more detailed explanation of the bug because it literally took me a whole day to figure this out (thanks @allush for the issue)
The current SDK version ("@uniswap/v3-sdk": "^3.11.2") does not allow swaps for Router 2 because it does not allow to construct correct swapCallParameters.
Steps to reproduce:
import { abi as SWAP_ROUTER_ABI } from "@uniswap/v3-periphery/artifacts/contracts/SwapRouter.sol/SwapRouter.json";
const options: SwapOptions = {
slippageTolerance: new Percent(50, 10_000), // 50 bips, or 0.50%
deadline: Math.floor(Date.now() / 1000) + 60 * 20, // 20 minutes from the current Unix time
recipient: address,
};
This has already been reported here in the old repo: https://github.com/Uniswap/v3-sdk/issues/199 here I'll provide a more detailed explanation of the bug because it literally took me a whole day to figure this out (thanks @allush for the issue)
The current SDK version ("@uniswap/v3-sdk": "^3.11.2") does not allow swaps for Router 2 because it does not allow to construct correct swapCallParameters.
Steps to reproduce:
I use wagmi in this example, but it doesn't matter. The fix to this would be to use the old SwapRouter (https://docs.uniswap.org/contracts/v3/reference/deployments/ethereum-deployments) I didn't manage to get it working with the new SwapRouter 2 because of this error:![image](https://github.com/Uniswap/sdks/assets/88230737/7dda5989-7b73-410f-b33c-25016845fdc1)
Versions used: "@uniswap/sdk-core": "^5.0.0", "@uniswap/v3-sdk": "^3.11.2",