npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@kumbaya_xyz/smart-order-router

v4.22.42

Published

Kumbaya DEX Smart Order Router

Downloads

541

Readme

Kumbaya Logo

Kumbaya Smart Order Router

The Smart Order Router for Kumbaya DEX on MegaETH - the first real-time blockchain with 10ms block times.

This package finds the most efficient way to swap tokens by searching across multiple routes and considering gas costs.

Supported Networks

| Network | Chain ID | Status | |---------|----------|--------| | MegaETH Testnet | 6343 | ✅ Live | | MegaETH Mainnet | 4326 | 🔜 Coming Soon |

Installation

npm install @kumbaya_xyz/smart-order-router

Quick Start

import { AlphaRouter, ChainId } from '@kumbaya_xyz/smart-order-router';
import { ethers } from 'ethers';

const provider = new ethers.providers.JsonRpcProvider('https://carrot.megaeth.com');
const router = new AlphaRouter({
  chainId: ChainId.MEGAETH_TESTNET,
  provider,
});

Contract Addresses (MegaETH Testnet)

| Contract | Address | |----------|---------| | UniswapV3Factory | 0x53447989580f541bc138d29A0FcCf72AfbBE1355 | | SwapRouter02 | 0x8268DC930BA98759E916DEd4c9F367A844814023 | | UniversalRouter | 0x7E6c4Ada91e432efe5F01FbCb3492Bd3eb7ccD2E | | QuoterV2 | 0xfb230b93803F90238cB03f254452bA3a3b0Ec38d | | NonfungiblePositionManager | 0x367f9db1F974eA241ba046b77B87C58e2947d8dF | | Multicall | 0x0DC8eE7a1BcF659dC41B25669238688A816A051A | | Multicall2 | 0xc638099246A98B3A110429B47B3F42CA037BC0a3 | | WETH | 0x4200000000000000000000000000000000000006 |

Testing

Unit Tests

pnpm install
pnpm build
pnpm test

Integration Tests

Create a .env file with your RPC endpoint:

JSON_RPC_PROVIDER_MEGAETH_TESTNET = 'https://carrot.megaeth.com'

Then run:

pnpm integ-test

CLI Examples

MegaETH Testnet

Swap WETH to USDC:

./bin/cli quote --tokenIn 0x4200000000000000000000000000000000000006 --tokenOut 0x75139A9559c9CD1aD69B7E239C216151D2c81e6f --amount 0.1 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 6343

Swap USDC to USDT:

./bin/cli quote --tokenIn 0x75139A9559c9CD1aD69B7E239C216151D2c81e6f --tokenOut 0x8E1eb0b74A0aC37abaa0f75C598A681975896900 --amount 100 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 6343

Gas Configuration

MegaETH has unique gas characteristics due to its 10ms block times:

  • Base swap cost: 80,000 gas
  • Cost per initialized tick: 350,000 gas
  • Cost per hop: 100,000 gas
  • Blocks to live (cache): 360,000 blocks (~1 hour)

Measuring Gas Costs

To measure actual gas costs on MegaETH Testnet, run the gas measurement script:

npx ts-node scripts/measure-megaeth-gas.ts

This script:

  • Connects to MegaETH Testnet RPC
  • Scans for existing pools via PoolCreated events
  • Measures gas for factory, pool, and quoter operations
  • Reports gasEstimate values from QuoterV2 quotes
  • Outputs recommended gas constants for the router

Related Packages

Troubleshooting

ProviderGasLimit Errors

If you encounter gas limit errors, ensure your RPC provider has a high enough eth_call gas limit. The default configuration uses up to 150,000,000 gas per call.

For custom node configurations, you can lower the multicallChunk and gasLimitPerCall parameters when initializing the router.

License

GPL-2.0-or-later