Repository navigation
feat(data)!: add range-event activity types and parse unknown ones - #495
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kartojal
marked this pull request as ready for review
November 4, 2026 16:27
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…types Drop the exported UnknownActivity name. Rows with types this SDK version does not list are an unnamed Activity member with type: undefined and rawType, so narrowing on ActivityType stays exact. Threshold compose/decompose rows move line tokens without collateral: the feed serves the amount in size and 0 in usdc_size. Expose it as shares instead of an always-zero USD amount. Unlisted rows gain isCombo so a Combo condition id is not mistaken for a market. Range-event titles, slugs and outcome labels are optional, matching the Python SDK; threshold rows still require the line's condition id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows with a type this SDK version does not list now carry only the shared account fields and type: OpaqueActivityType, an opaque type built on a private unique symbol. It never overlaps a listed ActivityType, so equality narrowing on known variants stays exact while exhaustive switches still need a default branch. The served type string stays at runtime. Drop rawType, isCombo, amount, conditionId and the display fields from the fallback row so consumers do not build on fields of types the SDK does not model yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Call out that the opaque activity type is a breaking change, and show how to read the served type with String(activity.type) where code assigned activity.type to a string or used it as a record key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cesarenaldi
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
DIRECTIONAL_SPLIT,DIRECTIONAL_MERGE,THRESHOLD_COMPOSEandTHRESHOLD_DECOMPOSEactivity types. Threshold rows report the moved line position asshares, since no collateral moves and the feed serves 0 inusdc_size. Titles, slugs and outcome labels are optional on all four types.Rows with any other type no longer fail the page. They carry only the shared account fields, and their
typeis anOpaqueActivityTypebuilt on a privateunique symbol. It never overlaps a listedActivityType, so comparingactivity.typewith anActivityTypemember still narrows each row, while exhaustive switches need adefaultbranch. At runtimetypestays the served string.Python parity: Polymarket/py-sdk#404.
🤖 Generated with Claude Code
Note
Medium Risk
Breaking public types on a core feed model may require consumer migrations; runtime parsing behavior changes for unknown activity types (graceful degradation vs. previous failure).
Overview
Adds four range-event activity variants to
ActivityTypeand theActivityunion: event-scopedDIRECTIONAL_SPLIT/DIRECTIONAL_MERGE(USDamount, optional event metadata, no single-marketconditionId) and line-scopedTHRESHOLD_COMPOSE/THRESHOLD_DECOMPOSE(requiredconditionId,sharesfrom wiresizeinstead of collateral). They are validlistActivitytypefilter values via the updated enum.Forward compatibility: wire
typeis parsed as any non-empty string instead of a strict enum, so rows whose type is not yet listed normalize to shared account fields only with anOpaqueActivityType—activity pages no longer fail when the API ships new types first.Breaking TypeScript behavior:
activity.typeis no longer astringor usable as a record key; consumers needString(activity.type)for labels/maps and adefaultbranch (plus new cases) in exhaustive switches. Docs and a changeset describe the migration.Reviewed by Cursor Bugbot for commit 6624cf1. Bugbot is set up for automated code reviews on this repo. Configure here.