hoodchain - v0.1.0
    Preparing search index...

    Function quoteSwap

    • Quote the best route from tokenIn to tokenOut for amountIn.

      Probes every fee tier for a direct hop, plus two-hop routes through WETH and USDG (0.05%/0.3% legs), all via QuoterV2 eth_call simulation, and returns the route with the highest output. Pools that exist without liquidity revert inside the quoter and are simply skipped.

      Parameters

      Returns Promise<SwapQuote>

      NoRouteError when no probed route can fill the swap.

      const quote = await quoteSwap(hood, {
      tokenIn: MAINNET_ADDRESSES.usdg,
      tokenOut: MAINNET_ADDRESSES.weth,
      amountIn: parseUsdg('100'),
      })