Quickstart
Node ≥ 20. viem is a peer dependency; ws is optional (Node ≤ 21 firehose only).
npm install hoodchain viem
import { createHoodClient, getQuote, getPortfolio } from 'hoodchain'
const hood = createHoodClient() // mainnet 4663, public RPC
// Chainlink quote (multiplier-adjusted token price, staleness-guarded)
const aapl = await getQuote(hood, 'AAPL')
console.log(`AAPL: $${aapl.priceUsd}`)
// Multiplier-correct portfolio for any address
const portfolio = await getPortfolio(hood, '0xYourAddress')
console.log(`total: $${portfolio.totalUsd.toFixed(2)}`)
for (const p of portfolio.positions) {
console.log(`${p.symbol}: ${p.balanceTokens} tokens = ${p.shareEquivalent} shares → $${p.valueUsd}`)
}
Wallet operations take a viem account:
import { privateKeyToAccount } from 'viem/accounts'
const hood = createHoodClient({
chain: 'testnet',
account: privateKeyToAccount(process.env.ROBINHOOD_CHAIN_PRIVATE_KEY),
})
const { hash, receipt } = await executeSwap(hood, {
tokenIn: TESTNET_ADDRESSES.weth,
tokenOut: TESTNET_STOCK_TOKENS.NFLX,
amountIn: parseEther('0.0001'),
})
Modules
Import only what you use — the package is side-effect-free and tree-shakeable.
client
Thin factory over viem pinned to the official robinhood / robinhoodTestnet chain definitions. Multicall batching on by default.
stocks
The 95-token registry, Chainlink quotes with a configurable staleness guard, ERC-8056 multipliers, and portfolios whose share math matches the token's own balanceOfUI().
swap
QuoterV2 quoting across every fee tier plus two-hop routes via WETH/USDG, slippage bounds, deadlines, and calldata for the canonical router on each network.
usdg
Paxos Global Dollar: verified address, 6-decimal parse/format, balances, transfers, approvals. (No EIP-2612 permit — verified on-chain.)
launchpads
Decoded launch, curve-trade, and graduation events for NOXA and The Odyssey — watchLaunches(), getRecentLaunches(), watchGraduations().
feed
Reconnecting client for the sequencer firehose: every transaction decoded ~100–300 ms before RPC, plus a simple watchTransfers() helper.
acknowledgeStockTokenEligibility: true, affirming eligibility.
Verified, not vibes
Every address the SDK ships was verified during development — and is re-verified every
time the registry regenerates (npm run refresh-registry).
95 tokens, one beacon
All canonical Stock Tokens are BeaconProxies onto one shared, source-verified Stock implementation. The registry asserts the beacon slot of every entry — a counterfeit token cannot slip in.
34 Chainlink feeds
Feed proxies come from Chainlink's official directory and each one answered latestRoundData() with a positive 8-decimal price at generation.
On-chain-linked Uniswap
The router, quoter, and factory were resolved by reading factory() / WETH9() on-chain — not copied from a chain-list. Both networks' flavors handled.