polymarket_dart 0.4.0
polymarket_dart: ^0.4.0 copied to clipboard
A Dart SDK for the Polymarket CLOB, Gamma, and Data APIs — REST, WebSocket, EIP-712 signing, HMAC auth, on-chain approvals, and order management.
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.
0.4.0 - 2026-03-08 #
Added #
GammaMarket.outcomePrices— parsed from the API's JSON-encodedoutcomePricesstring, giving ready-to-useList<double>YES/NO prices (e.g.[0.72, 0.28]) without extra CLOB calls
0.3.1 - 2026-03-08 #
Fixed #
- Reward endpoints — all 6 methods now use correct paths and require Level 2 HMAC auth (previously miscoded as Level 0 public)
getEarningsForDay→GET /rewards/user(added requiredaddressparam)getTotalEarningsForDay→GET /rewards/user/totalgetUserEarningsAndMarketsConfig→GET /rewards/user/marketsgetRewardPercentages→GET /rewards/user/percentages(addedsignature_type: 0param)getCurrentRewards→GET /rewards/markets/currentgetRawRewardsForMarket→GET /rewards/markets/{conditionId}(path param, not query string)
DataClient.getLeaderboardremoved — no public leaderboard endpoint exists on Polymarket's Data API- Reward integration tests updated to use Level 2 credentials from
.env
0.3.0 - 2026-03-07 #
Added #
- ClobClient parity with Python SDK — 4 additional methods
getSamplingSimplifiedMarkets()—GET /sampling-simplified-marketsgetOrderBookHash(tokenId)—GET /order-book-hashfor a given tokencalculateMarketPrice(tokenId, side, amount)— walks the live orderbook to estimate fill pricecreateAndPostOrder(params)— convenience wrapper: builds, signs, and posts an order in one call
- RfqClient — full Request-for-Quote system (
https://clob.polymarket.com/rfq/...)createRequest(),cancelRequest(),acceptQuote()— requester sidecreateQuote(),cancelQuote(),approveOrder()— quoter (market-maker) sidegetRequests(),getRequesterQuotes(),getQuoterQuotes(),getBestQuote(),getConfig()— data queries- All methods require Level 2 HMAC auth
- BridgeClient — cross-chain deposit API (
https://bridge.polymarket.com)createDeposit(address)— generate EVM + Solana + Bitcoin deposit addressesgetSupportedAssets()— discover supported chains and tokensgetQuote(params)— estimate fees and output amountsgetStatus(address)— track deposit progress by deposit address- No authentication required
- Builder API extension to
ClobClientgetBuilderOrders(),getBuilderOpenOrders(),getBuilderTrades()— attributed order/trade queriesrevokeBuilderApiKey()— revoke builder credentialsgetBuilderLeaderboard()—GET /v1/builders/leaderboard(public)- Constructor now accepts
BuilderCredentials? builderCredentials
builder_auth.dart— extractedBuilderCredentialsandgenerateBuilderHeaders()fromRelayerClientRelayerClientnow imports and re-exports frombuilder_auth.dart(no breaking change)
- New models:
RfqUserRequest,RfqUserQuote,RfqRequest,RfqQuote,RfqPaginatedResponse<T>,AcceptQuoteParams,ApproveOrderParams,CancelRfqRequestParams,CancelRfqQuoteParams,GetRfqRequestsParams,GetRfqQuotesParams,GetRfqBestQuoteParams,RfqRequestResponse,RfqQuoteResponse,MatchType(RFQ) - New models:
DepositAddresses,DepositResponse,SupportedAsset,TokenInfo,BridgeQuoteParams,BridgeQuote,FeeBreakdown,DepositTransaction,DepositStatus,DepositState(Bridge) - New model:
BuilderLeaderboardEntry PolymarketUrls.bridgeconstant added- Neg-risk guide added to
docs/plan/GUIDES.md - 8 new integration tests (bridge: 5, rfq: 3)
0.2.0 - 2026-03-05 #
Added #
- GammaClient — market and event discovery via
https://gamma-api.polymarket.comgetMarkets()— list markets with filters (active, closed, order, limit)getMarket(int id)— single market by numeric IDgetEvents()— list events with filtersgetEvent(int id)— single event by numeric IDgetTags()— all category tagssearchMarkets(String query)— text search
- DataClient expanded with 4 new methods
getTrades(userAddress)— completed trades for a usergetActivity(userAddress)— activity events (trades, redemptions, etc.)getHolders(conditionId)— outcome token holders for a marketgetLeaderboard()— top traders (path TBD)
- ClobClient — 10 new methods
- Rewards (Level 0):
getRewardPercentages,getCurrentRewards,getEarningsForDay,getTotalEarningsForDay,getUserEarningsAndMarketsConfig,getRawRewardsForMarket - Read-Only API Keys (Level 2):
createReadonlyApiKey,getReadonlyApiKeys,deleteReadonlyApiKey,validateReadonlyApiKey
- Rewards (Level 0):
- New models:
GammaMarket,GammaEvent,Tag,UserTrade,Activity,Holder,LeaderboardEntry - 17 new integration tests (80 total)
0.1.0 - 2026-03-03 #
Added #
- ClobClient — 42 methods across 3 authentication levels
- Level 0 (public): markets, orderbook, pricing, price history, market config
- Level 1 (EIP-712): API key creation and management
- Level 2 (HMAC): order placement, cancellation, account data, notifications
- DataClient — user positions and proxy wallet lookup
- WebSocketClient — real-time CLOB orderbook/trades and RTDS price/comment feeds
- RelayerClient — gasless GnosisSafe approvals via Polymarket relayer
- EIP-712 signing — ClobAuth (Level 1) and Order signing for EOA and GnosisSafe wallets
- HMAC auth — Level 2 request signing matching Python SDK behavior
- On-chain approvals —
ensureEoaApprovals()for direct EOA setup (7 transactions) - PrivateKeyWalletAdapter — full secp256k1 ECDSA with EIP-155 raw transaction signing
- 63 tests (23 unit + 40 integration)