@structbuild/sdk 0.3.2 → 0.3.4

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
+ "trader-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 `WebhookTraderTradeEventPayload` union for the trade types currently emitted by the webhook pipeline.
212
+ */
213
+ post: operations["trader-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;
@@ -1205,7 +1225,7 @@ export interface components {
1205
1225
  * @description Polymarket webhook event types
1206
1226
  * @enum {string}
1207
1227
  */
1208
- 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" | "trader_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";
1209
1229
  /**
1210
1230
  * @description Polymarket-specific webhook filters
1211
1231
  *
@@ -1224,6 +1244,8 @@ export interface components {
1224
1244
  * - market_created: event_slugs, tags, exclude_shortterm_markets
1225
1245
  * - probability_spike: condition_ids, event_slugs, outcomes, min_probability_change_pct, spike_direction, window_secs, exclude_shortterm_markets
1226
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
+ * - trader_trade_event: wallet_addresses, min_usd_value, min_probability, max_probability, condition_ids, event_slugs, trade_types, exclude_shortterm_markets
1227
1249
  * - trader_first_trade: wallet_addresses, min_usd_value, min_probability, max_probability, exclude_shortterm_markets
1228
1250
  * - trader_new_market: wallet_addresses, condition_ids, event_slugs, min_usd_value, min_probability, max_probability, exclude_shortterm_markets
1229
1251
  * - trader_whale_trade: min_usd_value (required), min_probability, max_probability, condition_ids, event_slugs, exclude_shortterm_markets
@@ -1312,6 +1334,8 @@ export interface components {
1312
1334
  * When non-empty, only trades whose outcome_index is in this list will match. Max 500 entries.
1313
1335
  */
1314
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[];
1315
1339
  /**
1316
1340
  * Format: double
1317
1341
  * @description Minimum fees - for metrics webhooks
@@ -1597,7 +1621,7 @@ export interface components {
1597
1621
  * @description Category grouping for the event type
1598
1622
  * @enum {string}
1599
1623
  */
1600
- category: "trader" | "market" | "event" | "position" | "assets";
1624
+ category: "trader" | "trade" | "market" | "event" | "position" | "assets";
1601
1625
  /**
1602
1626
  * Format: int64
1603
1627
  * @description Millicredits consumed per webhook delivery (1 credit = 1000 mc)
@@ -1624,6 +1648,8 @@ export interface components {
1624
1648
  outcomes?: string[];
1625
1649
  /** @description Filter by position outcome index — for close_to_bond. Position 0 = Yes/Up, 1 = No. Max 500 entries. */
1626
1650
  position_outcome_indices?: number[];
1651
+ /** @description Filter by trade type — for `trader_new_trade` and `trader_trade_event`. Max 500 entries. */
1652
+ trade_types?: string[];
1627
1653
  /**
1628
1654
  * Format: double
1629
1655
  * @description Minimum USD trade size (for whale_trade / first_trade)
@@ -1894,6 +1920,482 @@ export interface components {
1894
1920
  /** @description Delivery attempt number. 1 = first attempt; increments on each retry. */
1895
1921
  attempt: number;
1896
1922
  };
1923
+ /** @description Exact payload union for `trader_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
+ WebhookTraderTradeEventPayload: {
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
+ };
1897
2399
  /** @description Subscription filters for the `trader_first_trade` event. All fields are optional. */
1898
2400
  TraderFirstTradeFilters: {
1899
2401
  /** @description Only fire for trades by these wallet addresses (lowercase). Empty = all traders. */
@@ -1965,9 +2467,33 @@ export interface components {
1965
2467
  min_probability?: number;
1966
2468
  /** @description Only fire when outcome probability is ≤ this value. */
1967
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")[];
1968
2472
  /** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
1969
2473
  exclude_shortterm_markets?: boolean;
1970
2474
  };
2475
+ /** @description Subscription filters for the `trader_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
+ TraderTradeEventFilters: {
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
+ };
1971
2497
  /** @description Subscription filters for the `trader_global_pnl` event. All fields are optional. */
1972
2498
  TraderGlobalPnlFilters: {
1973
2499
  /** @description Track only these trader wallet addresses. Empty = all traders. */
@@ -2758,6 +3284,49 @@ export interface operations {
2758
3284
  };
2759
3285
  };
2760
3286
  };
3287
+ "trader-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"]["WebhookTraderTradeEventPayload"];
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
+ };
2761
3330
  "trader-global-pnl": {
2762
3331
  parameters: {
2763
3332
  query?: never;
@@ -264,6 +264,482 @@ export interface components {
264
264
  */
265
265
  trade_type: "OrderFilled" | "OrdersMatched";
266
266
  };
267
+ /** @description Exact payload union for `trader_trade_event` webhook deliveries. These callbacks are emitted from the live confirmed trade pipeline, so pending-only fields such as `received_at` are absent. */
268
+ WebhookTraderTradeEventPayload: {
269
+ id: string;
270
+ hash: string;
271
+ /** Format: int64 */
272
+ block: number;
273
+ /** Format: int64 */
274
+ confirmed_at: number;
275
+ /** Format: int64 */
276
+ log_index: number;
277
+ /** Format: int64 */
278
+ block_index: number;
279
+ order_hash: string;
280
+ trader: {
281
+ address: string;
282
+ name: string | null;
283
+ pseudonym: string | null;
284
+ profile_image: string | null;
285
+ x_username: string | null;
286
+ verified_badge: boolean;
287
+ };
288
+ taker: string;
289
+ /** @enum {string} */
290
+ side: "Buy" | "Sell";
291
+ condition_id: string | null;
292
+ position_id: string;
293
+ outcome?: string;
294
+ outcome_index: number | null;
295
+ question?: string;
296
+ image_url?: string;
297
+ slug?: string;
298
+ event_slug?: string;
299
+ usd_amount: number;
300
+ shares_amount: number;
301
+ price: number;
302
+ probability?: number;
303
+ fee: number;
304
+ fee_shares: number;
305
+ fee_pct: number;
306
+ /**
307
+ * @description Exchange contract that processed the event
308
+ * @enum {string}
309
+ */
310
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
311
+ /** @enum {string} */
312
+ trade_type: "OrderFilled" | "OrdersMatched";
313
+ } | {
314
+ id: string;
315
+ hash: string;
316
+ /** Format: int64 */
317
+ block: number;
318
+ /** Format: int64 */
319
+ confirmed_at: number;
320
+ /** Format: int64 */
321
+ log_index: number;
322
+ /** Format: int64 */
323
+ block_index: number;
324
+ trader: {
325
+ address: string;
326
+ name: string | null;
327
+ pseudonym: string | null;
328
+ profile_image: string | null;
329
+ x_username: string | null;
330
+ verified_badge: boolean;
331
+ };
332
+ condition_id: string | null;
333
+ outcome?: string;
334
+ outcome_index: number | null;
335
+ question?: string;
336
+ image_url?: string;
337
+ slug?: string;
338
+ event_slug?: string;
339
+ usd_amount: number;
340
+ winning_outcome_index?: number;
341
+ position_details?: {
342
+ position_id: string;
343
+ outcome_index: number;
344
+ outcome?: string;
345
+ amount: string;
346
+ }[];
347
+ /**
348
+ * @description Exchange contract that processed the event
349
+ * @enum {string}
350
+ */
351
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
352
+ /** @enum {string} */
353
+ trade_type: "Redemption";
354
+ } | {
355
+ id: string;
356
+ hash: string;
357
+ /** Format: int64 */
358
+ block: number;
359
+ /** Format: int64 */
360
+ confirmed_at: number;
361
+ /** Format: int64 */
362
+ log_index: number;
363
+ /** Format: int64 */
364
+ block_index: number;
365
+ trader: {
366
+ address: string;
367
+ name: string | null;
368
+ pseudonym: string | null;
369
+ profile_image: string | null;
370
+ x_username: string | null;
371
+ verified_badge: boolean;
372
+ };
373
+ condition_id: string | null;
374
+ question?: string;
375
+ image_url?: string;
376
+ slug?: string;
377
+ event_slug?: string;
378
+ usd_amount: number;
379
+ position_details?: {
380
+ position_id: string;
381
+ outcome_index: number;
382
+ outcome?: string;
383
+ amount: string;
384
+ }[];
385
+ /**
386
+ * @description Exchange contract that processed the event
387
+ * @enum {string}
388
+ */
389
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
390
+ /** @enum {string} */
391
+ trade_type: "Merge";
392
+ } | {
393
+ id: string;
394
+ hash: string;
395
+ /** Format: int64 */
396
+ block: number;
397
+ /** Format: int64 */
398
+ confirmed_at: number;
399
+ /** Format: int64 */
400
+ log_index: number;
401
+ /** Format: int64 */
402
+ block_index: number;
403
+ trader: {
404
+ address: string;
405
+ name: string | null;
406
+ pseudonym: string | null;
407
+ profile_image: string | null;
408
+ x_username: string | null;
409
+ verified_badge: boolean;
410
+ };
411
+ condition_id: string | null;
412
+ question?: string;
413
+ image_url?: string;
414
+ slug?: string;
415
+ event_slug?: string;
416
+ usd_amount: number;
417
+ position_details?: {
418
+ position_id: string;
419
+ outcome_index: number;
420
+ outcome?: string;
421
+ amount: string;
422
+ }[];
423
+ /**
424
+ * @description Exchange contract that processed the event
425
+ * @enum {string}
426
+ */
427
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
428
+ /** @enum {string} */
429
+ trade_type: "Split";
430
+ } | {
431
+ id: string;
432
+ hash: string;
433
+ /** Format: int64 */
434
+ block: number;
435
+ /** Format: int64 */
436
+ confirmed_at: number;
437
+ /** Format: int64 */
438
+ log_index: number;
439
+ /** Format: int64 */
440
+ block_index: number;
441
+ trader: {
442
+ address: string;
443
+ name: string | null;
444
+ pseudonym: string | null;
445
+ profile_image: string | null;
446
+ x_username: string | null;
447
+ verified_badge: boolean;
448
+ };
449
+ market_id: string;
450
+ index_set: string;
451
+ shares_amount: number;
452
+ /**
453
+ * @description Exchange contract that processed the event
454
+ * @enum {string}
455
+ */
456
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
457
+ /** @enum {string} */
458
+ trade_type: "PositionsConverted";
459
+ } | {
460
+ id: string;
461
+ hash: string;
462
+ /** Format: int64 */
463
+ block: number;
464
+ /** Format: int64 */
465
+ confirmed_at: number;
466
+ /** Format: int64 */
467
+ log_index: number;
468
+ /** Format: int64 */
469
+ block_index: number;
470
+ order_hash: string;
471
+ question?: string;
472
+ image_url?: string;
473
+ slug?: string;
474
+ event_slug?: string;
475
+ /**
476
+ * @description Exchange contract that processed the event
477
+ * @enum {string}
478
+ */
479
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
480
+ /** @enum {string} */
481
+ trade_type: "Cancelled";
482
+ } | {
483
+ id: string;
484
+ hash: string;
485
+ /** Format: int64 */
486
+ block: number;
487
+ /** Format: int64 */
488
+ confirmed_at: number;
489
+ /** Format: int64 */
490
+ log_index: number;
491
+ /** Format: int64 */
492
+ block_index: number;
493
+ oracle_contract: string;
494
+ condition_id: string;
495
+ creator: string;
496
+ reward_token: string;
497
+ reward: string;
498
+ proposal_bond: string;
499
+ question?: string;
500
+ image_url?: string;
501
+ slug?: string;
502
+ event_slug?: string;
503
+ /** @enum {string} */
504
+ trade_type: "Initialization";
505
+ } | {
506
+ id: string;
507
+ hash: string;
508
+ /** Format: int64 */
509
+ block: number;
510
+ /** Format: int64 */
511
+ confirmed_at: number;
512
+ /** Format: int64 */
513
+ log_index: number;
514
+ /** Format: int64 */
515
+ block_index: number;
516
+ oracle_contract: string;
517
+ condition_id: string;
518
+ assertion_id: string;
519
+ domain_id: string;
520
+ claim: string;
521
+ asserter: string;
522
+ callback_recipient: string;
523
+ escalation_manager: string;
524
+ caller: string;
525
+ /** Format: int64 */
526
+ expiration_time: number;
527
+ currency: string;
528
+ bond: string;
529
+ identifier: string;
530
+ proposed_outcome?: string;
531
+ question?: string;
532
+ image_url?: string;
533
+ slug?: string;
534
+ event_slug?: string;
535
+ /** @enum {string} */
536
+ trade_type: "Proposal";
537
+ } | {
538
+ id: string;
539
+ hash: string;
540
+ /** Format: int64 */
541
+ block: number;
542
+ /** Format: int64 */
543
+ confirmed_at: number;
544
+ /** Format: int64 */
545
+ log_index: number;
546
+ /** Format: int64 */
547
+ block_index: number;
548
+ oracle_contract: string;
549
+ condition_id: string;
550
+ assertion_id: string;
551
+ caller: string;
552
+ disputer: string;
553
+ question?: string;
554
+ image_url?: string;
555
+ slug?: string;
556
+ event_slug?: string;
557
+ /** @enum {string} */
558
+ trade_type: "Dispute";
559
+ } | {
560
+ id: string;
561
+ hash: string;
562
+ /** Format: int64 */
563
+ block: number;
564
+ /** Format: int64 */
565
+ confirmed_at: number;
566
+ /** Format: int64 */
567
+ log_index: number;
568
+ /** Format: int64 */
569
+ block_index: number;
570
+ oracle_contract: string;
571
+ condition_id: string;
572
+ assertion_id: string;
573
+ bond_recipient: string;
574
+ disputed: boolean;
575
+ settlement_resolution: boolean;
576
+ settle_caller: string;
577
+ question?: string;
578
+ image_url?: string;
579
+ slug?: string;
580
+ event_slug?: string;
581
+ /** @enum {string} */
582
+ trade_type: "Settled";
583
+ } | {
584
+ id: string;
585
+ hash: string;
586
+ /** Format: int64 */
587
+ block: number;
588
+ /** Format: int64 */
589
+ confirmed_at: number;
590
+ /** Format: int64 */
591
+ log_index: number;
592
+ /** Format: int64 */
593
+ block_index: number;
594
+ oracle_contract: string;
595
+ condition_id: string;
596
+ /** Format: int64 */
597
+ settled_price: number;
598
+ proposed_outcome?: string;
599
+ question?: string;
600
+ image_url?: string;
601
+ slug?: string;
602
+ event_slug?: string;
603
+ /** @enum {string} */
604
+ trade_type: "Resolution";
605
+ } | {
606
+ id: string;
607
+ hash: string;
608
+ /** Format: int64 */
609
+ block: number;
610
+ /** Format: int64 */
611
+ confirmed_at: number;
612
+ /** Format: int64 */
613
+ log_index: number;
614
+ /** Format: int64 */
615
+ block_index: number;
616
+ oracle_contract: string;
617
+ condition_id: string;
618
+ oracle: string;
619
+ proposed_outcome?: string;
620
+ question?: string;
621
+ image_url?: string;
622
+ slug?: string;
623
+ event_slug?: string;
624
+ /** @enum {string} */
625
+ trade_type: "ConditionResolution";
626
+ } | {
627
+ id: string;
628
+ hash: string;
629
+ /** Format: int64 */
630
+ block: number;
631
+ /** Format: int64 */
632
+ confirmed_at: number;
633
+ /** Format: int64 */
634
+ log_index: number;
635
+ /** Format: int64 */
636
+ block_index: number;
637
+ oracle_contract: string;
638
+ condition_id: string;
639
+ question?: string;
640
+ image_url?: string;
641
+ slug?: string;
642
+ event_slug?: string;
643
+ /** @enum {string} */
644
+ trade_type: "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause";
645
+ } | {
646
+ id: string;
647
+ hash: string;
648
+ /** Format: int64 */
649
+ block: number;
650
+ /** Format: int64 */
651
+ confirmed_at: number;
652
+ /** Format: int64 */
653
+ log_index: number;
654
+ /** Format: int64 */
655
+ block_index: number;
656
+ oracle_contract: string;
657
+ condition_id: string;
658
+ proposed_outcome?: string;
659
+ question?: string;
660
+ image_url?: string;
661
+ slug?: string;
662
+ event_slug?: string;
663
+ /** @enum {string} */
664
+ trade_type: "ManualResolution";
665
+ } | {
666
+ id: string;
667
+ hash: string;
668
+ /** Format: int64 */
669
+ block: number;
670
+ /** Format: int64 */
671
+ confirmed_at: number;
672
+ /** Format: int64 */
673
+ log_index: number;
674
+ /** Format: int64 */
675
+ block_index: number;
676
+ oracle_contract: string;
677
+ condition_id: string;
678
+ proposed_outcome?: string;
679
+ question?: string;
680
+ image_url?: string;
681
+ slug?: string;
682
+ event_slug?: string;
683
+ /** @enum {string} */
684
+ trade_type: "NegRiskOutcomeReported";
685
+ } | {
686
+ id: string;
687
+ hash: string;
688
+ /** Format: int64 */
689
+ block: number;
690
+ /** Format: int64 */
691
+ confirmed_at: number;
692
+ /** Format: int64 */
693
+ log_index: number;
694
+ /** Format: int64 */
695
+ block_index: number;
696
+ condition_id: string;
697
+ token0: string;
698
+ token1: string;
699
+ question?: string;
700
+ image_url?: string;
701
+ slug?: string;
702
+ event_slug?: string;
703
+ /**
704
+ * @description Exchange contract that processed the event
705
+ * @enum {string}
706
+ */
707
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
708
+ /** @enum {string} */
709
+ trade_type: "RegisterToken";
710
+ } | {
711
+ id: string;
712
+ hash: string;
713
+ /** Format: int64 */
714
+ block: number;
715
+ /** Format: int64 */
716
+ confirmed_at: number;
717
+ /** Format: int64 */
718
+ log_index: number;
719
+ /** Format: int64 */
720
+ block_index: number;
721
+ trader: {
722
+ address: string;
723
+ name: string | null;
724
+ pseudonym: string | null;
725
+ profile_image: string | null;
726
+ x_username: string | null;
727
+ verified_badge: boolean;
728
+ };
729
+ operator: string;
730
+ approved: boolean;
731
+ question?: string;
732
+ image_url?: string;
733
+ slug?: string;
734
+ event_slug?: string;
735
+ /**
736
+ * @description Exchange contract that processed the event
737
+ * @enum {string}
738
+ */
739
+ exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
740
+ /** @enum {string} */
741
+ trade_type: "Approval";
742
+ };
267
743
  /** @description Payload delivered when a trader's global PnL (across all markets) crosses a configured threshold */
268
744
  GlobalPnlPayload: {
269
745
  /** @description Trader wallet address (lowercase) */
@@ -943,9 +1419,30 @@ export interface components {
943
1419
  min_probability?: number;
944
1420
  /** @description Only fire when outcome probability is ≤ this value. */
945
1421
  max_probability?: number;
1422
+ /** @description Only fire for these fill-style trade types. Empty = OrderFilled and OrdersMatched only (default). */
1423
+ trade_types?: ("OrderFilled" | "OrdersMatched")[];
946
1424
  /** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
947
1425
  exclude_shortterm_markets?: boolean;
948
1426
  };
1427
+ /** @description Subscription filters for the `trader_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. */
1428
+ TraderTradeEventFilters: {
1429
+ /** @description Only fire for events associated with these wallet addresses. Empty = all traders. */
1430
+ wallet_addresses?: string[];
1431
+ /** @description Restrict to these markets. For `PositionsConverted`, this also matches the NegRisk `market_id`. */
1432
+ condition_ids?: string[];
1433
+ /** @description Restrict to markets belonging to these events. Requires explicit `trade_types` that exclude `PositionsConverted`. */
1434
+ event_slugs?: string[];
1435
+ /** @description Minimum USD amount for the underlying event. Defaults to 0 (matches all events). */
1436
+ min_usd_value?: number;
1437
+ /** @description Only fire when event probability is ≥ this value. Events without probability data do not match. */
1438
+ min_probability?: number;
1439
+ /** @description Only fire when event probability is ≤ this value. Events without probability data do not match. */
1440
+ max_probability?: number;
1441
+ /** @description Only fire for these trade types currently emitted through the webhook pipeline. Empty = all supported trade-event variants. */
1442
+ trade_types?: ("OrderFilled" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "OrdersMatched" | "Initialization" | "Proposal" | "Dispute" | "Settled" | "Resolution" | "ConditionResolution" | "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause" | "ManualResolution" | "NegRiskOutcomeReported" | "RegisterToken" | "Approval")[];
1443
+ /** @description When `true`, suppress webhooks for short-term "updown" markets. Requires explicit `trade_types` that exclude `PositionsConverted`. Default: `false`. */
1444
+ exclude_shortterm_markets?: boolean;
1445
+ };
949
1446
  /** @description Subscription filters for the `trader_global_pnl` event. All fields are optional. */
950
1447
  TraderGlobalPnlFilters: {
951
1448
  /** @description Track only these trader wallet addresses. Empty = all traders. */
@@ -1248,7 +1745,7 @@ export interface components {
1248
1745
  * @description All alert event types supported by both HTTP webhooks and the alerts WebSocket.
1249
1746
  * @enum {string}
1250
1747
  */
1251
- WsAlertEventType: "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" | "price_spike" | "market_volume_spike" | "event_volume_spike" | "position_volume_spike" | "close_to_bond" | "market_created" | "asset_price_tick" | "asset_price_window_update";
1748
+ WsAlertEventType: "trader_first_trade" | "trader_new_market" | "trader_whale_trade" | "trader_new_trade" | "trader_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" | "price_spike" | "market_volume_spike" | "event_volume_spike" | "position_volume_spike" | "close_to_bond" | "market_created" | "asset_price_tick" | "asset_price_window_update";
1252
1749
  /** @description Server acknowledgement for a successful alert subscription. */
1253
1750
  WsAlertSubscribedResponse: {
1254
1751
  /** @enum {string} */
@@ -1534,6 +2031,80 @@ export interface components {
1534
2031
  timestamp: number;
1535
2032
  data: components["schemas"]["NewTradePayload"];
1536
2033
  };
2034
+ WsAlertTraderTradeEventSubscribeMessage: {
2035
+ /** @enum {string} */
2036
+ op: "subscribe";
2037
+ /** @enum {string} */
2038
+ event: "trader_trade_event";
2039
+ } & components["schemas"]["TraderTradeEventFilters"] & {
2040
+ /**
2041
+ * @description discriminator enum property added by openapi-typescript
2042
+ * @enum {string}
2043
+ */
2044
+ event: "trader_trade_event";
2045
+ };
2046
+ WsAlertTraderTradeEventUnsubscribeMessage: {
2047
+ /** @enum {string} */
2048
+ op: "unsubscribe";
2049
+ /** @enum {string} */
2050
+ event: "trader_trade_event";
2051
+ } & components["schemas"]["TraderTradeEventFilters"] & {
2052
+ /**
2053
+ * @description discriminator enum property added by openapi-typescript
2054
+ * @enum {string}
2055
+ */
2056
+ event: "trader_trade_event";
2057
+ };
2058
+ /**
2059
+ * @description Pushed `trader_trade_event` alert. The `data` payload matches the corresponding HTTP webhook payload schema.
2060
+ * @example {
2061
+ * "event": "trader_trade_event",
2062
+ * "timestamp": 1743500000000,
2063
+ * "data": {
2064
+ * "trade_type": "OrderFilled",
2065
+ * "id": "00000000-0000-0000-0000-000000000000",
2066
+ * "hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
2067
+ * "block": 65000000,
2068
+ * "confirmed_at": 1700000000,
2069
+ * "log_index": 0,
2070
+ * "block_index": 0,
2071
+ * "order_hash": "0x1111111111111111111111111111111111111111111111111111111111111111",
2072
+ * "trader": {
2073
+ * "address": "0x0000000000000000000000000000000000000000"
2074
+ * },
2075
+ * "taker": "0x0000000000000000000000000000000000000000",
2076
+ * "side": "Buy",
2077
+ * "condition_id": "0x0000000000000000000000000000000000000000000000000000000000000000",
2078
+ * "position_id": "452312848583266388373324160190187140051835877600158453279131187530910662656",
2079
+ * "outcome": "Yes",
2080
+ * "outcome_index": 0,
2081
+ * "question": "Will this typed trade-event webhook fire correctly?",
2082
+ * "slug": "test-market-0000000000",
2083
+ * "event_slug": "test-event-0000000000",
2084
+ * "usd_amount": 25,
2085
+ * "shares_amount": 50,
2086
+ * "price": 0.5,
2087
+ * "probability": 0.5,
2088
+ * "fee": 0.025,
2089
+ * "fee_shares": 0,
2090
+ * "fee_pct": 0.1,
2091
+ * "exchange": "CTFExchange"
2092
+ * }
2093
+ * }
2094
+ */
2095
+ WsAlertTraderTradeEventEvent: {
2096
+ /**
2097
+ * @description discriminator enum property added by openapi-typescript
2098
+ * @enum {string}
2099
+ */
2100
+ event: "trader_trade_event";
2101
+ /**
2102
+ * Format: int64
2103
+ * @description Unix timestamp in milliseconds
2104
+ */
2105
+ timestamp: number;
2106
+ data: components["schemas"]["WebhookTraderTradeEventPayload"];
2107
+ };
1537
2108
  WsAlertTraderGlobalPnlSubscribeMessage: {
1538
2109
  /** @enum {string} */
1539
2110
  op: "subscribe";
@@ -2587,11 +3158,11 @@ export interface components {
2587
3158
  data: components["schemas"]["AssetPriceWindowUpdatePayload"];
2588
3159
  };
2589
3160
  /** @description Typed subscribe request for the alerts WebSocket. The request shape depends on `event` and reuses the matching webhook filter schema. */
2590
- WsAlertSubscribeMessage: components["schemas"]["WsAlertTraderFirstTradeSubscribeMessage"] | components["schemas"]["WsAlertTraderNewMarketSubscribeMessage"] | components["schemas"]["WsAlertTraderWhaleTradeSubscribeMessage"] | components["schemas"]["WsAlertTraderNewTradeSubscribeMessage"] | components["schemas"]["WsAlertTraderGlobalPnlSubscribeMessage"] | components["schemas"]["WsAlertTraderMarketPnlSubscribeMessage"] | components["schemas"]["WsAlertTraderEventPnlSubscribeMessage"] | components["schemas"]["WsAlertConditionMetricsSubscribeMessage"] | components["schemas"]["WsAlertEventMetricsSubscribeMessage"] | components["schemas"]["WsAlertPositionMetricsSubscribeMessage"] | components["schemas"]["WsAlertMarketVolumeMilestoneSubscribeMessage"] | components["schemas"]["WsAlertEventVolumeMilestoneSubscribeMessage"] | components["schemas"]["WsAlertPositionVolumeMilestoneSubscribeMessage"] | components["schemas"]["WsAlertProbabilitySpikeSubscribeMessage"] | components["schemas"]["WsAlertPriceSpikeSubscribeMessage"] | components["schemas"]["WsAlertMarketVolumeSpikeSubscribeMessage"] | components["schemas"]["WsAlertEventVolumeSpikeSubscribeMessage"] | components["schemas"]["WsAlertPositionVolumeSpikeSubscribeMessage"] | components["schemas"]["WsAlertCloseToBondSubscribeMessage"] | components["schemas"]["WsAlertMarketCreatedSubscribeMessage"] | components["schemas"]["WsAlertAssetPriceTickSubscribeMessage"] | components["schemas"]["WsAlertAssetPriceWindowUpdateSubscribeMessage"];
3161
+ WsAlertSubscribeMessage: components["schemas"]["WsAlertTraderFirstTradeSubscribeMessage"] | components["schemas"]["WsAlertTraderNewMarketSubscribeMessage"] | components["schemas"]["WsAlertTraderWhaleTradeSubscribeMessage"] | components["schemas"]["WsAlertTraderNewTradeSubscribeMessage"] | components["schemas"]["WsAlertTraderTradeEventSubscribeMessage"] | components["schemas"]["WsAlertTraderGlobalPnlSubscribeMessage"] | components["schemas"]["WsAlertTraderMarketPnlSubscribeMessage"] | components["schemas"]["WsAlertTraderEventPnlSubscribeMessage"] | components["schemas"]["WsAlertConditionMetricsSubscribeMessage"] | components["schemas"]["WsAlertEventMetricsSubscribeMessage"] | components["schemas"]["WsAlertPositionMetricsSubscribeMessage"] | components["schemas"]["WsAlertMarketVolumeMilestoneSubscribeMessage"] | components["schemas"]["WsAlertEventVolumeMilestoneSubscribeMessage"] | components["schemas"]["WsAlertPositionVolumeMilestoneSubscribeMessage"] | components["schemas"]["WsAlertProbabilitySpikeSubscribeMessage"] | components["schemas"]["WsAlertPriceSpikeSubscribeMessage"] | components["schemas"]["WsAlertMarketVolumeSpikeSubscribeMessage"] | components["schemas"]["WsAlertEventVolumeSpikeSubscribeMessage"] | components["schemas"]["WsAlertPositionVolumeSpikeSubscribeMessage"] | components["schemas"]["WsAlertCloseToBondSubscribeMessage"] | components["schemas"]["WsAlertMarketCreatedSubscribeMessage"] | components["schemas"]["WsAlertAssetPriceTickSubscribeMessage"] | components["schemas"]["WsAlertAssetPriceWindowUpdateSubscribeMessage"];
2591
3162
  /** @description Typed unsubscribe request for the alerts WebSocket. The request shape depends on `event` and must match the original subscription filters. */
2592
- WsAlertUnsubscribeMessage: components["schemas"]["WsAlertTraderFirstTradeUnsubscribeMessage"] | components["schemas"]["WsAlertTraderNewMarketUnsubscribeMessage"] | components["schemas"]["WsAlertTraderWhaleTradeUnsubscribeMessage"] | components["schemas"]["WsAlertTraderNewTradeUnsubscribeMessage"] | components["schemas"]["WsAlertTraderGlobalPnlUnsubscribeMessage"] | components["schemas"]["WsAlertTraderMarketPnlUnsubscribeMessage"] | components["schemas"]["WsAlertTraderEventPnlUnsubscribeMessage"] | components["schemas"]["WsAlertConditionMetricsUnsubscribeMessage"] | components["schemas"]["WsAlertEventMetricsUnsubscribeMessage"] | components["schemas"]["WsAlertPositionMetricsUnsubscribeMessage"] | components["schemas"]["WsAlertMarketVolumeMilestoneUnsubscribeMessage"] | components["schemas"]["WsAlertEventVolumeMilestoneUnsubscribeMessage"] | components["schemas"]["WsAlertPositionVolumeMilestoneUnsubscribeMessage"] | components["schemas"]["WsAlertProbabilitySpikeUnsubscribeMessage"] | components["schemas"]["WsAlertPriceSpikeUnsubscribeMessage"] | components["schemas"]["WsAlertMarketVolumeSpikeUnsubscribeMessage"] | components["schemas"]["WsAlertEventVolumeSpikeUnsubscribeMessage"] | components["schemas"]["WsAlertPositionVolumeSpikeUnsubscribeMessage"] | components["schemas"]["WsAlertCloseToBondUnsubscribeMessage"] | components["schemas"]["WsAlertMarketCreatedUnsubscribeMessage"] | components["schemas"]["WsAlertAssetPriceTickUnsubscribeMessage"] | components["schemas"]["WsAlertAssetPriceWindowUpdateUnsubscribeMessage"];
3163
+ WsAlertUnsubscribeMessage: components["schemas"]["WsAlertTraderFirstTradeUnsubscribeMessage"] | components["schemas"]["WsAlertTraderNewMarketUnsubscribeMessage"] | components["schemas"]["WsAlertTraderWhaleTradeUnsubscribeMessage"] | components["schemas"]["WsAlertTraderNewTradeUnsubscribeMessage"] | components["schemas"]["WsAlertTraderTradeEventUnsubscribeMessage"] | components["schemas"]["WsAlertTraderGlobalPnlUnsubscribeMessage"] | components["schemas"]["WsAlertTraderMarketPnlUnsubscribeMessage"] | components["schemas"]["WsAlertTraderEventPnlUnsubscribeMessage"] | components["schemas"]["WsAlertConditionMetricsUnsubscribeMessage"] | components["schemas"]["WsAlertEventMetricsUnsubscribeMessage"] | components["schemas"]["WsAlertPositionMetricsUnsubscribeMessage"] | components["schemas"]["WsAlertMarketVolumeMilestoneUnsubscribeMessage"] | components["schemas"]["WsAlertEventVolumeMilestoneUnsubscribeMessage"] | components["schemas"]["WsAlertPositionVolumeMilestoneUnsubscribeMessage"] | components["schemas"]["WsAlertProbabilitySpikeUnsubscribeMessage"] | components["schemas"]["WsAlertPriceSpikeUnsubscribeMessage"] | components["schemas"]["WsAlertMarketVolumeSpikeUnsubscribeMessage"] | components["schemas"]["WsAlertEventVolumeSpikeUnsubscribeMessage"] | components["schemas"]["WsAlertPositionVolumeSpikeUnsubscribeMessage"] | components["schemas"]["WsAlertCloseToBondUnsubscribeMessage"] | components["schemas"]["WsAlertMarketCreatedUnsubscribeMessage"] | components["schemas"]["WsAlertAssetPriceTickUnsubscribeMessage"] | components["schemas"]["WsAlertAssetPriceWindowUpdateUnsubscribeMessage"];
2593
3164
  /** @description Typed pushed-event envelope for the alerts WebSocket. The `data` payload depends on `event` and matches the corresponding HTTP webhook payload schema. */
2594
- WsAlertEventPayload: components["schemas"]["WsAlertTraderFirstTradeEvent"] | components["schemas"]["WsAlertTraderNewMarketEvent"] | components["schemas"]["WsAlertTraderWhaleTradeEvent"] | components["schemas"]["WsAlertTraderNewTradeEvent"] | components["schemas"]["WsAlertTraderGlobalPnlEvent"] | components["schemas"]["WsAlertTraderMarketPnlEvent"] | components["schemas"]["WsAlertTraderEventPnlEvent"] | components["schemas"]["WsAlertConditionMetricsEvent"] | components["schemas"]["WsAlertEventMetricsEvent"] | components["schemas"]["WsAlertPositionMetricsEvent"] | components["schemas"]["WsAlertMarketVolumeMilestoneEvent"] | components["schemas"]["WsAlertEventVolumeMilestoneEvent"] | components["schemas"]["WsAlertPositionVolumeMilestoneEvent"] | components["schemas"]["WsAlertProbabilitySpikeEvent"] | components["schemas"]["WsAlertPriceSpikeEvent"] | components["schemas"]["WsAlertMarketVolumeSpikeEvent"] | components["schemas"]["WsAlertEventVolumeSpikeEvent"] | components["schemas"]["WsAlertPositionVolumeSpikeEvent"] | components["schemas"]["WsAlertCloseToBondEvent"] | components["schemas"]["WsAlertMarketCreatedEvent"] | components["schemas"]["WsAlertAssetPriceTickEvent"] | components["schemas"]["WsAlertAssetPriceWindowUpdateEvent"];
3165
+ WsAlertEventPayload: components["schemas"]["WsAlertTraderFirstTradeEvent"] | components["schemas"]["WsAlertTraderNewMarketEvent"] | components["schemas"]["WsAlertTraderWhaleTradeEvent"] | components["schemas"]["WsAlertTraderNewTradeEvent"] | components["schemas"]["WsAlertTraderTradeEventEvent"] | components["schemas"]["WsAlertTraderGlobalPnlEvent"] | components["schemas"]["WsAlertTraderMarketPnlEvent"] | components["schemas"]["WsAlertTraderEventPnlEvent"] | components["schemas"]["WsAlertConditionMetricsEvent"] | components["schemas"]["WsAlertEventMetricsEvent"] | components["schemas"]["WsAlertPositionMetricsEvent"] | components["schemas"]["WsAlertMarketVolumeMilestoneEvent"] | components["schemas"]["WsAlertEventVolumeMilestoneEvent"] | components["schemas"]["WsAlertPositionVolumeMilestoneEvent"] | components["schemas"]["WsAlertProbabilitySpikeEvent"] | components["schemas"]["WsAlertPriceSpikeEvent"] | components["schemas"]["WsAlertMarketVolumeSpikeEvent"] | components["schemas"]["WsAlertEventVolumeSpikeEvent"] | components["schemas"]["WsAlertPositionVolumeSpikeEvent"] | components["schemas"]["WsAlertCloseToBondEvent"] | components["schemas"]["WsAlertMarketCreatedEvent"] | components["schemas"]["WsAlertAssetPriceTickEvent"] | components["schemas"]["WsAlertAssetPriceWindowUpdateEvent"];
2595
3166
  };
2596
3167
  responses: never;
2597
3168
  parameters: never;
@@ -2606,6 +3177,7 @@ export interface WsAlertSubscribeMap {
2606
3177
  trader_new_market: components["schemas"]["WsAlertTraderNewMarketSubscribeMessage"];
2607
3178
  trader_whale_trade: components["schemas"]["WsAlertTraderWhaleTradeSubscribeMessage"];
2608
3179
  trader_new_trade: components["schemas"]["WsAlertTraderNewTradeSubscribeMessage"];
3180
+ trader_trade_event: components["schemas"]["WsAlertTraderTradeEventSubscribeMessage"];
2609
3181
  trader_global_pnl: components["schemas"]["WsAlertTraderGlobalPnlSubscribeMessage"];
2610
3182
  trader_market_pnl: components["schemas"]["WsAlertTraderMarketPnlSubscribeMessage"];
2611
3183
  trader_event_pnl: components["schemas"]["WsAlertTraderEventPnlSubscribeMessage"];
@@ -2630,6 +3202,7 @@ export interface WsAlertEventDataMap {
2630
3202
  trader_new_market: components["schemas"]["NewMarketPayload"];
2631
3203
  trader_whale_trade: components["schemas"]["WhaleTradePayload"];
2632
3204
  trader_new_trade: components["schemas"]["NewTradePayload"];
3205
+ trader_trade_event: components["schemas"]["WebhookTraderTradeEventPayload"];
2633
3206
  trader_global_pnl: components["schemas"]["GlobalPnlPayload"];
2634
3207
  trader_market_pnl: components["schemas"]["MarketPnlPayload"];
2635
3208
  trader_event_pnl: components["schemas"]["EventPnlPayload"];
@@ -364,10 +364,43 @@ export type NewTradePayload = WebhookSchemas["NewTradePayload"];
364
364
  export type TraderNewTradeFilters = WebhookSchemas["TraderNewTradeFilters"];
365
365
  export type PriceSpikePayload = WebhookSchemas["PriceSpikePayload"];
366
366
  export type PriceSpikeFilters = WebhookSchemas["PriceSpikeFilters"];
367
+ export type TraderTradeEventFilters = WebhookSchemas["TraderTradeEventFilters"];
367
368
  export type WebhookDeliveryEnvelope = WebhookSchemas["WebhookDeliveryEnvelope"];
369
+ export type WebhookTraderTradeEventPayload = WebhookSchemas["WebhookTraderTradeEventPayload"];
368
370
  export type WebhookSpikeDirection = WebhookSchemas["SpikeDirection"];
369
371
  export type WebhookWebhookAssetSymbol = WebhookSchemas["WebhookAssetSymbol"];
370
372
  export type WebhookWebhookTimeframe = WebhookSchemas["WebhookTimeframe"];
373
+ export interface WebhookEventPayloadMap {
374
+ trader_first_trade: FirstTradePayload;
375
+ trader_new_market: NewMarketPayload;
376
+ trader_whale_trade: WhaleTradePayload;
377
+ trader_new_trade: NewTradePayload;
378
+ trader_trade_event: WebhookTraderTradeEventPayload;
379
+ trader_global_pnl: GlobalPnlPayload;
380
+ trader_market_pnl: MarketPnlPayload;
381
+ trader_event_pnl: EventPnlPayload;
382
+ condition_metrics: ConditionMetricsPayload;
383
+ event_metrics: EventMetricsPayload;
384
+ position_metrics: PositionMetricsPayload;
385
+ market_volume_milestone: VolumeMilestonePayload;
386
+ event_volume_milestone: EventVolumeMilestonePayload;
387
+ position_volume_milestone: PositionVolumeMilestonePayload;
388
+ probability_spike: ProbabilitySpikePayload;
389
+ price_spike: PriceSpikePayload;
390
+ market_volume_spike: MarketVolumeSpikePayload;
391
+ event_volume_spike: EventVolumeSpikePayload;
392
+ position_volume_spike: PositionVolumeSpikePayload;
393
+ close_to_bond: CloseToBondPayload;
394
+ market_created: MarketCreatedPayload;
395
+ asset_price_tick: AssetPriceTickPayload;
396
+ asset_price_window_update: AssetPriceWindowUpdatePayload;
397
+ }
398
+ export type WebhookEvent = {
399
+ [E in PolymarketWebhookEvent]: Omit<WebhookDeliveryEnvelope, "data" | "event"> & {
400
+ event: E;
401
+ data: WebhookEventPayloadMap[E];
402
+ };
403
+ }[PolymarketWebhookEvent];
371
404
  export interface ListWebhooksParams extends WebhookOperationQuery<"list_webhooks"> {
372
405
  }
373
406
  export interface GetWebhookParams {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@structbuild/sdk",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",