-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requesting V2 trades always throw an error "Unexpected pool type in route when constructing trade object" #477
Comments
I very often get this error even when I try to force it to only look for "V3" by specifying Update 1
Update 2I think I fixed it for my use-case like this: const swapRoute = await alphaRouter.route(
swapInTokenAmount,
swapOutToken,
TradeType.EXACT_INPUT,
swapOptions,
{
v2PoolSelection: undefined, // Hacky way to make sure Uniswap doesn't use V2 pools.
protocols: ["V3" as any], // Uniswap type issue, and this is not respected anyway, but added for completeness sake.
}
); and: const alphaRouter = new AlphaRouter({
chainId: config.chainId,
provider: new ethers.providers.JsonRpcProvider(config.rpcUrl),
v2Supported: [] // Remove V2 routes
}); Update 3Nope, still getting the error sometimes. Update 4Direct link to the problematic code in router SDK: https://github.com/Uniswap/sdks/blob/b2148e66482d72d0948895ad90b7dbd481616000/sdks/router-sdk/src/entities/trade.ts#L133 |
@Brenzee I don't quite get the explanation about the versions as the latest "@uniswap/default-token-list": "^11.13.0",
"@uniswap/permit2-sdk": "^1.3.0",
"@uniswap/router-sdk": "^1.10.0",
"@uniswap/sdk-core": "^5.3.0",
"@uniswap/swap-router-contracts": "^1.3.1",
"@uniswap/token-lists": "^1.0.0-beta.31",
"@uniswap/universal-router": "^1.6.0",
"@uniswap/universal-router-sdk": "^2.2.4",
"@uniswap/v2-sdk": "^4.3.2",
"@uniswap/v3-sdk": "^3.13.0",
"@uniswap/v4-sdk": "^1.0.0", These packages seem to be the latest and don't align with your description. |
I'm submitting a ...
[X] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
When
route
is called with configit always fails with error
This error comes from the
@uniswap/router-sdk
This makes the
smart-order-router
unusable for any V2 swaps unless a specific@uniswap/router-sdk
version is forced.I am pretty confident this happens because
smart-order-router
uses"@uniswap/v2-sdk": "^3.2.3"
, but therouter-sdk
uses"@uniswap/v2-sdk": "^4.0.1"
When I force
@uniswap/router-sdk
to be version1.7.1
, it works fine. I suggest either support the@uniswap/v2-sdk
versioni 4 or use a specific@uniswap/router-sdk
version, that does not use@uniswap/v2-sdk
version 4.The text was updated successfully, but these errors were encountered: