@structbuild/sdk 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1221 @@
1
+ export type paths = Record<string, never>;
2
+ export type webhooks = Record<string, never>;
3
+ export interface components {
4
+ schemas: {
5
+ /** @description Server-pushed CLOB reward change event. Envelope type: "clob_rewards_update". */
6
+ ClobRewardsUpdateEvent: {
7
+ /**
8
+ * @description Type of change
9
+ * @enum {string}
10
+ */
11
+ event_type?: "added" | "removed" | "updated";
12
+ /** @description Affected market condition ID */
13
+ condition_id?: string;
14
+ /** @description Full reward state (null for 'removed' events) */
15
+ reward?: {
16
+ condition_id?: string;
17
+ rewards_config?: {
18
+ id?: number;
19
+ /** @description Reward token address (e.g. USDC) */
20
+ asset_address?: string;
21
+ /** Format: date */
22
+ start_date?: string;
23
+ /** Format: date */
24
+ end_date?: string;
25
+ /** @description Daily reward rate in USDC */
26
+ rate_per_day?: number;
27
+ /** @description Cumulative rewards distributed */
28
+ total_rewards?: number;
29
+ }[];
30
+ /** @description Max spread to qualify for rewards */
31
+ rewards_max_spread?: number | null;
32
+ /** @description Min order size to qualify for rewards */
33
+ rewards_min_size?: number | null;
34
+ /** @description Native (non-sponsored) daily rate */
35
+ native_daily_rate?: number | null;
36
+ /** @description Sponsored daily rate */
37
+ sponsored_daily_rate?: number | null;
38
+ /** @description Combined daily rate (native + sponsored) */
39
+ total_daily_rate?: number | null;
40
+ /** @description Number of sponsors */
41
+ sponsors_count?: number | null;
42
+ } | null;
43
+ /** @description Unix timestamp in milliseconds */
44
+ timestamp_ms?: number;
45
+ };
46
+ /** @description Server acknowledgement for a CLOB rewards subscription. Envelope type: "clob_rewards_stream_subscribe_response". */
47
+ ClobRewardsSubscribeResponse: {
48
+ /** @description Accepted condition IDs */
49
+ condition_ids?: string[];
50
+ /** @description Whether subscribed to all changes */
51
+ subscribe_all?: boolean;
52
+ /** @description Filter values that were rejected */
53
+ rejected?: string[];
54
+ };
55
+ /** @description Subscribe to CLOB reward changes. Either provide specific condition_ids or set subscribe_all to true. */
56
+ ClobRewardsSubscribeMessage: {
57
+ /** @enum {string} */
58
+ action: "subscribe" | "unsubscribe_all";
59
+ /** @description Condition IDs to watch for reward changes. */
60
+ condition_ids?: string[];
61
+ /** @description If true, receive ALL reward changes across all markets. Overrides condition_ids. */
62
+ subscribe_all?: boolean;
63
+ };
64
+ /** @description Server-pushed event: full CLOB orderbook snapshot for an outcome token. Envelope type: "order_book_update". Delivered whenever the book changes for a subscribed condition or position. */
65
+ OrderBookUpdateEvent: {
66
+ /** @description Hex token ID (position / outcome token) */
67
+ asset_id: string;
68
+ /** @description Condition ID (hex) */
69
+ market: string;
70
+ /** @description Bid levels sorted best-first (highest price first) */
71
+ bids: components["schemas"]["OrderBookLevel"][];
72
+ /** @description Ask levels sorted best-first (lowest price first) */
73
+ asks: components["schemas"]["OrderBookLevel"][];
74
+ /**
75
+ * Format: int64
76
+ * @description Unix milliseconds from CLOB message
77
+ */
78
+ timestamp: number;
79
+ /** @description Orderbook content hash — identical hash means no change */
80
+ hash: string;
81
+ /** @description Best bid price (0–1) */
82
+ best_bid?: number | null;
83
+ /** @description Best ask price (0–1) */
84
+ best_ask?: number | null;
85
+ /** @description (best_bid + best_ask) / 2 */
86
+ mid_price?: number | null;
87
+ /** @description best_ask − best_bid */
88
+ spread?: number | null;
89
+ /** @description Total USD value of all bid levels */
90
+ bid_liquidity_usd?: number | null;
91
+ /** @description Total USD value of all ask levels */
92
+ ask_liquidity_usd?: number | null;
93
+ /** @description Number of bid price levels */
94
+ bid_levels?: number | null;
95
+ /** @description Number of ask price levels */
96
+ ask_levels?: number | null;
97
+ };
98
+ /** @description A single price level: [price_string, size_string] */
99
+ OrderBookLevel: string[];
100
+ /** @description Subscribe to the trades stream. No filters = subscribe to all trades. */
101
+ TradesStreamSubscribeMessage: {
102
+ /** @enum {string} */
103
+ action: "subscribe" | "unsubscribe_all";
104
+ /** @description 64-char hex condition IDs (with or without 0x prefix) */
105
+ condition_ids?: string[];
106
+ /** @description Market slugs */
107
+ market_slugs?: string[];
108
+ /** @description Event slugs — subscribes to all markets under each event */
109
+ event_slugs?: string[];
110
+ /** @description ERC-1155 outcome token IDs (decimal or hex strings) */
111
+ position_ids?: string[];
112
+ /** @description Trader wallet addresses (lowercase 0x-prefixed) */
113
+ traders?: string[];
114
+ /** @description Only receive events of these types. Empty array = all types. */
115
+ trade_types?: ("OrderFilled" | "OrdersMatched" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "Initialization" | "Proposal" | "Dispute" | "Settled" | "Resolution" | "ConditionResolution" | "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause" | "ManualResolution" | "NegRiskOutcomeReported" | "RegisterToken" | "Approval")[];
116
+ /**
117
+ * @description Trade status filter: "confirmed" (default) = on-chain only, "pending" = mempool only, "all" = both
118
+ * @enum {string}
119
+ */
120
+ status?: "confirmed" | "pending" | "all";
121
+ /** @description Explicitly subscribe to all trades. Also implicitly true when no filters are provided. */
122
+ subscribe_all?: boolean;
123
+ };
124
+ /** @description Server acknowledgement for a trades stream subscription */
125
+ TradesStreamSubscribeResponse: {
126
+ condition_ids?: string[];
127
+ market_slugs?: string[];
128
+ event_slugs?: string[];
129
+ position_ids?: string[];
130
+ traders?: string[];
131
+ trade_types?: string[];
132
+ /** @enum {string} */
133
+ status?: "confirmed" | "pending" | "all";
134
+ subscribe_all?: boolean;
135
+ /** @description Filter values that were rejected (invalid format or unknown type) */
136
+ rejected?: string[];
137
+ };
138
+ /**
139
+ * @description Server-pushed event. Discriminated by `trade_type` — each variant only includes relevant fields.
140
+ *
141
+ * Envelope: `{"type": "trade_stream_update", "room_id": "polymarket_trades", "status": "confirmed"|"pending", "data": {...}}`
142
+ *
143
+ * **Pending trades:** `block`, `confirmed_at`, `log_index`, `block_index` are absent. `received_at` (milliseconds) is included instead. For OrderFilled/OrdersMatched, `order_hash`, `taker`, `fee`, `fee_shares`, `fee_pct` are also absent.
144
+ */
145
+ TradeStreamEvent: {
146
+ /** @enum {string} */
147
+ trade_type: "OrderFilled" | "OrdersMatched";
148
+ id: string;
149
+ hash: string;
150
+ /** @description Absent for pending trades */
151
+ block?: number;
152
+ /** @description Unix seconds. Absent for pending trades */
153
+ confirmed_at?: number;
154
+ /** @description Unix milliseconds. Present for pending trades only */
155
+ received_at?: number;
156
+ /** @description Absent for pending trades */
157
+ log_index?: number;
158
+ /** @description Absent for pending trades */
159
+ block_index?: number;
160
+ /** @description Absent for pending trades */
161
+ order_hash?: string;
162
+ trader: {
163
+ address?: string;
164
+ name?: string | null;
165
+ pseudonym?: string | null;
166
+ profile_image?: string | null;
167
+ x_username?: string | null;
168
+ verified_badge?: boolean;
169
+ };
170
+ /** @description Absent for pending trades */
171
+ taker?: string;
172
+ /** @enum {string} */
173
+ side?: "Buy" | "Sell";
174
+ condition_id?: string | null;
175
+ position_id?: string;
176
+ outcome?: string | null;
177
+ outcome_index?: number | null;
178
+ question?: string | null;
179
+ image_url?: string | null;
180
+ slug?: string | null;
181
+ event_slug?: string | null;
182
+ usd_amount?: number;
183
+ shares_amount?: number;
184
+ price?: number;
185
+ probability?: number | null;
186
+ /** @description Absent for pending trades */
187
+ fee?: number;
188
+ /** @description Absent for pending trades */
189
+ fee_shares?: number;
190
+ /** @description Absent for pending trades */
191
+ fee_pct?: number;
192
+ exchange: number;
193
+ } | {
194
+ /** @enum {string} */
195
+ trade_type: "Redemption";
196
+ id: string;
197
+ hash: string;
198
+ block?: number;
199
+ confirmed_at?: number;
200
+ received_at?: number;
201
+ log_index?: number;
202
+ block_index?: number;
203
+ trader: {
204
+ address?: string;
205
+ name?: string | null;
206
+ pseudonym?: string | null;
207
+ profile_image?: string | null;
208
+ x_username?: string | null;
209
+ verified_badge?: boolean;
210
+ };
211
+ condition_id?: string | null;
212
+ outcome?: string | null;
213
+ outcome_index?: number | null;
214
+ question?: string | null;
215
+ image_url?: string | null;
216
+ slug?: string | null;
217
+ event_slug?: string | null;
218
+ usd_amount?: number;
219
+ winning_outcome_index?: number | null;
220
+ position_details?: {
221
+ position_id?: string;
222
+ outcome_index?: number;
223
+ amount?: string;
224
+ }[];
225
+ exchange: number;
226
+ } | {
227
+ /** @enum {string} */
228
+ trade_type: "Merge";
229
+ id: string;
230
+ hash: string;
231
+ block?: number;
232
+ confirmed_at?: number;
233
+ received_at?: number;
234
+ log_index?: number;
235
+ block_index?: number;
236
+ trader: {
237
+ address?: string;
238
+ name?: string | null;
239
+ pseudonym?: string | null;
240
+ profile_image?: string | null;
241
+ x_username?: string | null;
242
+ verified_badge?: boolean;
243
+ };
244
+ condition_id?: string | null;
245
+ question?: string | null;
246
+ image_url?: string | null;
247
+ slug?: string | null;
248
+ event_slug?: string | null;
249
+ usd_amount?: number;
250
+ position_details?: {
251
+ position_id?: string;
252
+ outcome_index?: number;
253
+ amount?: string;
254
+ }[];
255
+ exchange: number;
256
+ } | {
257
+ /** @enum {string} */
258
+ trade_type: "Split";
259
+ id: string;
260
+ hash: string;
261
+ block?: number;
262
+ confirmed_at?: number;
263
+ received_at?: number;
264
+ log_index?: number;
265
+ block_index?: number;
266
+ trader: {
267
+ address?: string;
268
+ name?: string | null;
269
+ pseudonym?: string | null;
270
+ profile_image?: string | null;
271
+ x_username?: string | null;
272
+ verified_badge?: boolean;
273
+ };
274
+ condition_id?: string | null;
275
+ question?: string | null;
276
+ image_url?: string | null;
277
+ slug?: string | null;
278
+ event_slug?: string | null;
279
+ usd_amount?: number;
280
+ position_details?: {
281
+ position_id?: string;
282
+ outcome_index?: number;
283
+ amount?: string;
284
+ }[];
285
+ exchange: number;
286
+ } | {
287
+ /** @enum {string} */
288
+ trade_type: "PositionsConverted";
289
+ id: string;
290
+ hash: string;
291
+ block?: number;
292
+ confirmed_at?: number;
293
+ received_at?: number;
294
+ log_index?: number;
295
+ block_index?: number;
296
+ trader: {
297
+ address?: string;
298
+ name?: string | null;
299
+ pseudonym?: string | null;
300
+ profile_image?: string | null;
301
+ x_username?: string | null;
302
+ verified_badge?: boolean;
303
+ };
304
+ market_id?: string;
305
+ index_set?: string;
306
+ shares_amount?: number;
307
+ exchange: number;
308
+ } | {
309
+ /** @enum {string} */
310
+ trade_type: "Cancelled";
311
+ id: string;
312
+ hash: string;
313
+ block?: number;
314
+ confirmed_at?: number;
315
+ received_at?: number;
316
+ log_index?: number;
317
+ block_index?: number;
318
+ order_hash?: string;
319
+ question?: string | null;
320
+ image_url?: string | null;
321
+ slug?: string | null;
322
+ event_slug?: string | null;
323
+ exchange: number;
324
+ } | {
325
+ /** @enum {string} */
326
+ trade_type: "Initialization" | "Proposal" | "Dispute" | "Settled" | "Resolution" | "ConditionResolution" | "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause" | "ManualResolution" | "NegRiskOutcomeReported";
327
+ id: string;
328
+ hash: string;
329
+ block?: number;
330
+ confirmed_at?: number;
331
+ received_at?: number;
332
+ log_index?: number;
333
+ block_index?: number;
334
+ oracle_contract: string;
335
+ condition_id: string;
336
+ question?: string | null;
337
+ image_url?: string | null;
338
+ slug?: string | null;
339
+ event_slug?: string | null;
340
+ assertion_id?: string | null;
341
+ proposer?: string | null;
342
+ disputer?: string | null;
343
+ proposed_outcome?: string | null;
344
+ settled_price?: number | null;
345
+ disputed?: boolean | null;
346
+ settlement_resolution?: boolean | null;
347
+ bond?: string | null;
348
+ expiration_time?: number | null;
349
+ creator?: string | null;
350
+ reward_token?: string | null;
351
+ reward?: string | null;
352
+ proposal_bond?: string | null;
353
+ } | {
354
+ /** @enum {string} */
355
+ trade_type: "RegisterToken";
356
+ id: string;
357
+ hash: string;
358
+ block?: number;
359
+ confirmed_at?: number;
360
+ received_at?: number;
361
+ log_index?: number;
362
+ block_index?: number;
363
+ condition_id: string;
364
+ token0?: string;
365
+ token1?: string;
366
+ question?: string | null;
367
+ image_url?: string | null;
368
+ slug?: string | null;
369
+ event_slug?: string | null;
370
+ exchange: number;
371
+ } | {
372
+ /** @enum {string} */
373
+ trade_type: "Approval";
374
+ id: string;
375
+ hash: string;
376
+ block?: number;
377
+ confirmed_at?: number;
378
+ received_at?: number;
379
+ log_index?: number;
380
+ block_index?: number;
381
+ trader: {
382
+ address?: string;
383
+ name?: string | null;
384
+ pseudonym?: string | null;
385
+ profile_image?: string | null;
386
+ x_username?: string | null;
387
+ verified_badge?: boolean;
388
+ };
389
+ operator?: string;
390
+ approved?: boolean;
391
+ question?: string | null;
392
+ image_url?: string | null;
393
+ slug?: string | null;
394
+ event_slug?: string | null;
395
+ exchange: number;
396
+ };
397
+ /** @description Subscribe to the asset prices stream. Empty asset_symbols = all assets. */
398
+ AssetPricesSubscribeMessage: {
399
+ /** @enum {string} */
400
+ action: "subscribe" | "unsubscribe_all";
401
+ /** @description Uppercase asset symbols (e.g. "BTC", "ETH"). Empty = subscribe to all. */
402
+ asset_symbols?: string[];
403
+ };
404
+ /** @description Server acknowledgement for an asset prices subscription */
405
+ AssetPricesSubscribeResponse: {
406
+ /** @description Accepted symbols. Empty array means subscribed to all symbols. */
407
+ asset_symbols?: string[];
408
+ };
409
+ /** @description Server-pushed event: a crypto-asset price tick. Envelope type: "asset_price_tick". */
410
+ AssetPriceTickEvent: {
411
+ /** @description Always "asset_price_tick" */
412
+ event_type: string;
413
+ /** @description Uppercase asset symbol (e.g. "BTC") */
414
+ symbol: string;
415
+ /** @description Current price in USD */
416
+ price: number;
417
+ /**
418
+ * Format: int64
419
+ * @description Event timestamp in Unix milliseconds
420
+ */
421
+ timestamp_ms: number;
422
+ /**
423
+ * Format: int64
424
+ * @description Publish timestamp in Unix milliseconds
425
+ */
426
+ published_at: number;
427
+ };
428
+ /** @description Server-pushed event: candle open or close for a crypto asset. Envelope type: "asset_price_window_update". Delivered from both `polymarket_asset_prices` and `polymarket_asset_window_updates` rooms. */
429
+ AssetPriceWindowUpdateEvent: {
430
+ /** @description Always "asset_price_window_update" */
431
+ event_type: string;
432
+ /** @description Uppercase asset symbol (e.g. "BTC") */
433
+ symbol: string;
434
+ /** @description Candle size / timeframe (e.g. "5m", "1h", "1d") */
435
+ variant: string;
436
+ /**
437
+ * Format: int64
438
+ * @description Candle start in Unix milliseconds
439
+ */
440
+ start_time: number;
441
+ /**
442
+ * Format: int64
443
+ * @description Candle end in Unix milliseconds
444
+ */
445
+ end_time: number;
446
+ /** @description Candle open price in USD */
447
+ open_price: number;
448
+ /** @description Candle close price in USD */
449
+ close_price: number;
450
+ /** @description "open" = candle starting, "close" = candle finalised */
451
+ update_type: string;
452
+ /**
453
+ * Format: int64
454
+ * @description Publish timestamp in Unix milliseconds
455
+ */
456
+ published_at: number;
457
+ };
458
+ /** @description Subscribe to the asset window updates stream. At least one of asset_symbols or timeframes must be non-empty. */
459
+ AssetWindowUpdatesSubscribeMessage: {
460
+ /** @enum {string} */
461
+ action: "subscribe" | "unsubscribe_all";
462
+ /** @description Uppercase asset symbols (e.g. "BTC", "ETH") */
463
+ asset_symbols?: string[];
464
+ /** @description Candle sizes to filter by. "1d" and "24h" are treated as equivalent. */
465
+ timeframes?: ("5m" | "15m" | "1h" | "4h" | "1d" | "24h")[];
466
+ };
467
+ /** @description Server acknowledgement for an asset window updates subscription */
468
+ AssetWindowUpdatesSubscribeResponse: {
469
+ asset_symbols?: string[];
470
+ timeframes?: string[];
471
+ /** @description Set if the subscription was rejected (e.g. no filters provided) */
472
+ error?: string | null;
473
+ };
474
+ /** @description Server-pushed event from the polymarket_asset_window_updates room. Same payload as AssetPriceWindowUpdateEvent. Envelope type: "asset_price_window_update". */
475
+ AssetWindowUpdateEvent: components["schemas"]["AssetPriceWindowUpdateEvent"];
476
+ /** @description Subscribe to the market metrics stream. condition_ids is required and must be non-empty. */
477
+ MarketMetricsSubscribeMessage: {
478
+ /** @enum {string} */
479
+ action: "subscribe" | "unsubscribe_all";
480
+ /** @description 64-char hex condition IDs (with or without 0x prefix) */
481
+ condition_ids: string[];
482
+ };
483
+ /** @description Server acknowledgement for a market metrics subscription */
484
+ MarketMetricsSubscribeResponse: {
485
+ condition_ids?: string[];
486
+ /** @description Condition IDs that were rejected (invalid format) */
487
+ rejected?: string[];
488
+ /** @description Set if the entire subscription was rejected */
489
+ error?: string | null;
490
+ };
491
+ /** @description Server-pushed event: metrics update for one timeframe of a condition. Envelope type: "market_metrics_update". One event is emitted per timeframe window on each update. */
492
+ MarketMetricsEvent: {
493
+ /** @description 64-char hex condition ID */
494
+ condition_id: string;
495
+ /** @enum {string} */
496
+ timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
497
+ /**
498
+ * Format: int64
499
+ * @description Optional event timestamp (Unix seconds)
500
+ */
501
+ timestamp?: number | null;
502
+ /** @description USD volume in this timeframe window (decimal string) */
503
+ usd_volume: string;
504
+ /** @description Total fees in this window */
505
+ fees: number;
506
+ /**
507
+ * Format: int64
508
+ * @description Number of transactions
509
+ */
510
+ txns: number;
511
+ /** Format: int64 */
512
+ unique_traders: number;
513
+ };
514
+ /** @description Subscribe to the event metrics stream. event_slugs is required and must be non-empty. */
515
+ EventMetricsSubscribeMessage: {
516
+ /** @enum {string} */
517
+ action: "subscribe" | "unsubscribe_all";
518
+ /** @description Event slugs (lowercase) */
519
+ event_slugs: string[];
520
+ };
521
+ /** @description Server acknowledgement for an event metrics subscription */
522
+ EventMetricsSubscribeResponse: {
523
+ event_slugs?: string[];
524
+ rejected?: string[];
525
+ error?: string | null;
526
+ };
527
+ /** @description Server-pushed event: aggregated metrics update for one timeframe of an event. Envelope type: "event_metrics_update". One event is emitted per timeframe window on each update. */
528
+ EventMetricsEvent: {
529
+ event_slug: string;
530
+ /** @enum {string} */
531
+ timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
532
+ /**
533
+ * Format: int64
534
+ * @description Optional event timestamp (Unix seconds)
535
+ */
536
+ timestamp?: number | null;
537
+ /** @description USD volume in this timeframe window (decimal string) */
538
+ usd_volume: string;
539
+ fees: number;
540
+ /** Format: int64 */
541
+ txns: number;
542
+ /** Format: int64 */
543
+ unique_traders: number;
544
+ };
545
+ /** @description Subscribe to the position metrics stream. position_ids is required and must be non-empty. */
546
+ PositionMetricsSubscribeMessage: {
547
+ /** @enum {string} */
548
+ action: "subscribe" | "unsubscribe_all";
549
+ /** @description ERC-1155 outcome token IDs (decimal or hex strings) */
550
+ position_ids: string[];
551
+ };
552
+ /** @description Server acknowledgement for a position metrics subscription */
553
+ PositionMetricsSubscribeResponse: {
554
+ position_ids?: string[];
555
+ rejected?: string[];
556
+ error?: string | null;
557
+ };
558
+ /** @description Server-pushed event: metrics update for one timeframe of an outcome token. Envelope type: "position_metrics_update". One event is emitted per timeframe window on each update. */
559
+ PositionMetricsEvent: {
560
+ /** @description 64-char hex condition ID */
561
+ condition_id: string;
562
+ /** @description ERC-1155 token ID (decimal string) */
563
+ position_id: string;
564
+ /** @description Outcome name (e.g. "Yes") */
565
+ outcome?: string | null;
566
+ outcome_index?: number | null;
567
+ /** @enum {string} */
568
+ timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
569
+ /**
570
+ * Format: int64
571
+ * @description Optional event timestamp (Unix seconds)
572
+ */
573
+ timestamp?: number | null;
574
+ /** @description Total USD volume (decimal string) */
575
+ usd_volume: string;
576
+ /** @description USD buy volume (decimal string) */
577
+ usd_buy_volume: string;
578
+ /** @description USD sell volume (decimal string) */
579
+ usd_sell_volume: string;
580
+ fees: number;
581
+ /** Format: int64 */
582
+ txns: number;
583
+ /** Format: int64 */
584
+ buys: number;
585
+ /** Format: int64 */
586
+ sells: number;
587
+ /** Format: int64 */
588
+ unique_traders: number;
589
+ /** @description OHLC open price (0–1) */
590
+ price_open: number;
591
+ /** @description OHLC close price (0–1) */
592
+ price_close: number;
593
+ /** @description OHLC high price (0–1) */
594
+ price_high: number;
595
+ /** @description OHLC low price (0–1) */
596
+ price_low: number;
597
+ /** @description Implied probability at open (0–1) */
598
+ probability_open: number;
599
+ /** @description Implied probability at close (0–1) */
600
+ probability_close: number;
601
+ /** @description Highest implied probability in window (0–1) */
602
+ probability_high: number;
603
+ /** @description Lowest implied probability in window (0–1) */
604
+ probability_low: number;
605
+ };
606
+ /** @description Subscribe to the trader PnL stream. `traders` is required and must be non-empty. `update_types` and `timeframes` are optional narrowing filters — omit or leave empty to receive all update types / timeframes. */
607
+ TraderPnlSubscribeMessage: {
608
+ /** @enum {string} */
609
+ action: "subscribe" | "unsubscribe_all";
610
+ /** @description EVM wallet addresses */
611
+ traders: string[];
612
+ /** @description Restrict pushed updates to this subset of PnL granularities. Empty/omitted = all three. Unknown values reject the subscription. */
613
+ update_types?: ("global" | "market" | "event")[];
614
+ /** @description Restrict pushed updates to these aggregation timeframes. Empty/omitted = all four. Unknown values reject the subscription. */
615
+ timeframes?: ("1d" | "7d" | "30d" | "lifetime")[];
616
+ };
617
+ /** @description Server acknowledgement for a trader PnL subscription. Echoes the accepted (normalized) filter sets so clients can confirm the active subscription. */
618
+ TraderPnlSubscribeResponse: {
619
+ traders?: string[];
620
+ /** @description Accepted update types. Empty = all. */
621
+ update_types?: ("global" | "market" | "event")[];
622
+ /** @description Accepted timeframes. Empty = all. */
623
+ timeframes?: ("1d" | "7d" | "30d" | "lifetime")[];
624
+ /** @description Trader addresses that were rejected (invalid EVM format). */
625
+ rejected?: string[];
626
+ /** @description Set if the entire subscription was rejected (e.g. empty traders, or an invalid update_type / timeframe value). */
627
+ error?: string | null;
628
+ };
629
+ /** @description Server-pushed event: global (portfolio-level) PnL update for a trader. Envelope type: "trader_global_pnl_update". */
630
+ TraderGlobalPnlEvent: {
631
+ /** @description Trader EVM wallet address */
632
+ trader: string;
633
+ /** @description Total realized PnL in USD (decimal string) */
634
+ realized_pnl_usd: string;
635
+ /** Format: int64 */
636
+ events_traded?: number | null;
637
+ /** Format: int64 */
638
+ markets_traded?: number | null;
639
+ /** Format: int64 */
640
+ total_buys?: number | null;
641
+ /** Format: int64 */
642
+ total_sells?: number | null;
643
+ /** Format: int64 */
644
+ total_redemptions?: number | null;
645
+ /** Format: int64 */
646
+ total_merges?: number | null;
647
+ /** @description Total USD volume (decimal string) */
648
+ total_volume_usd: string;
649
+ buy_volume_usd: string;
650
+ sell_volume_usd: string;
651
+ redemption_volume_usd: string;
652
+ merge_volume_usd: string;
653
+ /** Format: int64 */
654
+ markets_won?: number | null;
655
+ /** Format: int64 */
656
+ markets_lost?: number | null;
657
+ /** @description Win rate percentage (decimal string) */
658
+ market_win_rate_pct: string;
659
+ avg_pnl_per_market: string;
660
+ avg_pnl_per_trade: string;
661
+ avg_hold_time_seconds: string;
662
+ total_fees: string;
663
+ best_trade_pnl_usd: string;
664
+ best_trade_condition_id?: string | null;
665
+ worst_trade_pnl_usd: string;
666
+ worst_trade_condition_id?: string | null;
667
+ /**
668
+ * Format: int64
669
+ * @description Unix seconds
670
+ */
671
+ first_trade_at?: number | null;
672
+ /**
673
+ * Format: int64
674
+ * @description Unix seconds
675
+ */
676
+ last_trade_at?: number | null;
677
+ /** Format: int64 */
678
+ timestamp?: number | null;
679
+ /** @description "1d", "7d", "30d", or "lifetime" */
680
+ timeframe?: string | null;
681
+ };
682
+ /** @description Server-pushed event: per-market PnL update for a trader. Envelope type: "trader_market_pnl_update". */
683
+ TraderMarketPnlEvent: {
684
+ trader: string;
685
+ /** @description 64-char hex condition ID */
686
+ condition_id: string;
687
+ event_slug?: string | null;
688
+ /** Format: int64 */
689
+ outcomes_traded?: number | null;
690
+ /** Format: int64 */
691
+ total_buys?: number | null;
692
+ /** Format: int64 */
693
+ total_sells?: number | null;
694
+ /** Format: int64 */
695
+ total_redemptions?: number | null;
696
+ /** Format: int64 */
697
+ total_merges?: number | null;
698
+ /** @description Total buy volume in USD (decimal string) */
699
+ buy_usd: string;
700
+ sell_usd: string;
701
+ redemption_usd: string;
702
+ merge_usd: string;
703
+ /** @description Realized PnL in USD (decimal string) */
704
+ realized_pnl_usd: string;
705
+ /** Format: int64 */
706
+ winning_outcomes?: number | null;
707
+ total_fees: string;
708
+ /**
709
+ * Format: int64
710
+ * @description Unix seconds
711
+ */
712
+ first_trade_at?: number | null;
713
+ /**
714
+ * Format: int64
715
+ * @description Unix seconds
716
+ */
717
+ last_trade_at?: number | null;
718
+ /** Format: int64 */
719
+ timestamp?: number | null;
720
+ /** @description "1d", "7d", "30d", or "lifetime" */
721
+ timeframe?: string | null;
722
+ };
723
+ /** @description Server-pushed event: per-event PnL update for a trader. Envelope type: "trader_event_pnl_update". */
724
+ TraderEventPnlEvent: {
725
+ trader: string;
726
+ event_slug: string;
727
+ /** Format: int64 */
728
+ markets_traded?: number | null;
729
+ /** Format: int64 */
730
+ outcomes_traded?: number | null;
731
+ /** Format: int64 */
732
+ total_buys?: number | null;
733
+ /** Format: int64 */
734
+ total_sells?: number | null;
735
+ /** Format: int64 */
736
+ total_redemptions?: number | null;
737
+ /** Format: int64 */
738
+ total_merges?: number | null;
739
+ /** @description Total USD volume (decimal string) */
740
+ total_volume_usd: string;
741
+ buy_usd: string;
742
+ sell_usd: string;
743
+ redemption_usd: string;
744
+ merge_usd: string;
745
+ /** @description Realized PnL in USD (decimal string) */
746
+ realized_pnl_usd: string;
747
+ /** Format: int64 */
748
+ winning_markets?: number | null;
749
+ /** Format: int64 */
750
+ losing_markets?: number | null;
751
+ total_fees: string;
752
+ /**
753
+ * Format: int64
754
+ * @description Unix seconds
755
+ */
756
+ first_trade_at?: number | null;
757
+ /**
758
+ * Format: int64
759
+ * @description Unix seconds
760
+ */
761
+ last_trade_at?: number | null;
762
+ /** Format: int64 */
763
+ timestamp?: number | null;
764
+ /** @description "1d", "7d", "30d", or "lifetime" */
765
+ timeframe?: string | null;
766
+ };
767
+ /** @description Subscribe to the trader positions stream. traders is required and must be non-empty. */
768
+ TraderPositionsSubscribeMessage: {
769
+ /** @enum {string} */
770
+ action: "subscribe" | "unsubscribe_all";
771
+ /** @description EVM wallet addresses */
772
+ traders: string[];
773
+ };
774
+ /** @description Server acknowledgement for a trader positions subscription */
775
+ TraderPositionsSubscribeResponse: {
776
+ traders?: string[];
777
+ rejected?: string[];
778
+ error?: string | null;
779
+ };
780
+ /** @description Server-pushed event: full position snapshot for a tracked trader. Envelope type: "trader_position_update". Pushed whenever a position's PnL changes. */
781
+ TraderPositionUpdateEvent: {
782
+ /** @description Trader EVM wallet address */
783
+ trader: string;
784
+ /** @description ERC-1155 token ID (decimal string) */
785
+ position_id?: string | null;
786
+ condition_id?: string | null;
787
+ market_slug?: string | null;
788
+ event_slug?: string | null;
789
+ /** @description Market title / question */
790
+ title?: string | null;
791
+ image_url?: string | null;
792
+ /** @description Outcome name (e.g. "Yes") */
793
+ outcome?: string | null;
794
+ outcome_index?: number | null;
795
+ /** @description True if this outcome resolved as winner */
796
+ won?: boolean | null;
797
+ /** Format: int64 */
798
+ total_buys?: number | null;
799
+ /** Format: int64 */
800
+ total_sells?: number | null;
801
+ total_shares_bought?: number | null;
802
+ total_shares_sold?: number | null;
803
+ total_buy_usd?: number | null;
804
+ total_sell_usd?: number | null;
805
+ redemption_usd?: number | null;
806
+ /** @description Average entry price (0–1) */
807
+ avg_entry_price?: number | null;
808
+ /** @description Average exit price (0–1) */
809
+ avg_exit_price?: number | null;
810
+ realized_pnl_usd?: number | null;
811
+ total_fees?: number | null;
812
+ /**
813
+ * Format: int64
814
+ * @description Unix seconds
815
+ */
816
+ first_trade_at?: number | null;
817
+ /**
818
+ * Format: int64
819
+ * @description Unix seconds
820
+ */
821
+ last_trade_at?: number | null;
822
+ /** @description Current ERC-1155 token balance */
823
+ current_shares_balance?: number | null;
824
+ /** @description Realized PnL as a percentage of cost basis */
825
+ realized_pnl_pct?: number | null;
826
+ };
827
+ /** @description Subscribe to the accounts stream. `wallets` is required. Share balance updates (`accounts_update`) are always delivered. Set `include_usdce` or `include_matic` to also receive those balance streams. */
828
+ AccountsSubscribeMessage: {
829
+ /** @enum {string} */
830
+ action: "subscribe" | "unsubscribe_all";
831
+ /** @description EVM wallet addresses */
832
+ wallets: string[];
833
+ /** @description Also stream USDCe collateral balance updates for subscribed wallets */
834
+ include_usdce?: boolean;
835
+ /** @description Also stream MATIC gas balance updates for subscribed wallets */
836
+ include_matic?: boolean;
837
+ };
838
+ /** @description Server acknowledgement for an accounts subscription */
839
+ AccountsSubscribeResponse: {
840
+ wallets?: string[];
841
+ /** @description Addresses rejected (invalid format) */
842
+ rejected?: string[];
843
+ include_usdce?: boolean;
844
+ include_matic?: boolean;
845
+ error?: string | null;
846
+ };
847
+ /** @description Server-pushed event: ERC-1155 outcome token balance change for a wallet. Envelope type: "accounts_update". */
848
+ AccountsUpdateEvent: {
849
+ /** @description Wallet address */
850
+ wallet: string;
851
+ /** @description ERC-1155 outcome token ID (decimal string) */
852
+ position_id: string;
853
+ /** @description Current token balance (decimal string) */
854
+ balance: string;
855
+ /** Format: int64 */
856
+ block_number: number;
857
+ /**
858
+ * Format: int64
859
+ * @description Unix seconds
860
+ */
861
+ updated_at: number;
862
+ /** @description Condition ID — omitted when not available */
863
+ condition_id?: string;
864
+ /** @description Event slug — omitted when not available */
865
+ event_slug?: string;
866
+ };
867
+ /** @description Server-pushed event: USDCe collateral balance change for a wallet. Envelope type: "usdce_update". Only delivered when `include_usdce: true`. */
868
+ UsdceUpdateEvent: {
869
+ /** @description Wallet address (0x-prefixed hex) */
870
+ address: string;
871
+ /** @description USDCe contract address — omitted when not available */
872
+ token_address?: string;
873
+ /** @description Current USDCe balance (decimal string) — omitted when not available */
874
+ balance?: string;
875
+ /** Format: uint64 */
876
+ block_number: number;
877
+ /**
878
+ * Format: int64
879
+ * @description Unix seconds
880
+ */
881
+ updated_at: number;
882
+ };
883
+ /** @description Server-pushed event: MATIC native balance change for a wallet. Envelope type: "matic_update". Only delivered when `include_matic: true`. */
884
+ MaticUpdateEvent: {
885
+ /** @description Wallet address (0x-prefixed hex) */
886
+ address: string;
887
+ /** @description Native token address — omitted when not available */
888
+ token_address?: string;
889
+ /** @description Current MATIC balance (decimal string) — omitted when not available */
890
+ balance?: string;
891
+ /** Format: uint64 */
892
+ block_number: number;
893
+ /**
894
+ * Format: int64
895
+ * @description Unix seconds
896
+ */
897
+ updated_at: number;
898
+ };
899
+ /** @description Subscribe to the order book stream. At least one filter is required. Maximum 500 combined condition_ids + position_ids per client. No `type` field is needed — the server routes by room_id. */
900
+ OrderBookSubscribeMessage: {
901
+ /** @enum {string} */
902
+ action: "subscribe" | "unsubscribe_all";
903
+ /** @description Condition IDs (markets). All positions within each market are delivered. */
904
+ condition_ids?: string[];
905
+ /** @description Token / asset IDs (individual outcome positions, hex strings). */
906
+ position_ids?: string[];
907
+ };
908
+ /** @description Server acknowledgement for an order book subscription. Envelope type: "order_book_stream_subscribe_response". */
909
+ OrderBookSubscribeResponse: {
910
+ /** @description Accepted condition IDs */
911
+ condition_ids?: string[];
912
+ /** @description Accepted position IDs */
913
+ position_ids?: string[];
914
+ /** @description Filter values that were rejected (invalid format or limit exceeded) */
915
+ rejected?: string[];
916
+ };
917
+ /**
918
+ * OrderFilled / OrdersMatched
919
+ * @description A buy/sell trade was matched on the exchange.
920
+ */
921
+ TradeOrderFilledEvent: {
922
+ /** @enum {string} */
923
+ trade_type: "OrderFilled" | "OrdersMatched";
924
+ id: string;
925
+ hash: string;
926
+ /** @description Absent for pending trades */
927
+ block?: number;
928
+ /** @description Unix seconds. Absent for pending trades */
929
+ confirmed_at?: number;
930
+ /** @description Unix milliseconds. Present for pending trades only */
931
+ received_at?: number;
932
+ /** @description Absent for pending trades */
933
+ log_index?: number;
934
+ /** @description Absent for pending trades */
935
+ block_index?: number;
936
+ /** @description Absent for pending trades */
937
+ order_hash?: string;
938
+ trader: {
939
+ address?: string;
940
+ name?: string | null;
941
+ pseudonym?: string | null;
942
+ profile_image?: string | null;
943
+ x_username?: string | null;
944
+ verified_badge?: boolean;
945
+ };
946
+ /** @description Absent for pending trades */
947
+ taker?: string;
948
+ /** @enum {string} */
949
+ side?: "Buy" | "Sell";
950
+ condition_id?: string | null;
951
+ position_id?: string;
952
+ outcome?: string | null;
953
+ outcome_index?: number | null;
954
+ question?: string | null;
955
+ image_url?: string | null;
956
+ slug?: string | null;
957
+ event_slug?: string | null;
958
+ usd_amount?: number;
959
+ shares_amount?: number;
960
+ price?: number;
961
+ probability?: number | null;
962
+ /** @description Absent for pending trades */
963
+ fee?: number;
964
+ /** @description Absent for pending trades */
965
+ fee_shares?: number;
966
+ /** @description Absent for pending trades */
967
+ fee_pct?: number;
968
+ exchange: number;
969
+ };
970
+ /**
971
+ * Redemption
972
+ * @description Positions redeemed after market resolution.
973
+ */
974
+ TradeRedemptionEvent: {
975
+ /** @enum {string} */
976
+ trade_type: "Redemption";
977
+ id: string;
978
+ hash: string;
979
+ block?: number;
980
+ confirmed_at?: number;
981
+ received_at?: number;
982
+ log_index?: number;
983
+ block_index?: number;
984
+ trader: {
985
+ address?: string;
986
+ name?: string | null;
987
+ pseudonym?: string | null;
988
+ profile_image?: string | null;
989
+ x_username?: string | null;
990
+ verified_badge?: boolean;
991
+ };
992
+ condition_id?: string | null;
993
+ outcome?: string | null;
994
+ outcome_index?: number | null;
995
+ question?: string | null;
996
+ image_url?: string | null;
997
+ slug?: string | null;
998
+ event_slug?: string | null;
999
+ usd_amount?: number;
1000
+ winning_outcome_index?: number | null;
1001
+ position_details?: {
1002
+ position_id?: string;
1003
+ outcome_index?: number;
1004
+ amount?: string;
1005
+ }[];
1006
+ exchange: number;
1007
+ };
1008
+ /**
1009
+ * Merge
1010
+ * @description Outcome tokens burned to receive collateral.
1011
+ */
1012
+ TradeMergeEvent: {
1013
+ /** @enum {string} */
1014
+ trade_type: "Merge";
1015
+ id: string;
1016
+ hash: string;
1017
+ block?: number;
1018
+ confirmed_at?: number;
1019
+ received_at?: number;
1020
+ log_index?: number;
1021
+ block_index?: number;
1022
+ trader: {
1023
+ address?: string;
1024
+ name?: string | null;
1025
+ pseudonym?: string | null;
1026
+ profile_image?: string | null;
1027
+ x_username?: string | null;
1028
+ verified_badge?: boolean;
1029
+ };
1030
+ condition_id?: string | null;
1031
+ question?: string | null;
1032
+ image_url?: string | null;
1033
+ slug?: string | null;
1034
+ event_slug?: string | null;
1035
+ usd_amount?: number;
1036
+ position_details?: {
1037
+ position_id?: string;
1038
+ outcome_index?: number;
1039
+ amount?: string;
1040
+ }[];
1041
+ exchange: number;
1042
+ };
1043
+ /**
1044
+ * Split
1045
+ * @description Collateral deposited to receive outcome tokens.
1046
+ */
1047
+ TradeSplitEvent: {
1048
+ /** @enum {string} */
1049
+ trade_type: "Split";
1050
+ id: string;
1051
+ hash: string;
1052
+ block?: number;
1053
+ confirmed_at?: number;
1054
+ received_at?: number;
1055
+ log_index?: number;
1056
+ block_index?: number;
1057
+ trader: {
1058
+ address?: string;
1059
+ name?: string | null;
1060
+ pseudonym?: string | null;
1061
+ profile_image?: string | null;
1062
+ x_username?: string | null;
1063
+ verified_badge?: boolean;
1064
+ };
1065
+ condition_id?: string | null;
1066
+ question?: string | null;
1067
+ image_url?: string | null;
1068
+ slug?: string | null;
1069
+ event_slug?: string | null;
1070
+ usd_amount?: number;
1071
+ position_details?: {
1072
+ position_id?: string;
1073
+ outcome_index?: number;
1074
+ amount?: string;
1075
+ }[];
1076
+ exchange: number;
1077
+ };
1078
+ /**
1079
+ * PositionsConverted
1080
+ * @description NegRisk NO tokens converted to YES tokens + collateral.
1081
+ */
1082
+ TradePositionsConvertedEvent: {
1083
+ /** @enum {string} */
1084
+ trade_type: "PositionsConverted";
1085
+ id: string;
1086
+ hash: string;
1087
+ block?: number;
1088
+ confirmed_at?: number;
1089
+ received_at?: number;
1090
+ log_index?: number;
1091
+ block_index?: number;
1092
+ trader: {
1093
+ address?: string;
1094
+ name?: string | null;
1095
+ pseudonym?: string | null;
1096
+ profile_image?: string | null;
1097
+ x_username?: string | null;
1098
+ verified_badge?: boolean;
1099
+ };
1100
+ market_id?: string;
1101
+ index_set?: string;
1102
+ shares_amount?: number;
1103
+ exchange: number;
1104
+ };
1105
+ /**
1106
+ * Cancelled
1107
+ * @description Order cancelled on-chain.
1108
+ */
1109
+ TradeCancelledEvent: {
1110
+ /** @enum {string} */
1111
+ trade_type: "Cancelled";
1112
+ id: string;
1113
+ hash: string;
1114
+ block?: number;
1115
+ confirmed_at?: number;
1116
+ received_at?: number;
1117
+ log_index?: number;
1118
+ block_index?: number;
1119
+ order_hash?: string;
1120
+ question?: string | null;
1121
+ image_url?: string | null;
1122
+ slug?: string | null;
1123
+ event_slug?: string | null;
1124
+ exchange: number;
1125
+ };
1126
+ /**
1127
+ * Oracle Lifecycle Event
1128
+ * @description Market lifecycle events: Initialization, Proposal, Dispute, Settled, Resolution, ConditionResolution, Reset, Flag, Unflag, Pause, Unpause, ManualResolution, NegRiskOutcomeReported.
1129
+ */
1130
+ TradeOracleLifecycleEvent: {
1131
+ /** @enum {string} */
1132
+ trade_type: "Initialization" | "Proposal" | "Dispute" | "Settled" | "Resolution" | "ConditionResolution" | "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause" | "ManualResolution" | "NegRiskOutcomeReported";
1133
+ id: string;
1134
+ hash: string;
1135
+ block?: number;
1136
+ confirmed_at?: number;
1137
+ received_at?: number;
1138
+ log_index?: number;
1139
+ block_index?: number;
1140
+ oracle_contract: string;
1141
+ condition_id: string;
1142
+ question?: string | null;
1143
+ image_url?: string | null;
1144
+ slug?: string | null;
1145
+ event_slug?: string | null;
1146
+ assertion_id?: string | null;
1147
+ proposer?: string | null;
1148
+ disputer?: string | null;
1149
+ proposed_outcome?: string | null;
1150
+ settled_price?: number | null;
1151
+ disputed?: boolean | null;
1152
+ settlement_resolution?: boolean | null;
1153
+ bond?: string | null;
1154
+ expiration_time?: number | null;
1155
+ creator?: string | null;
1156
+ reward_token?: string | null;
1157
+ reward?: string | null;
1158
+ proposal_bond?: string | null;
1159
+ };
1160
+ /**
1161
+ * RegisterToken
1162
+ * @description YES/NO token pair registered for a condition.
1163
+ */
1164
+ TradeRegisterTokenEvent: {
1165
+ /** @enum {string} */
1166
+ trade_type: "RegisterToken";
1167
+ id: string;
1168
+ hash: string;
1169
+ block?: number;
1170
+ confirmed_at?: number;
1171
+ received_at?: number;
1172
+ log_index?: number;
1173
+ block_index?: number;
1174
+ condition_id: string;
1175
+ token0?: string;
1176
+ token1?: string;
1177
+ question?: string | null;
1178
+ image_url?: string | null;
1179
+ slug?: string | null;
1180
+ event_slug?: string | null;
1181
+ exchange: number;
1182
+ };
1183
+ /**
1184
+ * Approval
1185
+ * @description ERC-1155 setApprovalForAll — operator approved/revoked.
1186
+ */
1187
+ TradeApprovalEvent: {
1188
+ /** @enum {string} */
1189
+ trade_type: "Approval";
1190
+ id: string;
1191
+ hash: string;
1192
+ block?: number;
1193
+ confirmed_at?: number;
1194
+ received_at?: number;
1195
+ log_index?: number;
1196
+ block_index?: number;
1197
+ trader: {
1198
+ address?: string;
1199
+ name?: string | null;
1200
+ pseudonym?: string | null;
1201
+ profile_image?: string | null;
1202
+ x_username?: string | null;
1203
+ verified_badge?: boolean;
1204
+ };
1205
+ operator?: string;
1206
+ approved?: boolean;
1207
+ question?: string | null;
1208
+ image_url?: string | null;
1209
+ slug?: string | null;
1210
+ event_slug?: string | null;
1211
+ exchange: number;
1212
+ };
1213
+ };
1214
+ responses: never;
1215
+ parameters: never;
1216
+ requestBodies: never;
1217
+ headers: never;
1218
+ pathItems: never;
1219
+ }
1220
+ export type $defs = Record<string, never>;
1221
+ export type operations = Record<string, never>;