@0xinsider/mcp 2.1.0 → 2.4.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 +49 -17
- package/dist/catalog.generated.d.ts +42 -6
- package/dist/catalog.generated.d.ts.map +1 -1
- package/dist/catalog.generated.js +51 -6
- package/dist/catalog.generated.js.map +1 -1
- package/dist/cli-lib.d.ts +8 -0
- package/dist/cli-lib.d.ts.map +1 -1
- package/dist/cli-lib.js +123 -17
- package/dist/cli-lib.js.map +1 -1
- package/dist/client.d.ts +35 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +42 -4
- package/dist/client.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/product-cli/client.d.ts +3 -2
- package/dist/product-cli/client.d.ts.map +1 -1
- package/dist/product-cli/client.js.map +1 -1
- package/dist/product-cli/index.d.ts.map +1 -1
- package/dist/product-cli/index.js +3 -1
- package/dist/product-cli/index.js.map +1 -1
- package/dist/prompts/index.js +2 -2
- package/dist/sdk/client.d.ts +861 -136
- package/dist/sdk/client.d.ts.map +1 -1
- package/dist/sdk/client.js +924 -127
- package/dist/sdk/client.js.map +1 -1
- package/dist/sdk/errors.d.ts +48 -4
- package/dist/sdk/errors.d.ts.map +1 -1
- package/dist/sdk/errors.js +123 -3
- package/dist/sdk/errors.js.map +1 -1
- package/dist/sdk/index.d.ts +40 -9
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +6 -4
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/pagination.d.ts +133 -15
- package/dist/sdk/pagination.d.ts.map +1 -1
- package/dist/sdk/pagination.js +132 -34
- package/dist/sdk/pagination.js.map +1 -1
- package/dist/sdk/retry.d.ts +68 -0
- package/dist/sdk/retry.d.ts.map +1 -0
- package/dist/sdk/retry.js +125 -0
- package/dist/sdk/retry.js.map +1 -0
- package/dist/sdk/schema.d.ts +2200 -688
- package/dist/sdk/schema.d.ts.map +1 -1
- package/dist/sdk/stream.d.ts +323 -8
- package/dist/sdk/stream.d.ts.map +1 -1
- package/dist/sdk/stream.js +582 -56
- package/dist/sdk/stream.js.map +1 -1
- package/dist/sdk/webhooks.d.ts +104 -12
- package/dist/sdk/webhooks.d.ts.map +1 -1
- package/dist/sdk/webhooks.js +22 -4
- package/dist/sdk/webhooks.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +13 -2
- package/dist/server.js.map +1 -1
- package/dist/tools/explore-markets.d.ts.map +1 -1
- package/dist/tools/explore-markets.js +2 -5
- package/dist/tools/explore-markets.js.map +1 -1
- package/dist/tools/games.d.ts +5 -0
- package/dist/tools/games.d.ts.map +1 -0
- package/dist/tools/games.js +103 -0
- package/dist/tools/games.js.map +1 -0
- package/dist/tools/get-insider-radar.d.ts.map +1 -1
- package/dist/tools/get-insider-radar.js +11 -40
- package/dist/tools/get-insider-radar.js.map +1 -1
- package/dist/tools/get-large-positions.d.ts.map +1 -1
- package/dist/tools/get-large-positions.js +3 -10
- package/dist/tools/get-large-positions.js.map +1 -1
- package/dist/tools/get-leaderboard.d.ts.map +1 -1
- package/dist/tools/get-leaderboard.js +23 -12
- package/dist/tools/get-leaderboard.js.map +1 -1
- package/dist/tools/get-market-intel.d.ts.map +1 -1
- package/dist/tools/get-market-intel.js +3 -6
- package/dist/tools/get-market-intel.js.map +1 -1
- package/dist/tools/get-position-timeline.d.ts.map +1 -1
- package/dist/tools/get-position-timeline.js +3 -10
- package/dist/tools/get-position-timeline.js.map +1 -1
- package/dist/tools/get-positions.d.ts +2 -0
- package/dist/tools/get-positions.d.ts.map +1 -1
- package/dist/tools/get-positions.js +8 -11
- package/dist/tools/get-positions.js.map +1 -1
- package/dist/tools/get-suspicious-trades.d.ts +26 -0
- package/dist/tools/get-suspicious-trades.d.ts.map +1 -0
- package/dist/tools/get-suspicious-trades.js +91 -0
- package/dist/tools/get-suspicious-trades.js.map +1 -0
- package/dist/tools/get-trader-pnl.d.ts.map +1 -1
- package/dist/tools/get-trader-pnl.js +3 -6
- package/dist/tools/get-trader-pnl.js.map +1 -1
- package/dist/tools/get-trader.d.ts.map +1 -1
- package/dist/tools/get-trader.js +3 -6
- package/dist/tools/get-trader.js.map +1 -1
- package/dist/tools/get-trending-wallets.d.ts.map +1 -1
- package/dist/tools/get-trending-wallets.js +3 -10
- package/dist/tools/get-trending-wallets.js.map +1 -1
- package/dist/tools/get-whale-trades.d.ts +2 -0
- package/dist/tools/get-whale-trades.d.ts.map +1 -1
- package/dist/tools/get-whale-trades.js +21 -16
- package/dist/tools/get-whale-trades.js.map +1 -1
- package/dist/tools/pick-of-the-day.d.ts.map +1 -1
- package/dist/tools/pick-of-the-day.js +5 -21
- package/dist/tools/pick-of-the-day.js.map +1 -1
- package/dist/tools/read-parity.d.ts +8 -0
- package/dist/tools/read-parity.d.ts.map +1 -1
- package/dist/tools/read-parity.js +125 -77
- package/dist/tools/read-parity.js.map +1 -1
- package/dist/tools/result.d.ts +31 -0
- package/dist/tools/result.d.ts.map +1 -0
- package/dist/tools/result.js +70 -0
- package/dist/tools/result.js.map +1 -0
- package/dist/tools/search-markets.d.ts.map +1 -1
- package/dist/tools/search-markets.js +16 -11
- package/dist/tools/search-markets.js.map +1 -1
- package/package.json +4 -4
package/dist/sdk/client.d.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* - Extra typed convenience methods for list/candle/webhook-event/stream
|
|
20
20
|
* surfaces and a typed `Grade` enum.
|
|
21
21
|
*/
|
|
22
|
-
import type { OperationData,
|
|
22
|
+
import type { OperationBody, OperationData, OperationPath, OperationQuery, OperationResponse, ResponseMeta } from "./schema.js";
|
|
23
23
|
/**
|
|
24
24
|
* The envelope `meta` as THIS client hands it to a caller: everything the
|
|
25
25
|
* contract declares (`ResponseMeta`), plus `etag`.
|
|
@@ -34,21 +34,88 @@ import type { OperationData, PickOfTheDay, PickOfTheDayArchive, PickOfTheDayLedg
|
|
|
34
34
|
export type ClientResponseMeta = ResponseMeta & {
|
|
35
35
|
/** Lifted from the `ETag` response header by this client. */
|
|
36
36
|
etag?: string;
|
|
37
|
+
/**
|
|
38
|
+
* `true` when the response carried `X-Oxi-Sandbox: true`, which every
|
|
39
|
+
* response of the sandbox server does and no production response does.
|
|
40
|
+
* Lifted from the header by this client (#16138); absent otherwise.
|
|
41
|
+
*/
|
|
42
|
+
sandbox?: true;
|
|
43
|
+
/**
|
|
44
|
+
* HTTP status of the success response, set by this client (#16137).
|
|
45
|
+
* `201` on `registerAgent`, `202` on a `submitTraderExport` that queued a
|
|
46
|
+
* new job, `200` everywhere else.
|
|
47
|
+
*/
|
|
48
|
+
status?: number;
|
|
49
|
+
/** Unknown query names reported by the server in compatibility mode. */
|
|
50
|
+
queryIgnored?: string;
|
|
51
|
+
/** Normalized query names and values the server actually applied. */
|
|
52
|
+
effectiveQuery?: string;
|
|
37
53
|
};
|
|
38
54
|
export type ApiClientMethod = "GET" | "POST" | "PATCH" | "DELETE";
|
|
39
55
|
/** Whether an operation requires the `oxi_sk_*` Bearer key. */
|
|
40
56
|
export type AuthMode = "none" | "bearer";
|
|
57
|
+
/**
|
|
58
|
+
* How an operation carries its success body, which decides the method that
|
|
59
|
+
* can read it (#16137). Before this, every row was assumed to answer the
|
|
60
|
+
* JSON envelope, so `call()` parsed Markdown as JSON and then rejected it as
|
|
61
|
+
* a bad 200.
|
|
62
|
+
*
|
|
63
|
+
* - `envelope` (the default, and every row that omits `kind`): a JSON
|
|
64
|
+
* `{ object, data, meta }` body -> `call()` and `list()`.
|
|
65
|
+
* - `text`: a `text/*` body -> `text()`. The two `context.md` reads.
|
|
66
|
+
* - `jsonrpc`: a JSON-RPC 2.0 response, or an empty `202` for a
|
|
67
|
+
* notification -> `mcp()`. `POST /api/v1/mcp`.
|
|
68
|
+
* - `sse`: an open-ended `text/event-stream` -> `streamFeed()` and the
|
|
69
|
+
* other consumers in `stream.ts`. Buffering one with `call()` or `text()`
|
|
70
|
+
* would never return, so both refuse it.
|
|
71
|
+
*
|
|
72
|
+
* `scripts/check-sdk-openapi-drift.mjs` derives the same kind from each
|
|
73
|
+
* operation's documented success media type and schema and fails on a row
|
|
74
|
+
* that disagrees, so a route that changes shape cannot keep a stale kind.
|
|
75
|
+
*/
|
|
76
|
+
export type ResponseKind = "envelope" | "text" | "jsonrpc" | "sse";
|
|
41
77
|
export interface ApiClientOperation {
|
|
42
78
|
readonly method: ApiClientMethod;
|
|
43
79
|
readonly path: string;
|
|
44
80
|
readonly operationId: string;
|
|
45
81
|
readonly auth: AuthMode;
|
|
82
|
+
/** How the success body is carried; absent means `"envelope"`. */
|
|
83
|
+
readonly kind?: ResponseKind;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A published operation whose success is a REDIRECT, so it has no success
|
|
87
|
+
* body and cannot go through `call()` (#16137). Declared here rather than
|
|
88
|
+
* omitted in silence: the drift check requires every redirect-only spec
|
|
89
|
+
* operation to appear in `REDIRECT_OPERATIONS` with the method that follows
|
|
90
|
+
* it, so "the SDK cannot do this" is never the same as "nobody noticed".
|
|
91
|
+
*/
|
|
92
|
+
export interface ApiRedirectOperation {
|
|
93
|
+
readonly method: ApiClientMethod;
|
|
94
|
+
readonly path: string;
|
|
95
|
+
readonly operationId: string;
|
|
96
|
+
readonly auth: AuthMode;
|
|
97
|
+
/** The documented redirect status. */
|
|
98
|
+
readonly status: number;
|
|
99
|
+
/** How a caller reaches it through this package. */
|
|
100
|
+
readonly handledBy: string;
|
|
101
|
+
}
|
|
102
|
+
/** A published operation this client deliberately does not wrap. */
|
|
103
|
+
export interface ApiUnsupportedOperation {
|
|
104
|
+
readonly method: ApiClientMethod;
|
|
105
|
+
readonly path: string;
|
|
106
|
+
readonly operationId: string;
|
|
107
|
+
/** Why there is no method, and what to use instead. */
|
|
108
|
+
readonly reason: string;
|
|
46
109
|
}
|
|
47
110
|
/**
|
|
48
|
-
* The full V1 operation table. One row per OpenAPI operation
|
|
49
|
-
*
|
|
50
|
-
* `
|
|
51
|
-
*
|
|
111
|
+
* The full V1 operation table. One row per OpenAPI operation with a
|
|
112
|
+
* documented 2xx, which since #16137 includes the `201`-only
|
|
113
|
+
* `registerAgent`; `kind` says which method reads its body. Kept in lockstep
|
|
114
|
+
* with `web/public/api/v1/openapi.json` by
|
|
115
|
+
* `scripts/check-sdk-openapi-drift.mjs`, which also checks every row's kind
|
|
116
|
+
* against the spec. Do not add a row without a matching spec operation, and
|
|
117
|
+
* do not remove a spec operation without removing its row. A redirect-only
|
|
118
|
+
* operation belongs in `REDIRECT_OPERATIONS` below, not here.
|
|
52
119
|
*/
|
|
53
120
|
export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
54
121
|
readonly method: "GET";
|
|
@@ -95,6 +162,11 @@ export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
|
95
162
|
readonly path: "/api/v1/trader/{address}/pnl";
|
|
96
163
|
readonly operationId: "getTraderPnl";
|
|
97
164
|
readonly auth: "bearer";
|
|
165
|
+
}, {
|
|
166
|
+
readonly method: "GET";
|
|
167
|
+
readonly path: "/api/v1/trader/{address}/categories";
|
|
168
|
+
readonly operationId: "getTraderCategoryRecords";
|
|
169
|
+
readonly auth: "bearer";
|
|
98
170
|
}, {
|
|
99
171
|
readonly method: "GET";
|
|
100
172
|
readonly path: "/api/v1/trader/{address}/context";
|
|
@@ -105,6 +177,7 @@ export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
|
105
177
|
readonly path: "/api/v1/trader/{address}/context.md";
|
|
106
178
|
readonly operationId: "getTraderContextMarkdown";
|
|
107
179
|
readonly auth: "bearer";
|
|
180
|
+
readonly kind: "text";
|
|
108
181
|
}, {
|
|
109
182
|
readonly method: "POST";
|
|
110
183
|
readonly path: "/api/v1/trader/{address}/export";
|
|
@@ -120,6 +193,16 @@ export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
|
120
193
|
readonly path: "/api/v1/leaderboard/trending";
|
|
121
194
|
readonly operationId: "listTrendingWallets";
|
|
122
195
|
readonly auth: "bearer";
|
|
196
|
+
}, {
|
|
197
|
+
readonly method: "GET";
|
|
198
|
+
readonly path: "/api/v1/sports/pre-game-sides";
|
|
199
|
+
readonly operationId: "listPreGameSides";
|
|
200
|
+
readonly auth: "bearer";
|
|
201
|
+
}, {
|
|
202
|
+
readonly method: "GET";
|
|
203
|
+
readonly path: "/api/v1/sports/pre-game-side-observations";
|
|
204
|
+
readonly operationId: "listPreGameSideObservations";
|
|
205
|
+
readonly auth: "bearer";
|
|
123
206
|
}, {
|
|
124
207
|
readonly method: "GET";
|
|
125
208
|
readonly path: "/api/v1/sports-edge-signals";
|
|
@@ -130,6 +213,41 @@ export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
|
130
213
|
readonly path: "/api/v1/sports-edge-observations";
|
|
131
214
|
readonly operationId: "listSportsEdgeObservations";
|
|
132
215
|
readonly auth: "bearer";
|
|
216
|
+
}, {
|
|
217
|
+
readonly method: "GET";
|
|
218
|
+
readonly path: "/api/v1/games";
|
|
219
|
+
readonly operationId: "listGames";
|
|
220
|
+
readonly auth: "bearer";
|
|
221
|
+
}, {
|
|
222
|
+
readonly method: "GET";
|
|
223
|
+
readonly path: "/api/v1/games/{event_slug}";
|
|
224
|
+
readonly operationId: "getGame";
|
|
225
|
+
readonly auth: "bearer";
|
|
226
|
+
}, {
|
|
227
|
+
readonly method: "GET";
|
|
228
|
+
readonly path: "/api/v1/large-trades";
|
|
229
|
+
readonly operationId: "listLargeTrades";
|
|
230
|
+
readonly auth: "bearer";
|
|
231
|
+
}, {
|
|
232
|
+
readonly method: "GET";
|
|
233
|
+
readonly path: "/api/v1/large-trades/history";
|
|
234
|
+
readonly operationId: "listLargeTradeHistory";
|
|
235
|
+
readonly auth: "bearer";
|
|
236
|
+
}, {
|
|
237
|
+
readonly method: "GET";
|
|
238
|
+
readonly path: "/api/v1/large-trades/{id}/counterparties/executions";
|
|
239
|
+
readonly operationId: "listLargeTradeCounterpartyExecutions";
|
|
240
|
+
readonly auth: "bearer";
|
|
241
|
+
}, {
|
|
242
|
+
readonly method: "GET";
|
|
243
|
+
readonly path: "/api/v1/large-trades/{id}/counterparties/executions/{execution_id}/makers";
|
|
244
|
+
readonly operationId: "listLargeTradeCounterpartyMakers";
|
|
245
|
+
readonly auth: "bearer";
|
|
246
|
+
}, {
|
|
247
|
+
readonly method: "GET";
|
|
248
|
+
readonly path: "/api/v1/large-trades/{id}";
|
|
249
|
+
readonly operationId: "getLargeTrade";
|
|
250
|
+
readonly auth: "bearer";
|
|
133
251
|
}, {
|
|
134
252
|
readonly method: "GET";
|
|
135
253
|
readonly path: "/api/v1/whale-trades";
|
|
@@ -190,6 +308,11 @@ export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
|
190
308
|
readonly path: "/api/v1/platforms";
|
|
191
309
|
readonly operationId: "getPlatforms";
|
|
192
310
|
readonly auth: "none";
|
|
311
|
+
}, {
|
|
312
|
+
readonly method: "GET";
|
|
313
|
+
readonly path: "/api/v1/market/{condition_id}/holders";
|
|
314
|
+
readonly operationId: "getMarketHolders";
|
|
315
|
+
readonly auth: "bearer";
|
|
193
316
|
}, {
|
|
194
317
|
readonly method: "GET";
|
|
195
318
|
readonly path: "/api/v1/market/{condition_id}/intel";
|
|
@@ -210,11 +333,22 @@ export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
|
210
333
|
readonly path: "/api/v1/market/{condition_id}/context.md";
|
|
211
334
|
readonly operationId: "getMarketContextMarkdown";
|
|
212
335
|
readonly auth: "bearer";
|
|
336
|
+
readonly kind: "text";
|
|
213
337
|
}, {
|
|
214
338
|
readonly method: "GET";
|
|
215
339
|
readonly path: "/api/v1/market/{condition_id}/candles";
|
|
216
340
|
readonly operationId: "getMarketCandles";
|
|
217
341
|
readonly auth: "bearer";
|
|
342
|
+
}, {
|
|
343
|
+
readonly method: "GET";
|
|
344
|
+
readonly path: "/api/v1/suspicious-trades";
|
|
345
|
+
readonly operationId: "listSuspiciousTrades";
|
|
346
|
+
readonly auth: "bearer";
|
|
347
|
+
}, {
|
|
348
|
+
readonly method: "GET";
|
|
349
|
+
readonly path: "/api/v1/suspicious-trades/{id}";
|
|
350
|
+
readonly operationId: "getSuspiciousTrade";
|
|
351
|
+
readonly auth: "bearer";
|
|
218
352
|
}, {
|
|
219
353
|
readonly method: "GET";
|
|
220
354
|
readonly path: "/api/v1/insider-radar";
|
|
@@ -235,6 +369,7 @@ export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
|
235
369
|
readonly path: "/api/v1/stream";
|
|
236
370
|
readonly operationId: "getStream";
|
|
237
371
|
readonly auth: "bearer";
|
|
372
|
+
readonly kind: "sse";
|
|
238
373
|
}, {
|
|
239
374
|
readonly method: "GET";
|
|
240
375
|
readonly path: "/api/v1/webhooks";
|
|
@@ -270,6 +405,21 @@ export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
|
270
405
|
readonly path: "/api/v1/webhooks/{id}/rotate-secret";
|
|
271
406
|
readonly operationId: "rotateWebhookSecret";
|
|
272
407
|
readonly auth: "bearer";
|
|
408
|
+
}, {
|
|
409
|
+
readonly method: "POST";
|
|
410
|
+
readonly path: "/api/v1/webhooks/{id}/rotate-secret/prepare";
|
|
411
|
+
readonly operationId: "prepareWebhookSecret";
|
|
412
|
+
readonly auth: "bearer";
|
|
413
|
+
}, {
|
|
414
|
+
readonly method: "POST";
|
|
415
|
+
readonly path: "/api/v1/webhooks/{id}/rotate-secret/activate";
|
|
416
|
+
readonly operationId: "activateWebhookSecret";
|
|
417
|
+
readonly auth: "bearer";
|
|
418
|
+
}, {
|
|
419
|
+
readonly method: "POST";
|
|
420
|
+
readonly path: "/api/v1/webhooks/{id}/rotate-secret/retire";
|
|
421
|
+
readonly operationId: "retireWebhookSecret";
|
|
422
|
+
readonly auth: "bearer";
|
|
273
423
|
}, {
|
|
274
424
|
readonly method: "GET";
|
|
275
425
|
readonly path: "/api/v1/webhooks/events";
|
|
@@ -295,11 +445,7 @@ export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
|
295
445
|
readonly path: "/api/v1/mcp";
|
|
296
446
|
readonly operationId: "createMcpJsonRpcResponse";
|
|
297
447
|
readonly auth: "bearer";
|
|
298
|
-
|
|
299
|
-
readonly method: "GET";
|
|
300
|
-
readonly path: "/api/v1/mcp";
|
|
301
|
-
readonly operationId: "openMcpEventStream";
|
|
302
|
-
readonly auth: "bearer";
|
|
448
|
+
readonly kind: "jsonrpc";
|
|
303
449
|
}, {
|
|
304
450
|
readonly method: "GET";
|
|
305
451
|
readonly path: "/api/v1/reports";
|
|
@@ -344,9 +490,94 @@ export declare const API_CLIENT_OPERATIONS: readonly [{
|
|
|
344
490
|
readonly method: "GET";
|
|
345
491
|
readonly path: "/api/v1/pick-of-the-day/ledger";
|
|
346
492
|
readonly operationId: "getPickOfTheDayLedger";
|
|
347
|
-
readonly auth: "
|
|
493
|
+
readonly auth: "none";
|
|
494
|
+
}, {
|
|
495
|
+
readonly method: "POST";
|
|
496
|
+
readonly path: "/api/v1/agents/register";
|
|
497
|
+
readonly operationId: "registerAgent";
|
|
498
|
+
readonly auth: "none";
|
|
348
499
|
}];
|
|
349
500
|
export type ApiOperationId = (typeof API_CLIENT_OPERATIONS)[number]["operationId"];
|
|
501
|
+
/** Operations whose success body is a `text/*` document; read with `text()`. */
|
|
502
|
+
export type TextOperationId = Extract<(typeof API_CLIENT_OPERATIONS)[number], {
|
|
503
|
+
kind: "text";
|
|
504
|
+
}>["operationId"];
|
|
505
|
+
/** Operations whose success body is JSON-RPC 2.0; read with `mcp()`. */
|
|
506
|
+
export type JsonRpcOperationId = Extract<(typeof API_CLIENT_OPERATIONS)[number], {
|
|
507
|
+
kind: "jsonrpc";
|
|
508
|
+
}>["operationId"];
|
|
509
|
+
/** Operations whose success body is an open SSE stream; read through `stream.ts`. */
|
|
510
|
+
export type SseOperationId = Extract<(typeof API_CLIENT_OPERATIONS)[number], {
|
|
511
|
+
kind: "sse";
|
|
512
|
+
}>["operationId"];
|
|
513
|
+
/**
|
|
514
|
+
* Published operations whose success is a redirect, with the method that
|
|
515
|
+
* follows it (#16137). These have no 2xx body, so they are absent from
|
|
516
|
+
* `API_CLIENT_OPERATIONS` and from the generated `schema.ts`;
|
|
517
|
+
* `scripts/check-sdk-openapi-drift.mjs` requires every redirect-only spec
|
|
518
|
+
* operation to be declared here, so one cannot go missing in silence again.
|
|
519
|
+
*/
|
|
520
|
+
export declare const REDIRECT_OPERATIONS: readonly [{
|
|
521
|
+
readonly method: "GET";
|
|
522
|
+
readonly path: "/api/v1/trader/{address}/export/download";
|
|
523
|
+
readonly operationId: "downloadTraderExport";
|
|
524
|
+
readonly auth: "bearer";
|
|
525
|
+
readonly status: 302;
|
|
526
|
+
readonly handledBy: "getTraderExportDownloadUrl() resolves the Location; downloadTraderExport() then fetches the object with no Authorization header.";
|
|
527
|
+
}, {
|
|
528
|
+
readonly method: "GET";
|
|
529
|
+
readonly path: "/api/v1/openapi.json";
|
|
530
|
+
readonly operationId: "redirectApiOpenapiSpec";
|
|
531
|
+
readonly auth: "none";
|
|
532
|
+
readonly status: 307;
|
|
533
|
+
readonly handledBy: "No method: the document is public and static, so fetch the URL directly and let your runtime follow the redirect. This package ships the same contract as generated types in schema.ts.";
|
|
534
|
+
}];
|
|
535
|
+
/**
|
|
536
|
+
* Published operations this client deliberately does not wrap, with the
|
|
537
|
+
* reason. The drift check requires every remaining spec operation to be
|
|
538
|
+
* accounted for here, so "unsupported" is always a stated decision.
|
|
539
|
+
*/
|
|
540
|
+
export declare const UNSUPPORTED_OPERATIONS: readonly [{
|
|
541
|
+
readonly method: "GET";
|
|
542
|
+
readonly path: "/api/v1/mcp";
|
|
543
|
+
readonly operationId: "openMcpEventStream";
|
|
544
|
+
readonly reason: "The MCP endpoint offers no server-to-client stream: GET answers 405 by design, so a client that reconnects to it would loop (#16354). Post JSON-RPC with mcp() instead.";
|
|
545
|
+
}];
|
|
546
|
+
/**
|
|
547
|
+
* The writes the API replays under `Idempotency-Key`: a second request with
|
|
548
|
+
* the same key and the same body returns the first result instead of
|
|
549
|
+
* repeating the write. Source of truth: the operations declaring the
|
|
550
|
+
* `Idempotency-Key` header parameter in `web/public/api/v1/openapi.json`,
|
|
551
|
+
* pinned by `scripts/check-sdk-openapi-drift.mjs` (#16182). Only these are
|
|
552
|
+
* retried on a transport or 5xx failure, and only when a key is set; a key on
|
|
553
|
+
* any other operation is refused before the request, since the server would
|
|
554
|
+
* ignore it and a retry could repeat the side effect (`verifyWebhook` sends
|
|
555
|
+
* a challenge to your URL each time; `submitTraderExport` starts a job).
|
|
556
|
+
*/
|
|
557
|
+
export declare const IDEMPOTENT_WRITE_OPERATIONS: readonly ["createWebhook", "updateWebhook", "deleteWebhook", "rotateWebhookSecret", "prepareWebhookSecret", "activateWebhookSecret", "retireWebhookSecret", "redeliverWebhookDelivery"];
|
|
558
|
+
export type IdempotentWriteOperationId = (typeof IDEMPOTENT_WRITE_OPERATIONS)[number];
|
|
559
|
+
/**
|
|
560
|
+
* POST operations that read and never write (#16182): the batch lookups.
|
|
561
|
+
* `POST /api/v1/traders/batch` and `POST /api/v1/markets/intel/batch` resolve
|
|
562
|
+
* their inputs and store nothing (`backend/src/api_v1/handlers/batch.rs`), so
|
|
563
|
+
* a repeat cannot duplicate a side effect. Each attempt is one request
|
|
564
|
+
* against the account's quota and one reservation of batch item units, which
|
|
565
|
+
* is exactly what a retried GET costs, so they are retried like a GET. Every
|
|
566
|
+
* other POST, PATCH or DELETE is retried only as a keyed write above.
|
|
567
|
+
*/
|
|
568
|
+
export declare const READ_ONLY_POST_OPERATIONS: readonly ["batchGetTraders", "batchGetMarketIntel"];
|
|
569
|
+
/**
|
|
570
|
+
* How `call()` may repeat an operation that failed with 429, 502, 503, 504 or
|
|
571
|
+
* a network error before any response (#16182):
|
|
572
|
+
* - `"read"`: a GET or a read-only POST, repeated without conditions.
|
|
573
|
+
* - `"keyed"`: an `IDEMPOTENT_WRITE_OPERATIONS` member, repeated only when
|
|
574
|
+
* the request carries an `Idempotency-Key`, with the same key and the same
|
|
575
|
+
* bytes on every attempt.
|
|
576
|
+
* - `"never"`: any other write; the first failure is thrown.
|
|
577
|
+
*/
|
|
578
|
+
export type RetryEligibility = "read" | "keyed" | "never";
|
|
579
|
+
/** The retry class of an operation; see `RetryEligibility`. */
|
|
580
|
+
export declare function retryEligibility(operation: Pick<ApiClientOperation, "method" | "operationId">): RetryEligibility;
|
|
350
581
|
/**
|
|
351
582
|
* Trader skill grade. Source of truth:
|
|
352
583
|
* `components.schemas.Trader.properties.grade.enum` (S highest, F lowest).
|
|
@@ -359,6 +590,8 @@ export interface ApiRequestOptions {
|
|
|
359
590
|
query?: Record<string, ApiQueryValue>;
|
|
360
591
|
body?: unknown;
|
|
361
592
|
headers?: Record<string, string>;
|
|
593
|
+
/** Reject query names the operation does not publish before it runs. */
|
|
594
|
+
strictQuery?: boolean;
|
|
362
595
|
/** Cooperative cancellation; composed with the request deadline. */
|
|
363
596
|
signal?: AbortSignal;
|
|
364
597
|
/**
|
|
@@ -373,22 +606,46 @@ export interface ApiRequestOptions {
|
|
|
373
606
|
*/
|
|
374
607
|
maxRetries?: number;
|
|
375
608
|
/**
|
|
376
|
-
* Sent as the `Idempotency-Key` header.
|
|
377
|
-
* `
|
|
378
|
-
* `
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
609
|
+
* Sent as the `Idempotency-Key` header. Accepted only on the
|
|
610
|
+
* `IDEMPOTENT_WRITE_OPERATIONS` (`createWebhook`, `updateWebhook`,
|
|
611
|
+
* `deleteWebhook`, `rotateWebhookSecret`, `prepareWebhookSecret`,
|
|
612
|
+
* `activateWebhookSecret`, `retireWebhookSecret`, `redeliverWebhookDelivery`),
|
|
613
|
+
* where a replay with the same key and body returns the first result
|
|
614
|
+
* instead of repeating the write; on any other operation `call()` throws
|
|
615
|
+
* before sending, since the server would ignore the key (#16182). A keyed
|
|
616
|
+
* write is the only non-read request the SDK retries, always with the
|
|
617
|
+
* same key and the same body bytes. On `IdempotencyInProgressError`, or
|
|
618
|
+
* when the outcome is unknown after a timeout or exhausted retries, send
|
|
619
|
+
* the SAME key and body again to learn what happened; never mint a new key
|
|
620
|
+
* for the same intent.
|
|
382
621
|
*/
|
|
383
622
|
idempotencyKey?: string;
|
|
384
623
|
}
|
|
385
624
|
export interface ApiClientOptions {
|
|
386
625
|
/**
|
|
387
|
-
*
|
|
626
|
+
* The server URL, one of the `servers` in the OpenAPI document:
|
|
627
|
+
* `https://api.0xinsider.com` (the default) or
|
|
628
|
+
* `https://0xinsider.com/sandbox`. A path on it is kept, so every operation
|
|
629
|
+
* path (`/api/v1/...`) is appended after it (#16138: the path used to be
|
|
630
|
+
* discarded, which sent a sandbox client to the live host). Trailing slashes
|
|
631
|
+
* are trimmed, and a trailing `/api/v1` is removed once, since the operation
|
|
632
|
+
* paths carry it.
|
|
388
633
|
*/
|
|
389
634
|
baseUrl?: string;
|
|
390
|
-
/**
|
|
635
|
+
/**
|
|
636
|
+
* The `oxi_sk_live_*` secret API key, or a sandbox key (`oxi_sk_test_*`)
|
|
637
|
+
* when `sandbox` is set.
|
|
638
|
+
*/
|
|
391
639
|
apiKey?: string;
|
|
640
|
+
/**
|
|
641
|
+
* Explicit sandbox mode (#16138). `baseUrl` defaults to
|
|
642
|
+
* `SANDBOX_BASE_URL` (`https://0xinsider.com/sandbox`), every operation is
|
|
643
|
+
* allowed without a key, since the sandbox needs no credential, and a live
|
|
644
|
+
* key (`oxi_sk_live_*`) is refused by the constructor so it is never sent
|
|
645
|
+
* there. A sandbox key from `POST /api/v1/agents/register` is optional and
|
|
646
|
+
* is sent when given. `OxinsiderApiClient.sandbox()` builds one.
|
|
647
|
+
*/
|
|
648
|
+
sandbox?: boolean;
|
|
392
649
|
/** Override the global `fetch` (e.g. for testing or a proxy agent). */
|
|
393
650
|
fetch?: typeof fetch;
|
|
394
651
|
/**
|
|
@@ -402,13 +659,18 @@ export interface ApiClientOptions {
|
|
|
402
659
|
* How many times a failed idempotent request is retried (#14281). Default
|
|
403
660
|
* `DEFAULT_MAX_RETRIES` (2); `0` disables retries.
|
|
404
661
|
*
|
|
405
|
-
* Retried: a GET,
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
662
|
+
* Retried: a GET, a read-only POST (`READ_ONLY_POST_OPERATIONS`), or an
|
|
663
|
+
* `IDEMPOTENT_WRITE_OPERATIONS` write carrying an `Idempotency-Key`, that
|
|
664
|
+
* failed with 408, 429, 502, 503, 504, or a network error before any
|
|
665
|
+
* response (`retryEligibility`, #16182). A 408 is the server's own timeout
|
|
666
|
+
* (`request_timeout`, #16146): it carries `Retry-After` on a GET, and a
|
|
667
|
+
* keyed write replays safely. The wait is the
|
|
668
|
+
* response's `Retry-After` (delta-seconds or an HTTP-date, `parseRetryAfter`)
|
|
669
|
+
* plus up to 250 ms of jitter when present, otherwise a jittered exponential
|
|
670
|
+
* backoff from 500 ms capped at 8 s. A `Retry-After` longer than
|
|
671
|
+
* `RETRY_AFTER_CEILING_MS` (60 s) is not waited out; the error is thrown so
|
|
672
|
+
* the caller can schedule it from `retryAfterSeconds` or `retryAt`. Never retried: 400, 401, 402, 403, 404, 409, 500, a write
|
|
673
|
+
* without a key, this client's own timeout, or a caller abort. A retry never starts unless it
|
|
412
674
|
* can finish inside `timeoutMs`, and a caller `AbortSignal` ends a backoff at
|
|
413
675
|
* once.
|
|
414
676
|
*/
|
|
@@ -416,6 +678,17 @@ export interface ApiClientOptions {
|
|
|
416
678
|
}
|
|
417
679
|
/** Default production API base used when `baseUrl` is omitted. */
|
|
418
680
|
export declare const DEFAULT_BASE_URL = "https://api.0xinsider.com";
|
|
681
|
+
/**
|
|
682
|
+
* The sandbox server, the second `servers` entry of the OpenAPI document: no
|
|
683
|
+
* credential, no production data, every documented operation answered with
|
|
684
|
+
* its example or a deterministic sample, `?sandbox_status=<code>` for a
|
|
685
|
+
* documented error, and `X-Oxi-Sandbox: true` on every response. The two
|
|
686
|
+
* Markdown documents answer `200 text/markdown` there and the export download
|
|
687
|
+
* answers its `302` to a sample file the sandbox serves itself. `GET
|
|
688
|
+
* /api/v1/stream` is the one operation it does not simulate and answers 400,
|
|
689
|
+
* because an SSE stream is a live connection rather than a body.
|
|
690
|
+
*/
|
|
691
|
+
export declare const SANDBOX_BASE_URL = "https://0xinsider.com/sandbox";
|
|
419
692
|
/** Default per-request deadline; see `ApiClientOptions.timeoutMs`. */
|
|
420
693
|
export declare const DEFAULT_TIMEOUT_MS = 15000;
|
|
421
694
|
/** Default retry budget; see `ApiClientOptions.maxRetries`. */
|
|
@@ -427,6 +700,14 @@ export declare const DEFAULT_MAX_RETRIES = 2;
|
|
|
427
700
|
* else throws from the constructor, before any request is sent (#11115).
|
|
428
701
|
*/
|
|
429
702
|
export declare function assertTrustedBaseUrl(baseUrl: string): URL;
|
|
703
|
+
/**
|
|
704
|
+
* Join an `/api/v1/...` path onto the server URL, keeping the server's own
|
|
705
|
+
* path (`/sandbox`) exactly once. REST (`buildUrl`) and the SSE stream
|
|
706
|
+
* (`stream.ts`) both resolve through this, so the two cannot disagree about
|
|
707
|
+
* where a path-bearing base points (#16138: `new URL("/api/v1/...", base)`
|
|
708
|
+
* resolved against the origin and dropped `/sandbox`).
|
|
709
|
+
*/
|
|
710
|
+
export declare function resolveApiUrl(baseUrl: string, path: string): URL;
|
|
430
711
|
/**
|
|
431
712
|
* One signal that aborts on the deadline OR when the caller's signal aborts.
|
|
432
713
|
* Uses native composition where available. The manual fallback removes both
|
|
@@ -469,12 +750,15 @@ export interface CategorySkillStatusCounts {
|
|
|
469
750
|
unknown: number;
|
|
470
751
|
degraded: number;
|
|
471
752
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
753
|
+
/** Query parameters accepted by {@link OxinsiderApiClient.listGames}. */
|
|
754
|
+
export type GamesListParams = OperationQuery["listGames"];
|
|
755
|
+
/** One game: both sides, its schedule, its provider status and its markets. */
|
|
756
|
+
export type { Game } from "./schema.js";
|
|
757
|
+
/** Query parameters of `GET /api/v1/sports/pre-game-sides` (#16310). */
|
|
758
|
+
export type PreGameSidesParams = OperationQuery["listPreGameSides"];
|
|
759
|
+
/** @deprecated Use {@link PreGameSidesParams} (#16310). */
|
|
760
|
+
export type SportsEdgeSignalsParams = PreGameSidesParams;
|
|
761
|
+
/** Observation cohorts exposed by `listPreGameSideObservations`. */
|
|
478
762
|
export type SportsEdgeObservationCohort = "wider_holder" | "in_play" | "emerging_pile";
|
|
479
763
|
/** Source of the provider holder snapshot used to build an observation. */
|
|
480
764
|
export type SportsEdgeObservationProviderSource = "cached" | "live";
|
|
@@ -494,23 +778,19 @@ export type SportsEdgeObservationOutcomeIndex = 0 | 1;
|
|
|
494
778
|
export type SportsEdgeObservationTopGrade = "S" | "A" | "B";
|
|
495
779
|
/** Canonical sports emitted by observation responses. */
|
|
496
780
|
export type SportsEdgeObservationSport = "Basketball" | "Football" | "Baseball" | "Hockey" | "MMA" | "Boxing" | "Soccer" | "Cricket" | "Golf" | "Tennis" | "Esports" | "Racing" | "Table Tennis" | "Pickleball";
|
|
497
|
-
/**
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
export interface SportsEdgeObservationsParams extends ListParams {
|
|
511
|
-
cohort: SportsEdgeObservationCohort;
|
|
512
|
-
category?: string;
|
|
513
|
-
}
|
|
781
|
+
/**
|
|
782
|
+
* Full list response, including the observation snapshot and accountable
|
|
783
|
+
* funnel: the operation's own envelope (#16136). `degraded` is the
|
|
784
|
+
* snapshot-wide verdict; fully accounted `capacity_limited` rows alone do
|
|
785
|
+
* not set it.
|
|
786
|
+
*/
|
|
787
|
+
export type PreGameSideObservationsResponse = OperationEnvelope<"listPreGameSideObservations">;
|
|
788
|
+
/** @deprecated Use {@link PreGameSideObservationsResponse} (#16310). */
|
|
789
|
+
export type SportsEdgeObservationsResponse = PreGameSideObservationsResponse;
|
|
790
|
+
/** Query parameters of `GET /api/v1/sports/pre-game-side-observations` (#16310). */
|
|
791
|
+
export type PreGameSideObservationsParams = OperationQuery["listPreGameSideObservations"];
|
|
792
|
+
/** @deprecated Use {@link PreGameSideObservationsParams} (#16310). */
|
|
793
|
+
export type SportsEdgeObservationsParams = PreGameSideObservationsParams;
|
|
514
794
|
/**
|
|
515
795
|
* One qualifying category expert on a Pick of the Day's backed side.
|
|
516
796
|
*
|
|
@@ -606,10 +886,178 @@ export interface ApiNotModifiedResponse {
|
|
|
606
886
|
status: 304;
|
|
607
887
|
etag?: string;
|
|
608
888
|
request_id?: string;
|
|
889
|
+
queryIgnored?: string;
|
|
890
|
+
effectiveQuery?: string;
|
|
609
891
|
[key: string]: unknown;
|
|
610
892
|
};
|
|
611
893
|
}
|
|
612
894
|
export type ApiClientResponse<T> = ApiEnvelope<T> | ApiNotModifiedResponse;
|
|
895
|
+
/** `etag`, `sandbox` and `status`, lifted by this client onto whichever `meta` the operation declares. */
|
|
896
|
+
export type ClientMeta<M> = M & {
|
|
897
|
+
/** Lifted from the `ETag` response header by this client. */
|
|
898
|
+
etag?: string;
|
|
899
|
+
/** `true` when the response carried `X-Oxi-Sandbox: true` (#16138). */
|
|
900
|
+
sandbox?: true;
|
|
901
|
+
/**
|
|
902
|
+
* The HTTP status of the success response, set by this client (#16137).
|
|
903
|
+
*
|
|
904
|
+
* Not every operation answers `200`, and the difference is the answer:
|
|
905
|
+
* `registerAgent` answers `201`, and `submitTraderExport` answers `202`
|
|
906
|
+
* when it queued a new job and `200` when it returned one that already
|
|
907
|
+
* existed. The envelope body is the same shape either way, so without this
|
|
908
|
+
* a caller could not tell a fresh job from a replayed one.
|
|
909
|
+
*/
|
|
910
|
+
status?: number;
|
|
911
|
+
};
|
|
912
|
+
/** Operations whose 200 is the JSON envelope (`object`, `data`, `meta`); the two text bodies and the JSON-RPC post are not. */
|
|
913
|
+
export type EnvelopeOperationId = {
|
|
914
|
+
[K in ApiOperationId]: OperationResponse[K] extends {
|
|
915
|
+
object: string;
|
|
916
|
+
data: unknown;
|
|
917
|
+
meta: unknown;
|
|
918
|
+
} ? K : never;
|
|
919
|
+
}[ApiOperationId];
|
|
920
|
+
/** Envelope operations that page: `data` is an array and `has_more` is declared. */
|
|
921
|
+
export type ListOperationId = {
|
|
922
|
+
[K in EnvelopeOperationId]: OperationResponse[K] extends {
|
|
923
|
+
has_more: boolean;
|
|
924
|
+
data: readonly unknown[];
|
|
925
|
+
} ? K : never;
|
|
926
|
+
}[EnvelopeOperationId];
|
|
927
|
+
/** The operation's documented `meta` type. */
|
|
928
|
+
export type OperationMeta<K extends ApiOperationId> = OperationResponse[K] extends {
|
|
929
|
+
meta: infer M;
|
|
930
|
+
} ? M : never;
|
|
931
|
+
/**
|
|
932
|
+
* What a 200 resolves to: the operation's own envelope (`object` literal,
|
|
933
|
+
* `data`, every top-level field such as `has_more` or a list's `totals`) with
|
|
934
|
+
* its own `meta` type (`BatchResponseMeta` on a batch, `EventReplayMeta` on
|
|
935
|
+
* the replay, `ResponseMeta` elsewhere) plus this client's lifted `etag` and
|
|
936
|
+
* `sandbox`.
|
|
937
|
+
*/
|
|
938
|
+
export type OperationEnvelope<K extends EnvelopeOperationId> = Omit<OperationResponse[K], "meta"> & {
|
|
939
|
+
meta: ClientMeta<OperationMeta<K>>;
|
|
940
|
+
};
|
|
941
|
+
/** A `call()` result: the envelope, or the typed 304 when `If-None-Match` matched. */
|
|
942
|
+
export type OperationResult<K extends EnvelopeOperationId> = OperationEnvelope<K> | ApiNotModifiedResponse;
|
|
943
|
+
/** One item of a list operation's `data`. */
|
|
944
|
+
export type OperationItem<K extends ListOperationId> = OperationData[K] extends readonly (infer I)[] ? I : never;
|
|
945
|
+
/**
|
|
946
|
+
* `call()` options bound to one operation: `path` is required exactly when
|
|
947
|
+
* the route has path parameters, `query` is the documented query, `body` is
|
|
948
|
+
* required exactly when the operation declares a request body, and the
|
|
949
|
+
* transport options (`signal`, `timeoutMs`, `maxRetries`, `headers`,
|
|
950
|
+
* `idempotencyKey`) are the shared ones.
|
|
951
|
+
*/
|
|
952
|
+
export type OperationRequestOptions<K extends ApiOperationId> = Omit<ApiRequestOptions, "path" | "query" | "body"> & (OperationPath[K] extends Record<string, never> ? {
|
|
953
|
+
path?: OperationPath[K];
|
|
954
|
+
} : {
|
|
955
|
+
path: OperationPath[K];
|
|
956
|
+
}) & {
|
|
957
|
+
query?: OperationQuery[K];
|
|
958
|
+
} & ([
|
|
959
|
+
OperationBody[K]
|
|
960
|
+
] extends [never] ? {
|
|
961
|
+
body?: never;
|
|
962
|
+
} : {
|
|
963
|
+
body: OperationBody[K];
|
|
964
|
+
});
|
|
965
|
+
/**
|
|
966
|
+
* Whether operation `K` cannot be called without options: it has path
|
|
967
|
+
* parameters or a request body (#16643). For a union of operations it is
|
|
968
|
+
* `true` when any member needs them.
|
|
969
|
+
*/
|
|
970
|
+
export type OperationRequiresOptions<K extends ApiOperationId> = true extends (K extends ApiOperationId ? OperationPath[K] extends Record<string, never> ? [OperationBody[K]] extends [never] ? false : true : true : never) ? true : false;
|
|
971
|
+
/** The operations that can be called with no options at all. */
|
|
972
|
+
export type OptionalInputOperationId = {
|
|
973
|
+
[K in ApiOperationId]: OperationRequiresOptions<K> extends true ? never : K;
|
|
974
|
+
}[ApiOperationId];
|
|
975
|
+
/**
|
|
976
|
+
* The options argument of a typed overload (#16643): required when the
|
|
977
|
+
* operation has path parameters or a body, optional otherwise, so
|
|
978
|
+
* `client.call("createWebhook")` and `client.list("listWebhookDeliveries")`
|
|
979
|
+
* fail to compile instead of failing at the API.
|
|
980
|
+
*/
|
|
981
|
+
export type OperationOptionsArgs<K extends ApiOperationId, O> = OperationRequiresOptions<K> extends true ? [options: O] : [options?: O];
|
|
982
|
+
/**
|
|
983
|
+
* The operation id a LOOSE overload accepts (#16643). A value typed as the
|
|
984
|
+
* whole `ApiOperationId` union (an id chosen at runtime) passes; a literal
|
|
985
|
+
* passes only when the operation needs no options, so a literal with a
|
|
986
|
+
* mandatory path or body cannot fall through to the loose form without them.
|
|
987
|
+
* A caller that names the result type explicitly (`call<T>(...)`) skips the
|
|
988
|
+
* inference this relies on; the runtime still refuses a missing path
|
|
989
|
+
* parameter before any request.
|
|
990
|
+
*/
|
|
991
|
+
export type RuntimeOperationId<I extends ApiOperationId> = I & (ApiOperationId extends I ? unknown : OptionalInputOperationId);
|
|
992
|
+
/** The transport options a convenience method forwards: everything but the parts it fills itself. */
|
|
993
|
+
export type ConvenienceOptions = Omit<ApiRequestOptions, "path" | "query" | "body">;
|
|
994
|
+
/** The MCP methods `POST /api/v1/mcp` accepts, from the operation's request body. */
|
|
995
|
+
export declare const MCP_METHODS: readonly ["initialize", "notifications/initialized", "notifications/cancelled", "ping", "tools/list", "tools/call"];
|
|
996
|
+
export type McpMethod = (typeof MCP_METHODS)[number];
|
|
997
|
+
/**
|
|
998
|
+
* One JSON-RPC 2.0 message for `POST /api/v1/mcp`. `jsonrpc` defaults to
|
|
999
|
+
* `"2.0"`. Omit `id` for a notification, which answers an empty `202`.
|
|
1000
|
+
*/
|
|
1001
|
+
export interface McpJsonRpcRequest {
|
|
1002
|
+
jsonrpc?: "2.0";
|
|
1003
|
+
/** Echoed exactly in the response. Omit it on a notification. */
|
|
1004
|
+
id?: string | number | null;
|
|
1005
|
+
method: McpMethod;
|
|
1006
|
+
params?: Record<string, unknown>;
|
|
1007
|
+
}
|
|
1008
|
+
/** The JSON-RPC 2.0 response body, as the operation declares it. */
|
|
1009
|
+
export type McpJsonRpcResponse = OperationResponse["createMcpJsonRpcResponse"];
|
|
1010
|
+
/** Options for `mcp()`: the shared transport options plus the two MCP headers. */
|
|
1011
|
+
export interface McpOptions extends ConvenienceOptions {
|
|
1012
|
+
/** Sent as `Mcp-Session-Id`; use the value a previous response returned. */
|
|
1013
|
+
sessionId?: string;
|
|
1014
|
+
/**
|
|
1015
|
+
* Sent as `MCP-Protocol-Version`. Omit it and the server serves
|
|
1016
|
+
* `2025-03-26`; an unsupported revision is a `400`.
|
|
1017
|
+
*/
|
|
1018
|
+
protocolVersion?: string;
|
|
1019
|
+
}
|
|
1020
|
+
/** What `mcp()` returns: the JSON-RPC response, or the accepted notification. */
|
|
1021
|
+
export interface McpResult {
|
|
1022
|
+
/** `200` for a JSON-RPC response, `202` for an accepted notification. */
|
|
1023
|
+
status: 200 | 202;
|
|
1024
|
+
/** The JSON-RPC body, or `null` for the empty `202` a notification receives. */
|
|
1025
|
+
response: McpJsonRpcResponse | null;
|
|
1026
|
+
/** `Mcp-Session-Id`, when the server issued or echoed one. */
|
|
1027
|
+
sessionId?: string;
|
|
1028
|
+
}
|
|
1029
|
+
/** Where a finished export actually lives, from the `302`'s `Location`. */
|
|
1030
|
+
export interface TraderExportDownloadTarget {
|
|
1031
|
+
/**
|
|
1032
|
+
* The presigned object URL. It authorizes itself, so treat it as a
|
|
1033
|
+
* credential: never log it and never share it.
|
|
1034
|
+
*/
|
|
1035
|
+
url: string;
|
|
1036
|
+
/**
|
|
1037
|
+
* When the link stops working, read from the URL's own SigV4
|
|
1038
|
+
* `X-Amz-Date` and `X-Amz-Expires`. Absent when the URL does not carry
|
|
1039
|
+
* them; the API signs a one-hour link today.
|
|
1040
|
+
*/
|
|
1041
|
+
expiresAt?: string;
|
|
1042
|
+
}
|
|
1043
|
+
/** The object response, with what its headers said about the file. */
|
|
1044
|
+
export interface TraderExportDownload extends TraderExportDownloadTarget {
|
|
1045
|
+
/** Not buffered: read `response.body` as a stream. */
|
|
1046
|
+
response: Response;
|
|
1047
|
+
/** `Content-Length` of the object, or `null` when the store sent none. */
|
|
1048
|
+
contentLength: number | null;
|
|
1049
|
+
contentType: string | null;
|
|
1050
|
+
/** The filename from `Content-Disposition`, or `null`. */
|
|
1051
|
+
filename: string | null;
|
|
1052
|
+
}
|
|
1053
|
+
export interface TraderExportDownloadOptions extends ConvenienceOptions {
|
|
1054
|
+
/**
|
|
1055
|
+
* A deadline in ms for the OBJECT fetch, which has none by default: an
|
|
1056
|
+
* export can be far larger than a REST read and the 15-second default
|
|
1057
|
+
* would cut it off mid-file. `timeoutMs` still bounds the redirect.
|
|
1058
|
+
*/
|
|
1059
|
+
downloadTimeoutMs?: number | null;
|
|
1060
|
+
}
|
|
613
1061
|
/** Shared paging params accepted by Stripe-style list endpoints. */
|
|
614
1062
|
export interface ListParams {
|
|
615
1063
|
limit?: number;
|
|
@@ -620,77 +1068,267 @@ export interface ListParams {
|
|
|
620
1068
|
export declare const LEADERBOARD_STRATEGIES: readonly ["accumulator", "algo_trader", "arbitrageur", "directional", "event_driven", "market_maker", "momentum", "scalper", "speculator", "swing_trader"];
|
|
621
1069
|
export type LeaderboardStrategy = (typeof LEADERBOARD_STRATEGIES)[number];
|
|
622
1070
|
/**
|
|
623
|
-
* Query parameters for `GET /api/v1/leaderboard
|
|
624
|
-
* it only holds S, A, and B traders,
|
|
625
|
-
* instead of rejecting it
|
|
1071
|
+
* Query parameters for `GET /api/v1/leaderboard`, from the operation
|
|
1072
|
+
* (#16136). The board has no `min_grade`: it only holds S, A, and B traders,
|
|
1073
|
+
* and the backend drops an unknown query key instead of rejecting it
|
|
1074
|
+
* (#10642), which is why the type now refuses one.
|
|
626
1075
|
*/
|
|
627
|
-
export
|
|
628
|
-
category?: string;
|
|
629
|
-
strategy?: LeaderboardStrategy;
|
|
630
|
-
}
|
|
1076
|
+
export type LeaderboardListParams = OperationQuery["listLeaderboard"];
|
|
631
1077
|
/** Query parameters for `GET /api/v1/leaderboard/trending`. */
|
|
632
|
-
export
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
/** Query parameters
|
|
636
|
-
export
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
/** Query parameters
|
|
644
|
-
export
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
1078
|
+
export type TrendingWalletsParams = OperationQuery["listTrendingWallets"];
|
|
1079
|
+
/** Query parameters of the V1 large-trade list (#16304). */
|
|
1080
|
+
export type LargeTradeListParams = OperationQuery["listLargeTrades"];
|
|
1081
|
+
/** Query parameters of the V1 historical large-trade replay (#16304). */
|
|
1082
|
+
export type LargeTradeHistoryParams = OperationQuery["listLargeTradeHistory"];
|
|
1083
|
+
/** @deprecated Use {@link LargeTradeListParams} (#16304). */
|
|
1084
|
+
export type WhaleTradeListParams = OperationQuery["listWhaleTrades"];
|
|
1085
|
+
/** @deprecated Use {@link LargeTradeHistoryParams} (#16304). */
|
|
1086
|
+
export type WhaleTradeHistoryParams = OperationQuery["listWhaleTradeHistory"];
|
|
1087
|
+
/** Query parameters of `GET /api/v1/positions`. */
|
|
1088
|
+
export type PositionsListParams = OperationQuery["listPositions"];
|
|
1089
|
+
/** Query parameters of `GET /api/v1/large-positions`. */
|
|
1090
|
+
export type LargePositionsListParams = OperationQuery["listLargePositions"];
|
|
1091
|
+
/** Query parameters of the sharp-money flows read and its legacy alias. */
|
|
1092
|
+
export type SharpMoneyFlowsParams = OperationQuery["listSharpMoneyFlows"];
|
|
1093
|
+
/** Query parameters of `GET /api/v1/suspicious-trades`: `min_suspicion` and `severity`, not a grade. */
|
|
1094
|
+
export type SuspiciousTradesListParams = OperationQuery["listSuspiciousTrades"];
|
|
1095
|
+
/**
|
|
1096
|
+
* @deprecated Use `SuspiciousTradesListParams`; the Insider Radar spelling of
|
|
1097
|
+
* this contract was renamed to suspicious trades in #16301. The deprecated
|
|
1098
|
+
* `GET /api/v1/insider-radar` takes the same parameters, so this stays an
|
|
1099
|
+
* alias with no retirement date.
|
|
1100
|
+
*/
|
|
1101
|
+
export type InsiderRadarListParams = SuspiciousTradesListParams;
|
|
1102
|
+
/** Query parameters of `GET /api/v1/markets/explore`. */
|
|
1103
|
+
export type ExploreMarketsParams = OperationQuery["exploreMarkets"];
|
|
1104
|
+
/**
|
|
1105
|
+
* Body-level `expand` values of `POST /api/v1/traders/batch`. The type is the
|
|
1106
|
+
* operation's own body (`OperationBody["batchGetTraders"]["expand"]`); the
|
|
1107
|
+
* const is the same list as a runtime value for a caller that iterates it.
|
|
1108
|
+
*/
|
|
1109
|
+
export declare const BATCH_TRADER_EXPANSIONS: readonly ["strategy", "categories", "quant_metrics", "trust"];
|
|
1110
|
+
export type BatchTraderExpand = NonNullable<OperationBody["batchGetTraders"]["expand"]>[number];
|
|
1111
|
+
/**
|
|
1112
|
+
* Options for `batchGetTraders`. The body is built from the positional
|
|
1113
|
+
* `traders` array and `expand`, so `body` is not accepted here.
|
|
1114
|
+
*/
|
|
1115
|
+
export interface BatchGetTradersOptions extends ConvenienceOptions {
|
|
1116
|
+
/** Shared expand flags applied to every trader item; sent as the body's `expand`. */
|
|
1117
|
+
expand?: OperationBody["batchGetTraders"]["expand"];
|
|
650
1118
|
}
|
|
651
1119
|
export declare class OxinsiderApiClient {
|
|
652
1120
|
private readonly baseUrl;
|
|
653
1121
|
private readonly apiKey?;
|
|
1122
|
+
private readonly sandbox;
|
|
654
1123
|
private readonly fetchImpl;
|
|
655
1124
|
private readonly timeoutMs;
|
|
656
1125
|
private readonly maxRetries;
|
|
1126
|
+
/**
|
|
1127
|
+
* A client for the sandbox server (#16138): `SANDBOX_BASE_URL`, no
|
|
1128
|
+
* credential needed, example data only, never production data. The same
|
|
1129
|
+
* as `new OxinsiderApiClient({ ...options, sandbox: true })`; pass a
|
|
1130
|
+
* sandbox key (`oxi_sk_test_*`) as `apiKey` to have it checked.
|
|
1131
|
+
*
|
|
1132
|
+
* @example
|
|
1133
|
+
* const sandbox = OxinsiderApiClient.sandbox();
|
|
1134
|
+
* const board = await sandbox.listLeaderboard({ limit: 5 }); // no key
|
|
1135
|
+
* board.meta?.sandbox; // true
|
|
1136
|
+
*/
|
|
1137
|
+
static sandbox(options?: Omit<ApiClientOptions, "sandbox">): OxinsiderApiClient;
|
|
657
1138
|
constructor(options?: ApiClientOptions);
|
|
658
1139
|
/**
|
|
659
|
-
* Execute
|
|
660
|
-
* subclass on a non-2xx response, returns a typed
|
|
661
|
-
* 304, and otherwise returns the
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
1140
|
+
* Execute an envelope operation by id. Throws the matching
|
|
1141
|
+
* `OxinsiderApiError` subclass on a non-2xx response, returns a typed
|
|
1142
|
+
* `not_modified` result for a 304, and otherwise returns the operation's
|
|
1143
|
+
* own `{ object, data, meta, ... }` envelope (#16136): `path` is required
|
|
1144
|
+
* exactly when the route has path parameters, `query` and `body` are the
|
|
1145
|
+
* documented ones, and `data` and `meta` are the operation's types.
|
|
1146
|
+
*
|
|
1147
|
+
* @example
|
|
1148
|
+
* const trader = await client.call("getTrader", { path: { address } });
|
|
1149
|
+
* if (trader.object === "trader") trader.data.grade; // typed
|
|
1150
|
+
*/
|
|
1151
|
+
call<K extends EnvelopeOperationId>(operationId: K, ...options: OperationOptionsArgs<K, OperationRequestOptions<K>>): Promise<OperationResult<K>>;
|
|
1152
|
+
/**
|
|
1153
|
+
* The untyped form, for an operation chosen at runtime or a caller that
|
|
1154
|
+
* asserts the shape itself with `T`: loose `path`, `query` and `body`, and
|
|
1155
|
+
* the generic `{ object, data, meta? }` envelope back. Every convenience
|
|
1156
|
+
* method uses the typed form above; reach for this one only when the
|
|
1157
|
+
* operation id is not a literal.
|
|
1158
|
+
*/
|
|
1159
|
+
call<T = unknown, I extends ApiOperationId = ApiOperationId>(operationId: RuntimeOperationId<I>, options?: ApiRequestOptions): Promise<ApiClientResponse<T>>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Read a `text/*` operation's body as a string (#16137).
|
|
1162
|
+
*
|
|
1163
|
+
* `getTraderContextMarkdown` and `getMarketContextMarkdown` answer
|
|
1164
|
+
* `text/markdown`, which `call()` used to parse as JSON and then reject as
|
|
1165
|
+
* an invalid 200. Authentication, the request deadline, retries and the
|
|
1166
|
+
* typed error hierarchy are the same as `call()`; only the body differs.
|
|
1167
|
+
*
|
|
1168
|
+
* @example
|
|
1169
|
+
* const md = await client.text("getTraderContextMarkdown", { path: { address } });
|
|
1170
|
+
*/
|
|
1171
|
+
text<K extends TextOperationId>(operationId: K, ...options: OperationOptionsArgs<K, OperationRequestOptions<K>>): Promise<string>;
|
|
1172
|
+
/** The untyped form, for an operation id chosen at runtime. */
|
|
1173
|
+
text<I extends ApiOperationId = ApiOperationId>(operationId: RuntimeOperationId<I>, options?: ApiRequestOptions): Promise<string>;
|
|
1174
|
+
/**
|
|
1175
|
+
* Post one MCP JSON-RPC 2.0 message to `POST /api/v1/mcp` (#16137).
|
|
1176
|
+
*
|
|
1177
|
+
* The endpoint answers a JSON-RPC envelope, not the `{ object, data, meta }`
|
|
1178
|
+
* envelope every other operation uses, so `call()` refuses it. A request
|
|
1179
|
+
* (one carrying `id`) comes back as `status: 200` with `response` set; a
|
|
1180
|
+
* supported notification (no `id`) comes back as `status: 202` with
|
|
1181
|
+
* `response: null`, which is the empty body the server sends. A JSON-RPC
|
|
1182
|
+
* `error` member is a protocol-level failure and is RETURNED, not thrown:
|
|
1183
|
+
* only a non-2xx HTTP status throws, because an unknown tool is an answer
|
|
1184
|
+
* and a revoked credential is not.
|
|
1185
|
+
*
|
|
1186
|
+
* The request is never retried: `tools/call` can have an effect, and the
|
|
1187
|
+
* endpoint honours no `Idempotency-Key`.
|
|
1188
|
+
*
|
|
1189
|
+
* @example
|
|
1190
|
+
* const listed = await client.mcp({ method: "tools/list", id: 1 });
|
|
1191
|
+
* listed.response?.result;
|
|
1192
|
+
*/
|
|
1193
|
+
mcp(request: McpJsonRpcRequest, options?: McpOptions): Promise<McpResult>;
|
|
1194
|
+
/**
|
|
1195
|
+
* Resolve the presigned object URL behind `GET /api/v1/trader/{address}/export/download`
|
|
1196
|
+
* without downloading anything (#16137).
|
|
1197
|
+
*
|
|
1198
|
+
* The route answers `302` with a `Location`, which `call()` treats as an
|
|
1199
|
+
* error. This reads the redirect target and stops there, so a caller can
|
|
1200
|
+
* hand the URL to a download manager or a browser. The returned URL is a
|
|
1201
|
+
* bearer credential in itself: anyone holding it can read the file until it
|
|
1202
|
+
* expires, so do not log it.
|
|
1203
|
+
*
|
|
1204
|
+
* Browser caveat: `fetch` with `redirect: "manual"` yields an opaque
|
|
1205
|
+
* redirect whose `Location` no script can read. The method says so rather
|
|
1206
|
+
* than guessing a URL; run the download from a server runtime.
|
|
1207
|
+
*/
|
|
1208
|
+
getTraderExportDownloadUrl(address: OperationPath["getTraderExportStatus"]["address"], jobId: OperationQuery["getTraderExportStatus"]["job_id"], options?: ConvenienceOptions): Promise<TraderExportDownloadTarget>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Download a finished export (#16137): resolve the `302`, then fetch the
|
|
1211
|
+
* object store directly.
|
|
1212
|
+
*
|
|
1213
|
+
* The second request carries NO headers at all, so the live API key never
|
|
1214
|
+
* reaches the object store; the presigned URL is its own credential. The
|
|
1215
|
+
* body is not buffered -- read `response.body` as a stream and write it
|
|
1216
|
+
* where it belongs.
|
|
1217
|
+
*
|
|
1218
|
+
* There is no default deadline on the object fetch, the way `streamFeed`
|
|
1219
|
+
* has none: a multi-gigabyte export would fail the 15-second REST default
|
|
1220
|
+
* halfway through. Pass `signal` to cancel it, or `downloadTimeoutMs` for
|
|
1221
|
+
* a deadline of your own. `timeoutMs` still bounds the redirect request.
|
|
1222
|
+
*
|
|
1223
|
+
* @example
|
|
1224
|
+
* const { response, filename } = await client.downloadTraderExport(address, jobId);
|
|
1225
|
+
* await pipeline(Readable.fromWeb(response.body), createWriteStream(filename ?? "export.json"));
|
|
1226
|
+
*/
|
|
1227
|
+
downloadTraderExport(address: OperationPath["getTraderExportStatus"]["address"], jobId: OperationQuery["getTraderExportStatus"]["job_id"], options?: TraderExportDownloadOptions): Promise<TraderExportDownload>;
|
|
1228
|
+
/**
|
|
1229
|
+
* Look up an operation and refuse it when the caller reached for the wrong
|
|
1230
|
+
* reader (#16137): `call()` on a Markdown route used to fail as a bad 200.
|
|
1231
|
+
*/
|
|
1232
|
+
private resolveOperation;
|
|
1233
|
+
/**
|
|
1234
|
+
* One request pipeline for every transport: URL and headers, the retry
|
|
1235
|
+
* policy, one deadline shared by every attempt, the typed error hierarchy,
|
|
1236
|
+
* and cancellation held live through body consumption. `consume` runs
|
|
1237
|
+
* inside that window, so a slow body is still covered by the deadline and
|
|
1238
|
+
* by the caller's `signal`.
|
|
1239
|
+
*/
|
|
1240
|
+
private request;
|
|
1241
|
+
/**
|
|
1242
|
+
* Execute a Stripe-style list operation and return its own list envelope
|
|
1243
|
+
* (`data`, `has_more`, `next_cursor`, and the route's extra fields such as
|
|
1244
|
+
* `facets` or `totals`). Use `paginate()` (in `pagination.ts`) to
|
|
1245
|
+
* auto-follow `next_cursor`.
|
|
1246
|
+
*/
|
|
1247
|
+
list<K extends ListOperationId>(operationId: K, ...options: OperationOptionsArgs<K, OperationRequestOptions<K>>): Promise<OperationEnvelope<K>>;
|
|
1248
|
+
/** The untyped form; see the second `call` signature. */
|
|
1249
|
+
list<T = unknown, I extends ApiOperationId = ApiOperationId>(operationId: RuntimeOperationId<I>, options?: ApiRequestOptions): Promise<ApiListEnvelope<T>>;
|
|
1250
|
+
getTrader(address: OperationPath["getTrader"]["address"], options?: Omit<OperationRequestOptions<"getTrader">, "path">): Promise<OperationResult<"getTrader">>;
|
|
1251
|
+
getTraderPnl(address: OperationPath["getTraderPnl"]["address"], options?: Omit<OperationRequestOptions<"getTraderPnl">, "path">): Promise<OperationResult<"getTraderPnl">>;
|
|
1252
|
+
/**
|
|
1253
|
+
* Fetch one wallet's win record per canonical category.
|
|
1254
|
+
*
|
|
1255
|
+
* Counts every settled market at any position size, so it can differ from
|
|
1256
|
+
* `category_strengths` on `getTrader`, which reads the floored calibration
|
|
1257
|
+
* sample. A category under `min_decided_for_win_rate` keeps its `wins` and
|
|
1258
|
+
* `decided` with `win_rate: null` and `status: "not_enough_data"`; a category
|
|
1259
|
+
* the wallet has no settled market in is absent, which means no record rather
|
|
1260
|
+
* than a 0% record. The `Esports` record carries `games`: the wallet's record
|
|
1261
|
+
* per esports title (`LoL`, `CS2`, `Dota 2`, ...) under the same rule, named
|
|
1262
|
+
* as the holder chips name them in `category_win_rate_game`. Pass
|
|
1263
|
+
* `params.category` to filter to one bucket; a filter that reaches Esports
|
|
1264
|
+
* returns its games too.
|
|
1265
|
+
*/
|
|
1266
|
+
getTraderCategoryRecords(address: OperationPath["getTraderCategoryRecords"]["address"], params?: OperationQuery["getTraderCategoryRecords"], options?: ConvenienceOptions): Promise<OperationResult<"getTraderCategoryRecords">>;
|
|
1267
|
+
/**
|
|
1268
|
+
* Resolve 1 to 25 traders in one request (`POST /api/v1/traders/batch`).
|
|
1269
|
+
*
|
|
1270
|
+
* `traders` is sent as the request body's `traders` array, the field the
|
|
1271
|
+
* route requires: wallet addresses, usernames, `trd_` ids or integer trader
|
|
1272
|
+
* ids, resolved in input order. Until #16135 this method sent the array as
|
|
1273
|
+
* `identifiers`, a field the route does not declare, so every call was
|
|
1274
|
+
* refused for a missing `traders`. `options.expand` is sent as the body's
|
|
1275
|
+
* `expand` array and applies to every item.
|
|
1276
|
+
*
|
|
1277
|
+
* The response `data` keeps request order and one row per input, duplicates
|
|
1278
|
+
* included; a row is `status: "ok"` with `data`, or `status: "error"` with
|
|
1279
|
+
* the item's own `error` (an unknown identity is a per-item `not_found`, not
|
|
1280
|
+
* a request failure). `meta` is the batch's `BatchResponseMeta`:
|
|
1281
|
+
* `request_cost` and `rate_limit` follow the batch item quota, not the
|
|
1282
|
+
* per-request one.
|
|
1283
|
+
*/
|
|
1284
|
+
batchGetTraders(traders: OperationBody["batchGetTraders"]["traders"], options?: BatchGetTradersOptions): Promise<OperationResult<"batchGetTraders">>;
|
|
1285
|
+
/**
|
|
1286
|
+
* Resolve up to 25 markets' intel in one request
|
|
1287
|
+
* (`POST /api/v1/markets/intel/batch`); `meta` is the batch's own.
|
|
1288
|
+
*/
|
|
1289
|
+
batchGetMarketIntel(body: OperationBody["batchGetMarketIntel"], options?: ConvenienceOptions): Promise<OperationResult<"batchGetMarketIntel">>;
|
|
1290
|
+
listLeaderboard(params?: LeaderboardListParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listLeaderboard">>;
|
|
1291
|
+
listTrendingWallets(params?: TrendingWalletsParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listTrendingWallets">>;
|
|
1292
|
+
listLargeTrades(params?: LargeTradeListParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listLargeTrades">>;
|
|
1293
|
+
listLargeTradeHistory(params?: LargeTradeHistoryParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listLargeTradeHistory">>;
|
|
1294
|
+
/** @deprecated Use {@link listLargeTrades} (#16304); calls the deprecated `/api/v1/whale-trades`. */
|
|
1295
|
+
listWhaleTrades(params?: WhaleTradeListParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listWhaleTrades">>;
|
|
1296
|
+
/** @deprecated Use {@link listLargeTradeHistory} (#16304); calls the deprecated `/api/v1/whale-trades/history`. */
|
|
1297
|
+
listWhaleTradeHistory(params?: WhaleTradeHistoryParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listWhaleTradeHistory">>;
|
|
1298
|
+
listPositions(params?: PositionsListParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listPositions">>;
|
|
1299
|
+
listLargePositions(params?: LargePositionsListParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listLargePositions">>;
|
|
1300
|
+
listSmartMoneyFlows(params?: OperationQuery["listSmartMoneyFlows"], options?: ConvenienceOptions): Promise<OperationEnvelope<"listSmartMoneyFlows">>;
|
|
685
1301
|
/** Canonical alias of {@link listSmartMoneyFlows} (epic #6912). */
|
|
686
|
-
listSharpMoneyFlows
|
|
687
|
-
min_grade?: Grade;
|
|
688
|
-
}): Promise<ApiListEnvelope<T>>;
|
|
1302
|
+
listSharpMoneyFlows(params?: SharpMoneyFlowsParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listSharpMoneyFlows">>;
|
|
689
1303
|
/**
|
|
690
|
-
* List
|
|
691
|
-
*
|
|
1304
|
+
* List covered games: both sides with their provider ids and live scores, the
|
|
1305
|
+
* UTC kickoff, the provider's own status, and every linked Polymarket market
|
|
1306
|
+
* with its condition id and outcome token ids. Ordered by kickoff, then by
|
|
1307
|
+
* `event_slug`, with unscheduled games last. An unknown `sport` or `status`
|
|
1308
|
+
* returns an empty page rather than an error, and the response's `coverage`
|
|
1309
|
+
* names what this deployment serves.
|
|
692
1310
|
*/
|
|
693
|
-
|
|
1311
|
+
listGames(params?: GamesListParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listGames">>;
|
|
1312
|
+
/**
|
|
1313
|
+
* Read one game by its `event_slug`, the identity the `live_sports_updated`
|
|
1314
|
+
* webhook pulse carries. A slug outside the published coverage returns 404.
|
|
1315
|
+
*/
|
|
1316
|
+
getGame(eventSlug: OperationPath["getGame"]["event_slug"], options?: ConvenienceOptions): Promise<OperationResult<"getGame">>;
|
|
1317
|
+
/**
|
|
1318
|
+
* List upcoming games ranked by the side profitable wallets hold, with
|
|
1319
|
+
* additive, shadow-only category evidence. `category_skill` never changes
|
|
1320
|
+
* membership, ordering, or sizing. Rows carry `side`, `ranked_at`,
|
|
1321
|
+
* `backing_score` and `side_share`; the older `piled_side`,
|
|
1322
|
+
* `signal_created_at`, `conviction_score` and `smart_score` keys carry the
|
|
1323
|
+
* same values and stay on the wire.
|
|
1324
|
+
*/
|
|
1325
|
+
listPreGameSides(params?: PreGameSidesParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listPreGameSides">>;
|
|
1326
|
+
/**
|
|
1327
|
+
* @deprecated Use {@link listPreGameSides} (#16310). Kept live; it calls the
|
|
1328
|
+
* deprecated `/api/v1/sports-edge-signals` path, which answers with
|
|
1329
|
+
* `Deprecation` and successor `Link` headers and the same body.
|
|
1330
|
+
*/
|
|
1331
|
+
listSportsEdgeSignals(params?: SportsEdgeSignalsParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listSportsEdgeSignals">>;
|
|
694
1332
|
/**
|
|
695
1333
|
* Read an explicitly observation-only sports cohort and its accountable
|
|
696
1334
|
* per-sport funnel. This surface is isolated from the funded signals route.
|
|
@@ -700,7 +1338,13 @@ export declare class OxinsiderApiClient {
|
|
|
700
1338
|
* additive wider-holder projection, not an arrival-history or independent
|
|
701
1339
|
* denominator view.
|
|
702
1340
|
*/
|
|
703
|
-
|
|
1341
|
+
listPreGameSideObservations(params: PreGameSideObservationsParams, options?: ConvenienceOptions): Promise<PreGameSideObservationsResponse>;
|
|
1342
|
+
/**
|
|
1343
|
+
* @deprecated Use {@link listPreGameSideObservations} (#16310). Kept live; it
|
|
1344
|
+
* calls the deprecated `/api/v1/sports-edge-observations` path, which answers
|
|
1345
|
+
* with `Deprecation` and successor `Link` headers and the same body.
|
|
1346
|
+
*/
|
|
1347
|
+
listSportsEdgeObservations(params: SportsEdgeObservationsParams, options?: ConvenienceOptions): Promise<SportsEdgeObservationsResponse>;
|
|
704
1348
|
/**
|
|
705
1349
|
* Typed conditional-read variant of {@link listSportsEdgeObservations}.
|
|
706
1350
|
* Returns the full observation response on 200 or a typed `not_modified`
|
|
@@ -710,29 +1354,74 @@ export declare class OxinsiderApiClient {
|
|
|
710
1354
|
* projection cutoff inside `next_cursor` is excluded while its stable page
|
|
711
1355
|
* position remains covered.
|
|
712
1356
|
*/
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
1357
|
+
listPreGameSideObservationsConditional(params: PreGameSideObservationsParams, options?: ConvenienceOptions): Promise<PreGameSideObservationsResponse | ApiNotModifiedResponse>;
|
|
1358
|
+
/**
|
|
1359
|
+
* @deprecated Use {@link listPreGameSideObservationsConditional} (#16310).
|
|
1360
|
+
* Kept live on the deprecated `/api/v1/sports-edge-observations` path.
|
|
1361
|
+
*/
|
|
1362
|
+
listSportsEdgeObservationsConditional(params: SportsEdgeObservationsParams, options?: ConvenienceOptions): Promise<SportsEdgeObservationsResponse | ApiNotModifiedResponse>;
|
|
1363
|
+
searchMarkets(q: OperationQuery["searchMarkets"]["q"], options?: ConvenienceOptions & {
|
|
1364
|
+
query?: Omit<OperationQuery["searchMarkets"], "q">;
|
|
1365
|
+
}): Promise<OperationEnvelope<"searchMarkets">>;
|
|
1366
|
+
searchContent(q: OperationQuery["searchContent"]["q"], options?: ConvenienceOptions & {
|
|
1367
|
+
query?: Omit<OperationQuery["searchContent"], "q">;
|
|
1368
|
+
}): Promise<OperationEnvelope<"searchContent">>;
|
|
1369
|
+
exploreMarkets(params?: ExploreMarketsParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"exploreMarkets">>;
|
|
1370
|
+
getMarketIntel(conditionId: OperationPath["getMarketIntel"]["condition_id"], options?: Omit<OperationRequestOptions<"getMarketIntel">, "path">): Promise<OperationResult<"getMarketIntel">>;
|
|
1371
|
+
getMarketSnapshot(conditionId: OperationPath["getMarketSnapshot"]["condition_id"], options?: Omit<OperationRequestOptions<"getMarketSnapshot">, "path">): Promise<OperationResult<"getMarketSnapshot">>;
|
|
1372
|
+
/**
|
|
1373
|
+
* One page of a market's graded (S/A/B) holder roster from a complete
|
|
1374
|
+
* provider holder scan: the list a Pick of the Day shows, for any market.
|
|
1375
|
+
* `params.outcome` (`yes` | `no` | `all`), `params.min_grade` (`S` | `A` |
|
|
1376
|
+
* `B`), `params.limit` and `params.cursor` (`mh_` prefix). The page carries
|
|
1377
|
+
* the `market`, `scan` and roster `totals` beside `data`; `total` is the
|
|
1378
|
+
* count matching the filters across every page.
|
|
1379
|
+
*/
|
|
1380
|
+
getMarketHolders(conditionId: OperationPath["getMarketHolders"]["condition_id"], params?: OperationQuery["getMarketHolders"], options?: ConvenienceOptions): Promise<OperationEnvelope<"getMarketHolders">>;
|
|
718
1381
|
/**
|
|
719
1382
|
* Fetch bucketed OHLC candles for a market's outcome tokens.
|
|
720
|
-
* Resolution defaults to the server default; pass `
|
|
721
|
-
* `"1d"` or `"1w"` to override.
|
|
1383
|
+
* Resolution defaults to the server default; pass `params.resolution` as
|
|
1384
|
+
* `"1d"` or `"1w"` to override. `params.from` is exclusive and `params.to`
|
|
1385
|
+
* is inclusive; when both are present, `from` must be less than or equal to
|
|
1386
|
+
* `to`.
|
|
1387
|
+
*/
|
|
1388
|
+
getMarketCandles(conditionId: OperationPath["getMarketCandles"]["condition_id"], params?: OperationQuery["getMarketCandles"], options?: ConvenienceOptions): Promise<OperationResult<"getMarketCandles">>;
|
|
1389
|
+
/**
|
|
1390
|
+
* Fetch one suspicious trade by raw `whale_alerts.id` or the `rf_`-prefixed
|
|
1391
|
+
* id list responses emit. The envelope's `object` is `"suspicious_trade"`.
|
|
722
1392
|
*/
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
1393
|
+
getSuspiciousTrade(id: OperationPath["getSuspiciousTrade"]["id"], options?: ConvenienceOptions): Promise<OperationResult<"getSuspiciousTrade">>;
|
|
1394
|
+
/** List stored trades whose recorded suspicion score meets the flag threshold. */
|
|
1395
|
+
listSuspiciousTrades(params?: SuspiciousTradesListParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listSuspiciousTrades">>;
|
|
1396
|
+
/**
|
|
1397
|
+
* @deprecated Use `getSuspiciousTrade()`; renamed in #16301. This method
|
|
1398
|
+
* keeps calling the deprecated `GET /api/v1/insider-radar/{id}`, which stays
|
|
1399
|
+
* live with no retirement date and still answers `object: "radar_flag"`, so
|
|
1400
|
+
* an integration branching on that envelope keeps working.
|
|
1401
|
+
*/
|
|
1402
|
+
getInsiderRadarFlag(id: OperationPath["getInsiderRadarFlag"]["id"], options?: ConvenienceOptions): Promise<OperationResult<"getInsiderRadarFlag">>;
|
|
1403
|
+
/**
|
|
1404
|
+
* @deprecated Use `listSuspiciousTrades()`; renamed in #16301. This method
|
|
1405
|
+
* keeps calling the deprecated `GET /api/v1/insider-radar`, which stays live
|
|
1406
|
+
* with no retirement date and answers with `Deprecation` plus a `Link
|
|
1407
|
+
* rel="successor-version"` header.
|
|
1408
|
+
*/
|
|
1409
|
+
listInsiderRadar(params?: InsiderRadarListParams, options?: ConvenienceOptions): Promise<OperationEnvelope<"listInsiderRadar">>;
|
|
1410
|
+
getLargeTrade(id: OperationPath["getLargeTrade"]["id"], options?: ConvenienceOptions): Promise<OperationResult<"getLargeTrade">>;
|
|
1411
|
+
/** @deprecated Use {@link getLargeTrade} (#16304); calls the deprecated `/api/v1/whale-trades/{id}`. */
|
|
1412
|
+
getWhaleTrade(id: OperationPath["getWhaleTrade"]["id"], options?: ConvenienceOptions): Promise<OperationResult<"getWhaleTrade">>;
|
|
1413
|
+
listWebhooks(options?: ConvenienceOptions): Promise<OperationEnvelope<"listWebhooks">>;
|
|
1414
|
+
getWebhook(id: OperationPath["getWebhook"]["id"], options?: ConvenienceOptions): Promise<OperationResult<"getWebhook">>;
|
|
1415
|
+
createWebhook(body: OperationBody["createWebhook"], options?: ConvenienceOptions): Promise<OperationResult<"createWebhook">>;
|
|
1416
|
+
updateWebhook(id: OperationPath["updateWebhook"]["id"], body: OperationBody["updateWebhook"], options?: ConvenienceOptions): Promise<OperationResult<"updateWebhook">>;
|
|
1417
|
+
deleteWebhook(id: OperationPath["deleteWebhook"]["id"], options?: ConvenienceOptions): Promise<OperationResult<"deleteWebhook">>;
|
|
729
1418
|
/**
|
|
730
1419
|
* Fetch the self-describing webhook event catalog (each entry's `id`,
|
|
731
1420
|
* description, payload shape, and active/dormant status).
|
|
732
1421
|
*/
|
|
733
|
-
listWebhookEvents
|
|
1422
|
+
listWebhookEvents(options?: ConvenienceOptions): Promise<OperationEnvelope<"listWebhookEvents">>;
|
|
734
1423
|
/** List delivery attempts for one webhook endpoint (Stripe-style list). */
|
|
735
|
-
listWebhookDeliveries
|
|
1424
|
+
listWebhookDeliveries(webhookId: OperationPath["listWebhookDeliveries"]["id"], params?: OperationQuery["listWebhookDeliveries"], options?: ConvenienceOptions): Promise<OperationEnvelope<"listWebhookDeliveries">>;
|
|
736
1425
|
/**
|
|
737
1426
|
* Requeue one `dead_letter` delivery with a fresh attempt budget and return
|
|
738
1427
|
* the delivery row. Re-enabling a disabled endpoint resends nothing, so this
|
|
@@ -741,20 +1430,39 @@ export declare class OxinsiderApiClient {
|
|
|
741
1430
|
* disabled, unverified, or no longer subscribed to the delivery's event type;
|
|
742
1431
|
* the error message names the fix. Pass `idempotencyKey` to make a retry safe.
|
|
743
1432
|
*/
|
|
744
|
-
redeliverWebhookDelivery
|
|
745
|
-
getHealth
|
|
746
|
-
getApiDiscovery
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
1433
|
+
redeliverWebhookDelivery(webhookId: OperationPath["redeliverWebhookDelivery"]["id"], deliveryId: OperationPath["redeliverWebhookDelivery"]["delivery_id"], options?: ConvenienceOptions): Promise<OperationResult<"redeliverWebhookDelivery">>;
|
|
1434
|
+
getHealth(options?: ConvenienceOptions): Promise<OperationResult<"getHealth">>;
|
|
1435
|
+
getApiDiscovery(options?: ConvenienceOptions): Promise<OperationResult<"getApiDiscovery">>;
|
|
1436
|
+
getPlatforms(options?: ConvenienceOptions): Promise<OperationResult<"getPlatforms">>;
|
|
1437
|
+
getAccountIdentity(options?: ConvenienceOptions): Promise<OperationResult<"getAccountIdentity">>;
|
|
1438
|
+
/**
|
|
1439
|
+
* One wallet's context as Markdown, ready to paste into a model prompt
|
|
1440
|
+
* (`GET /api/v1/trader/{address}/context.md`). The JSON form of the same
|
|
1441
|
+
* read is `getTraderContext`.
|
|
1442
|
+
*/
|
|
1443
|
+
getTraderContextMarkdown(address: OperationPath["getTraderContextMarkdown"]["address"], options?: Omit<OperationRequestOptions<"getTraderContextMarkdown">, "path">): Promise<string>;
|
|
1444
|
+
/**
|
|
1445
|
+
* One market's context as Markdown
|
|
1446
|
+
* (`GET /api/v1/market/{condition_id}/context.md`). The JSON form is
|
|
1447
|
+
* `getMarketIntel`.
|
|
1448
|
+
*/
|
|
1449
|
+
getMarketContextMarkdown(conditionId: OperationPath["getMarketContextMarkdown"]["condition_id"], options?: Omit<OperationRequestOptions<"getMarketContextMarkdown">, "path">): Promise<string>;
|
|
1450
|
+
/**
|
|
1451
|
+
* Mint a sandbox key (`POST /api/v1/agents/register`), the one write that
|
|
1452
|
+
* needs no credential. Answers `201`, which is why the SDK had no method
|
|
1453
|
+
* for it until #16137: the drift gate counted only operations with a
|
|
1454
|
+
* documented `200`. `meta.status` is `201`; `data.api_key` is the
|
|
1455
|
+
* `oxi_sk_test_*` key to pass to `OxinsiderApiClient.sandbox()`.
|
|
1456
|
+
*
|
|
1457
|
+
* Nothing is stored: the key cannot be listed or revoked and does not
|
|
1458
|
+
* expire. Register again for another one.
|
|
1459
|
+
*/
|
|
1460
|
+
registerAgent(options?: ConvenienceOptions): Promise<OperationResult<"registerAgent">>;
|
|
1461
|
+
getUsage(options?: ConvenienceOptions): Promise<OperationResult<"getUsage">>;
|
|
754
1462
|
/** Fetch today's editorial Pick of the Day (single-object envelope). */
|
|
755
|
-
getPickOfTheDay
|
|
1463
|
+
getPickOfTheDay(options?: ConvenienceOptions): Promise<OperationResult<"getPickOfTheDay">>;
|
|
756
1464
|
/** Fetch the Pick of the Day archive with hit-rate (single-object envelope). */
|
|
757
|
-
getPickOfTheDayArchive
|
|
1465
|
+
getPickOfTheDayArchive(options?: ConvenienceOptions): Promise<OperationResult<"getPickOfTheDayArchive">>;
|
|
758
1466
|
/**
|
|
759
1467
|
* Fetch the Pick of the Day commitment ledger (single-object envelope).
|
|
760
1468
|
*
|
|
@@ -766,17 +1474,34 @@ export declare class OxinsiderApiClient {
|
|
|
766
1474
|
* received and hashing with sha256; do not reserialize the payload, since it
|
|
767
1475
|
* is served byte for byte as it was hashed.
|
|
768
1476
|
*/
|
|
769
|
-
getPickOfTheDayLedger
|
|
1477
|
+
getPickOfTheDayLedger(options?: ConvenienceOptions): Promise<OperationResult<"getPickOfTheDayLedger">>;
|
|
770
1478
|
/** Resolve the base URL (used by the SSE stream consumer). */
|
|
771
1479
|
getBaseUrl(): string;
|
|
772
1480
|
/** The configured API key, if any (used by the SSE stream consumer). */
|
|
773
1481
|
getApiKey(): string | undefined;
|
|
1482
|
+
/** Whether this client was built in sandbox mode (#16138). */
|
|
1483
|
+
isSandbox(): boolean;
|
|
774
1484
|
/** The resolved fetch implementation (used by the SSE stream consumer). */
|
|
775
1485
|
getFetch(): typeof fetch;
|
|
776
1486
|
buildUrl(operation: ApiClientOperation, options: ApiRequestOptions): string;
|
|
777
1487
|
private buildHeaders;
|
|
778
1488
|
}
|
|
779
|
-
|
|
1489
|
+
/**
|
|
1490
|
+
* Narrow a `call()` result to the typed 304. Takes any envelope-shaped
|
|
1491
|
+
* value, so it works on an `OperationResult<K>` (whose `meta` is the
|
|
1492
|
+
* operation's own type) as well as the loose `ApiClientResponse<T>`
|
|
1493
|
+
* (#16136).
|
|
1494
|
+
*/
|
|
1495
|
+
export declare function isApiNotModifiedResponse<R extends {
|
|
1496
|
+
object: string;
|
|
1497
|
+
}>(response: R): response is Extract<R, ApiNotModifiedResponse>;
|
|
780
1498
|
export declare function interpolatePath(path: string, params: Partial<Record<string, string | number>>): string;
|
|
1499
|
+
/**
|
|
1500
|
+
* Whether `body` is a list envelope whose control fields the walker can act
|
|
1501
|
+
* on: `object: "list"`, an array `data`, a BOOLEAN `has_more`, and a
|
|
1502
|
+
* `next_cursor` that is a string, `null` or absent (#16246: the check used to
|
|
1503
|
+
* accept any `has_more` that was merely present, so a malformed value could
|
|
1504
|
+
* be coerced into "no more pages" or "more pages" by truthiness).
|
|
1505
|
+
*/
|
|
781
1506
|
export declare function isListEnvelope<T>(body: unknown): body is ApiListEnvelope<T>;
|
|
782
1507
|
//# sourceMappingURL=client.d.ts.map
|