You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiple type safety and SDK parity fixes in the TypeScript client: (1) adds a question getter as an alias for title on UnifiedMarket for Python SDK parity, (2) types fetchMarketsPaginated parameter as MarketFetchParams instead of any, (3) makes getExecutionPrice synchronous (client-side VWAP calculation instead of server round-trip), (4) adds bestBid/bestAsk fields to MarketOutcome, (5) adds apiKey and pmxtApiKey to PolymarketOptions.
No core or Python changes in this PR (but Python already has question property and bestBid/bestAsk).
Findings
Breaking change: getExecutionPrice changed from async to sync. The return type changes from Promise<number> to number. Any caller doing await exchange.getExecutionPrice(...) will still work (awaiting a non-Promise is valid), but callers using .then() will break. The old implementation delegated to getExecutionPriceDetailed (server call) and returned 0 on partial fills; the new implementation is a local VWAP walk. The behavioral change (always returning VWAP vs. returning 0 for partial fills) is intentional per the fix, but should be noted in release notes.
question getter uses Object.defineProperty with this-based getter. This relies on this being the plain object at runtime. Because convertMarket creates a {...raw, ...} spread, this will correctly refer to the market object. However, the property is non-enumerable, so JSON.stringify(market) will not include question -- this matches the Python @property behavior (not serialized to JSON). This is likely intentional.
PolymarketOptions adds apiKey and pmxtApiKey but these are not wired to anything in this PR. The options interface is extended, but no constructor logic passes these to ExchangeOptions or uses them. This may be forward-looking, but as-is they are dead fields.
PMXT Pipeline Check
Field propagation: OK -- bestBid/bestAsk already exist in Python SDK models, now added to TS models. Core already passes these through.
OpenAPI sync: N/A -- no core BaseExchange changes
Type safety: OK -- removes any on fetchMarketsPaginated
Semver Impact
minor -- new fields on MarketOutcome, new question alias, new interface properties. The getExecutionPrice sync change is technically a breaking signature change (minor or major depending on policy).
Risk
The getExecutionPrice behavior change (sync VWAP walk vs. async server call returning 0 on partial fills) is untested in this PR. The apiKey/pmxtApiKey options are unused. PR 598 and PR 600 both also modify the Python-side create_order/build_order -- ensure merge order doesn't cause conflicts if these are batched.
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
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.
Fixes #453
Fixes #454
Fixes #462
Fixes #470
Fixes #502
Fixes #503