Skip to content

PolymarketUSWebSocketConfig.watchTimeoutMs is dead code — unreachable even from core itself #1602

Description

@realfishsam

Gap

PolymarketUSWebSocketConfig defines a watchTimeoutMs option, but PolymarketUSExchange has no options wrapper to accept it at all — unlike sibling PolymarketExchange, which threads an equivalent config through to its WebSocket client. For polymarket_us, the config is entirely unreachable, even by a core consumer bypassing the SDKs — this is a step deeper than #1052 ("PolymarketExchangeOptions.websocket not passable through either SDK"), where plain Polymarket's config is wired in core, just not SDK-exposed.

Note: PolymarketUSConfig's gatewayUrl has the same problem in miniature — it's only settable via the POLYMARKET_US_GATEWAY_URL env var, with no per-instance override path; folding that into this same issue since it's the same root cause (missing options wrapper).

Core

  • core/src/exchanges/polymarket_us/websocket.ts:30-33 — defines PolymarketUSWebSocketConfig { watchTimeoutMs?: number }; PolymarketUSWebSocket's constructor accepts it as an optional third param (default {}).
  • core/src/exchanges/polymarket_us/index.ts:452-458 (ensureWs()) — always calls new PolymarketUSWebSocket(this.client, this.normalizer) — the config argument is never supplied.
  • core/src/exchanges/polymarket_us/index.ts:74 — the constructor accepts only credentials?: ExchangeCredentials, with no PolymarketUSExchangeOptions { credentials?; websocket? } wrapper, unlike the sibling pattern at core/src/exchanges/polymarket/index.ts:54-88.
  • core/src/exchanges/polymarket_us/config.ts:25-35getPolymarketUSConfig() lets credentials.baseUrl override apiUrl per-instance, but gatewayUrl can only come from the POLYMARKET_US_GATEWAY_URL env var.
  • Confirmed via grep that every call site (core/scripts/smoke-polymarket-us.ts:78, find-active-polymarket-us.ts:11, inspect-polymarket-us.ts:8, exchange-factory.ts:122) constructs PolymarketUSExchange with zero or bare {apiKey, privateKey} — none can inject a watch timeout or gateway URL override.

TypeScript SDK

N/A directly (nothing in core to expose) — but for context, sdks/typescript/pmxt/client.ts's PolymarketUS class has no websocket option either, consistent with core lacking one.

Python SDK

N/A directly — same, sdks/python/pmxt/_exchanges.py's PolymarketUS/Polymarket_us classes have no websocket option.

Evidence

core/src/exchanges/polymarket_us/index.ts:452-458,74 vs. core/src/exchanges/polymarket/index.ts:54-88 — direct comparison shows Polymarket has the options-wrapper plumbing that PolymarketUS lacks entirely.

Impact

Neither a polymarket_us SDK user nor a direct core consumer can configure the WebSocket watch timeout or override the gateway URL per-instance — the only lever available is the global POLYMARKET_US_GATEWAY_URL environment variable.


Found by automated Core-to-SDK surface coverage audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions