polybrainz_polymarket 1.0.0
polybrainz_polymarket: ^1.0.0 copied to clipboard
A comprehensive Dart wrapper for the Polymarket API including Gamma, CLOB, Data APIs and WebSocket streams.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.0 - 2026-01-16 #
Added #
Core Infrastructure
ApiClient- HTTP client with automatic retry, rate limiting, and error handlingWebSocketClient- Base WebSocket client with auto-reconnect and heartbeatPolymarketExceptionhierarchy for typed error handlingResult<T, E>sealed class for functional error handling- Constants for all API URLs and configuration
Gamma API (Market Discovery)
GammaClient- Full client for Gamma APIEventsEndpoint- List, get by ID/slug, filter eventsMarketsEndpoint- List, get by ID/slug/conditionId, filter marketsTagsEndpoint- List tags, get related tagsSeriesEndpoint- List and get seriesCommentsEndpoint- List comments, get by userProfilesEndpoint- Get user profilesSearchEndpoint- Search events, tags, profilesSportsEndpoint- List teams, get sports metadata
CLOB API (Order Book & Trading)
ClobClient- Full client for CLOB APIClobMarketsEndpoint- CLOB-specific market dataOrderbookEndpoint- Get order books for tokensPricingEndpoint- Get prices, midpoints, spreads, price historyOrdersEndpoint- Post, get, cancel orders (L2 auth)ClobTradesEndpoint- Get trade history
Data API (Analytics)
DataClient- Full client for Data APIPositionsEndpoint- Get open/closed positionsDataTradesEndpoint- Get user/market trade historyActivityEndpoint- Get on-chain activityHoldersEndpoint- Get token/market holdersValueEndpoint- Get portfolio valueLeaderboardEndpoint- Get leaderboard rankings
WebSocket Clients
ClobWebSocket- Real-time order book, prices, user ordersRtdsWebSocket- Real-time crypto prices, comments- Auto-reconnect with exponential backoff
- Heartbeat/ping-pong support
- Typed message streams
Authentication
ApiCredentials- Model for API key, secret, passphraseL1Auth- EIP-712 signing for API key creation (placeholder)L2Auth- HMAC-SHA256 signing for trading operationsAuthService- Authentication orchestration
Models (25+ classes)
- Gamma: Event, Market, Tag, Category, Profile, Comment, Series, Team, SearchResult
- CLOB: ClobMarket, ClobToken, ClobRewards, OrderBook, OrderSummary, Order, OrderResponse, Trade, SimplifiedMarket
- Data: Position, ClosedPosition, TradeRecord, Activity, Holder, HoldingsValue, LeaderboardEntry
- WebSocket: WsMessage, BookMessage, PriceChangeMessage, LastTradePriceMessage, TradeWsMessage, OrderWsMessage, CryptoPriceMessage, CommentMessage
Enums (15 types)
- OrderSide, OrderType, OrderActionType, TradeStatus
- SortBy, SortDirection, FilterType
- ActivityType, ParentEntityType
- LeaderboardWindow, LeaderboardType
- WsEventType, WsChannel, RtdsTopic
- SignatureType
Notes #
- L1 authentication (EIP-712 signing) requires a proper Ethereum library like
web3dartfor production use - All models use
json_serializablefor JSON serialization - All models extend
Equatablefor value equality