Skip to content

docs: clarify order book and subscription types#72

Merged
cesarenaldi merged 4 commits into
mainfrom
feature/dev-145-dev-146-docs
May 28, 2026
Merged

docs: clarify order book and subscription types#72
cesarenaldi merged 4 commits into
mainfrom
feature/dev-145-dev-146-docs

Conversation

@cesarenaldi
Copy link
Copy Markdown
Collaborator

@cesarenaldi cesarenaldi commented May 28, 2026

Summary

  • document OrderBook.bids and OrderBook.asks ordering on explicit public types
  • type OrderBook.market as a branded ConditionId and validate it with ConditionIdSchema
  • type OrderBook.hash as a branded OrderBookHash and validate the backend SHA-1 hex format
  • type-check the Zod order-book schemas against those documented types
  • document which market events customFeatureEnabled enables

Closes DEV-145
Closes DEV-146

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm build
  • pnpm changeset status --since=origin/main

Note

Low Risk
Documentation and compile-time typing with slightly stricter Zod validation on order book fields; no auth, payments, or broad behavioral refactors.

Overview
This PR tightens public typings and docs for CLOB order books and market subscriptions without changing runtime behavior beyond stricter parsing.

In @polymarket/bindings, order book types are now explicit interfaces (not z.infer) with JSDoc stating bids ascend (lowest first) and asks descend (highest first). market is a branded ConditionId and hash a branded OrderBookHash validated as 40-char lowercase hex (SHA-1). Zod schemas use satisfies z.ZodType<...> so parsers stay aligned with those types.

In @polymarket/client, MarketSubscription documents tokenIds and that customFeatureEnabled: true also delivers MarketBestBidAskEvent, NewMarketEvent, and MarketResolvedEvent. A changeset records patch releases for both packages.

Reviewed by Cursor Bugbot for commit c1b9084. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant