polybrainz_polymarket 3.1.0
polybrainz_polymarket: ^3.1.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.
3.1.0 - 2026-01-23 #
Breaking Changes #
- Removed
PolygonClient- The blockchain RPC client has been removed to eliminate thewebthreedependency, which causeddart_styleversion conflicts with packages liketeleverseandfreezed. For blockchain operations (USDC balance, approvals), use a separate web3 library directly. - Removed
PolymarketClient.polygongetter - No longer available since PolygonClient was removed
Added #
- Internal crypto types - Implemented
EthPrivateKey,EthereumAddress, andEthSignatureusing pointycastle directly- These types are exported from
polybrainz_polymarketand replace the webthree types - No external dependencies for Ethereum signing - eliminates
dart_styleconflicts entirely
- These types are exported from
Removed #
webthreedependency removed entirelyPolygonClientclassPolymarketClient.polygongetter- Trading exceptions related to blockchain operations:
InsufficientAllowanceException,TransactionFailedException,TransactionTimeoutException
Migration #
// v3.0.x - With webthree (caused dart_style conflicts)
import 'package:webthree/webthree.dart';
final credentials = EthPrivateKey.fromHex(privateKey);
// v3.1.0 - Internal types (no conflicts)
import 'package:polybrainz_polymarket/polybrainz_polymarket.dart';
final credentials = EthPrivateKey.fromHex(privateKey);
// Same API, but no external dependencies!
// For blockchain operations (if needed):
// Use webthree or another web3 library directly in your project
3.0.1 - 2026-01-23 #
Added #
- Re-exported webthree types - Consumers can now import
EthPrivateKey,Credentials, andEthereumAddressdirectly frompolybrainz_polymarketinstead of needing a directwebthreedependency- This resolves
dart_styleversion conflicts when using packages liketeleversethat depend ondart_style ^3.0.0(webthree uses^2.3.2)
- This resolves
Migration #
If your code imports from webthree directly for signing:
// Before (causes dart_style conflict with televerse, freezed, etc.)
import 'package:webthree/webthree.dart';
// After (no conflict)
import 'package:polybrainz_polymarket/polybrainz_polymarket.dart';
// EthPrivateKey, Credentials, EthereumAddress are available
3.0.0 - 2026-01-23 #
Breaking Changes #
- Upgraded to pointycastle 4.x - Enables compatibility with latest serverpod and other packages
- Replaced web3dart with webthree - webthree is the maintained fork with pointycastle 4.x support
- Signing methods are now async -
EIP712Signer.signOrder()andEIP712Signer.signAuth()now returnFuture<String> - L1Auth.getHeaders() is now async - Returns
Future<Map<String, String>> - buildSignedOrder() is now async - Returns
Future<SignedOrder>
Changed #
- Implemented BIP32 and BIP39 directly using pointycastle 4.x (removed bip32 and bip39 packages)
- Removed encrypt package (was unused)
- All imports changed from
package:web3darttopackage:webthree
Migration Guide #
// Before (v2.x)
final signature = EIP712Signer.signOrder(...);
final headers = l1Auth.getHeaders();
final signedOrder = client.buildSignedOrder(...);
// After (v3.x)
final signature = await EIP712Signer.signOrder(...);
final headers = await l1Auth.getHeaders();
final signedOrder = await client.buildSignedOrder(...);
2.0.2 - 2026-01-23 #
Fixed #
- Fixed
ClobRewards.ratestype to accept bothListandMapfrom API response - Added comprehensive test suite for trading extension (93 tests total)
- HD wallet generation and derivation tests
- Order builder tests
- EIP-712 signing tests
- Live API integration tests
2.0.1 - 2026-01-23 #
- Updated Dependencies
Changed #
- Updated repository URL to
https://github.com/mayankjanmejay/PolybrainZ_Polymarket/
2.0.0 - 2026-01-23 #
Added #
Live Trading Extension - Full Trading Capabilities!
New Factory Constructor:
PolymarketClient.withTrading()- Create a trading-enabled client with order signing and blockchain operations
New Convenience Methods on PolymarketClient:
buildSignedOrder()- Build and sign an order ready for submissionplaceOrder()- Build, sign, and submit an order in one callpolygongetter - Access Polygon blockchain operationshasTradingCapabilities- Check if trading is enabled
New Wallet Module (lib/src/wallet/):
HdWallet- HD wallet generation and derivationgenerateMnemonic()- Generate BIP-39 mnemonic (12 or 24 words)validateMnemonic()- Validate mnemonic phrasederiveWallet()- Derive wallet from mnemonic using BIP-44 path
WalletCredentials- Container for address, private key, derivation indexPolygonClient- Polygon blockchain operationsgetMaticBalance()- Get MATIC balancegetUsdcBalance()- Get USDC balancetransferUsdc()- Transfer USDC to addressapproveUsdc()- Approve USDC spending for CTF ExchangegetUsdcAllowance()- Check current USDC allowancewaitForTransaction()- Wait for transaction confirmation
New EIP-712 Signing Module (lib/src/clob/signing/):
EIP712Signer- Sign orders and auth messages with EIP-712signOrder()- Sign order for CLOB submissionsignAuth()- Sign authentication message for L1 auth
TypedDataBuilder- Build EIP-712 typed data structures
New Order Building Module (lib/src/clob/orders/):
OrderStruct- Raw order structure matching CLOB contracttoJson()- Convert to JSON for API submissiontoTypedDataMessage()- Convert to EIP-712 typed dataprice/sizegetters - Human-readable price and size
OrderBuilder- Build limit and market ordersbuildLimitOrder()- Build a limit order with price/sizebuildMarketOrder()- Build a market order
New Trading Models:
SignedOrder- Order with signature ready for submissionCancelAllResponse- Response from bulk cancel operationsCancelFailure- Details of failed cancellationCancelResult- Result of single order cancellationOrderScoringResponse- Check if order is scoring rewards
New Trading Enums:
TickSize- Order book tick sizes (cent,tenthCent,hundredthCent)NegRiskFlag- Negative risk market flag (standard,negRisk)TimeInForce- Order time in force (gtc,gtd,fok,ioc)
New Trading Exceptions:
TradingException- Base trading exceptionOrderSubmissionException- Order submission failedSigningException- EIP-712 signing failedWalletException- Wallet operation failedInsufficientUsdcException- Not enough USDCInsufficientGasException- Not enough MATIC for gasInsufficientAllowanceException- USDC not approvedTransactionFailedException- Transaction revertedTransactionTimeoutException- Transaction not confirmed in time
New Constants:
PolymarketConstants.usdcAddress- USDC token contractPolymarketConstants.negRiskAdapterAddress- Neg risk adapter contractPolymarketConstants.conditionalTokensAddress- CTF contractPolymarketConstants.polygonRpcUrl- Default Polygon RPCPolymarketConstants.alternativeRpcUrls- Fallback RPC URLsPolymarketConstants.eip712DomainName- EIP-712 domain namePolymarketConstants.eip712DomainVersion- EIP-712 domain version
Changed #
- Breaking:
L1Authnow implements actual EIP-712 signing (was placeholder) - Breaking: New dependencies required:
web3dart,bip39,bip32,pointycastle,encrypt
Migration #
Before (v1.x - L1Auth was placeholder):
// L1Auth threw UnimplementedError
final l1Auth = L1Auth(privateKey: key, walletAddress: addr);
l1Auth.getHeaders(); // Would throw
After (v2.0 - Full trading support):
// Create trading client
final client = PolymarketClient.withTrading(
credentials: ApiCredentials(
apiKey: 'your-api-key',
secret: 'your-secret',
passphrase: 'your-passphrase',
),
walletAddress: '0x...',
privateKey: '0x...',
);
// Check USDC balance
final balance = await client.polygon.getUsdcBalance('0x...');
// Place an order
final response = await client.placeOrder(
tokenId: 'token-id',
side: OrderSide.buy,
size: 10.0,
price: 0.55,
);
// Or build and sign manually
final signedOrder = client.buildSignedOrder(
tokenId: 'token-id',
side: OrderSide.buy,
size: 10.0,
price: 0.55,
negRisk: false,
);
final response = await client.clob.orders.postOrder(signedOrder.toJson());
// Generate a new wallet
final mnemonic = HdWallet.generateMnemonic();
final wallet = HdWallet.deriveWallet(mnemonic);
print('Address: ${wallet.address}');
1.8.1 - 2026-01-19 #
Fixed #
JSON Parsing Bugs - Type Cast Exceptions
Fixed multiple type cast exceptions when parsing API responses:
1. Null String Fields:
Fixed type 'Null' is not a subtype of type 'String' in type cast errors.
Market.marketMakerAddress- Now nullableOrder.timestamp- Now nullableOrderBook.timestamp,OrderBook.hash- Now nullableTrade.matchTime,Trade.lastUpdate- Now nullable
2. Gamma API Field Naming:
Fixed fieldRename: FieldRename.snake mismatch - Gamma API uses camelCase, not snake_case.
- All Gamma models now use camelCase JSON keys (matching API response format)
- Affected:
Market,Event,Tag,Series,Category,Profile,Comment,Team,SearchResult
3. String-to-Number Type Coercion:
Fixed type 'String' is not a subtype of type 'num?' in type cast errors.
- Added
json_helpers.dartwith flexible parsing functions Series.id- API returns String"2", now handled correctly- Numeric fields that may come as strings now use
parseIdNullable/parseDoubleNullable
The SDK now robustly handles API response variations without throwing type cast exceptions.
1.8.0 - 2026-01-19 #
Added #
Complete Magic String Elimination - 100% Type-Safe SDK!
New Enums:
SportsMarketType- 20+ sports market types (winner, spread, total, prop, playerProp, futures, championship, etc.)SportsLeague- 35+ leagues (NFL, NBA, MLB, NHL, EPL, La Liga, UFC, F1, PGA, Olympics, etc.)SeriesType- Series types (recurring, championship, tournament, season, etc.)SeriesLayout- Layout types (grid, list, carousel, featured, bracket, etc.)
New Model Getters (Parse Raw Strings to Enums):
LastTradePrice.sideEnum→OrderSideSeries.seriesTypeEnum→SeriesTypeSeries.recurrenceEnum→RecurrenceTypeSeries.layoutEnum→SeriesLayoutComment.parentEntityTypeEnum→ParentEntityTypeCommentMessage.parentEntityTypeEnum→ParentEntityTypeEvent.subcategoryEnum→ Appropriate subcategory enum based on categoryTeam.leagueEnum→SportsLeagueSimplifiedToken.outcomeEnum→OutcomeTypeClobMarket.tagSlugs→List<TagSlug>OrderResponse.statusEnum→OrderStatus
Changed #
- Breaking:
MarketsEndpoint.listMarkets()-sportsMarketTypeschanged fromList<String>?toList<SportsMarketType>? - Breaking:
SportsEndpoint.listTeams()-leagueschanged fromList<String>?toList<SportsLeague>? - Breaking:
SeriesEndpoint.listSeries()-categoriesLabelschanged tocategorieswith typeList<MarketCategory>? - Breaking:
SearchEndpoint.search()-eventsTagschanged fromList<String>?toList<TagSlug>?
Migration #
Before:
final markets = await client.gamma.markets.listMarkets(
sportsMarketTypes: ['winner', 'spread'],
);
final teams = await client.gamma.sports.listTeams(leagues: ['NFL', 'NBA']);
final series = await client.gamma.series.listSeries(categoriesLabels: ['Sports']);
final results = await client.gamma.search.search(
query: SearchQuery.nfl,
eventsTags: ['nfl', 'football'],
);
After:
final markets = await client.gamma.markets.listMarkets(
sportsMarketTypes: [SportsMarketType.winner, SportsMarketType.spread],
);
final teams = await client.gamma.sports.listTeams(leagues: [SportsLeague.nfl, SportsLeague.nba]);
final series = await client.gamma.series.listSeries(categories: [MarketCategory.sports]);
final results = await client.gamma.search.search(
query: SearchQuery.nfl,
eventsTags: [TagSlug.nfl, TagSlug.football],
);
// Use enum getters on models
final trade = await client.clob.pricing.getLastTradePrice(tokenId);
print(trade.sideEnum); // OrderSide.buy or OrderSide.sell
final team = teams.first;
print(team.leagueEnum); // SportsLeague.nfl
1.7.0 - 2026-01-19 #
Added #
Type-Safe Tag Slugs - NO MORE MAGIC STRINGS!
TagSlug Sealed Class:
- 130+ preset tag slugs organized by category
TagSlug.custom()for user-created or unlisted tags with validationTagSlug.tryFromPreset()- Find preset matching a value (returns null if not found)TagSlug.fromValue()- Find preset or create custom slug
Preset Categories:
- Main Categories:
politics,sports,crypto,business,entertainment,popCulture,science,tech,finance,news,world - Politics:
election,trump,biden,harris,congress,senate,house,supremeCourt,governor,republicans,democrats - Sports:
nfl,nba,mlb,nhl,cfb,cbb,soccer,premierLeague,championsLeague,worldCup,mma,ufc,f1,olympics,superBowl,nbaFinals,heismanTrophy,tourDeFrance, and more - Crypto:
bitcoin,ethereum,solana,xrp,doge,cardano,polygon,defi,nft,etfs,cryptocurrency - Business/Finance:
economy,gdp,inflation,interestRates,fed,ipos,ceos,layoffs,tradeWar,bankOfJapan,monetaryPolicy - Entertainment:
movies,tv,music,album,oscars,grammys,emmys,billboardHot100,youtube,tiktok,streaming,netflix - Science/Tech:
ai,openai,chatgpt,spacex,nasa,space,climate,tesla,apple,google,microsoft,amazon,meta - World/Geopolitics:
ukraine,russia,china,israel,iran,middleEast,europe,uk,france,germany,japan,india,war,nato,un,eu - People:
elonMusk,joeRogan,kanyeWest,putin,netanyahu,popeFrancis,taylorSwift
Tag Model Enhancement:
Tag.slugEnum- Get the slug as a type-safeTagSlugTag.slugPreset- Try to get a presetTagSlug(returns null if no preset matches)
Changed #
- Breaking:
TagsEndpoint.getBySlug()-slugparameter changed fromStringtoTagSlug - Breaking:
EventsEndpoint.listEvents()-tagSlugparameter changed fromString?toTagSlug? - Breaking:
EventsEndpoint.getByTagSlug()-tagSlugparameter changed fromStringtoTagSlug - Breaking:
MarketsEndpoint.listMarkets()-tagSlugparameter changed fromString?toTagSlug? - Breaking:
MarketsEndpoint.getByTagSlug()-tagSlugparameter changed fromStringtoTagSlug
Migration #
Before:
final events = await client.gamma.events.listEvents(tagSlug: 'politics');
final markets = await client.gamma.markets.getByTagSlug('crypto');
After:
final events = await client.gamma.events.listEvents(tagSlug: TagSlug.politics);
final markets = await client.gamma.markets.getByTagSlug(TagSlug.crypto);
// For custom/user-created tags:
final events = await client.gamma.events.listEvents(tagSlug: TagSlug.custom('my-tag'));
1.6.1 - 2026-01-18 #
Changed #
- README UI Overhaul - Modern design with badges, collapsible sections, and improved visual hierarchy
- Added Dart SDK, version, and license badges
- Reorganized API reference with collapsible
<details>sections - Features displayed in clean table format
- Type-safe enums organized into categorized collapsible tables
- Quick navigation links and centered hero section
- Improved code examples organization
1.6.0 - 2026-01-18 #
Added #
Complete Idiot-Proofing - All String Parameters Now Type-Safe!
New Order Enums:
TagOrderBy- Type-safe ordering for tags (volume,eventsCount,createdAt,label)CommentOrderBy- Type-safe ordering for comments (createdAt,likes,replies,updatedAt)SeriesOrderBy- Type-safe ordering for series (volume,startDate,endDate,createdAt,liquidity)SportsOrderBy- Type-safe ordering for sports teams (name,league,abbreviation,createdAt)
New Filter Enums:
RecurrenceType- Event recurrence filtering (daily,weekly,monthly,yearly,none)- Helper method:
isRecurringgetter
- Helper method:
UmaResolutionStatus- UMA oracle resolution status (pending,proposed,disputed,resolved)- Helper methods:
isTerminal,isInProgress,hasStartedgetters
- Helper methods:
SearchQuery Enhancements:
SearchQuery.tryFromPreset()- Find preset matching a value (returns null if not found)SearchQuery.fromValue()- Find preset or create custom querySearchQuery.custom()now validates input and throwsArgumentErroron empty/whitespace
Enum Improvements:
SortDirectionnow hasoppositegetter- All enums now have consistent
fromJson(throws) andtryFromJson(returns null) behavior - Added
@JsonEnumannotations and comprehensive documentation
Changed #
- Breaking:
TagsEndpoint.listTags()-orderparameter changed fromString?toTagOrderBy? - Breaking:
CommentsEndpoint.listComments()-orderparameter changed fromString?toCommentOrderBy? - Breaking:
SeriesEndpoint.listSeries()-orderchanged toSeriesOrderBy?,recurrencechanged toRecurrenceType? - Breaking:
SportsEndpoint.listTeams()-orderparameter changed fromString?toSportsOrderBy? - Breaking:
EventsEndpoint.listEvents()-recurrenceparameter changed fromString?toRecurrenceType? - Breaking:
SearchEndpoint.search()-recurrenceparameter changed fromString?toRecurrenceType? - Breaking:
MarketsEndpoint.listMarkets()-umaResolutionStatuschanged fromString?toUmaResolutionStatus? - Breaking:
SearchQuery.custom()now throwsArgumentErroron empty/whitespace input - Breaking:
LeaderboardWindow.fromJson()now throws on invalid input (was silent fallback toall) - Breaking:
LeaderboardType.fromJson()now throws on invalid input (was silent fallback toprofit) - Breaking:
SortDirection.fromJson()now throws on invalid input (was silent fallback todesc)
Documentation #
- Added
doc/IDIOT_PROOFING.md- Comprehensive progress tracker for type-safety work
1.5.0 - 2026-01-18 #
Added #
Type-Safe Search Queries
SearchQuery- Sealed class for type-safe search queries with 60+ presets- Crypto:
bitcoin,ethereum,solana,crypto,defi,nft,memecoin,altcoin - Politics:
election,trump,biden,president,congress,senate,supremeCourt,policy - Sports:
nfl,nba,mlb,nhl,soccer,ufc,boxing,tennis,golf,olympics,superBowl,worldCup - Entertainment:
oscars,grammys,emmys,movies,tv,music,celebrity,taylorSwift,streaming - Business:
stocks,fed,interestRates,inflation,recession,ipo,tesla,apple,google,amazon,microsoft,elonMusk - Science/Tech:
ai,openai,chatgpt,spacex,nasa,climate,space,mars - World:
war,ukraine,russia,china,israel,middleEast - Custom queries via
SearchQuery.custom('your search') - Category-grouped presets:
SearchQuery.cryptoPresets,SearchQuery.politicsPresets, etc.
- Crypto:
SearchEndpoint Convenience Methods
searchBitcoin(),searchEthereum(),searchCrypto()- Quick crypto searchessearchElection(),searchTrump()- Quick politics searchessearchAI()- Quick AI/tech searchessearchNFL(),searchNBA()- Quick sports searches
Changed #
- Breaking:
SearchEndpoint.search()now usesSearchQueryinstead ofStringfor thequeryparameter- Use
SearchQuery.bitcoinfor presets orSearchQuery.custom('text')for custom searches
- Use
1.4.0 - 2026-01-18 #
Added #
Additional Type-Safe Enums
PriceHistoryInterval- Enum for price history time intervalsminute1,minute5,minute15,minute30,hour1,hour4,hour6,hour12,day1,week1,max
GammaLeaderboardOrderBy- Enum for Gamma leaderboard orderingprofit,volume,marketsTraded
SearchSort- Enum for search result sortingrelevance,volume,liquidity,startDate,endDate,createdAt
EventsStatus- Enum for filtering events by statusactive,closed,all
WsSubscriptionType- Enum for WebSocket subscription typesmarket,user,unsubscribe
Changed #
- Breaking:
PricingEndpoint.getPriceHistory()now usesPriceHistoryIntervalenum instead ofStringforinterval - Breaking:
GammaLeaderboardEndpoint.getLeaderboard()now usesGammaLeaderboardOrderByenum instead ofStringfororder - Breaking:
SearchEndpoint.search()now usesSearchSortenum instead ofStringforsort - Breaking:
SearchEndpoint.search()now usesEventsStatusenum instead ofStringforeventsStatus - Breaking:
WebSocketClient.subscribe()now usesWsSubscriptionTypeenum instead ofStringfortype
1.3.0 - 2026-01-18 #
Added #
Type-Safe Order By Enums
MarketOrderBy- Enum for ordering markets in list queriesvolume,volume24hr,liquidity,endDate,startDate,createdAt
EventOrderBy- Enum for ordering events in list queriesvolume,startDate,endDate,createdAt,liquidity
Changed #
- Breaking:
MarketsEndpoint.listMarkets()now usesMarketOrderByenum instead ofStringfor theorderparameter - Breaking:
EventsEndpoint.listEvents()now usesEventOrderByenum instead ofStringfor theorderparameter
1.2.1 - 2026-01-18 #
Changed #
- Updated repository URL to
https://github.com/mayankjanmejay/PolybrainZ_Polymarket/
1.2.0 - 2026-01-18 #
Added #
New Enums
OutcomeType- Binary outcome types (yes,no) with helper methodsoppositegetter to get the opposite outcomeisYes,isNoboolean getterstryFromJson()for safe parsing
OrderStatus- Order lifecycle states (live,matched,filled,cancelled,pending,delayed)isActive,isTerminal,isCancellableboolean getters
GameStatus- Sports game states (scheduled,inProgress,halftime,ended,postponed,cancelled,suspended)isLive,isFinished,isUpcoming,isInterruptedboolean getters
Type-Safe Enum Getters on Models
Added enum parsing getters to all models with string fields that have fixed values:
CLOB Models:
Order-sideEnum,typeEnum,statusEnum,outcomeEnumTrade-sideEnum,statusEnum,outcomeEnumMakerOrder-outcomeEnumClobToken-outcomeEnum
Data Models:
TradeRecord-sideEnum,outcomeEnumActivity-outcomeEnum(already hadactivityType,sideEnum)Position-outcomeEnum,oppositeOutcomeEnumClosedPosition-outcomeEnum
Gamma Models:
Event-categoryEnum,sortByEnum,gameStatusEnum
WebSocket Models:
OrderWsMessage-sideEnum,typeEnum,outcomeEnumTradeWsMessage-sideEnum,statusEnum,outcomeEnum
Helper Methods on Models
- Added
toLegacyMap()to all model classes for simplified Map output - Added
yesPriceandnoPricegetters toMarketclass
1.1.0 - 2026-01-18 #
Added #
Category Enums
MarketCategory- Main categories (politics, sports, crypto, popCulture, business, science, etc.)PoliticsSubcategory- US elections, international, policy, supreme court, etc.SportsSubcategory- NFL, NBA, MLB, NHL, soccer leagues, UFC, Olympics, etc.CryptoSubcategory- Bitcoin, Ethereum, DeFi, NFTs, exchanges, etc.PopCultureSubcategory- Movies, TV, music, celebrities, awards, streaming, etc.BusinessSubcategory- Tech companies, stocks, Fed, economy, M&A, etc.ScienceSubcategory- AI, space, climate, biotech, medicine, etc.
CategoryDetector Utility
CategoryDetector.detectFromEvent()- Detect category from an EventCategoryDetector.detectFromMarket()- Detect category from a MarketCategoryDetector.detectFromTags()- Detect category from Tag listCategoryDetector.detectFromTagSlugs()- Detect category from slug stringsCategoryDetector.groupEventsByCategory()- Group events by detected categoryCategoryDetector.groupMarketsByCategory()- Group markets by detected categoryCategoryDetector.getSubcategoriesFor()- Get subcategory enum values for a category- Extension methods on
List<Event>andList<Market>for convenience
New Endpoints
GammaLeaderboardEndpoint- Get trader rankings via Gamma APIgetTopByProfit()- Top traders by profitgetTopByVolume()- Top traders by volumegetTopByMarketsTraded()- Top traders by markets tradedgetLeaderboard()- Custom ordering
EventsEndpoint Enhancements
- Added
hotparameter for trending events - Added
tagSlugparameter for category filtering getHotEvents()- Get trending/hot eventsgetFeaturedEvents()- Get featured eventsgetByTagSlug()- Get events by category sluggetEndingSoon()- Get events ending within a time window
MarketsEndpoint Enhancements
- Added
tagSlugparameter for category filtering getTopByVolume()- Top markets by total volumegetTopByVolume24hr()- Top markets by 24-hour volumegetTopByLiquidity()- Top markets by liquiditygetByTagSlug()- Get markets by category sluggetEndingSoon()- Get markets ending within a time window
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