Skip to content

SDK

The hookr-sdk package: the builders for launch, swap and quote calls, the release manifest, and how hookr.fun uses it.

On this page

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.

npm install hookr-sdk viem

hookr-sdk 1.6.1 quotes and swaps on any Hookr pool. It builds launches on the standard core through the launcher it carries, at the 25% split. Launch the core's 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

TaskBuilderContract
Launch a token with Hook BlocksbuildLaunch, buildLaunchAdvised, buildLaunchFamilyHookrLauncher
Open pools for an existing tokenbuildLaunch with the token namedHookrLauncher
Quote a swapbuildQuoteHookrQuoter
SwapbuildSwapHookrRouter
Approve an ERC-20swapAllowance, launchFunding, buildApprovalsthe token
Claimclaimable and claim on the pool's own core, config.rules from poolConfigthe pool's own core
Read a King of the Pool roundreadKingOfThePool, kingOfThePoolClosethe pool's own core

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

Modules

ModuleWhat it does
chainsThe two chains this SDK carries: their nodes, explorers and PoolManagers, the clock the contracts count in and how each chain charges gas
releasesHookr's addresses and deployments on Robinhood Chain and Monad, the release manifest, the chains for viem, explorer links and the lane gas floor
king-of-the-poolKing of the Pool's reads, its checks and the round's arithmetic
walletBuilds the launcher, router and quoter calls, each with its bounds
launchEncodes a Multi-pool launch, its dev buy and exactly what the launcher pulls
paramsEvery 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
quotesClassifies a quote asset and reads amounts in its own decimals
registryTyped registry operations and the admission checks
advisoriesEncodes the fee and market-hours advisory configs
vault, referrals, proofsLiquidity 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:

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.

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 arb 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.
  • 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 covers the rest of the flow and the reverts to surface.

Arb recapture

The launch builders give every pool arb recapture unless its member names RECAPTURE_OFF. A member that names no recapture takes RECAPTURE_DEFAULTS, what hookr.fun's launch sends by default. A pool the SDK opens takes the 25% split. A pool launched without arb 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 arb 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 hookr.fun opens with arb recapture on, each profit splits 25/15/60 at the lane's full share: the partner 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 is 6,802,619 at the lane's 3,000,000 gas cap. eth_estimateGas includes the floor, about 7.5 million for a buy now. Send the estimate plus a sixth. A fixed limit should be at least 8.8 million.

King of the Pool

A King of the Pool pool runs rounds inside arb 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 core's settings and the new-token launcher, 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's Anti-Snipe 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.