> For the complete documentation index, see [llms.txt](https://docs.kumbaya.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kumbaya.xyz/developers/sdks/quickstart.md).

# Quickstart

This page gets you from zero to a real swap quote on MegaETH in about a dozen lines of TypeScript.

## What we're building

A script that:

1. Connects to MegaETH mainnet
2. Asks `QuoterV2` for the price of swapping 1 WETH → USDC through the 0.3% pool
3. Prints the result

## Install

```bash
npm install @kumbaya_xyz/sdk-core @kumbaya_xyz/v3-sdk viem
```

You don't strictly need viem - any RPC client works - but the example below uses it because it's the most ergonomic.

## The full script

```ts
import { createPublicClient, http, parseEther } from 'viem'
import { Token, ChainId } from '@kumbaya_xyz/sdk-core'
import { FeeAmount, Pool } from '@kumbaya_xyz/v3-sdk'

// 1. Network + RPC
const MEGAETH_MAINNET = {
  id: 4326,
  rpc: 'https://mainnet.megaeth.com/rpc',
}

// 2. Tokens (replace USDC with the real address from the token list / explorer)
//    Note: `ChainId.MEGAETH` (= 4326). The mainnet enum is just `MEGAETH`.
const WETH = new Token(
  ChainId.MEGAETH,
  '0x4200000000000000000000000000000000000006',
  18,
  'WETH',
)
const USDC = new Token(
  ChainId.MEGAETH,
  '0xYOUR_USDC_ADDRESS_HERE', // get it from default-token-list
  6,
  'USDC',
)

// 3. Compute the pool address (Kumbaya's POOL_INIT_CODE_HASH is wired in already)
const poolAddress = Pool.getAddress(WETH, USDC, FeeAmount.MEDIUM) // 0.3%

// 4. Quote 1 WETH -> USDC via QuoterV2
const QUOTER_V2 = '0x1F1a8dC7E138C34b503Ca080962aC10B75384a27'
const quoterAbi = [{
  type: 'function',
  name: 'quoteExactInputSingle',
  stateMutability: 'nonpayable',
  inputs: [{ type: 'tuple', name: 'params', components: [
    { type: 'address', name: 'tokenIn' },
    { type: 'address', name: 'tokenOut' },
    { type: 'uint256', name: 'amountIn' },
    { type: 'uint24', name: 'fee' },
    { type: 'uint160', name: 'sqrtPriceLimitX96' },
  ]}],
  outputs: [
    { type: 'uint256', name: 'amountOut' },
    { type: 'uint160', name: 'sqrtPriceX96After' },
    { type: 'uint32', name: 'initializedTicksCrossed' },
    { type: 'uint256', name: 'gasEstimate' },
  ],
}] as const

const client = createPublicClient({ transport: http(MEGAETH_MAINNET.rpc) })

const result = await client.simulateContract({
  address: QUOTER_V2,
  abi: quoterAbi,
  functionName: 'quoteExactInputSingle',
  args: [{
    tokenIn: WETH.address as `0x${string}`,
    tokenOut: USDC.address as `0x${string}`,
    amountIn: parseEther('1'),
    fee: FeeAmount.MEDIUM,
    sqrtPriceLimitX96: 0n,
  }],
})

console.log(`Pool address: ${poolAddress}`)
console.log(`1 WETH → ${result.result[0]} USDC (raw, 6 decimals)`)
```

## What just happened

* **`Pool.getAddress`** computed the deterministic pool address using **Kumbaya's** init code hash. If you used `@uniswap/v3-sdk` instead, the address would be wrong on MegaETH.
* **`QuoterV2`** is the standard V3 quoter, deployed at the address shown above. It does a real on-chain simulation and returns the exact output amount.
* No private key or signature involved - quoting is read-only.

## Where to go from here

* [**Executing swaps**](/developers/dex-integration/swapping.md) - turning this quote into a real on-chain trade
* [**Smart Order Router**](/developers/sdks/smart-order-router.md) - for multi-hop or multi-pool optimal routes
* [**Exchange API quote endpoint**](/developers/apis/exchange-api/quote.md) - if you'd rather not run the SOR client-side
* [**Reading pools and positions**](/developers/dex-integration/reading-pools.md) - querying live pool state directly
* [**Kumbaya Agent Kit**](/developers/building-agents/agent-kit.md) - building an LLM agent? Skip the SDK glue and use the ready-made MCP tools (`quote`, `swap`, `add_liquidity`, `ignite`, …)

## Don't do this

* **Don't use `@uniswap/v3-sdk` directly** for pool address derivation on MegaETH. It uses Uniswap's init code hash, not Kumbaya's. Use `@kumbaya_xyz/v3-sdk`.
* **Don't reference Uniswap V2 or V4 docs** when integrating Kumbaya. Stick to [V3 protocol docs](https://developers.uniswap.org/docs/protocols/v3/overview) plus this site.
