Skip to main content
@hoodstudio/hoodstar-sdk is the official TypeScript SDK for the veto.fun protocol. It’s a thin, fully-typed layer over viem (its only peer dependency) covering the entire protocol surface: launching tokens, trading the curve, quoting, migration, fee claims, and event streaming.
The package ships both ESM and CommonJS builds (import and require both work). All amounts are bigint wei values. Use viem’s parseEther / formatEther helpers.

Setup

Create a viem client pair and pass it to createVeto. The SDK exports ready-made chain definitions for Robinhood Chain mainnet and testnet.
Only "mainnet" is deployed. The "testnet" entry is a guarded placeholder (Uniswap v3 doesn’t exist on Robinhood Chain testnet); the SDK throws a descriptive error if you select it. For development, fork mainnet with Anvil and pass a custom deployment object (below).
Three namespaces do all the work:
  • hood.read: typed views over the launchpad (curve state, quotes, fees, registry, pool info)
  • hood.write: transactions (throws if you didn’t pass a walletClient)
  • hood.watch / hood.backfill: event streaming and historical indexing
Local development: you can point the SDK at any deployment (e.g. an Anvil fork) by passing a deployment object instead of a network name:

Reading the protocol

Quoting

You can quote on-chain (source of truth) or client-side. The SDK’s math module is a bit-exact mirror of the contract’s rounding, so quotes match to the wei with zero RPC round-trips:

Launching a token

createToken deploys the ERC-20 and opens its curve. The flat creation fee (0.001 ETH under the current config) is read live and added to the transaction value automatically, so devBuyEth is exactly the dev buy. Recover the token address from the TokenCreated event in the receipt; the event also carries the token’s frozen fee snapshot:
Every hood.write.* method simulates first (so reverts are decoded before you spend gas) and returns the transaction Hash. Await the receipt yourself with publicClient.waitForTransactionReceipt.

Trading

Buying

Selling

Tokens support EIP-2612, so the one-transaction permit path is the default choice:

Graduation & migration

Claiming fees

Claims are gated but never redirectable: funds always go to the registered recipient, and only the recipient itself (or the platform’s claim-authority backend) can trigger the payout.

Streaming events

The watch layer polls eth_getLogs over HTTP (Robinhood Chain’s public RPC has no websocket), delivers events at least once in (blockNumber, logIndex) order, and gives you a cursor for crash-safe resumption:
For historical indexing, backfill replays the full event history in chunked eth_getLogs calls and resolves with the last processed block:
Make handlers idempotent (delivery is at-least-once), and key trades on transactionHash + logIndex in your database.

Error handling

Writes simulate first, so contract reverts surface as decoded errors before gas is spent. The custom errors you’ll most commonly handle:

Full API surface

tokenCount(), getTokens(offset, limit), getAllTokens(), getCurveState(token), getCurveStates(tokens[]), getFees(), claimAuthority(), creatorLpShareBpsOf(token), quoteBuy(token, ethIn), quoteBuyExact(token, tokensOut), quoteSell(token, amount), creatorFeesOwed(token), protocolFeesOwed(), feeRecipientOf(token), getTokenInfo(token), balanceOf(token, account), getPool(token), positionOf(token), getPoolState(pool), locker(), treasury(), weth(), positionManager()
createToken({ name, symbol, metadataURI, devBuyEth?, minTokensOut? }), buy(token, ethIn, quotedTokensOut, opts?), buyExactTokens(token, tokensOut, maxEthIn, opts?), sell(token, amount, quotedEthOut, opts?), sellWithPermit(token, amount, quotedEthOut, opts?), approve(token, amount), migrate(token), claimCreatorFees(token), claimCreatorFeesBatch(tokens[]), claimProtocolFees(), setFeeRecipient(token, newRecipient), collectFees(locker, token). Trade opts: { slippageBps?: number; deadline?: bigint }
quoteBuy(state, totalFeeBps, grossIn), quoteBuyExact(state, totalFeeBps, tokensOut), quoteSell(state, totalFeeBps, amount), totalFeeBpsOf(state), currentPrice(state), curveProgressBps(state), ethToGraduate(state, totalFeeBps), minAfterSlippage(quoted, slippageBps). Plus constants TOTAL_SUPPLY, SALE_SUPPLY, POOL_SUPPLY, VIRTUAL_TOKEN_0
vetoDotFunAbi, hoodTokenAbi, feeLockerAbi, exported for direct viem/wagmi use and event parsing. (hoodLaunchpadAbi remains as a deprecated alias of vetoDotFunAbi.)

Contract reference

Prefer to integrate at the contract level? Full function, event, and error reference.