# SDK

`hookr-sdk` is the TypeScript package for building on Hookr from any app, launcher or agent. It runs on viem, holds no wallet and signs nothing. It carries the release's addresses, its ABIs, the 22-quote catalog, the bounds of every setting of the standard core's Hook Blocks and advisories, and the builders hookr.fun itself uses.


`hookr-sdk` 1.8.1 quotes and swaps on any Hookr pool. It builds launches on Hookr's core, with arbitrage recapture on unless a pool's member names `RECAPTURE_OFF`, at the 15% split. Launch the core's own Hook Blocks on hookr.fun or with hookr_build_launch. It reads King of the Pool rounds, and Hookr on Monad is in it too. It also carries the Agent gate: a pool's terms and bind data, a wallet's link and its proof, and the gate's own explanation of a swap.

## What it builds

| Task | Builder | Contract |
| --- | --- | --- |
| Launch a token with Hook Blocks | `readCoreLaunchManifest`, `buildLaunch`, `buildLaunchAdvised`, `buildLaunchFamily` | the core's HookrLauncher |
| Open pools for an existing token | `buildLaunch` with the token named | HookrLauncher |
| Quote a swap | `buildQuote` | HookrQuoter |
| Swap | `buildSwap` | HookrRouter |
| Approve an ERC-20 | `swapAllowance`, `launchFunding`, `buildApprovals` | the token |
| Claim | `claimable` and `claim` on the pool's own core, `config.rules` from `poolConfig` | the pool's own core |
| Read a King of the Pool round | `readKingOfThePool`, `kingOfThePoolClose` | the pool's own core |

Each builder returns the chain id, the contract, the call data and the value. Your wallet sends it.

## Modules

| Module | What it does |
| --- | --- |
| `chains` | The three chains this SDK carries: their nodes, explorers and PoolManagers, the clock the contracts count in and how each chain charges gas |
| `releases` | Hookr's addresses and deployments on Robinhood Chain, Monad and Arbitrum, the release manifest and the one with the core's launcher, the chains for viem, explorer links and the lane gas floor |
| `king-of-the-pool` | King of the Pool's reads, its checks and the round's arithmetic |
| `wallet` | Builds the launcher, router and quoter calls, each with its bounds |
| `launch` | Encodes a Multi-pool launch, its dev buy and exactly what the launcher pulls |
| `params` | Every creator knob with its range and default, and the checks that refuse a value outside them |
| Core block settings (`rules.ts`) | Encodes and checks a pool's core block settings, and prices the Snipe tax and the dynamic fee |
| `quotes` | Classifies a quote asset and reads amounts in its own decimals |
| `registry` | Typed registry operations and the admission checks |
| `advisories` | Encodes the fee and market-hours advisory configs |
| `vault`, `referrals`, `proofs` | Liquidity vault and treasury calls, referral authorizations and Merkle proofs |

## The release manifest

Every builder takes the release's manifest: each contract it calls, at its address, with its runtime code hash. The package carries the release's deployment, so there is nothing to pass:

```ts
const manifest = await readReleaseManifest(client, HOOKR_1);
```

It reads the code at each address and refuses it unless every contract runs the code the release deployed. `releaseManifest(HOOKR_1)` builds the same manifest with no reads. A new token on Hookr's core launches through the core's own launcher, so its launch takes `readCoreLaunchManifest(client, HOOKR_1)`, the same manifest with that launcher.

## Launch on your own hook

The SDK's launch and swap builders take only a root the manifest you pass them pins. `buildLaunch`, `buildLaunchAdvised`, `buildLaunchWithBuy`, `buildLaunchFamily`, `buildSwap` and `buildQuote` refuse any other hook, your own included, with `Unqualified root`: the release manifest pins one root.

A manifest that adds your hook and its core beside the release's pins, each at the hash of the code it holds, is one the builders take. The Builder's Integrate code for your own hook builds it and says the checks to pass first, the ones Hookr makes before it trades an own hook. The builders give a member arbitrage recapture unless it names `RECAPTURE_OFF`, so name it on a hook whose `laneSource()` reads zero.

To launch on your own hook without the builders, encode `HookrLauncher.launch(token, hook, members, deadline)` yourself with the package's `launcherAbi`, and send it to `contract(manifest, "launcher")`:

- Read `rootOpenFor(hook, sender)` on the registry first. HookrLauncher refuses a caller it answers false for with `InvalidFamily()`. On an owner-only hook only the owner gets a yes, after it has accepted the role: see [Owned roots](/docs/pools/owned-roots#accepting-ownership).
- Bind each member's core blocks to your hook's own copy, the core the factory names with `rulesOf(hook)`, never Hookr's.
- Launch every member with recapture off (`RECAPTURE_OFF`) when `laneSource()` on your hook reads zero.

The [launcher guide](/docs/guides/integrating-as-a-launcher) covers the rest of the flow and the reverts to surface.

## Arbitrage recapture

The launch builders give every pool arbitrage recapture unless its member names `RECAPTURE_OFF`, and on Hookr's core they set bit 18 of `potEveryNBuys` for that member. A member that names no `recapture` takes `RECAPTURE_DEFAULTS`, what hookr.fun's launch sends by default. A pool the SDK opens on Hookr's core takes the 15% split, and one on the standard core 25%. A pool launched without arbitrage recapture never gets it, and a launch with it reverts while the root has no open lane.

On a call sent straight to Hookr's launcher, a pool opens with arbitrage recapture on while the root's lane is open. To open one without it, set bit 18 of `potEveryNBuys` and send a zero `recapture`; a zero `recapture` alone does not opt out.

On a pool on Hookr's core with arbitrage recapture on, each profit splits 25/15/60 at the lane's full share: the executor keeps up to 25% (the lane's share), Hookr takes 15%, and the rest is the pool's, as it froze it at launch. `recaptureSplit` works out a pool opened at 25% to the wei.

A swap on such a pool must carry the lane's gas floor, `gasFloor` from `laneOf(id)` on the root, plus its own gas. The floor follows the lane's gas cap, so read it at send time. `eth_estimateGas` includes it. Send the estimate plus a sixth, never a fixed limit. Since 2026-11-16 the lane's cap on Robinhood Chain is 3,000,000 and its floor 6,802,619.

## King of the Pool

A King of the Pool pool runs rounds inside arbitrage recapture: the pool's share of each arb profit fills the pot, the biggest buy of the round leads, and when the round's time is up the next swap, or anyone's `settleEpoch`, closes it and credits the leader a prize on the pool's core. `readKingOfThePool` reads a pool's round at its core, and `kingOfThePoolClose` says what closing it now would credit, release and carry, as the contract does it.

## Monad

Hookr is live on Monad (chain 143) at the same addresses. `HOOKR_1_MONAD` is the release, `MONAD_CHAIN` the chain for viem, and `readReleaseManifest(client, HOOKR_1_MONAD)` reads it. Two things differ, and the builders take the same inputs on both chains: the contracts count their guards in `floor(block.timestamp / 12)`, which `readContractClock(client, 143)` reads, and Monad bills the whole gas limit, so `sendGasLimit(estimate, floor, 143)` carries 5% over the larger of the estimate and the lane's floor. Only the standard core is deployed there, so King of the Pool and Wallet Cap are not launched on Monad.

## How hookr.fun uses it

hookr.fun carries the SDK's source, pinned by the hash of every file, and builds each call with it. hookr.fun adds the settings of the core's own Hook Blocks, which the package does not carry. Before it offers a launch, hookr.fun checks the call against the release as read from chain, and refuses one the release cannot take.

## Before you send a call

- Check the wallet's chain, the payer, the token approvals, the deadline and the slippage yourself.
- Count a launch guard from Ethereum's height: the latest block's `l1BlockNumber`, which the contracts read as `block.number`. A guard counted from `eth_blockNumber` is one the launch refuses. On Monad the contracts read `floor(block.timestamp / 12)` instead; `readContractClock` gives the right one on either chain.
- Claim at the pool's own core. Claim at the core `config.rules` names: pools can differ.
- A quote simulates the pool's accounting. It does not prove approvals, balances or gas.
- Treat token names and links as untrusted display text.

The package README on npm has an example for each task.

---

This page: https://hookr.fun/docs/pools/sdk. Every docs page as Markdown: https://hookr.fun/docs.md.
