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 npmQuick 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.receiptcreatePickhooks() // reads only, over BNB Chain's public RPC
createPickhooks({ rpcUrl }) // reads over your RPC
createPickhooks({ walletClient }) // signs and sends with your viem wallet clientEvery 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 + extraGasWhat 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.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.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 partnerAddresses 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.