@structbuild/sdk 0.3.1 → 0.3.3

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.
@@ -188,7 +188,7 @@ export interface webhooks {
188
188
  put?: never;
189
189
  /**
190
190
  * New trade callback
191
- * @description Fired on every order-filled trade. Use `wallet_addresses` to watch specific traders, `min_usd_value` to filter by size, and `min_probability`/`max_probability` to restrict to a probability range.
191
+ * @description Fired on fill-style trades only (`OrderFilled`, `OrdersMatched`). Use `wallet_addresses` to watch specific traders, `min_usd_value` to filter by size, and `min_probability`/`max_probability` to restrict to a probability range.
192
192
  */
193
193
  post: operations["trader-new-trade"];
194
194
  delete?: never;
@@ -197,6 +197,26 @@ export interface webhooks {
197
197
  patch?: never;
198
198
  trace?: never;
199
199
  };
200
+ "trade-event": {
201
+ parameters: {
202
+ query?: never;
203
+ header?: never;
204
+ path?: never;
205
+ cookie?: never;
206
+ };
207
+ get?: never;
208
+ put?: never;
209
+ /**
210
+ * Typed trade-event callback
211
+ * @description Fired on every live confirmed prediction-trade event. Payload uses the exact tagged `WebhookTradeEventPayload` union for the trade types currently emitted by the webhook pipeline.
212
+ */
213
+ post: operations["trade-event"];
214
+ delete?: never;
215
+ options?: never;
216
+ head?: never;
217
+ patch?: never;
218
+ trace?: never;
219
+ };
200
220
  "trader-global-pnl": {
201
221
  parameters: {
202
222
  query?: never;
@@ -657,8 +677,11 @@ export interface components {
657
677
  ConditionMetricsPayload: {
658
678
  /** @description Market condition ID */
659
679
  condition_id?: string | null;
660
- /** @description Aggregation window (e.g. "1h", "24h") */
661
- timeframe?: string | null;
680
+ /**
681
+ * @description Aggregation window
682
+ * @enum {string|null}
683
+ */
684
+ timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | null;
662
685
  /** @description Total trading volume in USD for this timeframe */
663
686
  volume_usd?: number | null;
664
687
  /** @description Total fees collected in USD */
@@ -694,8 +717,11 @@ export interface components {
694
717
  EventMetricsPayload: {
695
718
  /** @description Event slug */
696
719
  event_slug?: string | null;
697
- /** @description Aggregation window (e.g. "1h", "24h") */
698
- timeframe?: string | null;
720
+ /**
721
+ * @description Aggregation window
722
+ * @enum {string|null}
723
+ */
724
+ timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | null;
699
725
  /** @description Total aggregated volume across all markets in the event (USD) */
700
726
  volume_usd?: number | null;
701
727
  /** @description Total fees collected in USD */
@@ -765,8 +791,11 @@ export interface components {
765
791
  EventVolumeMilestonePayload: {
766
792
  /** @description Event slug */
767
793
  event_slug: string;
768
- /** @description Aggregation window (e.g. "1h", "24h") */
769
- timeframe: string;
794
+ /**
795
+ * @description Aggregation window
796
+ * @enum {string}
797
+ */
798
+ timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
770
799
  /** @description The USD milestone amount that was crossed */
771
800
  milestone_usd: number;
772
801
  /** @description Current aggregated event volume at time of trigger (USD) */
@@ -783,8 +812,11 @@ export interface components {
783
812
  EventVolumeSpikePayload: {
784
813
  /** @description Event slug */
785
814
  event_slug: string;
786
- /** @description Aggregation window (e.g. "1h", "24h") */
787
- timeframe: string;
815
+ /**
816
+ * @description Aggregation window
817
+ * @enum {string}
818
+ */
819
+ timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "1d" | "24h" | "7d" | "30d";
788
820
  /** @description Current aggregated event volume at time of the spike (USD) */
789
821
  current_volume_usd: number;
790
822
  /** @description Volume at the snapshot baseline (USD) */
@@ -844,10 +876,16 @@ export interface components {
844
876
  side: "Buy" | "Sell";
845
877
  /** @description Outcome token price (0.0–1.0) */
846
878
  price: number;
847
- /** @description Exchange identifier */
848
- exchange: string;
849
- /** @description Trade type identifier */
850
- trade_type: string;
879
+ /**
880
+ * @description Exchange contract that processed the trade
881
+ * @enum {string}
882
+ */
883
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
884
+ /**
885
+ * @description Trade type (webhook events only fire on order fills)
886
+ * @enum {string}
887
+ */
888
+ trade_type: "OrderFilled" | "OrdersMatched";
851
889
  };
852
890
  /** @description Payload delivered when a trader's global PnL (across all markets) crosses a configured threshold */
853
891
  GlobalPnlPayload: {
@@ -1037,8 +1075,11 @@ export interface components {
1037
1075
  MarketVolumeSpikePayload: {
1038
1076
  /** @description Market condition ID */
1039
1077
  condition_id: string;
1040
- /** @description Aggregation window (e.g. "1h", "24h") */
1041
- timeframe: string;
1078
+ /**
1079
+ * @description Aggregation window
1080
+ * @enum {string}
1081
+ */
1082
+ timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "1d" | "24h" | "7d" | "30d";
1042
1083
  /** @description Current volume at the time of the spike (USD) */
1043
1084
  current_volume_usd: number;
1044
1085
  /** @description Volume at the snapshot baseline (USD) */
@@ -1104,10 +1145,16 @@ export interface components {
1104
1145
  price: number;
1105
1146
  /** @description Implied probability (0.0–1.0); null when outcome is unknown */
1106
1147
  probability?: number | null;
1107
- /** @description Exchange identifier */
1108
- exchange: string;
1109
- /** @description Trade type identifier */
1110
- trade_type: string;
1148
+ /**
1149
+ * @description Exchange contract that processed the trade
1150
+ * @enum {string}
1151
+ */
1152
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
1153
+ /**
1154
+ * @description Trade type (webhook events only fire on order fills)
1155
+ * @enum {string}
1156
+ */
1157
+ trade_type: "OrderFilled" | "OrdersMatched";
1111
1158
  };
1112
1159
  /** @description Payload delivered on every order-filled trade */
1113
1160
  NewTradePayload: {
@@ -1158,10 +1205,16 @@ export interface components {
1158
1205
  price: number;
1159
1206
  /** @description Implied probability (0.0–1.0); null when outcome is unknown */
1160
1207
  probability?: number | null;
1161
- /** @description Exchange identifier */
1162
- exchange: string;
1163
- /** @description Trade type identifier */
1164
- trade_type: string;
1208
+ /**
1209
+ * @description Exchange contract that processed the trade
1210
+ * @enum {string}
1211
+ */
1212
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
1213
+ /**
1214
+ * @description Trade type (webhook events only fire on order fills)
1215
+ * @enum {string}
1216
+ */
1217
+ trade_type: "OrderFilled" | "OrdersMatched";
1165
1218
  };
1166
1219
  /**
1167
1220
  * @description PnL timeframe enum for webhook filtering
@@ -1172,7 +1225,7 @@ export interface components {
1172
1225
  * @description Polymarket webhook event types
1173
1226
  * @enum {string}
1174
1227
  */
1175
- PolymarketWebhookEvent: "trader_first_trade" | "trader_new_market" | "trader_whale_trade" | "trader_new_trade" | "trader_global_pnl" | "trader_market_pnl" | "trader_event_pnl" | "condition_metrics" | "event_metrics" | "position_metrics" | "market_volume_milestone" | "event_volume_milestone" | "position_volume_milestone" | "probability_spike" | "market_volume_spike" | "event_volume_spike" | "position_volume_spike" | "close_to_bond" | "market_created" | "asset_price_tick" | "asset_price_window_update" | "price_spike";
1228
+ PolymarketWebhookEvent: "trader_first_trade" | "trader_new_market" | "trader_whale_trade" | "trader_new_trade" | "trade_event" | "trader_global_pnl" | "trader_market_pnl" | "trader_event_pnl" | "condition_metrics" | "event_metrics" | "position_metrics" | "market_volume_milestone" | "event_volume_milestone" | "position_volume_milestone" | "probability_spike" | "market_volume_spike" | "event_volume_spike" | "position_volume_spike" | "close_to_bond" | "market_created" | "asset_price_tick" | "asset_price_window_update" | "price_spike";
1176
1229
  /**
1177
1230
  * @description Polymarket-specific webhook filters
1178
1231
  *
@@ -1191,6 +1244,8 @@ export interface components {
1191
1244
  * - market_created: event_slugs, tags, exclude_shortterm_markets
1192
1245
  * - probability_spike: condition_ids, event_slugs, outcomes, min_probability_change_pct, spike_direction, window_secs, exclude_shortterm_markets
1193
1246
  * - price_spike: condition_ids, event_slugs, outcomes, min_price_change_pct, spike_direction, window_secs, exclude_shortterm_markets
1247
+ * - trader_new_trade: wallet_addresses, min_usd_value, min_probability, max_probability, condition_ids, event_slugs, trade_types, exclude_shortterm_markets
1248
+ * - trade_event: wallet_addresses, min_usd_value, min_probability, max_probability, condition_ids, event_slugs, trade_types, exclude_shortterm_markets
1194
1249
  * - trader_first_trade: wallet_addresses, min_usd_value, min_probability, max_probability, exclude_shortterm_markets
1195
1250
  * - trader_new_market: wallet_addresses, condition_ids, event_slugs, min_usd_value, min_probability, max_probability, exclude_shortterm_markets
1196
1251
  * - trader_whale_trade: min_usd_value (required), min_probability, max_probability, condition_ids, event_slugs, exclude_shortterm_markets
@@ -1279,6 +1334,8 @@ export interface components {
1279
1334
  * When non-empty, only trades whose outcome_index is in this list will match. Max 500 entries.
1280
1335
  */
1281
1336
  position_outcome_indices?: number[];
1337
+ /** @description Filter by trade type (e.g. "OrderFilled", "Redemption", "Merge", "Split"). Empty = default behavior per handler. */
1338
+ trade_types?: string[];
1282
1339
  /**
1283
1340
  * Format: double
1284
1341
  * @description Minimum fees - for metrics webhooks
@@ -1357,8 +1414,11 @@ export interface components {
1357
1414
  * @description Outcome index
1358
1415
  */
1359
1416
  outcome_index?: number | null;
1360
- /** @description Aggregation window (e.g. "1h", "24h") */
1361
- timeframe?: string | null;
1417
+ /**
1418
+ * @description Aggregation window
1419
+ * @enum {string|null}
1420
+ */
1421
+ timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | null;
1362
1422
  /** @description Total trading volume in USD */
1363
1423
  volume_usd?: number | null;
1364
1424
  /** @description Buy volume in USD */
@@ -1397,8 +1457,11 @@ export interface components {
1397
1457
  * @description Outcome index
1398
1458
  */
1399
1459
  outcome_index?: number | null;
1400
- /** @description Aggregation window (e.g. "1h", "24h") */
1401
- timeframe: string;
1460
+ /**
1461
+ * @description Aggregation window
1462
+ * @enum {string}
1463
+ */
1464
+ timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
1402
1465
  /** @description The USD milestone amount that was crossed */
1403
1466
  milestone_usd: number;
1404
1467
  /** @description Current position volume at time of trigger (USD) */
@@ -1426,8 +1489,11 @@ export interface components {
1426
1489
  outcome?: string | null;
1427
1490
  /** Format: int16 */
1428
1491
  outcome_index?: number | null;
1429
- /** @description Aggregation window (e.g. "1h", "24h") */
1430
- timeframe: string;
1492
+ /**
1493
+ * @description Aggregation window
1494
+ * @enum {string}
1495
+ */
1496
+ timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "1d" | "24h" | "7d" | "30d";
1431
1497
  /** @description Current position volume at the time of the spike (USD) */
1432
1498
  current_volume_usd: number;
1433
1499
  /** @description Volume at the snapshot baseline (USD) */
@@ -1523,8 +1589,11 @@ export interface components {
1523
1589
  VolumeMilestonePayload: {
1524
1590
  /** @description Market condition ID */
1525
1591
  condition_id: string;
1526
- /** @description Aggregation window that crossed the milestone (e.g. "1h", "24h") */
1527
- timeframe: string;
1592
+ /**
1593
+ * @description Aggregation window that crossed the milestone
1594
+ * @enum {string}
1595
+ */
1596
+ timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
1528
1597
  /** @description The USD milestone amount that was crossed */
1529
1598
  milestone_usd: number;
1530
1599
  /** @description Current volume at time of trigger (USD) */
@@ -1548,13 +1617,16 @@ export interface components {
1548
1617
  event: string;
1549
1618
  /** @description Human-readable description */
1550
1619
  description: string;
1551
- /** @description Category grouping: "trader", "market", "event", or "position" */
1552
- category: string;
1620
+ /**
1621
+ * @description Category grouping for the event type
1622
+ * @enum {string}
1623
+ */
1624
+ category: "trader" | "trade" | "market" | "event" | "position" | "assets";
1553
1625
  /**
1554
1626
  * Format: int64
1555
- * @description Credits consumed per webhook delivery
1627
+ * @description Millicredits consumed per webhook delivery (1 credit = 1000 mc)
1556
1628
  */
1557
- credits_cost: number;
1629
+ millicredits_cost: number;
1558
1630
  /** @description Filter field names that apply to this event type */
1559
1631
  applicable_filters: string[];
1560
1632
  };
@@ -1570,10 +1642,14 @@ export interface components {
1570
1642
  position_ids?: string[];
1571
1643
  /** @description Filter by event slugs. Max 500 entries. */
1572
1644
  event_slugs?: string[];
1645
+ /** @description Filter by tags or category names (case-insensitive) — for market_created. Max 500 entries. */
1646
+ tags?: string[];
1573
1647
  /** @description Filter by outcomes (e.g. "Yes", "No") — for position metrics / close_to_bond. Max 500 entries. */
1574
1648
  outcomes?: string[];
1575
1649
  /** @description Filter by position outcome index — for close_to_bond. Position 0 = Yes/Up, 1 = No. Max 500 entries. */
1576
1650
  position_outcome_indices?: number[];
1651
+ /** @description Filter by trade type — for `trader_new_trade` and `trade_event`. Max 500 entries. */
1652
+ trade_types?: string[];
1577
1653
  /**
1578
1654
  * Format: double
1579
1655
  * @description Minimum USD trade size (for whale_trade / first_trade)
@@ -1629,6 +1705,16 @@ export interface components {
1629
1705
  * @description Minimum markets traded — for global_pnl / event_pnl
1630
1706
  */
1631
1707
  min_markets_traded?: number | null;
1708
+ /**
1709
+ * Format: double
1710
+ * @description Minimum net shares held — for position-level filters
1711
+ */
1712
+ min_net_shares?: number | null;
1713
+ /**
1714
+ * Format: double
1715
+ * @description Maximum net shares held — for position-level filters
1716
+ */
1717
+ max_net_shares?: number | null;
1632
1718
  /**
1633
1719
  * Format: double
1634
1720
  * @description Minimum fees (USD) — for metrics webhooks
@@ -1667,6 +1753,14 @@ export interface components {
1667
1753
  * @description Spike ratio multiplier (must be > 1.0) — for volume_spike. E.g. 2.0 for 2x baseline
1668
1754
  */
1669
1755
  spike_ratio?: number | null;
1756
+ spike_direction?: null | components["schemas"]["SpikeDirection"];
1757
+ /**
1758
+ * Format: int64
1759
+ * @description Observation window in seconds (max 600) — for probability_spike, price_spike, volume_spike
1760
+ */
1761
+ window_secs?: number | null;
1762
+ /** @description When true, suppress webhooks for short-term "updown" markets */
1763
+ exclude_shortterm_markets?: boolean;
1670
1764
  /**
1671
1765
  * @description Filter by crypto asset symbol — for `asset_price_tick` and `asset_price_window_update`.
1672
1766
  * Valid values: "BTC", "ETH", "SOL", "XRP", "DOGE", "BNB", "HYPE". Empty = all assets (send everything).
@@ -1690,8 +1784,11 @@ export interface components {
1690
1784
  event: components["schemas"]["PolymarketWebhookEvent"];
1691
1785
  /** @description Active filters (omitted when no filters are set) */
1692
1786
  filters?: components["schemas"]["PolymarketWebhookFilter"];
1693
- /** @description Current status: "active", "paused", or "disabled" */
1694
- status: string;
1787
+ /**
1788
+ * @description Current webhook status
1789
+ * @enum {string}
1790
+ */
1791
+ status: "active" | "paused" | "disabled" | "suspended";
1695
1792
  /**
1696
1793
  * Format: int64
1697
1794
  * @description Created timestamp (ms)
@@ -1788,10 +1885,16 @@ export interface components {
1788
1885
  price: number;
1789
1886
  /** @description Implied probability (0.0–1.0); null when outcome is unknown */
1790
1887
  probability?: number | null;
1791
- /** @description Exchange identifier */
1792
- exchange: string;
1793
- /** @description Trade type identifier */
1794
- trade_type: string;
1888
+ /**
1889
+ * @description Exchange contract that processed the trade
1890
+ * @enum {string}
1891
+ */
1892
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
1893
+ /**
1894
+ * @description Trade type (webhook events only fire on order fills)
1895
+ * @enum {string}
1896
+ */
1897
+ trade_type: "OrderFilled" | "OrdersMatched";
1795
1898
  };
1796
1899
  /** @description Outer envelope for every webhook HTTP POST delivery. The `data` field contains the event-specific payload. Delivery headers sent with every POST: `X-Webhook-ID` (subscription UUID), `X-Delivery-ID` (this attempt's UUID), `X-Event-Type` (event name string, e.g. `trader_first_trade`), `X-Attempt` (attempt number, 1-indexed). When the webhook has a secret configured, `X-Webhook-Signature: sha256=<hmac-hex>` is also included — compute HMAC-SHA256 over the raw request body using your secret to verify. */
1797
1900
  WebhookDeliveryEnvelope: {
@@ -1817,6 +1920,482 @@ export interface components {
1817
1920
  /** @description Delivery attempt number. 1 = first attempt; increments on each retry. */
1818
1921
  attempt: number;
1819
1922
  };
1923
+ /** @description Exact payload union for `trade_event` webhook deliveries. These callbacks are emitted from the live confirmed trade pipeline, so pending-only fields such as `received_at` are absent. */
1924
+ WebhookTradeEventPayload: {
1925
+ id: string;
1926
+ hash: string;
1927
+ /** Format: int64 */
1928
+ block: number;
1929
+ /** Format: int64 */
1930
+ confirmed_at: number;
1931
+ /** Format: int64 */
1932
+ log_index: number;
1933
+ /** Format: int64 */
1934
+ block_index: number;
1935
+ order_hash: string;
1936
+ trader: {
1937
+ address: string;
1938
+ name: string | null;
1939
+ pseudonym: string | null;
1940
+ profile_image: string | null;
1941
+ x_username: string | null;
1942
+ verified_badge: boolean;
1943
+ };
1944
+ taker: string;
1945
+ /** @enum {string} */
1946
+ side: "Buy" | "Sell";
1947
+ condition_id: string | null;
1948
+ position_id: string;
1949
+ outcome?: string;
1950
+ outcome_index: number | null;
1951
+ question?: string;
1952
+ image_url?: string;
1953
+ slug?: string;
1954
+ event_slug?: string;
1955
+ usd_amount: number;
1956
+ shares_amount: number;
1957
+ price: number;
1958
+ probability?: number;
1959
+ fee: number;
1960
+ fee_shares: number;
1961
+ fee_pct: number;
1962
+ /**
1963
+ * @description Exchange contract that processed the event
1964
+ * @enum {string}
1965
+ */
1966
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
1967
+ /** @enum {string} */
1968
+ trade_type: "OrderFilled" | "OrdersMatched";
1969
+ } | {
1970
+ id: string;
1971
+ hash: string;
1972
+ /** Format: int64 */
1973
+ block: number;
1974
+ /** Format: int64 */
1975
+ confirmed_at: number;
1976
+ /** Format: int64 */
1977
+ log_index: number;
1978
+ /** Format: int64 */
1979
+ block_index: number;
1980
+ trader: {
1981
+ address: string;
1982
+ name: string | null;
1983
+ pseudonym: string | null;
1984
+ profile_image: string | null;
1985
+ x_username: string | null;
1986
+ verified_badge: boolean;
1987
+ };
1988
+ condition_id: string | null;
1989
+ outcome?: string;
1990
+ outcome_index: number | null;
1991
+ question?: string;
1992
+ image_url?: string;
1993
+ slug?: string;
1994
+ event_slug?: string;
1995
+ usd_amount: number;
1996
+ winning_outcome_index?: number;
1997
+ position_details?: {
1998
+ position_id: string;
1999
+ outcome_index: number;
2000
+ outcome?: string;
2001
+ amount: string;
2002
+ }[];
2003
+ /**
2004
+ * @description Exchange contract that processed the event
2005
+ * @enum {string}
2006
+ */
2007
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
2008
+ /** @enum {string} */
2009
+ trade_type: "Redemption";
2010
+ } | {
2011
+ id: string;
2012
+ hash: string;
2013
+ /** Format: int64 */
2014
+ block: number;
2015
+ /** Format: int64 */
2016
+ confirmed_at: number;
2017
+ /** Format: int64 */
2018
+ log_index: number;
2019
+ /** Format: int64 */
2020
+ block_index: number;
2021
+ trader: {
2022
+ address: string;
2023
+ name: string | null;
2024
+ pseudonym: string | null;
2025
+ profile_image: string | null;
2026
+ x_username: string | null;
2027
+ verified_badge: boolean;
2028
+ };
2029
+ condition_id: string | null;
2030
+ question?: string;
2031
+ image_url?: string;
2032
+ slug?: string;
2033
+ event_slug?: string;
2034
+ usd_amount: number;
2035
+ position_details?: {
2036
+ position_id: string;
2037
+ outcome_index: number;
2038
+ outcome?: string;
2039
+ amount: string;
2040
+ }[];
2041
+ /**
2042
+ * @description Exchange contract that processed the event
2043
+ * @enum {string}
2044
+ */
2045
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
2046
+ /** @enum {string} */
2047
+ trade_type: "Merge";
2048
+ } | {
2049
+ id: string;
2050
+ hash: string;
2051
+ /** Format: int64 */
2052
+ block: number;
2053
+ /** Format: int64 */
2054
+ confirmed_at: number;
2055
+ /** Format: int64 */
2056
+ log_index: number;
2057
+ /** Format: int64 */
2058
+ block_index: number;
2059
+ trader: {
2060
+ address: string;
2061
+ name: string | null;
2062
+ pseudonym: string | null;
2063
+ profile_image: string | null;
2064
+ x_username: string | null;
2065
+ verified_badge: boolean;
2066
+ };
2067
+ condition_id: string | null;
2068
+ question?: string;
2069
+ image_url?: string;
2070
+ slug?: string;
2071
+ event_slug?: string;
2072
+ usd_amount: number;
2073
+ position_details?: {
2074
+ position_id: string;
2075
+ outcome_index: number;
2076
+ outcome?: string;
2077
+ amount: string;
2078
+ }[];
2079
+ /**
2080
+ * @description Exchange contract that processed the event
2081
+ * @enum {string}
2082
+ */
2083
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
2084
+ /** @enum {string} */
2085
+ trade_type: "Split";
2086
+ } | {
2087
+ id: string;
2088
+ hash: string;
2089
+ /** Format: int64 */
2090
+ block: number;
2091
+ /** Format: int64 */
2092
+ confirmed_at: number;
2093
+ /** Format: int64 */
2094
+ log_index: number;
2095
+ /** Format: int64 */
2096
+ block_index: number;
2097
+ trader: {
2098
+ address: string;
2099
+ name: string | null;
2100
+ pseudonym: string | null;
2101
+ profile_image: string | null;
2102
+ x_username: string | null;
2103
+ verified_badge: boolean;
2104
+ };
2105
+ market_id: string;
2106
+ index_set: string;
2107
+ shares_amount: number;
2108
+ /**
2109
+ * @description Exchange contract that processed the event
2110
+ * @enum {string}
2111
+ */
2112
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
2113
+ /** @enum {string} */
2114
+ trade_type: "PositionsConverted";
2115
+ } | {
2116
+ id: string;
2117
+ hash: string;
2118
+ /** Format: int64 */
2119
+ block: number;
2120
+ /** Format: int64 */
2121
+ confirmed_at: number;
2122
+ /** Format: int64 */
2123
+ log_index: number;
2124
+ /** Format: int64 */
2125
+ block_index: number;
2126
+ order_hash: string;
2127
+ question?: string;
2128
+ image_url?: string;
2129
+ slug?: string;
2130
+ event_slug?: string;
2131
+ /**
2132
+ * @description Exchange contract that processed the event
2133
+ * @enum {string}
2134
+ */
2135
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
2136
+ /** @enum {string} */
2137
+ trade_type: "Cancelled";
2138
+ } | {
2139
+ id: string;
2140
+ hash: string;
2141
+ /** Format: int64 */
2142
+ block: number;
2143
+ /** Format: int64 */
2144
+ confirmed_at: number;
2145
+ /** Format: int64 */
2146
+ log_index: number;
2147
+ /** Format: int64 */
2148
+ block_index: number;
2149
+ oracle_contract: string;
2150
+ condition_id: string;
2151
+ creator: string;
2152
+ reward_token: string;
2153
+ reward: string;
2154
+ proposal_bond: string;
2155
+ question?: string;
2156
+ image_url?: string;
2157
+ slug?: string;
2158
+ event_slug?: string;
2159
+ /** @enum {string} */
2160
+ trade_type: "Initialization";
2161
+ } | {
2162
+ id: string;
2163
+ hash: string;
2164
+ /** Format: int64 */
2165
+ block: number;
2166
+ /** Format: int64 */
2167
+ confirmed_at: number;
2168
+ /** Format: int64 */
2169
+ log_index: number;
2170
+ /** Format: int64 */
2171
+ block_index: number;
2172
+ oracle_contract: string;
2173
+ condition_id: string;
2174
+ assertion_id: string;
2175
+ domain_id: string;
2176
+ claim: string;
2177
+ asserter: string;
2178
+ callback_recipient: string;
2179
+ escalation_manager: string;
2180
+ caller: string;
2181
+ /** Format: int64 */
2182
+ expiration_time: number;
2183
+ currency: string;
2184
+ bond: string;
2185
+ identifier: string;
2186
+ proposed_outcome?: string;
2187
+ question?: string;
2188
+ image_url?: string;
2189
+ slug?: string;
2190
+ event_slug?: string;
2191
+ /** @enum {string} */
2192
+ trade_type: "Proposal";
2193
+ } | {
2194
+ id: string;
2195
+ hash: string;
2196
+ /** Format: int64 */
2197
+ block: number;
2198
+ /** Format: int64 */
2199
+ confirmed_at: number;
2200
+ /** Format: int64 */
2201
+ log_index: number;
2202
+ /** Format: int64 */
2203
+ block_index: number;
2204
+ oracle_contract: string;
2205
+ condition_id: string;
2206
+ assertion_id: string;
2207
+ caller: string;
2208
+ disputer: string;
2209
+ question?: string;
2210
+ image_url?: string;
2211
+ slug?: string;
2212
+ event_slug?: string;
2213
+ /** @enum {string} */
2214
+ trade_type: "Dispute";
2215
+ } | {
2216
+ id: string;
2217
+ hash: string;
2218
+ /** Format: int64 */
2219
+ block: number;
2220
+ /** Format: int64 */
2221
+ confirmed_at: number;
2222
+ /** Format: int64 */
2223
+ log_index: number;
2224
+ /** Format: int64 */
2225
+ block_index: number;
2226
+ oracle_contract: string;
2227
+ condition_id: string;
2228
+ assertion_id: string;
2229
+ bond_recipient: string;
2230
+ disputed: boolean;
2231
+ settlement_resolution: boolean;
2232
+ settle_caller: string;
2233
+ question?: string;
2234
+ image_url?: string;
2235
+ slug?: string;
2236
+ event_slug?: string;
2237
+ /** @enum {string} */
2238
+ trade_type: "Settled";
2239
+ } | {
2240
+ id: string;
2241
+ hash: string;
2242
+ /** Format: int64 */
2243
+ block: number;
2244
+ /** Format: int64 */
2245
+ confirmed_at: number;
2246
+ /** Format: int64 */
2247
+ log_index: number;
2248
+ /** Format: int64 */
2249
+ block_index: number;
2250
+ oracle_contract: string;
2251
+ condition_id: string;
2252
+ /** Format: int64 */
2253
+ settled_price: number;
2254
+ proposed_outcome?: string;
2255
+ question?: string;
2256
+ image_url?: string;
2257
+ slug?: string;
2258
+ event_slug?: string;
2259
+ /** @enum {string} */
2260
+ trade_type: "Resolution";
2261
+ } | {
2262
+ id: string;
2263
+ hash: string;
2264
+ /** Format: int64 */
2265
+ block: number;
2266
+ /** Format: int64 */
2267
+ confirmed_at: number;
2268
+ /** Format: int64 */
2269
+ log_index: number;
2270
+ /** Format: int64 */
2271
+ block_index: number;
2272
+ oracle_contract: string;
2273
+ condition_id: string;
2274
+ oracle: string;
2275
+ proposed_outcome?: string;
2276
+ question?: string;
2277
+ image_url?: string;
2278
+ slug?: string;
2279
+ event_slug?: string;
2280
+ /** @enum {string} */
2281
+ trade_type: "ConditionResolution";
2282
+ } | {
2283
+ id: string;
2284
+ hash: string;
2285
+ /** Format: int64 */
2286
+ block: number;
2287
+ /** Format: int64 */
2288
+ confirmed_at: number;
2289
+ /** Format: int64 */
2290
+ log_index: number;
2291
+ /** Format: int64 */
2292
+ block_index: number;
2293
+ oracle_contract: string;
2294
+ condition_id: string;
2295
+ question?: string;
2296
+ image_url?: string;
2297
+ slug?: string;
2298
+ event_slug?: string;
2299
+ /** @enum {string} */
2300
+ trade_type: "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause";
2301
+ } | {
2302
+ id: string;
2303
+ hash: string;
2304
+ /** Format: int64 */
2305
+ block: number;
2306
+ /** Format: int64 */
2307
+ confirmed_at: number;
2308
+ /** Format: int64 */
2309
+ log_index: number;
2310
+ /** Format: int64 */
2311
+ block_index: number;
2312
+ oracle_contract: string;
2313
+ condition_id: string;
2314
+ proposed_outcome?: string;
2315
+ question?: string;
2316
+ image_url?: string;
2317
+ slug?: string;
2318
+ event_slug?: string;
2319
+ /** @enum {string} */
2320
+ trade_type: "ManualResolution";
2321
+ } | {
2322
+ id: string;
2323
+ hash: string;
2324
+ /** Format: int64 */
2325
+ block: number;
2326
+ /** Format: int64 */
2327
+ confirmed_at: number;
2328
+ /** Format: int64 */
2329
+ log_index: number;
2330
+ /** Format: int64 */
2331
+ block_index: number;
2332
+ oracle_contract: string;
2333
+ condition_id: string;
2334
+ proposed_outcome?: string;
2335
+ question?: string;
2336
+ image_url?: string;
2337
+ slug?: string;
2338
+ event_slug?: string;
2339
+ /** @enum {string} */
2340
+ trade_type: "NegRiskOutcomeReported";
2341
+ } | {
2342
+ id: string;
2343
+ hash: string;
2344
+ /** Format: int64 */
2345
+ block: number;
2346
+ /** Format: int64 */
2347
+ confirmed_at: number;
2348
+ /** Format: int64 */
2349
+ log_index: number;
2350
+ /** Format: int64 */
2351
+ block_index: number;
2352
+ condition_id: string;
2353
+ token0: string;
2354
+ token1: string;
2355
+ question?: string;
2356
+ image_url?: string;
2357
+ slug?: string;
2358
+ event_slug?: string;
2359
+ /**
2360
+ * @description Exchange contract that processed the event
2361
+ * @enum {string}
2362
+ */
2363
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
2364
+ /** @enum {string} */
2365
+ trade_type: "RegisterToken";
2366
+ } | {
2367
+ id: string;
2368
+ hash: string;
2369
+ /** Format: int64 */
2370
+ block: number;
2371
+ /** Format: int64 */
2372
+ confirmed_at: number;
2373
+ /** Format: int64 */
2374
+ log_index: number;
2375
+ /** Format: int64 */
2376
+ block_index: number;
2377
+ trader: {
2378
+ address: string;
2379
+ name: string | null;
2380
+ pseudonym: string | null;
2381
+ profile_image: string | null;
2382
+ x_username: string | null;
2383
+ verified_badge: boolean;
2384
+ };
2385
+ operator: string;
2386
+ approved: boolean;
2387
+ question?: string;
2388
+ image_url?: string;
2389
+ slug?: string;
2390
+ event_slug?: string;
2391
+ /**
2392
+ * @description Exchange contract that processed the event
2393
+ * @enum {string}
2394
+ */
2395
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
2396
+ /** @enum {string} */
2397
+ trade_type: "Approval";
2398
+ };
1820
2399
  /** @description Subscription filters for the `trader_first_trade` event. All fields are optional. */
1821
2400
  TraderFirstTradeFilters: {
1822
2401
  /** @description Only fire for trades by these wallet addresses (lowercase). Empty = all traders. */
@@ -1842,6 +2421,12 @@ export interface components {
1842
2421
  condition_ids?: string[];
1843
2422
  /** @description Restrict to markets belonging to these events. */
1844
2423
  event_slugs?: string[];
2424
+ /** @description Minimum trade size in USD. Omit to match all sizes. */
2425
+ min_usd_value?: number;
2426
+ /** @description Only fire when the outcome probability is ≥ this value. */
2427
+ min_probability?: number;
2428
+ /** @description Only fire when the outcome probability is ≤ this value. */
2429
+ max_probability?: number;
1845
2430
  /** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
1846
2431
  exclude_shortterm_markets?: boolean;
1847
2432
  };
@@ -1882,9 +2467,33 @@ export interface components {
1882
2467
  min_probability?: number;
1883
2468
  /** @description Only fire when outcome probability is ≤ this value. */
1884
2469
  max_probability?: number;
2470
+ /** @description Only fire for these fill-style trade types. Empty = OrderFilled and OrdersMatched only (default). */
2471
+ trade_types?: ("OrderFilled" | "OrdersMatched")[];
1885
2472
  /** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
1886
2473
  exclude_shortterm_markets?: boolean;
1887
2474
  };
2475
+ /** @description Subscription filters for the `trade_event` event. All fields are optional. `event_slugs` and `exclude_shortterm_markets` require explicit `trade_types` that exclude `PositionsConverted`, because conversion events do not currently carry `event_slug` in the typed webhook payload. */
2476
+ TradeEventFilters: {
2477
+ /** @description Only fire for events associated with these wallet addresses. Empty = all traders. */
2478
+ wallet_addresses?: string[];
2479
+ /** @description Restrict to these markets. For `PositionsConverted`, this also matches the NegRisk `market_id`. */
2480
+ condition_ids?: string[];
2481
+ /** @description Restrict to markets belonging to these events. Requires explicit `trade_types` that exclude `PositionsConverted`. */
2482
+ event_slugs?: string[];
2483
+ /**
2484
+ * @description Minimum USD amount for the underlying event. Defaults to 0 (matches all events).
2485
+ * @default 0
2486
+ */
2487
+ min_usd_value: number;
2488
+ /** @description Only fire when event probability is ≥ this value. Events without probability data do not match. */
2489
+ min_probability?: number;
2490
+ /** @description Only fire when event probability is ≤ this value. Events without probability data do not match. */
2491
+ max_probability?: number;
2492
+ /** @description Only fire for these trade types currently emitted through the webhook pipeline. Empty = all supported trade-event variants. */
2493
+ trade_types?: ("OrderFilled" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "OrdersMatched" | "Initialization" | "Proposal" | "Dispute" | "Settled" | "Resolution" | "ConditionResolution" | "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause" | "ManualResolution" | "NegRiskOutcomeReported" | "RegisterToken" | "Approval")[];
2494
+ /** @description When `true`, suppress webhooks for short-term "updown" markets. Requires explicit `trade_types` that exclude `PositionsConverted`. Default: `false`. */
2495
+ exclude_shortterm_markets?: boolean;
2496
+ };
1888
2497
  /** @description Subscription filters for the `trader_global_pnl` event. All fields are optional. */
1889
2498
  TraderGlobalPnlFilters: {
1890
2499
  /** @description Track only these trader wallet addresses. Empty = all traders. */
@@ -1968,8 +2577,6 @@ export interface components {
1968
2577
  MarketMetricsFilters: {
1969
2578
  /** @description Restrict to these markets. Empty = all markets. */
1970
2579
  condition_ids?: string[];
1971
- /** @description Restrict to markets in these events. */
1972
- event_slugs?: string[];
1973
2580
  /** @description Restrict to these aggregation windows. Empty = all windows. */
1974
2581
  timeframes?: ("1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d")[];
1975
2582
  /** @description Only fire when volume ≥ this value (USD). */
@@ -2168,8 +2775,6 @@ export interface components {
2168
2775
  MarketCreatedFilters: {
2169
2776
  /** @description Restrict to markets with these tags or category names (case-insensitive match). */
2170
2777
  tags?: string[];
2171
- /** @description Restrict to these specific markets. */
2172
- condition_ids?: string[];
2173
2778
  /** @description Restrict to markets belonging to these events. */
2174
2779
  event_slugs?: string[];
2175
2780
  /** @description When `true`, suppress webhooks for short-term "updown" markets (event slugs containing `updown`). Default: `false`. */
@@ -2679,6 +3284,49 @@ export interface operations {
2679
3284
  };
2680
3285
  };
2681
3286
  };
3287
+ "trade-event": {
3288
+ parameters: {
3289
+ query?: never;
3290
+ header: {
3291
+ /** @description UUID of the webhook subscription that fired */
3292
+ "X-Webhook-ID": string;
3293
+ /** @description UUID of this specific delivery attempt (matches envelope `id` field) */
3294
+ "X-Delivery-ID": string;
3295
+ /** @description Event name string (e.g. `trader_first_trade`) */
3296
+ "X-Event-Type": string;
3297
+ /** @description Delivery attempt number (1 = first attempt) */
3298
+ "X-Attempt": number;
3299
+ /** @description HMAC-SHA256 of the raw request body: `sha256=<hex>`. Present only when the webhook has a secret configured. Verify with: HMAC-SHA256(secret, raw_body_bytes) == hex_part. */
3300
+ "X-Webhook-Signature"?: string;
3301
+ };
3302
+ path?: never;
3303
+ cookie?: never;
3304
+ };
3305
+ /** @description Webhook delivery envelope. The `data` field contains the event-specific payload. */
3306
+ requestBody: {
3307
+ content: {
3308
+ "application/json": components["schemas"]["WebhookDeliveryEnvelope"] & {
3309
+ data?: components["schemas"]["WebhookTradeEventPayload"];
3310
+ };
3311
+ };
3312
+ };
3313
+ responses: {
3314
+ /** @description Webhook delivery acknowledged */
3315
+ 200: {
3316
+ headers: {
3317
+ [name: string]: unknown;
3318
+ };
3319
+ content?: never;
3320
+ };
3321
+ /** @description Server error (will retry) */
3322
+ 500: {
3323
+ headers: {
3324
+ [name: string]: unknown;
3325
+ };
3326
+ content?: never;
3327
+ };
3328
+ };
3329
+ };
2682
3330
  "trader-global-pnl": {
2683
3331
  parameters: {
2684
3332
  query?: never;