MarketSubscription in packages/client/src/actions/subscriptions.ts:47-51 exposes customFeatureEnabled?: boolean; without documenting what events the flag enables.
export type MarketSubscription = {
topic: 'market';
tokenIds: readonly string[];
customFeatureEnabled?: boolean;
};
Reading the bindings reveals the answer in packages/bindings/src/subscriptions/clob.ts:537-543 — the events split into:
StandardMarketEventSchema: MarketBookEvent, MarketPriceChangeEvent, MarketLastTradePriceEvent, MarketTickSizeChangeEvent (delivered regardless of the flag)
CustomMarketEventSchema: MarketBestBidAskEvent, NewMarketEvent, MarketResolvedEvent (only delivered when customFeatureEnabled=true)
The naming Standard* vs Custom* already hints at the split, but a user reading MarketSubscription doesn't immediately know that setting the flag is required to receive top-of-book or market lifecycle events.
Suggested fix
Mirror the py-sdk fix from #43 (resolved by Polymarket/py-sdk#45). A short JSDoc on the field is enough:
export type MarketSubscription = {
topic: 'market';
/** Token ids whose market events should be delivered. */
tokenIds: readonly string[];
/**
* When `true`, the server additionally emits `MarketBestBidAskEvent`,
* `NewMarketEvent`, and `MarketResolvedEvent` (the `CustomMarketEvent` set).
*/
customFeatureEnabled?: boolean;
};
Happy to send a small PR once external PRs are accepted.
MarketSubscriptioninpackages/client/src/actions/subscriptions.ts:47-51exposescustomFeatureEnabled?: boolean;without documenting what events the flag enables.Reading the bindings reveals the answer in
packages/bindings/src/subscriptions/clob.ts:537-543— the events split into:StandardMarketEventSchema:MarketBookEvent,MarketPriceChangeEvent,MarketLastTradePriceEvent,MarketTickSizeChangeEvent(delivered regardless of the flag)CustomMarketEventSchema:MarketBestBidAskEvent,NewMarketEvent,MarketResolvedEvent(only delivered whencustomFeatureEnabled=true)The naming
Standard*vsCustom*already hints at the split, but a user readingMarketSubscriptiondoesn't immediately know that setting the flag is required to receive top-of-book or market lifecycle events.Suggested fix
Mirror the py-sdk fix from #43 (resolved by Polymarket/py-sdk#45). A short JSDoc on the field is enough:
Happy to send a small PR once external PRs are accepted.