@structbuild/sdk 0.5.8 → 0.5.10
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.
- package/dist/generated/polymarket.d.ts +8 -6
- package/dist/generated/webhooks.d.ts +172 -19
- package/dist/generated/ws-alerts.d.ts +104 -13
- package/dist/generated/ws.d.ts +119 -17
- package/dist/index.cjs +5 -1
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +5 -1
- package/dist/index.js.map +3 -3
- package/dist/namespaces/webhooks.d.ts +2 -1
- package/dist/types/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -262,7 +262,7 @@ export interface components {
|
|
|
262
262
|
/** @description Market condition ID */
|
|
263
263
|
condition_id?: string | null;
|
|
264
264
|
/** @description Aggregation window */
|
|
265
|
-
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d");
|
|
265
|
+
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d" | "lifetime");
|
|
266
266
|
/**
|
|
267
267
|
* Format: double
|
|
268
268
|
* @description Total trading volume in USD for this timeframe
|
|
@@ -420,7 +420,7 @@ export interface components {
|
|
|
420
420
|
/** @description Event slug */
|
|
421
421
|
event_slug?: string | null;
|
|
422
422
|
/** @description Aggregation window */
|
|
423
|
-
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d");
|
|
423
|
+
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d" | "lifetime");
|
|
424
424
|
/**
|
|
425
425
|
* Format: double
|
|
426
426
|
* @description Total aggregated volume across all markets in the event (USD)
|
|
@@ -1095,6 +1095,16 @@ export interface components {
|
|
|
1095
1095
|
exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "CTFExchangeV2" | "NegRiskExchangeV2" | "Unknown";
|
|
1096
1096
|
/** @description Trade type (webhook events only fire on order fills) */
|
|
1097
1097
|
trade_type: "OrderFilled" | "OrdersMatched";
|
|
1098
|
+
/**
|
|
1099
|
+
* @description CLOB V2 builder code (lower-cased `0x...` bytes32 hex). Absent on V1
|
|
1100
|
+
* trades; may be `0x0000…` for V2 trades placed without a builder code.
|
|
1101
|
+
*/
|
|
1102
|
+
builder_code?: string | null;
|
|
1103
|
+
/**
|
|
1104
|
+
* Format: double
|
|
1105
|
+
* @description Builder fee in USDC. Absent when no builder code is attached.
|
|
1106
|
+
*/
|
|
1107
|
+
builder_fee?: number | null;
|
|
1098
1108
|
};
|
|
1099
1109
|
/**
|
|
1100
1110
|
* @description Oracle event variants accepted by `oracle_events.oracle_event_types`.
|
|
@@ -1164,6 +1174,13 @@ export interface components {
|
|
|
1164
1174
|
/** @description Restrict to events for these condition IDs. */
|
|
1165
1175
|
condition_ids?: string[] | null;
|
|
1166
1176
|
};
|
|
1177
|
+
/** @description Pagination metadata to include in API responses */
|
|
1178
|
+
PaginationMeta: {
|
|
1179
|
+
/** @description Whether there are more results available */
|
|
1180
|
+
has_more: boolean;
|
|
1181
|
+
/** @description Pagination key for the next page (if has_more is true) */
|
|
1182
|
+
pagination_key?: string | null;
|
|
1183
|
+
};
|
|
1167
1184
|
/**
|
|
1168
1185
|
* @description PnL aggregation windows accepted by `*_pnl.timeframes`.
|
|
1169
1186
|
* @enum {string}
|
|
@@ -1178,7 +1195,7 @@ export interface components {
|
|
|
1178
1195
|
* @description Polymarket webhook event types
|
|
1179
1196
|
* @enum {string}
|
|
1180
1197
|
*/
|
|
1181
|
-
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" | "trader_global_pnl_v3" | "trader_market_pnl_v3" | "trader_event_pnl_v3" | "trader_category_pnl_v3" | "trader_position_resolved_v3" | "condition_metrics" | "event_metrics" | "tag_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" | "oracle_events";
|
|
1198
|
+
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" | "trader_global_pnl_v3" | "trader_market_pnl_v3" | "trader_event_pnl_v3" | "trader_category_pnl_v3" | "trader_position_resolved_v3" | "trader_exit_markers_v3" | "position_holder_metrics_v3" | "condition_holder_metrics_v3" | "event_holder_metrics_v3" | "condition_metrics" | "event_metrics" | "tag_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" | "oracle_events";
|
|
1182
1199
|
/**
|
|
1183
1200
|
* @description Polymarket-specific webhook filters
|
|
1184
1201
|
*
|
|
@@ -1417,7 +1434,7 @@ export interface components {
|
|
|
1417
1434
|
*/
|
|
1418
1435
|
outcome_index?: number | null;
|
|
1419
1436
|
/** @description Aggregation window */
|
|
1420
|
-
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d");
|
|
1437
|
+
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d" | "lifetime");
|
|
1421
1438
|
/**
|
|
1422
1439
|
* Format: double
|
|
1423
1440
|
* @description Total trading volume in USD
|
|
@@ -1787,15 +1804,15 @@ export interface components {
|
|
|
1787
1804
|
outcome_index?: number | null;
|
|
1788
1805
|
/**
|
|
1789
1806
|
* Format: double
|
|
1790
|
-
* @description
|
|
1807
|
+
* @description YES probability at the start of the observation window (the baseline snapshot)
|
|
1791
1808
|
*/
|
|
1792
1809
|
previous_probability: number;
|
|
1793
1810
|
/**
|
|
1794
1811
|
* Format: double
|
|
1795
|
-
* @description Current probability that triggered the spike
|
|
1812
|
+
* @description Current YES probability that triggered the spike
|
|
1796
1813
|
*/
|
|
1797
1814
|
current_probability: number;
|
|
1798
|
-
/** @description Direction of the spike: `"up"` (probability rising) or `"down"` (probability falling) */
|
|
1815
|
+
/** @description Direction of the spike: `"up"` (YES probability rising) or `"down"` (YES probability falling) */
|
|
1799
1816
|
spike_direction: string;
|
|
1800
1817
|
/**
|
|
1801
1818
|
* Format: double
|
|
@@ -2117,7 +2134,7 @@ export interface components {
|
|
|
2117
2134
|
/** @description Tag label or slug */
|
|
2118
2135
|
tag?: string | null;
|
|
2119
2136
|
/** @description Aggregation window */
|
|
2120
|
-
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d");
|
|
2137
|
+
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d" | "lifetime");
|
|
2121
2138
|
/**
|
|
2122
2139
|
* Format: double
|
|
2123
2140
|
* @description Total aggregated volume for the tag (USD)
|
|
@@ -2184,7 +2201,7 @@ export interface components {
|
|
|
2184
2201
|
* full set of typed prediction-trade variants.
|
|
2185
2202
|
* @enum {string}
|
|
2186
2203
|
*/
|
|
2187
|
-
TradeEventFilterType: "OrderFilled" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "
|
|
2204
|
+
TradeEventFilterType: "OrderFilled" | "OrdersMatched" | "MakerRebate" | "Reward" | "Yield" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "Initialization" | "Proposal" | "Dispute" | "Settled" | "Resolution" | "ConditionResolution" | "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause" | "ManualResolution" | "NegRiskOutcomeReported" | "RegisterToken";
|
|
2188
2205
|
/** @description Subscription filters for the `trader_event_pnl` event. All fields are optional. */
|
|
2189
2206
|
TraderEventPnlFilters: {
|
|
2190
2207
|
/** @description Track only these trader wallet addresses. */
|
|
@@ -2430,7 +2447,7 @@ export interface components {
|
|
|
2430
2447
|
*/
|
|
2431
2448
|
max_probability?: number | null;
|
|
2432
2449
|
/** @description Only fire for these trade types. Empty = all supported trade-event variants. */
|
|
2433
|
-
trade_types?: ("OrderFilled" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "
|
|
2450
|
+
trade_types?: ("OrderFilled" | "OrdersMatched" | "MakerRebate" | "Reward" | "Yield" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "Initialization" | "Proposal" | "Dispute" | "Settled" | "Resolution" | "ConditionResolution" | "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause" | "ManualResolution" | "NegRiskOutcomeReported" | "RegisterToken")[] | null;
|
|
2434
2451
|
/** @description When `true`, suppress webhooks for short-term "updown" markets. Requires explicit `trade_types` that exclude `PositionsConverted`. Default: `false`. */
|
|
2435
2452
|
exclude_shortterm_markets?: boolean | null;
|
|
2436
2453
|
};
|
|
@@ -2671,6 +2688,49 @@ export interface components {
|
|
|
2671
2688
|
/** @description Total count */
|
|
2672
2689
|
total: number;
|
|
2673
2690
|
};
|
|
2691
|
+
/** @description A single webhook delivery log entry (GET /v1/webhooks/{id}/logs) */
|
|
2692
|
+
WebhookLogEntry: {
|
|
2693
|
+
/** @description When the payload was sent (RFC3339, millisecond precision) */
|
|
2694
|
+
sent_at: string;
|
|
2695
|
+
/** @description The full payload we delivered, parsed back to JSON */
|
|
2696
|
+
payload: unknown;
|
|
2697
|
+
/** @description Event type (e.g. "trader_first_trade") */
|
|
2698
|
+
event: string;
|
|
2699
|
+
/** @description Unique delivery id */
|
|
2700
|
+
delivery_id: string;
|
|
2701
|
+
/**
|
|
2702
|
+
* Format: int32
|
|
2703
|
+
* @description Final attempt number for this dispatch
|
|
2704
|
+
*/
|
|
2705
|
+
attempt: number;
|
|
2706
|
+
/** @description Whether delivery ultimately succeeded */
|
|
2707
|
+
success: boolean;
|
|
2708
|
+
/**
|
|
2709
|
+
* Format: int32
|
|
2710
|
+
* @description HTTP status code from the endpoint (0 = no response / transport error)
|
|
2711
|
+
*/
|
|
2712
|
+
status_code: number;
|
|
2713
|
+
/**
|
|
2714
|
+
* Format: int32
|
|
2715
|
+
* @description Total dispatch time in milliseconds (including retries)
|
|
2716
|
+
*/
|
|
2717
|
+
latency_ms: number;
|
|
2718
|
+
/** @description Destination URL the payload was POSTed to */
|
|
2719
|
+
url: string;
|
|
2720
|
+
/** @description Error message when delivery failed (omitted when empty) */
|
|
2721
|
+
error?: string;
|
|
2722
|
+
};
|
|
2723
|
+
/** @description Response for GET /v1/webhooks/{id}/logs */
|
|
2724
|
+
WebhookLogsResponseBody: {
|
|
2725
|
+
/** @description The webhook these logs belong to */
|
|
2726
|
+
webhook_id: string;
|
|
2727
|
+
/** @description Number of log entries returned */
|
|
2728
|
+
total: number;
|
|
2729
|
+
/** @description Delivery log entries, newest first */
|
|
2730
|
+
logs: components["schemas"]["WebhookLogEntry"][];
|
|
2731
|
+
/** @description Cursor pagination metadata */
|
|
2732
|
+
pagination: components["schemas"]["PaginationMeta"];
|
|
2733
|
+
};
|
|
2674
2734
|
/** @description Webhook response (returned from API) */
|
|
2675
2735
|
WebhookResponse: {
|
|
2676
2736
|
/** @description Unique webhook ID */
|
|
@@ -2732,7 +2792,7 @@ export interface components {
|
|
|
2732
2792
|
* @description Timeframe values accepted by webhook metric, milestone, spike, and asset-price filters.
|
|
2733
2793
|
* @enum {string}
|
|
2734
2794
|
*/
|
|
2735
|
-
WebhookTimeframe: "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d";
|
|
2795
|
+
WebhookTimeframe: "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d" | "lifetime";
|
|
2736
2796
|
/** @description Payload delivered when a trade exceeds the configured size and probability thresholds */
|
|
2737
2797
|
WhaleTradePayload: {
|
|
2738
2798
|
/** @description Limit-order maker wallet address (lowercase) */
|
|
@@ -2803,6 +2863,16 @@ export interface components {
|
|
|
2803
2863
|
exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "CTFExchangeV2" | "NegRiskExchangeV2" | "Unknown";
|
|
2804
2864
|
/** @description Trade type (webhook events only fire on order fills) */
|
|
2805
2865
|
trade_type: "OrderFilled" | "OrdersMatched";
|
|
2866
|
+
/**
|
|
2867
|
+
* @description CLOB V2 builder code (lower-cased `0x...` bytes32 hex). Absent on V1
|
|
2868
|
+
* trades; may be `0x0000…` for V2 trades placed without a builder code.
|
|
2869
|
+
*/
|
|
2870
|
+
builder_code?: string | null;
|
|
2871
|
+
/**
|
|
2872
|
+
* Format: double
|
|
2873
|
+
* @description Builder fee in USDC. Absent when no builder code is attached.
|
|
2874
|
+
*/
|
|
2875
|
+
builder_fee?: number | null;
|
|
2806
2876
|
};
|
|
2807
2877
|
/** @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. */
|
|
2808
2878
|
WebhookDeliveryEnvelope: {
|
|
@@ -2872,6 +2942,10 @@ export interface components {
|
|
|
2872
2942
|
* @enum {string}
|
|
2873
2943
|
*/
|
|
2874
2944
|
exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
|
|
2945
|
+
/** @description CLOB V2 builder code (lower-cased `0x...` bytes32 hex). Absent on V1 trades; may be `0x0000…` for V2 trades placed without a builder code. */
|
|
2946
|
+
builder_code?: string;
|
|
2947
|
+
/** @description Builder fee in USDC. Absent when no builder code is attached. */
|
|
2948
|
+
builder_fee?: number;
|
|
2875
2949
|
/** @enum {string} */
|
|
2876
2950
|
trade_type: "OrderFilled" | "OrdersMatched";
|
|
2877
2951
|
} | {
|
|
@@ -2917,6 +2991,10 @@ export interface components {
|
|
|
2917
2991
|
* @enum {string}
|
|
2918
2992
|
*/
|
|
2919
2993
|
exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
|
|
2994
|
+
/** @description CLOB V2 builder code (lower-cased `0x...` bytes32 hex). Absent on V1 trades; may be `0x0000…` for V2 trades placed without a builder code. */
|
|
2995
|
+
builder_code?: string;
|
|
2996
|
+
/** @description Builder fee in USDC. Absent when no builder code is attached. */
|
|
2997
|
+
builder_fee?: number;
|
|
2920
2998
|
/** @enum {string} */
|
|
2921
2999
|
trade_type: "MakerRebate" | "Reward" | "Yield";
|
|
2922
3000
|
} | {
|
|
@@ -3058,6 +3136,15 @@ export interface components {
|
|
|
3058
3136
|
market_id: string;
|
|
3059
3137
|
index_set: string;
|
|
3060
3138
|
shares_amount: number;
|
|
3139
|
+
fee?: number;
|
|
3140
|
+
fee_pct?: number;
|
|
3141
|
+
/** @description Per-position conversion amounts. */
|
|
3142
|
+
position_details?: {
|
|
3143
|
+
position_id: string;
|
|
3144
|
+
outcome_index: number;
|
|
3145
|
+
outcome?: string;
|
|
3146
|
+
amount: string;
|
|
3147
|
+
}[];
|
|
3061
3148
|
/**
|
|
3062
3149
|
* @description Exchange contract that processed the event
|
|
3063
3150
|
* @enum {string}
|
|
@@ -3526,7 +3613,9 @@ export interface components {
|
|
|
3526
3613
|
* "price": 0.5,
|
|
3527
3614
|
* "probability": 0.5,
|
|
3528
3615
|
* "exchange": "CTFExchange",
|
|
3529
|
-
* "trade_type": "OrderFilled"
|
|
3616
|
+
* "trade_type": "OrderFilled",
|
|
3617
|
+
* "builder_code": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
3618
|
+
* "builder_fee": 0.25
|
|
3530
3619
|
* }
|
|
3531
3620
|
* }
|
|
3532
3621
|
*/
|
|
@@ -3594,7 +3683,9 @@ export interface components {
|
|
|
3594
3683
|
* "price": 0.5,
|
|
3595
3684
|
* "probability": 0.5,
|
|
3596
3685
|
* "exchange": "CTFExchange",
|
|
3597
|
-
* "trade_type": "OrderFilled"
|
|
3686
|
+
* "trade_type": "OrderFilled",
|
|
3687
|
+
* "builder_code": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
3688
|
+
* "builder_fee": 0.05
|
|
3598
3689
|
* }
|
|
3599
3690
|
* }
|
|
3600
3691
|
*/
|
package/dist/generated/ws.d.ts
CHANGED
|
@@ -262,7 +262,7 @@ export interface components {
|
|
|
262
262
|
/** @description Market condition ID */
|
|
263
263
|
condition_id?: string | null;
|
|
264
264
|
/** @description Aggregation window */
|
|
265
|
-
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d");
|
|
265
|
+
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d" | "lifetime");
|
|
266
266
|
/**
|
|
267
267
|
* Format: double
|
|
268
268
|
* @description Total trading volume in USD for this timeframe
|
|
@@ -420,7 +420,7 @@ export interface components {
|
|
|
420
420
|
/** @description Event slug */
|
|
421
421
|
event_slug?: string | null;
|
|
422
422
|
/** @description Aggregation window */
|
|
423
|
-
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d");
|
|
423
|
+
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d" | "lifetime");
|
|
424
424
|
/**
|
|
425
425
|
* Format: double
|
|
426
426
|
* @description Total aggregated volume across all markets in the event (USD)
|
|
@@ -1095,6 +1095,16 @@ export interface components {
|
|
|
1095
1095
|
exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "CTFExchangeV2" | "NegRiskExchangeV2" | "Unknown";
|
|
1096
1096
|
/** @description Trade type (webhook events only fire on order fills) */
|
|
1097
1097
|
trade_type: "OrderFilled" | "OrdersMatched";
|
|
1098
|
+
/**
|
|
1099
|
+
* @description CLOB V2 builder code (lower-cased `0x...` bytes32 hex). Absent on V1
|
|
1100
|
+
* trades; may be `0x0000…` for V2 trades placed without a builder code.
|
|
1101
|
+
*/
|
|
1102
|
+
builder_code?: string | null;
|
|
1103
|
+
/**
|
|
1104
|
+
* Format: double
|
|
1105
|
+
* @description Builder fee in USDC. Absent when no builder code is attached.
|
|
1106
|
+
*/
|
|
1107
|
+
builder_fee?: number | null;
|
|
1098
1108
|
};
|
|
1099
1109
|
/**
|
|
1100
1110
|
* @description Oracle event variants accepted by `oracle_events.oracle_event_types`.
|
|
@@ -1164,6 +1174,13 @@ export interface components {
|
|
|
1164
1174
|
/** @description Restrict to events for these condition IDs. */
|
|
1165
1175
|
condition_ids?: string[] | null;
|
|
1166
1176
|
};
|
|
1177
|
+
/** @description Pagination metadata to include in API responses */
|
|
1178
|
+
PaginationMeta: {
|
|
1179
|
+
/** @description Whether there are more results available */
|
|
1180
|
+
has_more: boolean;
|
|
1181
|
+
/** @description Pagination key for the next page (if has_more is true) */
|
|
1182
|
+
pagination_key?: string | null;
|
|
1183
|
+
};
|
|
1167
1184
|
/**
|
|
1168
1185
|
* @description PnL aggregation windows accepted by `*_pnl.timeframes`.
|
|
1169
1186
|
* @enum {string}
|
|
@@ -1178,7 +1195,7 @@ export interface components {
|
|
|
1178
1195
|
* @description Polymarket webhook event types
|
|
1179
1196
|
* @enum {string}
|
|
1180
1197
|
*/
|
|
1181
|
-
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" | "trader_global_pnl_v3" | "trader_market_pnl_v3" | "trader_event_pnl_v3" | "trader_category_pnl_v3" | "trader_position_resolved_v3" | "condition_metrics" | "event_metrics" | "tag_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" | "oracle_events";
|
|
1198
|
+
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" | "trader_global_pnl_v3" | "trader_market_pnl_v3" | "trader_event_pnl_v3" | "trader_category_pnl_v3" | "trader_position_resolved_v3" | "trader_exit_markers_v3" | "position_holder_metrics_v3" | "condition_holder_metrics_v3" | "event_holder_metrics_v3" | "condition_metrics" | "event_metrics" | "tag_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" | "oracle_events";
|
|
1182
1199
|
/**
|
|
1183
1200
|
* @description Polymarket-specific webhook filters
|
|
1184
1201
|
*
|
|
@@ -1417,7 +1434,7 @@ export interface components {
|
|
|
1417
1434
|
*/
|
|
1418
1435
|
outcome_index?: number | null;
|
|
1419
1436
|
/** @description Aggregation window */
|
|
1420
|
-
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d");
|
|
1437
|
+
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d" | "lifetime");
|
|
1421
1438
|
/**
|
|
1422
1439
|
* Format: double
|
|
1423
1440
|
* @description Total trading volume in USD
|
|
@@ -1787,15 +1804,15 @@ export interface components {
|
|
|
1787
1804
|
outcome_index?: number | null;
|
|
1788
1805
|
/**
|
|
1789
1806
|
* Format: double
|
|
1790
|
-
* @description
|
|
1807
|
+
* @description YES probability at the start of the observation window (the baseline snapshot)
|
|
1791
1808
|
*/
|
|
1792
1809
|
previous_probability: number;
|
|
1793
1810
|
/**
|
|
1794
1811
|
* Format: double
|
|
1795
|
-
* @description Current probability that triggered the spike
|
|
1812
|
+
* @description Current YES probability that triggered the spike
|
|
1796
1813
|
*/
|
|
1797
1814
|
current_probability: number;
|
|
1798
|
-
/** @description Direction of the spike: `"up"` (probability rising) or `"down"` (probability falling) */
|
|
1815
|
+
/** @description Direction of the spike: `"up"` (YES probability rising) or `"down"` (YES probability falling) */
|
|
1799
1816
|
spike_direction: string;
|
|
1800
1817
|
/**
|
|
1801
1818
|
* Format: double
|
|
@@ -2117,7 +2134,7 @@ export interface components {
|
|
|
2117
2134
|
/** @description Tag label or slug */
|
|
2118
2135
|
tag?: string | null;
|
|
2119
2136
|
/** @description Aggregation window */
|
|
2120
|
-
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d");
|
|
2137
|
+
timeframe?: null | ("1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d" | "lifetime");
|
|
2121
2138
|
/**
|
|
2122
2139
|
* Format: double
|
|
2123
2140
|
* @description Total aggregated volume for the tag (USD)
|
|
@@ -2184,7 +2201,7 @@ export interface components {
|
|
|
2184
2201
|
* full set of typed prediction-trade variants.
|
|
2185
2202
|
* @enum {string}
|
|
2186
2203
|
*/
|
|
2187
|
-
TradeEventFilterType: "OrderFilled" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "
|
|
2204
|
+
TradeEventFilterType: "OrderFilled" | "OrdersMatched" | "MakerRebate" | "Reward" | "Yield" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "Initialization" | "Proposal" | "Dispute" | "Settled" | "Resolution" | "ConditionResolution" | "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause" | "ManualResolution" | "NegRiskOutcomeReported" | "RegisterToken";
|
|
2188
2205
|
/** @description Subscription filters for the `trader_event_pnl` event. All fields are optional. */
|
|
2189
2206
|
TraderEventPnlFilters: {
|
|
2190
2207
|
/** @description Track only these trader wallet addresses. */
|
|
@@ -2430,7 +2447,7 @@ export interface components {
|
|
|
2430
2447
|
*/
|
|
2431
2448
|
max_probability?: number | null;
|
|
2432
2449
|
/** @description Only fire for these trade types. Empty = all supported trade-event variants. */
|
|
2433
|
-
trade_types?: ("OrderFilled" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "
|
|
2450
|
+
trade_types?: ("OrderFilled" | "OrdersMatched" | "MakerRebate" | "Reward" | "Yield" | "Redemption" | "Merge" | "Split" | "Cancelled" | "PositionsConverted" | "Initialization" | "Proposal" | "Dispute" | "Settled" | "Resolution" | "ConditionResolution" | "Reset" | "Flag" | "Unflag" | "Pause" | "Unpause" | "ManualResolution" | "NegRiskOutcomeReported" | "RegisterToken")[] | null;
|
|
2434
2451
|
/** @description When `true`, suppress webhooks for short-term "updown" markets. Requires explicit `trade_types` that exclude `PositionsConverted`. Default: `false`. */
|
|
2435
2452
|
exclude_shortterm_markets?: boolean | null;
|
|
2436
2453
|
};
|
|
@@ -2668,6 +2685,49 @@ export interface components {
|
|
|
2668
2685
|
/** @description Total count */
|
|
2669
2686
|
total: number;
|
|
2670
2687
|
};
|
|
2688
|
+
/** @description A single webhook delivery log entry (GET /v1/webhooks/{id}/logs) */
|
|
2689
|
+
WebhookLogEntry: {
|
|
2690
|
+
/** @description When the payload was sent (RFC3339, millisecond precision) */
|
|
2691
|
+
sent_at: string;
|
|
2692
|
+
/** @description The full payload we delivered, parsed back to JSON */
|
|
2693
|
+
payload: unknown;
|
|
2694
|
+
/** @description Event type (e.g. "trader_first_trade") */
|
|
2695
|
+
event: string;
|
|
2696
|
+
/** @description Unique delivery id */
|
|
2697
|
+
delivery_id: string;
|
|
2698
|
+
/**
|
|
2699
|
+
* Format: int32
|
|
2700
|
+
* @description Final attempt number for this dispatch
|
|
2701
|
+
*/
|
|
2702
|
+
attempt: number;
|
|
2703
|
+
/** @description Whether delivery ultimately succeeded */
|
|
2704
|
+
success: boolean;
|
|
2705
|
+
/**
|
|
2706
|
+
* Format: int32
|
|
2707
|
+
* @description HTTP status code from the endpoint (0 = no response / transport error)
|
|
2708
|
+
*/
|
|
2709
|
+
status_code: number;
|
|
2710
|
+
/**
|
|
2711
|
+
* Format: int32
|
|
2712
|
+
* @description Total dispatch time in milliseconds (including retries)
|
|
2713
|
+
*/
|
|
2714
|
+
latency_ms: number;
|
|
2715
|
+
/** @description Destination URL the payload was POSTed to */
|
|
2716
|
+
url: string;
|
|
2717
|
+
/** @description Error message when delivery failed (omitted when empty) */
|
|
2718
|
+
error?: string;
|
|
2719
|
+
};
|
|
2720
|
+
/** @description Response for GET /v1/webhooks/{id}/logs */
|
|
2721
|
+
WebhookLogsResponseBody: {
|
|
2722
|
+
/** @description The webhook these logs belong to */
|
|
2723
|
+
webhook_id: string;
|
|
2724
|
+
/** @description Number of log entries returned */
|
|
2725
|
+
total: number;
|
|
2726
|
+
/** @description Delivery log entries, newest first */
|
|
2727
|
+
logs: components["schemas"]["WebhookLogEntry"][];
|
|
2728
|
+
/** @description Cursor pagination metadata */
|
|
2729
|
+
pagination: components["schemas"]["PaginationMeta"];
|
|
2730
|
+
};
|
|
2671
2731
|
/** @description Webhook response (returned from API) */
|
|
2672
2732
|
WebhookResponse: {
|
|
2673
2733
|
/** @description Unique webhook ID */
|
|
@@ -2726,7 +2786,7 @@ export interface components {
|
|
|
2726
2786
|
* @description Timeframe values accepted by webhook metric, milestone, spike, and asset-price filters.
|
|
2727
2787
|
* @enum {string}
|
|
2728
2788
|
*/
|
|
2729
|
-
WebhookTimeframe: "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d";
|
|
2789
|
+
WebhookTimeframe: "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "6h" | "1d" | "24h" | "7d" | "30d" | "lifetime";
|
|
2730
2790
|
/** @description Payload delivered when a trade exceeds the configured size and probability thresholds */
|
|
2731
2791
|
WhaleTradePayload: {
|
|
2732
2792
|
/** @description Limit-order maker wallet address (lowercase) */
|
|
@@ -2797,6 +2857,16 @@ export interface components {
|
|
|
2797
2857
|
exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "CTFExchangeV2" | "NegRiskExchangeV2" | "Unknown";
|
|
2798
2858
|
/** @description Trade type (webhook events only fire on order fills) */
|
|
2799
2859
|
trade_type: "OrderFilled" | "OrdersMatched";
|
|
2860
|
+
/**
|
|
2861
|
+
* @description CLOB V2 builder code (lower-cased `0x...` bytes32 hex). Absent on V1
|
|
2862
|
+
* trades; may be `0x0000…` for V2 trades placed without a builder code.
|
|
2863
|
+
*/
|
|
2864
|
+
builder_code?: string | null;
|
|
2865
|
+
/**
|
|
2866
|
+
* Format: double
|
|
2867
|
+
* @description Builder fee in USDC. Absent when no builder code is attached.
|
|
2868
|
+
*/
|
|
2869
|
+
builder_fee?: number | null;
|
|
2800
2870
|
};
|
|
2801
2871
|
/** @description Server acknowledgement for an oracle events stream subscription */
|
|
2802
2872
|
OracleEventsStreamSubscribeResponse: {
|
|
@@ -2893,7 +2963,7 @@ export interface components {
|
|
|
2893
2963
|
* @description Timeframe that `volume`/`txns`/`unique_traders` thresholds are evaluated against. Default `24h`.
|
|
2894
2964
|
* @enum {string}
|
|
2895
2965
|
*/
|
|
2896
|
-
timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
2966
|
+
timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | "lifetime";
|
|
2897
2967
|
};
|
|
2898
2968
|
/** @description Subscribe to the trades stream. No filters = subscribe to all trades. */
|
|
2899
2969
|
TradesStreamSubscribeMessage: {
|
|
@@ -2988,6 +3058,10 @@ export interface components {
|
|
|
2988
3058
|
/** @description Absent for pending trades */
|
|
2989
3059
|
fee_pct?: number;
|
|
2990
3060
|
exchange: number;
|
|
3061
|
+
/** @description CLOB V2 builder code (lower-cased `0x...` bytes32 hex). Absent on V1 trades; may be `0x0000…` for V2 trades placed without a builder code. */
|
|
3062
|
+
builder_code?: string;
|
|
3063
|
+
/** @description Builder fee in USDC. Absent when no builder code is attached. */
|
|
3064
|
+
builder_fee?: number;
|
|
2991
3065
|
} | {
|
|
2992
3066
|
/** @enum {string} */
|
|
2993
3067
|
trade_type: "MakerRebate" | "Reward" | "Yield";
|
|
@@ -3135,6 +3209,14 @@ export interface components {
|
|
|
3135
3209
|
market_id?: string;
|
|
3136
3210
|
index_set?: string;
|
|
3137
3211
|
shares_amount?: number;
|
|
3212
|
+
fee?: number;
|
|
3213
|
+
fee_pct?: number;
|
|
3214
|
+
/** @description Per-position conversion amounts */
|
|
3215
|
+
position_details?: {
|
|
3216
|
+
position_id?: string;
|
|
3217
|
+
outcome_index?: number;
|
|
3218
|
+
amount?: string;
|
|
3219
|
+
}[];
|
|
3138
3220
|
exchange: number;
|
|
3139
3221
|
} | {
|
|
3140
3222
|
/** @enum {string} */
|
|
@@ -3285,10 +3367,12 @@ export interface components {
|
|
|
3285
3367
|
action: "subscribe" | "unsubscribe_all";
|
|
3286
3368
|
/** @description 64-char hex condition IDs (with or without 0x prefix) */
|
|
3287
3369
|
condition_ids: string[];
|
|
3370
|
+
timeframes?: ("1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | "lifetime")[];
|
|
3288
3371
|
};
|
|
3289
3372
|
/** @description Server acknowledgement for a market metrics subscription */
|
|
3290
3373
|
MarketMetricsSubscribeResponse: {
|
|
3291
3374
|
condition_ids?: string[];
|
|
3375
|
+
timeframes?: string[];
|
|
3292
3376
|
/** @description Condition IDs that were rejected (invalid format) */
|
|
3293
3377
|
rejected?: string[];
|
|
3294
3378
|
/** @description Set if the entire subscription was rejected */
|
|
@@ -3299,7 +3383,7 @@ export interface components {
|
|
|
3299
3383
|
/** @description 64-char hex condition ID */
|
|
3300
3384
|
condition_id: string;
|
|
3301
3385
|
/** @enum {string} */
|
|
3302
|
-
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
3386
|
+
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | "lifetime";
|
|
3303
3387
|
/**
|
|
3304
3388
|
* Format: int64
|
|
3305
3389
|
* @description Optional event timestamp (Unix seconds)
|
|
@@ -3342,10 +3426,12 @@ export interface components {
|
|
|
3342
3426
|
action: "subscribe" | "unsubscribe_all";
|
|
3343
3427
|
/** @description Event slugs (lowercase) */
|
|
3344
3428
|
event_slugs: string[];
|
|
3429
|
+
timeframes?: ("1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | "lifetime")[];
|
|
3345
3430
|
};
|
|
3346
3431
|
/** @description Server acknowledgement for an event metrics subscription */
|
|
3347
3432
|
EventMetricsSubscribeResponse: {
|
|
3348
3433
|
event_slugs?: string[];
|
|
3434
|
+
timeframes?: string[];
|
|
3349
3435
|
rejected?: string[];
|
|
3350
3436
|
error?: string | null;
|
|
3351
3437
|
};
|
|
@@ -3353,7 +3439,7 @@ export interface components {
|
|
|
3353
3439
|
EventMetricsEvent: {
|
|
3354
3440
|
event_slug: string;
|
|
3355
3441
|
/** @enum {string} */
|
|
3356
|
-
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
3442
|
+
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | "lifetime";
|
|
3357
3443
|
/**
|
|
3358
3444
|
* Format: int64
|
|
3359
3445
|
* @description Optional event timestamp (Unix seconds)
|
|
@@ -3388,10 +3474,12 @@ export interface components {
|
|
|
3388
3474
|
action: "subscribe" | "unsubscribe_all";
|
|
3389
3475
|
/** @description Tag labels or slugs, matched case-insensitively */
|
|
3390
3476
|
tags: string[];
|
|
3477
|
+
timeframes?: ("1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | "lifetime")[];
|
|
3391
3478
|
};
|
|
3392
3479
|
/** @description Server acknowledgement for a tag metrics subscription */
|
|
3393
3480
|
TagMetricsSubscribeResponse: {
|
|
3394
3481
|
tags?: string[];
|
|
3482
|
+
timeframes?: string[];
|
|
3395
3483
|
rejected?: string[];
|
|
3396
3484
|
error?: string | null;
|
|
3397
3485
|
};
|
|
@@ -3399,7 +3487,7 @@ export interface components {
|
|
|
3399
3487
|
TagMetricsEvent: {
|
|
3400
3488
|
tag: string;
|
|
3401
3489
|
/** @enum {string} */
|
|
3402
|
-
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
3490
|
+
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | "lifetime";
|
|
3403
3491
|
/**
|
|
3404
3492
|
* Format: int64
|
|
3405
3493
|
* @description Optional event timestamp (Unix seconds)
|
|
@@ -3434,10 +3522,12 @@ export interface components {
|
|
|
3434
3522
|
action: "subscribe" | "unsubscribe_all";
|
|
3435
3523
|
/** @description ERC-1155 outcome token IDs (decimal or hex strings) */
|
|
3436
3524
|
position_ids: string[];
|
|
3525
|
+
timeframes?: ("1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | "lifetime")[];
|
|
3437
3526
|
};
|
|
3438
3527
|
/** @description Server acknowledgement for a position metrics subscription */
|
|
3439
3528
|
PositionMetricsSubscribeResponse: {
|
|
3440
3529
|
position_ids?: string[];
|
|
3530
|
+
timeframes?: string[];
|
|
3441
3531
|
rejected?: string[];
|
|
3442
3532
|
error?: string | null;
|
|
3443
3533
|
};
|
|
@@ -3451,7 +3541,7 @@ export interface components {
|
|
|
3451
3541
|
outcome?: string | null;
|
|
3452
3542
|
outcome_index?: number | null;
|
|
3453
3543
|
/** @enum {string} */
|
|
3454
|
-
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
3544
|
+
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | "lifetime";
|
|
3455
3545
|
/**
|
|
3456
3546
|
* Format: int64
|
|
3457
3547
|
* @description Optional event timestamp (Unix seconds)
|
|
@@ -3991,7 +4081,7 @@ export interface components {
|
|
|
3991
4081
|
* @description Timeframe that `volume`/`txns`/`unique_traders` thresholds are evaluated against. Default `24h`.
|
|
3992
4082
|
* @enum {string}
|
|
3993
4083
|
*/
|
|
3994
|
-
timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
4084
|
+
timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | "lifetime";
|
|
3995
4085
|
};
|
|
3996
4086
|
/** @description Server acknowledgement for an events_stream subscribe/unsubscribe. Envelope type: "events_stream_subscribe_response". */
|
|
3997
4087
|
EventsStreamSubscribeResponse: {
|
|
@@ -4096,6 +4186,10 @@ export interface components {
|
|
|
4096
4186
|
/** @description Absent for pending trades */
|
|
4097
4187
|
fee_pct?: number;
|
|
4098
4188
|
exchange: number;
|
|
4189
|
+
/** @description CLOB V2 builder code (lower-cased `0x...` bytes32 hex). Absent on V1 trades; may be `0x0000…` for V2 trades placed without a builder code. */
|
|
4190
|
+
builder_code?: string;
|
|
4191
|
+
/** @description Builder fee in USDC. Absent when no builder code is attached. */
|
|
4192
|
+
builder_fee?: number;
|
|
4099
4193
|
};
|
|
4100
4194
|
/**
|
|
4101
4195
|
* MakerRebate / Reward / Yield
|
|
@@ -4268,6 +4362,14 @@ export interface components {
|
|
|
4268
4362
|
market_id?: string;
|
|
4269
4363
|
index_set?: string;
|
|
4270
4364
|
shares_amount?: number;
|
|
4365
|
+
fee?: number;
|
|
4366
|
+
fee_pct?: number;
|
|
4367
|
+
/** @description Per-position conversion amounts */
|
|
4368
|
+
position_details?: {
|
|
4369
|
+
position_id?: string;
|
|
4370
|
+
outcome_index?: number;
|
|
4371
|
+
amount?: string;
|
|
4372
|
+
}[];
|
|
4271
4373
|
exchange: number;
|
|
4272
4374
|
};
|
|
4273
4375
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -715,6 +715,10 @@ class WebhooksNamespace extends PlatformNamespace {
|
|
|
715
715
|
async listEvents() {
|
|
716
716
|
return this.http.get("/webhooks/events");
|
|
717
717
|
}
|
|
718
|
+
async getLogs(params) {
|
|
719
|
+
const { webhookId, ...query } = params;
|
|
720
|
+
return this.http.get(`/webhooks/${encodeURIComponent(webhookId)}/logs`, { params: query });
|
|
721
|
+
}
|
|
718
722
|
}
|
|
719
723
|
// src/client.ts
|
|
720
724
|
var DEFAULT_BASE_URL = "https://api.struct.to/v1";
|
|
@@ -1538,5 +1542,5 @@ async function* paginate(fetcher, params, pageSize = DEFAULT_PAGE_SIZE) {
|
|
|
1538
1542
|
}
|
|
1539
1543
|
}
|
|
1540
1544
|
|
|
1541
|
-
//# debugId=
|
|
1545
|
+
//# debugId=7F3446BC0D3244D064756E2164756E21
|
|
1542
1546
|
//# sourceMappingURL=index.js.map
|