Prerequisites
Before starting, make sure you have:- Node.js 18+ and a TypeScript project. If you’re starting fresh, follow the TypeScript & Node.js Setup Guide for the base project, then install the EVM dependencies below.
- Some ETH on Robinhood Chain (chain ID
4663) in the wallet you’ll sign with. - Read the Robinhood Chain Overview for the token lifecycle and address book.
No Bags API key is required for Robinhood Chain. You interact with the public smart contracts directly.
1. Install Dependencies
2. Set Up Environment Variables
Create a.env file. The public RPC works out of the box but is rate-limited; set a dedicated endpoint if you have one.
3. Define the Chain
Save this aschain.ts. It defines Robinhood Chain and tunes viem for the chain’s ~100 ms blocks.
chain.ts
4. Addresses & Protocol Constants
Save this asaddresses.ts. These are the protocol singletons and shared infrastructure (see the full address book).
addresses.ts
5. Create the Clients
Save this asclients.ts. The public client is for reads and simulations; the wallet client signs and sends transactions.
clients.ts
In a browser dApp, replace
getWalletClient with a wallet-backed client, e.g. createWalletClient({ account, chain: robinhoodChain, transport: custom(window.ethereum) }), and switch the wallet to chain 4663 before writing.6. Get the ABIs
The Bags contract ABIs are published in the publicrobinhood-abi-v2 directory of the bagsfm/bags-idl repository. It contains eight JSON files:
BagsFactory.json,BagsBondingCurve.json,BagsFeeShare.json,BagsLens.json,BagsToken.json,BagsV4Hook.json,BagsVault.json,BagsBeacon.json
abi/index.ts
Periphery ABIs (hand-written)
The Uniswap-style infrastructure (UniversalRouter, Permit2, WETH, V4Quoter, StateView) is not part of the Bags ABI export. The Trade Tokens guide includes the minimal hand-written ABIs you need for post-migration swaps. The full definitions are also listed in the Contracts Reference.7. Verify Your Setup
Read a value from the factory to confirm everything is wired up.verify.ts
0.02 ETH = 20000000000000000 wei) and a token count printed, you’re ready to move on.
Next steps
Launch a Token
Create a token through the BagsFactory.
Trade Tokens
Buy and sell across both phases.
Read State & Discover
Query state and list tokens with BagsLens.
Claim Creator Fees
Claim accrued fees from BagsFeeShare.
