@0xinsider/sdk 0.24.0 → 0.26.0
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/README.md +20 -5
- package/dist/client.d.ts +7 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -1
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/provenance.d.ts +2 -2
- package/dist/provenance.d.ts.map +1 -1
- package/dist/provenance.js +3 -3
- package/dist/provenance.js.map +1 -1
- package/dist/retry.d.ts +19 -0
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +111 -0
- package/dist/retry.js.map +1 -1
- package/dist/schema.d.ts +73 -13
- package/dist/schema.d.ts.map +1 -1
- package/dist/webhooks.d.ts +151 -28
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js +22 -6
- package/dist/webhooks.js.map +1 -1
- package/package.json +1 -1
package/dist/webhooks.d.ts
CHANGED
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
* across at-least-once retries. Terminal states never restart on polling or
|
|
42
42
|
* replay. The legacy synchronous method and its retry restriction remain.
|
|
43
43
|
*/
|
|
44
|
+
import type { Grade } from "./client.js";
|
|
45
|
+
import type { WebhookEventType as ContractWebhookEventType } from "./schema.js";
|
|
44
46
|
/** Default replay tolerance; the published contract is 300 seconds. */
|
|
45
47
|
export declare const SIGNATURE_TOLERANCE_SECONDS = 300;
|
|
46
48
|
/** Header carrying the `v1=<hex>` signature. */
|
|
@@ -88,12 +90,14 @@ export declare function computeSignature(secret: string, timestamp: number | str
|
|
|
88
90
|
*/
|
|
89
91
|
export declare function verifySignature(input: VerifySignatureInput): boolean;
|
|
90
92
|
/**
|
|
91
|
-
* Webhook event types. Source of truth:
|
|
92
|
-
* `web/public/api/v1/openapi.json` -> components.schemas.WebhookEventType.enum
|
|
93
|
-
* `
|
|
94
|
-
* `
|
|
95
|
-
* `
|
|
96
|
-
*
|
|
93
|
+
* Webhook event types, as a runtime list. Source of truth:
|
|
94
|
+
* `web/public/api/v1/openapi.json` -> components.schemas.WebhookEventType.enum,
|
|
95
|
+
* which `schema.ts` carries as the generated `WebhookEventType` union.
|
|
96
|
+
* `large_trade_inserted_v2`, `large_trades_inserted`, `whale_trades_inserted`,
|
|
97
|
+
* `wallet_grade_changed`, `suspicious_trade_flagged`,
|
|
98
|
+
* `insider_radar_flag_raised`, `sharp_money_flow_detected`, and
|
|
99
|
+
* `smart_money_flow_detected` are Pro and Max: they deliver only to API keys
|
|
100
|
+
* on an active Pro or Max subscription.
|
|
97
101
|
*
|
|
98
102
|
* Some entries are two spellings of ONE event, not two events: either one
|
|
99
103
|
* subscribes, and an endpoint receives its deliveries under the spelling it
|
|
@@ -103,9 +107,30 @@ export declare function verifySignature(input: VerifySignatureInput): boolean;
|
|
|
103
107
|
* `insider_radar_flag_raised` (#16301), and `sharp_money_flow_detected` over
|
|
104
108
|
* `smart_money_flow_detected` (#16308). No deprecated spelling is ever
|
|
105
109
|
* removed.
|
|
110
|
+
*
|
|
111
|
+
* This list, the generated union and the typed envelopes in `WebhookEvent`
|
|
112
|
+
* are one set, and the compiler holds them equal (#24603). Each is checked as
|
|
113
|
+
* a subset of the next: `satisfies` below refuses a name with no typed
|
|
114
|
+
* envelope, the `WebhookEventEnvelope` constraint refuses an envelope for a
|
|
115
|
+
* name the contract does not have, and `WebhookEventType` refuses a contract
|
|
116
|
+
* name this list lacks. A new event type therefore fails the SDK build until
|
|
117
|
+
* it is listed here and typed below. Before that check, the list missed
|
|
118
|
+
* `large_trade_inserted_v2` for three weeks after the API began offering it.
|
|
119
|
+
*
|
|
120
|
+
* A new name goes at the end, so the index of every earlier name is unchanged.
|
|
106
121
|
*/
|
|
107
|
-
export declare const WEBHOOK_EVENT_TYPES: readonly ["large_trades_inserted", "whale_trades_inserted", "live_sports_updated", "trader_synced", "whale_trader_synced", "large_positions_updated", "wallet_grade_changed", "suspicious_trade_flagged", "insider_radar_flag_raised", "sharp_money_flow_detected", "smart_money_flow_detected", "export_job_ready", "export_job_failed", "export_job_expired", "export_job_cancelled"];
|
|
108
|
-
|
|
122
|
+
export declare const WEBHOOK_EVENT_TYPES: readonly ["large_trades_inserted", "whale_trades_inserted", "live_sports_updated", "trader_synced", "whale_trader_synced", "large_positions_updated", "wallet_grade_changed", "suspicious_trade_flagged", "insider_radar_flag_raised", "sharp_money_flow_detected", "smart_money_flow_detected", "export_job_ready", "export_job_failed", "export_job_expired", "export_job_cancelled", "large_trade_inserted_v2"];
|
|
123
|
+
/**
|
|
124
|
+
* `T`, unchanged, when `Missing` is `never`. Any other `Missing` fails its
|
|
125
|
+
* constraint, so the compile error names what is missing.
|
|
126
|
+
*/
|
|
127
|
+
type Complete<T, Missing extends never> = T | Missing;
|
|
128
|
+
/**
|
|
129
|
+
* Every webhook event type: the generated contract union. It compiles only
|
|
130
|
+
* while `WEBHOOK_EVENT_TYPES` lists every name in the contract, and the error
|
|
131
|
+
* names the one the list lacks.
|
|
132
|
+
*/
|
|
133
|
+
export type WebhookEventType = Complete<ContractWebhookEventType, Exclude<ContractWebhookEventType, (typeof WEBHOOK_EVENT_TYPES)[number]>>;
|
|
109
134
|
/**
|
|
110
135
|
* Common delivery envelope every webhook POST body carries. Source of truth:
|
|
111
136
|
* the `enqueue_webhook_event` call sites in the backend
|
|
@@ -119,10 +144,61 @@ export interface WebhookEventEnvelope<TType extends WebhookEventType = WebhookEv
|
|
|
119
144
|
created_at: string;
|
|
120
145
|
data: TData;
|
|
121
146
|
}
|
|
122
|
-
/**
|
|
123
|
-
|
|
147
|
+
/**
|
|
148
|
+
* `large_trade_inserted_v2` data (Pro and Max): one large trade, with the
|
|
149
|
+
* trade itself. Source: `LargeTradeInsertedV2` in
|
|
150
|
+
* `backend/crates/core/src/feed_event.rs`.
|
|
151
|
+
*
|
|
152
|
+
* The three amounts are decimal strings that keep the stored precision. Parse
|
|
153
|
+
* them with a decimal library when the exact value matters; `Number` rounds.
|
|
154
|
+
* The endpoint's `trade_filters` decide which trades it receives.
|
|
155
|
+
*/
|
|
156
|
+
export interface LargeTradeInsertedV2Data {
|
|
157
|
+
/**
|
|
158
|
+
* Stable identity of this trade's event. It equals the envelope `id`, and
|
|
159
|
+
* the `id` of the same event on `GET /api/v1/events/feed/since`.
|
|
160
|
+
*/
|
|
161
|
+
event_id: string;
|
|
162
|
+
/** Numeric id of the trade. `GET /api/v1/large-trades/{id}` accepts it. */
|
|
163
|
+
whale_alert_id: number;
|
|
164
|
+
/** Polymarket condition id of the market. */
|
|
165
|
+
condition_id: string;
|
|
166
|
+
/** 0xinsider's numeric id for the wallet. */
|
|
167
|
+
trader_id: number;
|
|
168
|
+
/** Address of the wallet that made the trade. */
|
|
169
|
+
wallet: string;
|
|
170
|
+
/** The wallet's grade when the event was published; `null` when it has none. */
|
|
171
|
+
grade: Grade | null;
|
|
172
|
+
/** USD notional of the trade; decimal string. */
|
|
173
|
+
size_usd: string;
|
|
174
|
+
/** Shares traded; decimal string. */
|
|
175
|
+
shares: string;
|
|
176
|
+
/** Price paid per share; decimal string. */
|
|
177
|
+
price: string;
|
|
178
|
+
side: "BUY" | "SELL";
|
|
179
|
+
/** Polymarket's index of the outcome traded. */
|
|
180
|
+
outcome_index: number;
|
|
181
|
+
/** When the trade filled on Polymarket (ISO 8601). */
|
|
182
|
+
traded_at: string;
|
|
183
|
+
platform: "polymarket";
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* `large_trades_inserted` data (Pro and Max): new large trades were ingested.
|
|
187
|
+
* It carries a count and no trade; subscribe to `large_trade_inserted_v2` for
|
|
188
|
+
* the trade itself.
|
|
189
|
+
*
|
|
190
|
+
* Delivered identically under the deprecated spelling `whale_trades_inserted`
|
|
191
|
+
* (#16304) to an endpoint that registered that spelling; the payload is the
|
|
192
|
+
* same.
|
|
193
|
+
*/
|
|
194
|
+
export interface LargeTradesInsertedData {
|
|
124
195
|
count: number;
|
|
125
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* @deprecated Use `LargeTradesInsertedData`; renamed in #16304. The two event
|
|
199
|
+
* spellings are one event with one payload, so this is an alias.
|
|
200
|
+
*/
|
|
201
|
+
export type WhaleTradesInsertedData = LargeTradesInsertedData;
|
|
126
202
|
/** One side's score line inside a `live_sports_updated` pulse. */
|
|
127
203
|
export interface LiveSportsScoreEntry {
|
|
128
204
|
team: string;
|
|
@@ -171,11 +247,22 @@ export interface LiveSportsUpdatedData {
|
|
|
171
247
|
/** Public game page; re-read it after a gap instead of replaying pulses. */
|
|
172
248
|
snapshot_url: string;
|
|
173
249
|
}
|
|
174
|
-
/**
|
|
175
|
-
|
|
250
|
+
/**
|
|
251
|
+
* `trader_synced` data: a tracked trader finished a sync pass.
|
|
252
|
+
*
|
|
253
|
+
* Delivered identically under the deprecated spelling `whale_trader_synced`
|
|
254
|
+
* (#16304) to an endpoint that registered that spelling; the payload is the
|
|
255
|
+
* same.
|
|
256
|
+
*/
|
|
257
|
+
export interface TraderSyncedData {
|
|
176
258
|
trader_id: number;
|
|
177
259
|
wallet: string;
|
|
178
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* @deprecated Use `TraderSyncedData`; renamed in #16304. The two event
|
|
263
|
+
* spellings are one event with one payload, so this is an alias.
|
|
264
|
+
*/
|
|
265
|
+
export type WhaleTraderSyncedData = TraderSyncedData;
|
|
179
266
|
/** `large_positions_updated` data. */
|
|
180
267
|
export interface LargePositionsUpdatedData {
|
|
181
268
|
count: number;
|
|
@@ -187,31 +274,39 @@ export interface LargePositionsUpdatedData {
|
|
|
187
274
|
export interface WalletGradeChangedData {
|
|
188
275
|
wallet: string;
|
|
189
276
|
trader_id: number;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
277
|
+
/** The grade before the move. Never equal to `new_grade`. */
|
|
278
|
+
old_grade: Grade;
|
|
279
|
+
new_grade: Grade;
|
|
280
|
+
/** `"upgrade"` when `new_grade` is better than `old_grade`, else `"downgrade"`. */
|
|
281
|
+
direction: "upgrade" | "downgrade";
|
|
194
282
|
skill_index: number;
|
|
195
283
|
final_score: number;
|
|
196
284
|
date: string;
|
|
197
285
|
}
|
|
198
286
|
/**
|
|
199
287
|
* `suspicious_trade_flagged` data (Pro and Max): a suspicion threshold was
|
|
200
|
-
* crossed on a fresh fill. Source: `
|
|
288
|
+
* crossed on a fresh fill. Source: `insider_radar_flag_webhook_payload` in
|
|
289
|
+
* `backend/crates/core/src/trade_flagging/mod.rs`.
|
|
201
290
|
*
|
|
202
291
|
* Delivered identically under the deprecated spelling
|
|
203
292
|
* `insider_radar_flag_raised` (#16301) to an endpoint that registered that
|
|
204
293
|
* spelling; the payload is the same.
|
|
205
294
|
*/
|
|
206
295
|
export interface SuspiciousTradeFlaggedData {
|
|
207
|
-
|
|
296
|
+
/**
|
|
297
|
+
* Numeric id of the flagged trade, a JSON number (SDK 0.25.0 and earlier
|
|
298
|
+
* typed it as a string, which the API never sent). It is the `id` that
|
|
299
|
+
* `GET /api/v1/large-trades/{id}` accepts.
|
|
300
|
+
*/
|
|
301
|
+
trade_id: number;
|
|
208
302
|
wallet: string;
|
|
209
303
|
trader_id: number;
|
|
210
304
|
condition_id: string;
|
|
211
305
|
suspicion_score: number;
|
|
212
|
-
track
|
|
306
|
+
/** The scoring track that raised the flag. */
|
|
307
|
+
track: "whale" | "fresh_conviction" | "sliced_position";
|
|
213
308
|
/** Outcome side the flagged fill took. */
|
|
214
|
-
side:
|
|
309
|
+
side: "yes" | "no";
|
|
215
310
|
size: number;
|
|
216
311
|
price: number;
|
|
217
312
|
}
|
|
@@ -232,10 +327,10 @@ export interface SharpMoneyFlowDetectedData {
|
|
|
232
327
|
/** Signed net YES/NO exposure from ranked traders. */
|
|
233
328
|
net_flow_usd: number;
|
|
234
329
|
abs_net_flow_usd: number;
|
|
235
|
-
/** Side the net flow leans: "yes"
|
|
236
|
-
dominant_side:
|
|
237
|
-
/** Minimum trader grade included
|
|
238
|
-
grade_floor:
|
|
330
|
+
/** Side the net flow leans: `"yes"` when `net_flow_usd >= 0`, else `"no"`. */
|
|
331
|
+
dominant_side: "yes" | "no";
|
|
332
|
+
/** Minimum trader grade included in the flow. */
|
|
333
|
+
grade_floor: Grade;
|
|
239
334
|
whale_trade_count: number;
|
|
240
335
|
/** Detection window, e.g. "24h". */
|
|
241
336
|
window: string;
|
|
@@ -273,9 +368,31 @@ export interface ExportJobCancelledData {
|
|
|
273
368
|
format: string;
|
|
274
369
|
next_action: "resubmit";
|
|
275
370
|
}
|
|
276
|
-
|
|
371
|
+
/**
|
|
372
|
+
* One large trade per delivery (Pro and Max, #16149). The envelope `id` equals
|
|
373
|
+
* `data.event_id`, and `created_at` is the trade's fill time
|
|
374
|
+
* (`data.traded_at`), not the time the delivery was queued.
|
|
375
|
+
*/
|
|
376
|
+
export type LargeTradeInsertedV2Event = WebhookEventEnvelope<"large_trade_inserted_v2", LargeTradeInsertedV2Data>;
|
|
377
|
+
export type LargeTradesInsertedEvent = WebhookEventEnvelope<"large_trades_inserted", LargeTradesInsertedData>;
|
|
378
|
+
/**
|
|
379
|
+
* @deprecated Use `LargeTradesInsertedEvent`; renamed in #16304. This stays a
|
|
380
|
+
* distinct envelope rather than an alias of it because the delivered `type`
|
|
381
|
+
* discriminant is the spelling the endpoint registered: an endpoint subscribed
|
|
382
|
+
* to `whale_trades_inserted` keeps receiving that literal, so narrowing on it
|
|
383
|
+
* keeps working.
|
|
384
|
+
*/
|
|
385
|
+
export type WhaleTradesInsertedEvent = WebhookEventEnvelope<"whale_trades_inserted", LargeTradesInsertedData>;
|
|
277
386
|
export type LiveSportsUpdatedEvent = WebhookEventEnvelope<"live_sports_updated", LiveSportsUpdatedData>;
|
|
278
|
-
export type
|
|
387
|
+
export type TraderSyncedEvent = WebhookEventEnvelope<"trader_synced", TraderSyncedData>;
|
|
388
|
+
/**
|
|
389
|
+
* @deprecated Use `TraderSyncedEvent`; renamed in #16304. This stays a
|
|
390
|
+
* distinct envelope rather than an alias of it because the delivered `type`
|
|
391
|
+
* discriminant is the spelling the endpoint registered: an endpoint subscribed
|
|
392
|
+
* to `whale_trader_synced` keeps receiving that literal, so narrowing on it
|
|
393
|
+
* keeps working.
|
|
394
|
+
*/
|
|
395
|
+
export type WhaleTraderSyncedEvent = WebhookEventEnvelope<"whale_trader_synced", TraderSyncedData>;
|
|
279
396
|
export type LargePositionsUpdatedEvent = WebhookEventEnvelope<"large_positions_updated", LargePositionsUpdatedData>;
|
|
280
397
|
export type WalletGradeChangedEvent = WebhookEventEnvelope<"wallet_grade_changed", WalletGradeChangedData>;
|
|
281
398
|
export type SuspiciousTradeFlaggedEvent = WebhookEventEnvelope<"suspicious_trade_flagged", SuspiciousTradeFlaggedData>;
|
|
@@ -311,12 +428,18 @@ export type ExportJobCancelledEvent = WebhookEventEnvelope<"export_job_cancelled
|
|
|
311
428
|
* `SuspiciousTradeFlaggedEvent` and `InsiderRadarFlagRaisedEvent` are both
|
|
312
429
|
* members because the same event is delivered under whichever spelling the
|
|
313
430
|
* endpoint registered (#16301); the `data` shape is identical. So are
|
|
314
|
-
* `SharpMoneyFlowDetectedEvent` and `SmartMoneyFlowDetectedEvent` (#16308)
|
|
431
|
+
* `SharpMoneyFlowDetectedEvent` and `SmartMoneyFlowDetectedEvent` (#16308),
|
|
432
|
+
* `LargeTradesInsertedEvent` and `WhaleTradesInsertedEvent`, and
|
|
433
|
+
* `TraderSyncedEvent` and `WhaleTraderSyncedEvent` (#16304).
|
|
434
|
+
*
|
|
435
|
+
* One member for every name in `WEBHOOK_EVENT_TYPES`; the `satisfies` on that
|
|
436
|
+
* list fails to compile when a name has none.
|
|
315
437
|
*/
|
|
316
|
-
export type WebhookEvent = WhaleTradesInsertedEvent | LiveSportsUpdatedEvent | WhaleTraderSyncedEvent | LargePositionsUpdatedEvent | WalletGradeChangedEvent | SuspiciousTradeFlaggedEvent | InsiderRadarFlagRaisedEvent | SharpMoneyFlowDetectedEvent | SmartMoneyFlowDetectedEvent | ExportJobReadyEvent | ExportJobFailedEvent | ExportJobExpiredEvent | ExportJobCancelledEvent;
|
|
438
|
+
export type WebhookEvent = LargeTradeInsertedV2Event | LargeTradesInsertedEvent | WhaleTradesInsertedEvent | LiveSportsUpdatedEvent | TraderSyncedEvent | WhaleTraderSyncedEvent | LargePositionsUpdatedEvent | WalletGradeChangedEvent | SuspiciousTradeFlaggedEvent | InsiderRadarFlagRaisedEvent | SharpMoneyFlowDetectedEvent | SmartMoneyFlowDetectedEvent | ExportJobReadyEvent | ExportJobFailedEvent | ExportJobExpiredEvent | ExportJobCancelledEvent;
|
|
317
439
|
/**
|
|
318
440
|
* Parse a verified raw body into the typed delivery envelope. Call only AFTER
|
|
319
441
|
* `verifySignature` passes (parsing first would let an unverified payload in).
|
|
320
442
|
*/
|
|
321
443
|
export declare function parseWebhookEvent(body: string): WebhookEvent;
|
|
444
|
+
export {};
|
|
322
445
|
//# sourceMappingURL=webhooks.d.ts.map
|
package/dist/webhooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAIH,uEAAuE;AACvE,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C,gDAAgD;AAChD,eAAO,MAAM,gBAAgB,0BAA0B,CAAC;AACxD,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,0BAA0B,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACnC,2GAA2G;IAC3G,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,+DAA+D;IAC/D,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;OAUG;IACH,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AAsB,CACvB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,GACpB,yBAAyB,GACzB,wBAAwB,GACxB,wBAAwB,GACxB,sBAAsB,GACtB,iBAAiB,GACjB,sBAAsB,GACtB,0BAA0B,GAC1B,uBAAuB,GACvB,2BAA2B,GAC3B,2BAA2B,GAC3B,2BAA2B,GAC3B,2BAA2B,GAC3B,mBAAmB,GACnB,oBAAoB,GACpB,qBAAqB,GACrB,uBAAuB,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAE5D"}
|
package/dist/webhooks.js
CHANGED
|
@@ -114,12 +114,14 @@ function constantTimeEqual(candidate, expected) {
|
|
|
114
114
|
}
|
|
115
115
|
// --- Typed webhook payloads ---
|
|
116
116
|
/**
|
|
117
|
-
* Webhook event types. Source of truth:
|
|
118
|
-
* `web/public/api/v1/openapi.json` -> components.schemas.WebhookEventType.enum
|
|
119
|
-
* `
|
|
120
|
-
* `
|
|
121
|
-
* `
|
|
122
|
-
*
|
|
117
|
+
* Webhook event types, as a runtime list. Source of truth:
|
|
118
|
+
* `web/public/api/v1/openapi.json` -> components.schemas.WebhookEventType.enum,
|
|
119
|
+
* which `schema.ts` carries as the generated `WebhookEventType` union.
|
|
120
|
+
* `large_trade_inserted_v2`, `large_trades_inserted`, `whale_trades_inserted`,
|
|
121
|
+
* `wallet_grade_changed`, `suspicious_trade_flagged`,
|
|
122
|
+
* `insider_radar_flag_raised`, `sharp_money_flow_detected`, and
|
|
123
|
+
* `smart_money_flow_detected` are Pro and Max: they deliver only to API keys
|
|
124
|
+
* on an active Pro or Max subscription.
|
|
123
125
|
*
|
|
124
126
|
* Some entries are two spellings of ONE event, not two events: either one
|
|
125
127
|
* subscribes, and an endpoint receives its deliveries under the spelling it
|
|
@@ -129,6 +131,17 @@ function constantTimeEqual(candidate, expected) {
|
|
|
129
131
|
* `insider_radar_flag_raised` (#16301), and `sharp_money_flow_detected` over
|
|
130
132
|
* `smart_money_flow_detected` (#16308). No deprecated spelling is ever
|
|
131
133
|
* removed.
|
|
134
|
+
*
|
|
135
|
+
* This list, the generated union and the typed envelopes in `WebhookEvent`
|
|
136
|
+
* are one set, and the compiler holds them equal (#24603). Each is checked as
|
|
137
|
+
* a subset of the next: `satisfies` below refuses a name with no typed
|
|
138
|
+
* envelope, the `WebhookEventEnvelope` constraint refuses an envelope for a
|
|
139
|
+
* name the contract does not have, and `WebhookEventType` refuses a contract
|
|
140
|
+
* name this list lacks. A new event type therefore fails the SDK build until
|
|
141
|
+
* it is listed here and typed below. Before that check, the list missed
|
|
142
|
+
* `large_trade_inserted_v2` for three weeks after the API began offering it.
|
|
143
|
+
*
|
|
144
|
+
* A new name goes at the end, so the index of every earlier name is unchanged.
|
|
132
145
|
*/
|
|
133
146
|
export const WEBHOOK_EVENT_TYPES = [
|
|
134
147
|
"large_trades_inserted",
|
|
@@ -150,6 +163,9 @@ export const WEBHOOK_EVENT_TYPES = [
|
|
|
150
163
|
"export_job_failed",
|
|
151
164
|
"export_job_expired",
|
|
152
165
|
"export_job_cancelled",
|
|
166
|
+
// Pro and Max. One large trade per delivery, with the trade in `data`
|
|
167
|
+
// (#16149); `large_trades_inserted` and its twin carry only a count.
|
|
168
|
+
"large_trade_inserted_v2",
|
|
153
169
|
];
|
|
154
170
|
/**
|
|
155
171
|
* Parse a verified raw body into the typed delivery envelope. Call only AFTER
|
package/dist/webhooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;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AC5E,uDAAuD;IACvD,IAAI,YAAY,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,eAAe,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC;AAED,iCAAiC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,uBAAuB;IACvB,uBAAuB;IACvB,qBAAqB;IACrB,eAAe;IACf,qBAAqB;IACrB,yBAAyB;IACzB,sBAAsB;IACtB,0BAA0B;IAC1B,2BAA2B;IAC3B,2EAA2E;IAC3E,qDAAqD;IACrD,2EAA2E;IAC3E,sDAAsD;IACtD,2BAA2B;IAC3B,2BAA2B;IAC3B,kBAAkB;IAClB,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,sEAAsE;IACtE,qEAAqE;IACrE,yBAAyB;CACyB,CAAC;AA8YrD;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAiB,CAAC;AAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xinsider/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "Official TypeScript SDK for the 0xinsider API - analytics for Polymarket sports and esports markets (REST, cursor pagination, SSE stream, webhook verification)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|