@kumbaya_xyz/smart-order-router
Last updated
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@^5ethers v5 only. SOR uses
BaseProviderfrom@ethersproject/providersv5. Use ethers v5 (providers.JsonRpcProvider); v6 and viem providers are not directly compatible.
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.).
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.
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