$hooks is live0x07bc..7777Buy Chart

Docs · SDK

The pickhooks SDK

Every product of the pad from one TypeScript client, built on viem. Read pools and coins, quote and trade, launch from templates, claim what a wallet earned. Before a trade is signed, the SDK asks the coin and hands back the rule that would refuse it, as a sentence. Built for bots, launchpads and trading terminals.

Package: @pickhooks/sdk on npm · MIT

Install

npm install @pickhooks/sdk viem

TypeScript, ESM, Node 20 or newer. viem is a peer dependency: the SDK takes your viem clients and signs nothing on its own.

The README on npm walks through every call of every part, with a terminal, a bot and a launchpad as worked examples.

The package on npm

Quick start

One client, a part per product. With a wallet client it signs and sends; without one it reads.

import { createPickhooks } from "@pickhooks/sdk";
import { createWalletClient, http, parseEther } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { bsc } from "viem/chains";

const walletClient = createWalletClient({ account: privateKeyToAccount(KEY), chain: bsc, transport: http() });
const ph = createPickhooks({ walletClient });

const [pool] = await ph.any.pools({ limit: 1 });
const r = await ph.any.buy({ pool, bnbIn: parseEther("0.05") });
// r.amountOut, r.hash, r.receipt
createPickhooks()                  // reads only, over BNB Chain's public RPC
createPickhooks({ rpcUrl })        // reads over your RPC
createPickhooks({ walletClient })  // signs and sends with your viem wallet client

Every write has a build helper that returns the transaction instead of sending it, for a terminal that signs with its own stack. The hooks need gas room beyond a wallet's plain estimate; the helpers carry it as extraGas.

const key = await ph.any.key(poolId);
const tx = ph.any.build.buy({ key, bnbIn, minOut });  // { to, data, value, extraGas }
await ph.send(tx);                                     // or sign it yourself: estimate x 1.3 + extraGas

What is in it

ph.anyhook any coin
Pools next to coins that already trade: quotes, trades, opening a pool with a partner, and the earnings and claims of the opener, a partner and a router.
ph.stickysticky rules
Launch a coin from templates or your own hook script rows, read its table as sentences, check a trade against it before anyone signs, trade, lift.
ph.sticky3sticky 3
The sticky coin with a game: launch with a mode and its settings, or from one sentence with fromText; the mode and the validator check it on chain first.
ph.modesthe games
The modes: each game's state, every move holders make, custody and its release, the catalog with the line, the share of buys and the bounds.
ph.simulatea trade tried first
Any buy, sell, send or move run against the chain as it is now: what arrives, what burns, what goes into the pot, what the game pays, or the rule that stops it.
ph.coinscoins with rules
The v1 and v2 coins with their rules in the coin, find the dev and CZ mode coins included: rules as sentences, the rule that would refuse a trade, launches, pots and claims.
ph.pools, ph.callspools and curve calls
Coins with their rules in the pool's hook, and renting a step of a coin's curve: quote, open, close, pay out.
ph.leverLever
Longs and shorts on a coin's own liquidity: quote, open, close, claim. The first lever is ph.leverV1.
ph.dipsdip bids
Floors at a strike, bought from a maker's bid: post, fund, buy a floor, exercise.
ph.blocksbuilding blocks
The sticky templates with their numbers and rows, the hook script grammar and the rule book as plain JSON, offline.
ph.apithe site's API
The public JSON of the site: launch feed, one coin, the board, activity, burners, the token.
ph.sendsending
Sends any transaction the build helpers return, with the gas room the hooks need, and waits for the receipt.

Three more entry points

@pickhooks/sdk/abis
every ABI
@pickhooks/sdk/rules
the sticky rules encoder: templates and hook script to rows, rows to sentences
@pickhooks/sdk/coin-rules
the rule catalog of coins with rules

Before a trade is signed

Every part has check and quote. check names the rule that would stop a buy, a sell or a send, as the rule's sentence. quote is the fill the pool would give right now, and a buy the coin would refuse throws that sentence instead of a bare revert. A terminal shows the sentence where it would show honeypot; a bot skips the trade instead of paying gas for a revert.

const c = await ph.coins.check({ token, side: "sell", wallet, amount });
// { ok: true } or { ok: false, name: "Max per buy", text: "No buy over 0.5% of supply." }

const s = await ph.sticky.check({ token, side: "sell", wallet, amount });
// { ok: true } or { ok: false, row: 1, text: "Refused by rule 2: Sniper jail. ...", rule }

const q = await ph.coins.quote({ token, side: "buy", amount: parseEther("0.1"), wallet });
// q.amountOut: the fill right now. A buy the coin would refuse throws the rule's sentence.

Games inside the coin

A sticky 3 coin carries one game, fixed at launch: combo, pay it forward and the others on the games page. The coin calls it on every buy, sell and send, and every terminal trades the coin as always. The SDK launches a coin with its game, reads every game, plays every move and tries each one against the chain first.

// a coin with a game: rules plus one mode, fixed at launch
const { token } = await ph.sticky3.launch({
  name, symbol, metadata,
  picks: [{ id: "sniper" }],
  mode: "combo", modeSettings: { bps: 200 },
  devBuy: parseEther("0.05"),
});

// or from one sentence
const r = await ph.sticky3.fromText("CAT Cat, combo 3 %, dev lock 7 days, sniper jail, dev buy 0.05", { metadata });
if (r.launch) await ph.sticky3.launch(r.launch);

const g = await ph.modes.of(token);              // { name: "combo", gameBps: 200, gamePot }
const st = await ph.modes.combo.state(token);    // the combo, the best, the next win
const sim = await ph.simulate.buy({ token, wallet, bnbIn: parseEther("0.05") });
// { ok, out, burned, toPots, bonus, intoCustody, events }
await ph.modes.heist.try(token, parseUnits("1000000", 18));
All games

From a terminal

The pickhooks CLI does the same from a shell: the games, a coin, quotes, any trade or move tried first, a launch from one sentence. Nothing is sent without --send, and the key comes from the environment, never from an argument.

npx pickhooks modes
npx pickhooks game 0xCoin --wallet 0xYou
npx pickhooks simulate 0xCoin buy 0.05 --wallet 0xYou
npx pickhooks play 0xCoin try 1m --wallet 0xYou      # tried first, --send sends it
npx pickhooks launch "CAT Cat, combo, dev buy 0.05"

For launchpads and routers

A launchpad launches sticky coins from templates or hook script rows, and opens pools next to coins that already trade, with itself as the partner. A terminal that routes trades through its own contract is listed as a router. Both earn a share of the pickhooks part of the fees in what they bring.

import { TEMPLATES } from "@pickhooks/sdk"; // hold, sniper, devlock, drip, maxbuy, maxwallet, window, hours, burn, dipdrop, lucky, wakeup

const picks = [
  { id: "sniper", params: { b: 20, h: 24 } },        // buys in the first 20 blocks cannot sell for 24 h, in any wallet
  { id: "devlock", params: { d: 7 } },               // the creator's first buy cannot sell for 7 days
];
const table = ph.sticky.compile(picks);               // { rows, release, problems }
await ph.sticky.validate(table.rows, table.release);  // null, or the validator's reason as a sentence
const { token } = await ph.sticky.launch({ name, symbol, metadata, picks, devBuy: parseEther("0.05") });
const c = await ph.any.check(coin);                          // can this coin get a pool? depth, free slot, pair
const need = ph.any.depthNeeds(c, "ladder10", c.freeSlot!);    // the coins a pool needs to be as deep
const { id } = await ph.any.open({ token: coin, tokenAmount: need.coins, partner: MY_WALLET });
ph.any.partnerLink(MY_WALLET);                                 // the site's open form with you named as partner

Addresses and forks

BSC_MAINNET holds every pickhooks contract and PancakeSwap's, all verified on BscScan. Pass addresses to point the SDK at a fork or a new factory.

import { BSC_MAINNET } from "@pickhooks/sdk";
BSC_MAINNET.stickyFactory;   // every pickhooks contract, and PancakeSwap's

const fork = createPickhooks({ rpcUrl: "http://127.0.0.1:8545", addresses: { anyFactory, anyHook } });
All addresses

Get listed

Partners and routers are listed by pickhooks. Tell us on X what you build, a launchpad, a bot or a terminal, and what you need from the SDK that is not in it yet.