For the complete documentation index, see llms.txt. This page is also available as Markdown.

@kumbaya_xyz/smart-order-router

Finds the optimal route across Kumbaya's V3 pools for a given swap. Handles multi-hop, splits, and gas-cost-aware route selection.

npm install @kumbaya_xyz/smart-order-router @kumbaya_xyz/sdk-core ethers@^5

ethers v5 only. SOR uses BaseProvider from @ethersproject/providers v5. Use ethers v5 (providers.JsonRpcProvider); v6 and viem providers are not directly compatible.

Main exports

import {
  AlphaRouter,           // primary router class
  AlphaRouterParams,
  AlphaRouterConfig,
  // …plus the legacy router and lower-level providers/utilities
} from '@kumbaya_xyz/smart-order-router'

AlphaRouter is the entry point. It takes { chainId: ChainId.MEGAETH | ChainId.MEGAETH_TESTNET, provider: BaseProvider }, and optionally a long list of provider overrides if you want to plug in your own data sources (subgraph, multicall, gas oracle, etc.).

Use it when

  • You're building a swap UI and need quotes that consider all pools, not just one

  • You want the optimal route, not just a route

  • You're OK with the SOR being heavier than QuoterV2 - it does substantially more work

For one-shot quotes you don't want to compute client-side, use the hosted Exchange API /api/v1/quote endpoint instead.

Quick example

See Quoting prices → Option 2 for a runnable example.

The upstream @uniswap/smart-order-router docs cover the API surface in more detail - Kumbaya's fork is configured for MegaETH and uses Kumbaya's pool init code hash internally.

Last updated