Skip to content
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

router-sdk: "Unexpected pool type in route when constructing trade object" is sometimes being thrown when using @uniswap/smart-order-router on Celo #77

Closed
kasparkallas opened this issue Aug 19, 2024 · 1 comment

Comments

@kasparkallas
Copy link

kasparkallas commented Aug 19, 2024

I seemingly randomly get this error with the smart-order-router SDK on Celo. I'm suspecting a weird type mismatch.

Related issue: Uniswap/smart-order-router#477

Part of the problem is the error message not being descriptive enough. It could print out what the wrong pool type is, to give me some idea where the problem could be at. It could also print out the version of the package used.

Reference to the relevant code:

throw new Error('Unexpected pool type in route when constructing trade object')

Example of tokens that sometimes throw:

Network: Celo
InToken: 0x471EcE3750Da237f93B8E339c536989b8978a438
OutToken: 0x66803fb87abd4aac3cbb3fad7c3aa01f6f3fb207

Example of usage:

  const router = new AlphaRouter({
    chainId: celo.chainId,
    provider: new ethers.providers.JsonRpcProvider(config.rpcUrl)
  });

  const swapOptions: SwapOptionsSwapRouter02 = {
    type: SwapType.SWAP_ROUTER_02,
    recipient: config.recipient,
    slippageTolerance: new Percent(50, 10_000),
    deadline: Math.floor(Date.now() / 1000 + 1200)
  }

  const swapRoute = await router.route(
    swapInTokenAmount,
    swapOutToken,
    TradeType.EXACT_INPUT, 
    swapOptions,
  );
@kasparkallas kasparkallas changed the title "Unexpected pool type in route when constructing trade object" is sometimes being thrown when using @uniswap/smart-order-router on Celo router-sdk: "Unexpected pool type in route when constructing trade object" is sometimes being thrown when using @uniswap/smart-order-router on Celo Aug 19, 2024
@kasparkallas
Copy link
Author

My issue was related to Bun bundling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant