> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ponzu.app/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK Reference

> TypeScript SDK for deploying tokens on Ponzu. Buy, swap, and farm via the contracts or the MCP server.

## Installation

```bash theme={null}
npm install @ponzu_app/sdk viem
```

<Card title="@ponzu_app/sdk on NPM" icon="npm" href="https://www.npmjs.com/package/@ponzu_app/sdk">
  Full package, changelog, and API docs.
</Card>

***

## Setup

```typescript theme={null}
import { createWalletClient, createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0xYOUR_PRIVATE_KEY')
const wallet  = createWalletClient({ account, chain: mainnet, transport: http() })
const client  = createPublicClient({ chain: mainnet, transport: http() })
```

Replace `mainnet` with `sepolia` or use Robinhood Chain (`robinhood`).

The SDK `deploy()` encodes a **Ponzu Curve**. The app factory defaults to a **Ponzu Auction**. Both are valid crafts of the same Presale.

***

## Deploy a Token

```typescript theme={null}
import { deploy } from '@ponzu_app/sdk'
import { parseEther } from 'viem'

const result = await deploy(
  {
    owner:          account.address,
    tokenName:      'My Token',
    tokenSymbol:    'MYTKN',
    metadata:       'ipfs://Qm...',
    targetEthRaise: parseEther('5'),
  },
  wallet,
  client,
  'mainnet', // 'sepolia' | 'robinhood'
)
```

**Parameters:**

| Parameter          | Type      | Description                                                                                                               |
| ------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------- |
| `owner`            | `Address` | Wallet that receives the 1% creator purchase fee                                                                          |
| `tokenName`        | `string`  | ERC-20 token name                                                                                                         |
| `tokenSymbol`      | `string`  | ERC-20 token symbol                                                                                                       |
| `metadata`         | `string`  | IPFS, Arweave, or HTTPS URL to project metadata JSON. Image lives in that JSON.                                           |
| `targetEthRaise`   | `bigint`  | Optional target raise in wei. Clamped to the network's grossed minRaise (\~4.2 ETH mainnet/Robinhood, \~0.1 ETH Sepolia). |
| `initialBuyAmount` | `bigint`  | Optional founder buy in wei. Default 0.                                                                                   |
| `vestingDuration`  | `bigint`  | Seconds. Must be on the recipe allowlist. Default 864000 (10 days).                                                       |

**Cost:** live creation fee from `getCreationFee` plus optional founder buy. Do not hardcode the fee.

**Returns:**

```typescript theme={null}
result.addresses.token         // ERC-20 token
result.addresses.presale       // Presale contract (also the bottle NFT collection)
result.addresses.farm          // LP staking farm
result.addresses.distributor   // Fee distribution
result.addresses.launcher      // DEX pool creator
result.addresses.hook          // chain-wide Ponzuki
result.addresses.project       // Registry coordinator
result.addresses.operator      // Access control (same address as project)
result.addresses.lpVault
result.addresses.memberCard
result.addresses.membersVault
```

***

## Buy, refund, swap, farm

The published SDK ships `deploy`, `getAddresses`, and pricing helpers. Presale buys, refunds, claims, swaps, and farm actions go through the contracts or the MCP server.

See the [ABI Reference](/protocol/abi-reference) for `presale`, `refund`, `claimTokens`, `swapExactIn`, and `zapEth`.

Refunds return 90% of ETH before launch (95% if an auction expired unlaunched). Swap fee is charged on input: 20% at launch, decaying to 1% over the first hour.

***

## Network Configuration

```typescript theme={null}
import { getAddresses } from '@ponzu_app/sdk'

const addresses = getAddresses('mainnet')
// or 'sepolia' | 'robinhood'

// addresses.ponzuRecipe, .ponzuki, .poolManager, .weth,
// auction and curve template addresses, .ethRewarder
```

***

## MCP Server (AI Agent Integration)

For AI agents (Claude Desktop, Cursor, Claude Code):

```json theme={null}
{
  "mcpServers": {
    "ponzu": {
      "command": "npx",
      "args": ["-y", "@ponzu_app/mcp"],
      "env": {
        "PONZU_PRIVATE_KEY": "0x...",
        "PONZU_NETWORK": "mainnet"
      }
    }
  }
}
```

Set `PONZU_NETWORK` to `sepolia` or `robinhood` as needed. Omit `PONZU_PRIVATE_KEY` for read-only access.

<Card title="@ponzu_app/mcp on NPM" icon="npm" href="https://www.npmjs.com/package/@ponzu_app/mcp">
  Full MCP server package and configuration docs.
</Card>

***

## Raw Contract Interaction

For direct contract access without the SDK, see the [ABI Reference](/protocol/abi-reference).

Factory contract (PonzuV4Recipe, mainnet): [`0xCF3c37C0aD2Fd94368921ff570d100119072E826`](https://etherscan.io/address/0xCF3c37C0aD2Fd94368921ff570d100119072E826)
