Polymarket SDK & components
The type-safe SDK Polymarket didn't have, three versions deep.
- Role
- Sole author
- Stack
- TypeScriptReactNext.jsCLOBGamma API
When we wanted prediction markets in Boba, Polymarket had just launched its builder program and public API, but there was no SDK, and the docs said little about how to actually build a prediction-market interface on top of it.
So I built one: first a type-safe SDK and component library for the frontend, then a leaner server-side SDK that powers agentic trading, then a migration to Polymarket's CLOB V2.
Decisions
An SDK, because the API wasn't a product
Polymarket shipped an API, not a way to build on it. Searching by slug couldn't find every market, and an esports page needed the right tag families. Placing a trade took a chain of approvals across several contracts and reserve assets.
I wrapped all of it once, with types, so every surface in Boba gets prediction markets without relearning Polymarket's quirks.
v1: Frontend SDK & component library
A type-safe TypeScript SDK with an API client of 42 methods, plus 21 React hooks and 63 UI components, built in about a week.
Tag discovery and tag trees, which the first iteration of Polymarket's API didn't offer, so you could find every market in a category, not just the ones you knew the slug for.
Every view Polymarket supported, from dynamic nav bars to market pages, order books, portfolios and activity, all fully modular so they could be dropped anywhere in the app.
Transaction building that handled the approvals for each contract and reserve asset on CLOB V1, with full support for the Gamma V1 API.
v2: Server-side SDK
A leaner, server-side version without the UI layer, built for machines rather than screens. It powers agentic Polymarket trading in Boba, including through the Boba Agents CLI.
v3: CLOB V2
When Polymarket cut over to CLOB V2 with no backward compatibility, every V1-signed order started getting rejected. I migrated the SDK to the new exchange contracts, the new pUSD collateral and onchain builder codes.
Alongside it, I moved to the updated Gamma endpoints, fixed read endpoints that had quietly broken, and fixed a WebSocket bug that was dropping batched messages. It shipped as v2.0.0.