You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has already been reported here in the old repo: Uniswap/v3-sdk#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";
constoptions: SwapOptions={slippageTolerance: newPercent(50,10_000),// 50 bips, or 0.50%deadline: Math.floor(Date.now()/1000)+60*20,// 20 minutes from the current Unix timerecipient: address,};
This issue is fixed in PR #196 but until it's verified & merged, you can copy the swaprouter.ts file manually into your repo to construct correct swapCallParameters ( especially for those who are working on base chain which only supports swaprouter02 )
This has already been reported here in the old repo:
Uniswap/v3-sdk#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:
Versions used:
"@uniswap/sdk-core": "^5.0.0",
"@uniswap/v3-sdk": "^3.11.2",
The text was updated successfully, but these errors were encountered: