Skip to content

fix(client): strengthen CLOB price read types - #203

Merged
cesarenaldi merged 3 commits into
mainfrom
feature/dev-416-return-decimalstring-from-fetchprice
Jul 15, 2026
Merged

fix(client): strengthen CLOB price read types#203
cesarenaldi merged 3 commits into
mainfrom
feature/dev-416-return-decimalstring-from-fetchprice

Conversation

@cesarenaldi

@cesarenaldi cesarenaldi commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • return branded DecimalString values from single CLOB price read helpers
  • type CLOB batch price maps with TokenId keys: Midpoints, Prices, and Spreads
  • preserve partial OrderSide records for fetchPrices results
  • add binding runtime coverage, client action/decorator type coverage, integration assertions, and changesets for DEV-416 and DEV-417

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm test:bindings
  • pnpm test:client
  • pnpm build

Note

Medium Risk
Public TypeScript return types change from string and loose records to branded DecimalString and TokenId-keyed maps, which can break downstream consumers at compile time even though runtime parsing behavior is largely unchanged.

Overview
Tightens CLOB price read typings across @polymarket/bindings and @polymarket/client so validated API data is not widened to plain string maps at the boundary.

Bindings: MidpointsSchema, PricesSchema, and SpreadsSchema now key results by TokenId instead of arbitrary strings. Batch fetchPrices shapes are modeled as partial OrderSideDecimalString records (only requested sides present), with runtime tests for valid parses and rejection of unknown side keys.

Client: Single-token helpers (fetchMidpoint, fetchPrice, fetchSpread) return DecimalString; batch helpers return Midpoints, Prices, and Spreads. The DataActions decorator surface matches those types. New compile-time tests lock the public API; integration tests assert token-keyed batch results and that unrequested sell sides stay absent on fetchPrices.

Patch changesets cover DEV-416 (branded decimals) and DEV-417 (token-keyed batch maps).

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

@cesarenaldi cesarenaldi changed the title fix(client): preserve decimal price read types fix(client): strengthen CLOB price read types Jul 15, 2026
@cesarenaldi
cesarenaldi merged commit 662444c into main Jul 15, 2026
8 checks passed
@cesarenaldi
cesarenaldi deleted the feature/dev-416-return-decimalstring-from-fetchprice branch July 15, 2026 19:57
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