@0xinsider/mcp 3.6.1 → 3.7.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 +58 -22
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/product-cli/index.d.ts.map +1 -1
- package/dist/product-cli/index.js +162 -26
- package/dist/product-cli/index.js.map +1 -1
- package/dist/product-cli/operations.d.ts +24 -0
- package/dist/product-cli/operations.d.ts.map +1 -0
- package/dist/product-cli/operations.js +222 -0
- package/dist/product-cli/operations.js.map +1 -0
- package/dist/prompts/index.js +2 -2
- package/dist/sdk/client.d.ts +75 -160
- package/dist/sdk/client.d.ts.map +1 -1
- package/dist/sdk/client.js +122 -220
- package/dist/sdk/client.js.map +1 -1
- package/dist/sdk/errors.d.ts +17 -6
- package/dist/sdk/errors.d.ts.map +1 -1
- package/dist/sdk/errors.js +30 -6
- package/dist/sdk/errors.js.map +1 -1
- package/dist/sdk/index.d.ts +5 -27
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +3 -2
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/pagination.d.ts +3 -3
- package/dist/sdk/pagination.js +2 -2
- package/dist/sdk/schema.d.ts +481 -215
- package/dist/sdk/schema.d.ts.map +1 -1
- package/dist/sdk/stream.d.ts.map +1 -1
- package/dist/sdk/stream.js +3 -2
- package/dist/sdk/stream.js.map +1 -1
- package/dist/sdk/webhooks.d.ts +8 -60
- package/dist/sdk/webhooks.d.ts.map +1 -1
- package/dist/sdk/webhooks.js.map +1 -1
- package/dist/tools/explore-markets.js +4 -4
- package/dist/tools/explore-markets.js.map +1 -1
- package/dist/tools/get-insider-radar.js +1 -1
- package/dist/tools/get-insider-radar.js.map +1 -1
- package/dist/tools/get-leaderboard.d.ts.map +1 -1
- package/dist/tools/get-leaderboard.js +5 -14
- package/dist/tools/get-leaderboard.js.map +1 -1
- package/dist/tools/get-market-flow.js +1 -1
- package/dist/tools/get-trader-pnl.js +3 -3
- package/dist/tools/get-trader-pnl.js.map +1 -1
- package/dist/tools/get-trader.js +3 -3
- package/dist/tools/get-trending-wallets.js +1 -1
- package/dist/tools/get-whale-trades.js +3 -3
- package/dist/tools/get-whale-trades.js.map +1 -1
- package/dist/tools/pick-of-the-day.js +2 -2
- package/dist/tools/read-parity.d.ts.map +1 -1
- package/dist/tools/read-parity.js +17 -15
- package/dist/tools/read-parity.js.map +1 -1
- package/dist/tools/trader-reads.js +1 -1
- package/package.json +6 -6
package/dist/sdk/client.js
CHANGED
|
@@ -30,7 +30,9 @@ import { RETRY_AFTER_CEILING_MS, retryAfterSeconds, sleepUnlessAborted, } from "
|
|
|
30
30
|
* `scripts/check-sdk-openapi-drift.mjs`, which also checks every row's kind
|
|
31
31
|
* against the spec. Do not add a row without a matching spec operation, and
|
|
32
32
|
* do not remove a spec operation without removing its row. A redirect-only
|
|
33
|
-
* operation belongs in `REDIRECT_OPERATIONS` below, not here
|
|
33
|
+
* operation belongs in `REDIRECT_OPERATIONS` below, not here, and a
|
|
34
|
+
* deprecated alias this client no longer wraps belongs in
|
|
35
|
+
* `UNSUPPORTED_OPERATIONS` (#29350).
|
|
34
36
|
*/
|
|
35
37
|
export const API_CLIENT_OPERATIONS = [
|
|
36
38
|
{
|
|
@@ -207,42 +209,12 @@ export const API_CLIENT_OPERATIONS = [
|
|
|
207
209
|
operationId: "getLargeTrade",
|
|
208
210
|
auth: "bearer",
|
|
209
211
|
},
|
|
210
|
-
{
|
|
211
|
-
method: "GET",
|
|
212
|
-
path: "/api/v1/whale-trades",
|
|
213
|
-
operationId: "listWhaleTrades",
|
|
214
|
-
auth: "bearer",
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
method: "GET",
|
|
218
|
-
path: "/api/v1/whale-trades/history",
|
|
219
|
-
operationId: "listWhaleTradeHistory",
|
|
220
|
-
auth: "bearer",
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
method: "GET",
|
|
224
|
-
path: "/api/v1/whale-trades/{id}/counterparties/executions",
|
|
225
|
-
operationId: "listWhaleTradeCounterpartyExecutions",
|
|
226
|
-
auth: "bearer",
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
method: "GET",
|
|
230
|
-
path: "/api/v1/whale-trades/{id}/counterparties/executions/{execution_id}/makers",
|
|
231
|
-
operationId: "listWhaleTradeCounterpartyMakers",
|
|
232
|
-
auth: "bearer",
|
|
233
|
-
},
|
|
234
212
|
{
|
|
235
213
|
method: "GET",
|
|
236
214
|
path: "/api/v1/content/search",
|
|
237
215
|
operationId: "searchContent",
|
|
238
216
|
auth: "bearer",
|
|
239
217
|
},
|
|
240
|
-
{
|
|
241
|
-
method: "GET",
|
|
242
|
-
path: "/api/v1/whale-trades/{id}",
|
|
243
|
-
operationId: "getWhaleTrade",
|
|
244
|
-
auth: "bearer",
|
|
245
|
-
},
|
|
246
218
|
{
|
|
247
219
|
method: "GET",
|
|
248
220
|
path: "/api/v1/leaderboard",
|
|
@@ -261,12 +233,6 @@ export const API_CLIENT_OPERATIONS = [
|
|
|
261
233
|
operationId: "exploreMarkets",
|
|
262
234
|
auth: "bearer",
|
|
263
235
|
},
|
|
264
|
-
{
|
|
265
|
-
method: "GET",
|
|
266
|
-
path: "/api/v1/markets/smart-money-flows",
|
|
267
|
-
operationId: "listSmartMoneyFlows",
|
|
268
|
-
auth: "bearer",
|
|
269
|
-
},
|
|
270
236
|
{
|
|
271
237
|
method: "GET",
|
|
272
238
|
path: "/api/v1/markets/sharp-money-flows",
|
|
@@ -279,12 +245,6 @@ export const API_CLIENT_OPERATIONS = [
|
|
|
279
245
|
operationId: "getCoverage",
|
|
280
246
|
auth: "none",
|
|
281
247
|
},
|
|
282
|
-
{
|
|
283
|
-
method: "GET",
|
|
284
|
-
path: "/api/v1/platforms",
|
|
285
|
-
operationId: "getPlatforms",
|
|
286
|
-
auth: "none",
|
|
287
|
-
},
|
|
288
248
|
{
|
|
289
249
|
method: "GET",
|
|
290
250
|
path: "/api/v1/market/{condition_id}/holders",
|
|
@@ -297,24 +257,12 @@ export const API_CLIENT_OPERATIONS = [
|
|
|
297
257
|
operationId: "getMarketFlow",
|
|
298
258
|
auth: "bearer",
|
|
299
259
|
},
|
|
300
|
-
{
|
|
301
|
-
method: "GET",
|
|
302
|
-
path: "/api/v1/market/{condition_id}/intel",
|
|
303
|
-
operationId: "getMarketIntel",
|
|
304
|
-
auth: "bearer",
|
|
305
|
-
},
|
|
306
260
|
{
|
|
307
261
|
method: "POST",
|
|
308
262
|
path: "/api/v1/markets/flow/batch",
|
|
309
263
|
operationId: "batchGetMarketFlow",
|
|
310
264
|
auth: "bearer",
|
|
311
265
|
},
|
|
312
|
-
{
|
|
313
|
-
method: "POST",
|
|
314
|
-
path: "/api/v1/markets/intel/batch",
|
|
315
|
-
operationId: "batchGetMarketIntel",
|
|
316
|
-
auth: "bearer",
|
|
317
|
-
},
|
|
318
266
|
{
|
|
319
267
|
method: "GET",
|
|
320
268
|
path: "/api/v1/market/{condition_id}/snapshot",
|
|
@@ -346,22 +294,6 @@ export const API_CLIENT_OPERATIONS = [
|
|
|
346
294
|
operationId: "getSuspiciousTrade",
|
|
347
295
|
auth: "bearer",
|
|
348
296
|
},
|
|
349
|
-
// Deprecated aliases (#16301). Both paths stay live with no retirement
|
|
350
|
-
// date; responses carry Deprecation and a Link rel="successor-version".
|
|
351
|
-
// `/api/v1/insider-radar/{id}` also keeps answering `object: "radar_flag"`,
|
|
352
|
-
// so these entries are what an existing integration must keep exercising.
|
|
353
|
-
{
|
|
354
|
-
method: "GET",
|
|
355
|
-
path: "/api/v1/insider-radar",
|
|
356
|
-
operationId: "listInsiderRadar",
|
|
357
|
-
auth: "bearer",
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
method: "GET",
|
|
361
|
-
path: "/api/v1/insider-radar/{id}",
|
|
362
|
-
operationId: "getInsiderRadarFlag",
|
|
363
|
-
auth: "bearer",
|
|
364
|
-
},
|
|
365
297
|
{
|
|
366
298
|
method: "GET",
|
|
367
299
|
path: "/api/v1/events/feed/since",
|
|
@@ -578,9 +510,78 @@ export const REDIRECT_OPERATIONS = [
|
|
|
578
510
|
/**
|
|
579
511
|
* Published operations this client deliberately does not wrap, with the
|
|
580
512
|
* reason. The drift check requires every remaining spec operation to be
|
|
581
|
-
* accounted for here, so "unsupported" is always a stated decision.
|
|
513
|
+
* accounted for here, so "unsupported" is always a stated decision. An
|
|
514
|
+
* operation that still answers 200 may appear here only while the spec marks
|
|
515
|
+
* it `deprecated`: 0.32.0 dropped the September rename aliases (#29350), whose
|
|
516
|
+
* paths stay live until their 2027-02-01 sunset (#29351).
|
|
582
517
|
*/
|
|
583
518
|
export const UNSUPPORTED_OPERATIONS = [
|
|
519
|
+
{
|
|
520
|
+
method: "GET",
|
|
521
|
+
path: "/api/v1/whale-trades",
|
|
522
|
+
operationId: "listWhaleTrades",
|
|
523
|
+
reason: "Deprecated alias (#16304), sunset 2027-02-01: use listLargeTrades().",
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
method: "GET",
|
|
527
|
+
path: "/api/v1/whale-trades/history",
|
|
528
|
+
operationId: "listWhaleTradeHistory",
|
|
529
|
+
reason: "Deprecated alias (#16304), sunset 2027-02-01: use listLargeTradeHistory().",
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
method: "GET",
|
|
533
|
+
path: "/api/v1/whale-trades/{id}",
|
|
534
|
+
operationId: "getWhaleTrade",
|
|
535
|
+
reason: "Deprecated alias (#16304), sunset 2027-02-01: use getLargeTrade().",
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
method: "GET",
|
|
539
|
+
path: "/api/v1/whale-trades/{id}/counterparties/executions",
|
|
540
|
+
operationId: "listWhaleTradeCounterpartyExecutions",
|
|
541
|
+
reason: 'Deprecated alias (#16304), sunset 2027-02-01: use call("listLargeTradeCounterpartyExecutions").',
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
method: "GET",
|
|
545
|
+
path: "/api/v1/whale-trades/{id}/counterparties/executions/{execution_id}/makers",
|
|
546
|
+
operationId: "listWhaleTradeCounterpartyMakers",
|
|
547
|
+
reason: 'Deprecated alias (#16304), sunset 2027-02-01: use call("listLargeTradeCounterpartyMakers").',
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
method: "GET",
|
|
551
|
+
path: "/api/v1/markets/smart-money-flows",
|
|
552
|
+
operationId: "listSmartMoneyFlows",
|
|
553
|
+
reason: "Deprecated alias (#16308), sunset 2027-02-01: use listSharpMoneyFlows().",
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
method: "GET",
|
|
557
|
+
path: "/api/v1/platforms",
|
|
558
|
+
operationId: "getPlatforms",
|
|
559
|
+
reason: "Deprecated alias (#16315), sunset 2027-02-01: use getCoverage().",
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
method: "GET",
|
|
563
|
+
path: "/api/v1/market/{condition_id}/intel",
|
|
564
|
+
operationId: "getMarketIntel",
|
|
565
|
+
reason: "Deprecated alias (#16312), sunset 2027-02-01: use getMarketFlow().",
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
method: "POST",
|
|
569
|
+
path: "/api/v1/markets/intel/batch",
|
|
570
|
+
operationId: "batchGetMarketIntel",
|
|
571
|
+
reason: "Deprecated alias (#16312), sunset 2027-02-01: use batchGetMarketFlow().",
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
method: "GET",
|
|
575
|
+
path: "/api/v1/insider-radar",
|
|
576
|
+
operationId: "listInsiderRadar",
|
|
577
|
+
reason: "Deprecated alias (#16301), sunset 2027-02-01: use listSuspiciousTrades().",
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
method: "GET",
|
|
581
|
+
path: "/api/v1/insider-radar/{id}",
|
|
582
|
+
operationId: "getInsiderRadarFlag",
|
|
583
|
+
reason: "Deprecated alias (#16301), sunset 2027-02-01: use getSuspiciousTrade().",
|
|
584
|
+
},
|
|
584
585
|
{
|
|
585
586
|
method: "GET",
|
|
586
587
|
path: "/api/v1/sports/pre-game-sides",
|
|
@@ -636,8 +637,7 @@ export const IDEMPOTENT_WRITE_OPERATIONS = [
|
|
|
636
637
|
];
|
|
637
638
|
/**
|
|
638
639
|
* POST operations that read and never write (#16182): the batch lookups.
|
|
639
|
-
* `POST /api/v1/traders/batch` and `POST /api/v1/markets/flow/batch`
|
|
640
|
-
* deprecated alias `POST /api/v1/markets/intel/batch`) resolve
|
|
640
|
+
* `POST /api/v1/traders/batch` and `POST /api/v1/markets/flow/batch` resolve
|
|
641
641
|
* their inputs and store nothing (`backend/src/api_v1/handlers/batch.rs`), so
|
|
642
642
|
* a repeat cannot duplicate a side effect. Each attempt is one request
|
|
643
643
|
* against the account's quota and one reservation of batch item units, which
|
|
@@ -647,7 +647,6 @@ export const IDEMPOTENT_WRITE_OPERATIONS = [
|
|
|
647
647
|
export const READ_ONLY_POST_OPERATIONS = [
|
|
648
648
|
"batchGetTraders",
|
|
649
649
|
"batchGetMarketFlow",
|
|
650
|
-
"batchGetMarketIntel",
|
|
651
650
|
];
|
|
652
651
|
/**
|
|
653
652
|
* Writes whose repeat converges on the state the first one reached, so a
|
|
@@ -775,47 +774,23 @@ export function resolveApiUrl(baseUrl, path) {
|
|
|
775
774
|
return new URL(`${baseUrl}${suffix}`);
|
|
776
775
|
}
|
|
777
776
|
/**
|
|
778
|
-
* One signal that aborts on the deadline OR when the caller's signal aborts
|
|
779
|
-
*
|
|
780
|
-
* source listeners when either source aborts.
|
|
777
|
+
* One signal that aborts on the deadline OR when the caller's signal aborts,
|
|
778
|
+
* composed with `AbortSignal.any`, which every supported Node release has.
|
|
781
779
|
*/
|
|
782
780
|
export function composeSignals(timeoutMs, caller) {
|
|
783
781
|
return composeRequestSignal(timeoutMs, caller).signal;
|
|
784
782
|
}
|
|
785
|
-
/**
|
|
783
|
+
/**
|
|
784
|
+
* Keep cancellation live through body consumption. `timeout` is returned so a
|
|
785
|
+
* catch can tell the deadline from a caller abort by reason identity (#19749).
|
|
786
|
+
*/
|
|
786
787
|
function composeRequestSignal(timeoutMs, caller) {
|
|
787
788
|
const timeout = timeoutMs === null ? undefined : AbortSignal.timeout(timeoutMs);
|
|
788
789
|
if (!timeout)
|
|
789
790
|
return { signal: caller };
|
|
790
791
|
if (!caller)
|
|
791
792
|
return { signal: timeout, timeout };
|
|
792
|
-
|
|
793
|
-
return { signal: AbortSignal.any([caller, timeout]), timeout };
|
|
794
|
-
}
|
|
795
|
-
const controller = new AbortController();
|
|
796
|
-
const dispose = () => {
|
|
797
|
-
caller.removeEventListener("abort", onCallerAbort);
|
|
798
|
-
timeout.removeEventListener("abort", onTimeoutAbort);
|
|
799
|
-
};
|
|
800
|
-
const onCallerAbort = () => {
|
|
801
|
-
dispose();
|
|
802
|
-
controller.abort(caller.reason);
|
|
803
|
-
};
|
|
804
|
-
const onTimeoutAbort = () => {
|
|
805
|
-
dispose();
|
|
806
|
-
controller.abort(timeout.reason);
|
|
807
|
-
};
|
|
808
|
-
if (caller.aborted) {
|
|
809
|
-
onCallerAbort();
|
|
810
|
-
}
|
|
811
|
-
else if (timeout.aborted) {
|
|
812
|
-
onTimeoutAbort();
|
|
813
|
-
}
|
|
814
|
-
else {
|
|
815
|
-
caller.addEventListener("abort", onCallerAbort, { once: true });
|
|
816
|
-
timeout.addEventListener("abort", onTimeoutAbort, { once: true });
|
|
817
|
-
}
|
|
818
|
-
return { signal: controller.signal, timeout, dispose };
|
|
793
|
+
return { signal: AbortSignal.any([caller, timeout]), timeout };
|
|
819
794
|
}
|
|
820
795
|
const EXPORT_BODY_CLEANUP_TIMEOUT_MS = 2_000;
|
|
821
796
|
/** A failed transfer keeps its primary error and an observable cleanup cause. */
|
|
@@ -859,14 +834,13 @@ class ExportBodyOwner {
|
|
|
859
834
|
response(response) {
|
|
860
835
|
this.cancel = (reason) => response.body?.cancel(reason) ?? Promise.resolve();
|
|
861
836
|
}
|
|
862
|
-
reader(reader
|
|
837
|
+
reader(reader) {
|
|
863
838
|
let finished = false;
|
|
864
839
|
let cancellation;
|
|
865
840
|
const finish = () => {
|
|
866
841
|
if (finished)
|
|
867
842
|
return;
|
|
868
843
|
finished = true;
|
|
869
|
-
dispose();
|
|
870
844
|
reader.releaseLock();
|
|
871
845
|
};
|
|
872
846
|
const cancel = (reason) => {
|
|
@@ -875,7 +849,6 @@ class ExportBodyOwner {
|
|
|
875
849
|
if (finished)
|
|
876
850
|
return Promise.resolve();
|
|
877
851
|
finished = true;
|
|
878
|
-
dispose();
|
|
879
852
|
cancellation = Promise.resolve().then(() => reader.cancel(reason)).finally(() => reader.releaseLock());
|
|
880
853
|
return cancellation;
|
|
881
854
|
};
|
|
@@ -892,22 +865,22 @@ class ExportBodyOwner {
|
|
|
892
865
|
return releaseExportBody(cancel, primary);
|
|
893
866
|
}
|
|
894
867
|
}
|
|
895
|
-
/**
|
|
896
|
-
|
|
897
|
-
|
|
868
|
+
/**
|
|
869
|
+
* Hash decoded bytes with backpressure and finish the reader owner. Without a
|
|
870
|
+
* verification the response passes through untouched: the request signal is
|
|
871
|
+
* an `AbortSignal.any` composition, so no listener waits on the body's end.
|
|
872
|
+
*/
|
|
873
|
+
function managedExportBody(response, owner, verification) {
|
|
874
|
+
if (!verification)
|
|
898
875
|
return response;
|
|
899
876
|
if (!response.body) {
|
|
900
|
-
|
|
901
|
-
throw new ExportIntegrityError(verification.jobId, verification.expectedSha256, null, verification.expectedSizeBytes, 0);
|
|
902
|
-
dispose();
|
|
903
|
-
return response;
|
|
877
|
+
throw new ExportIntegrityError(verification.jobId, verification.expectedSha256, null, verification.expectedSizeBytes, 0);
|
|
904
878
|
}
|
|
905
|
-
const lease = owner.reader(response.body.getReader()
|
|
906
|
-
const hasher =
|
|
879
|
+
const lease = owner.reader(response.body.getReader());
|
|
880
|
+
const hasher = createHash("sha256");
|
|
907
881
|
let actualSizeBytes = 0;
|
|
908
882
|
let consumerCancelled = false;
|
|
909
|
-
const integrityFailure = (cause) => verification
|
|
910
|
-
? new ExportIntegrityError(verification.jobId, verification.expectedSha256, null, verification.expectedSizeBytes, actualSizeBytes, cause) : cause;
|
|
883
|
+
const integrityFailure = (cause) => new ExportIntegrityError(verification.jobId, verification.expectedSha256, null, verification.expectedSizeBytes, actualSizeBytes, cause);
|
|
911
884
|
const body = new ReadableStream({
|
|
912
885
|
async pull(controller) {
|
|
913
886
|
let chunk;
|
|
@@ -928,17 +901,17 @@ function managedExportBody(response, owner, dispose, needsDisposal, verification
|
|
|
928
901
|
try {
|
|
929
902
|
if (chunk.done) {
|
|
930
903
|
lease.finish();
|
|
931
|
-
const actualSha256 = hasher
|
|
932
|
-
if (
|
|
933
|
-
actualSha256 !== verification.expectedSha256)
|
|
934
|
-
controller.error(new ExportIntegrityError(verification.jobId, verification.expectedSha256, actualSha256
|
|
904
|
+
const actualSha256 = hasher.digest("hex");
|
|
905
|
+
if (actualSizeBytes !== verification.expectedSizeBytes ||
|
|
906
|
+
actualSha256 !== verification.expectedSha256) {
|
|
907
|
+
controller.error(new ExportIntegrityError(verification.jobId, verification.expectedSha256, actualSha256, verification.expectedSizeBytes, actualSizeBytes));
|
|
935
908
|
}
|
|
936
909
|
else {
|
|
937
910
|
controller.close();
|
|
938
911
|
}
|
|
939
912
|
return;
|
|
940
913
|
}
|
|
941
|
-
hasher
|
|
914
|
+
hasher.update(chunk.value);
|
|
942
915
|
actualSizeBytes += chunk.value.byteLength;
|
|
943
916
|
controller.enqueue(chunk.value);
|
|
944
917
|
}
|
|
@@ -990,6 +963,22 @@ function requestedEdgeHunterAxes(query = {}) {
|
|
|
990
963
|
return key !== "category" || typeof value !== "string" || value.trim().length > 0;
|
|
991
964
|
});
|
|
992
965
|
}
|
|
966
|
+
/** The opt-in admission rule a request named, if any (#27607). */
|
|
967
|
+
function requestedEdgeHunterAdmission(query = {}) {
|
|
968
|
+
const value = query["admission"];
|
|
969
|
+
return typeof value === "string" ? value.trim().toLowerCase() : undefined;
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* An instance that predates admission ignores it and answers the default
|
|
973
|
+
* selection, so an opt-in read requires the echo, as a selected read does.
|
|
974
|
+
*/
|
|
975
|
+
function requireEdgeHunterAdmissionEcho(envelope, admission) {
|
|
976
|
+
if (admission === undefined)
|
|
977
|
+
return;
|
|
978
|
+
if (Reflect.get(envelope, "admission") !== admission) {
|
|
979
|
+
throw new InvalidResponseError(200, "Edge Hunter response is missing its admission echo", envelope);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
993
982
|
function requireEdgeHunterSelectionEcho(envelope, axes) {
|
|
994
983
|
if (axes.length === 0)
|
|
995
984
|
return;
|
|
@@ -1117,20 +1106,10 @@ function filenameFromDisposition(disposition) {
|
|
|
1117
1106
|
}
|
|
1118
1107
|
/** `GET /api/v1/leaderboard` -> parameters -> strategy (`web/public/api/v1/openapi.json`). */
|
|
1119
1108
|
export const LEADERBOARD_STRATEGIES = [
|
|
1120
|
-
"accumulator",
|
|
1121
|
-
"algo_trader",
|
|
1122
|
-
"arbitrageur",
|
|
1123
1109
|
"category_focused",
|
|
1124
|
-
"directional",
|
|
1125
1110
|
"diversified",
|
|
1126
|
-
"event_driven",
|
|
1127
1111
|
"high_activity",
|
|
1128
|
-
"market_maker",
|
|
1129
1112
|
"mixed",
|
|
1130
|
-
"momentum",
|
|
1131
|
-
"scalper",
|
|
1132
|
-
"speculator",
|
|
1133
|
-
"swing_trader",
|
|
1134
1113
|
"two_sided",
|
|
1135
1114
|
"unclassified",
|
|
1136
1115
|
];
|
|
@@ -1234,7 +1213,7 @@ export class OxinsiderApiClient {
|
|
|
1234
1213
|
this.maxRetries = assertRetryCount(options.maxRetries ?? DEFAULT_MAX_RETRIES, "maxRetries");
|
|
1235
1214
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1236
1215
|
if (typeof fetchImpl !== "function") {
|
|
1237
|
-
throw new Error("No fetch implementation available. Pass `fetch` in OxinsiderApiClient options or run on Node
|
|
1216
|
+
throw new Error("No fetch implementation available. Pass `fetch` in OxinsiderApiClient options or run on Node 22+ / a fetch-capable runtime.");
|
|
1238
1217
|
}
|
|
1239
1218
|
// Bind so a passed-through `globalThis.fetch` keeps its receiver.
|
|
1240
1219
|
this.fetchImpl = fetchImpl.bind(globalThis);
|
|
@@ -1251,6 +1230,7 @@ export class OxinsiderApiClient {
|
|
|
1251
1230
|
if (isApiEnvelope(envelope)) {
|
|
1252
1231
|
if (operationId === "getEdgeHunter") {
|
|
1253
1232
|
requireEdgeHunterSelectionEcho(envelope, requestedEdgeHunterAxes(options.query));
|
|
1233
|
+
requireEdgeHunterAdmissionEcho(envelope, requestedEdgeHunterAdmission(options.query));
|
|
1254
1234
|
if (options.query?.["view"] === "observations" && !hasEdgeHunterObservationQuality(envelope)) {
|
|
1255
1235
|
throw new InvalidResponseError(response.status, "Edge Hunter observations response is missing valid snapshot quality evidence", envelope);
|
|
1256
1236
|
}
|
|
@@ -1406,7 +1386,7 @@ export class OxinsiderApiClient {
|
|
|
1406
1386
|
}
|
|
1407
1387
|
return this.request(operation, { ...options, path: { address }, query: { job_id: jobId } }, async (response) => {
|
|
1408
1388
|
if (response.type === "opaqueredirect" || response.status === 0) {
|
|
1409
|
-
throw new InvalidResponseError(302, "This runtime hides redirect targets: fetch with redirect: \"manual\" returned an opaque redirect, so the presigned download URL cannot be read. Run the export download from a server runtime (Node
|
|
1389
|
+
throw new InvalidResponseError(302, "This runtime hides redirect targets: fetch with redirect: \"manual\" returned an opaque redirect, so the presigned download URL cannot be read. Run the export download from a server runtime (Node 22+, Deno, Bun, a Worker).", null);
|
|
1410
1390
|
}
|
|
1411
1391
|
const location = response.headers.get("location");
|
|
1412
1392
|
if (!location) {
|
|
@@ -1460,13 +1440,6 @@ export class OxinsiderApiClient {
|
|
|
1460
1440
|
}
|
|
1461
1441
|
async downloadExportObject(target, options, verification, statusError) {
|
|
1462
1442
|
const signal = composeRequestSignal(options.downloadTimeoutMs ?? null, options.signal);
|
|
1463
|
-
let disposed = false;
|
|
1464
|
-
const dispose = () => {
|
|
1465
|
-
if (disposed)
|
|
1466
|
-
return;
|
|
1467
|
-
disposed = true;
|
|
1468
|
-
signal.dispose?.();
|
|
1469
|
-
};
|
|
1470
1443
|
const owner = new ExportBodyOwner();
|
|
1471
1444
|
try {
|
|
1472
1445
|
// A signed object URL authorizes itself; never forward API headers.
|
|
@@ -1477,7 +1450,7 @@ export class OxinsiderApiClient {
|
|
|
1477
1450
|
owner.response(response);
|
|
1478
1451
|
if (!response.ok)
|
|
1479
1452
|
throw statusError(response.status);
|
|
1480
|
-
response = managedExportBody(response, owner,
|
|
1453
|
+
response = managedExportBody(response, owner, verification);
|
|
1481
1454
|
const contentLength = response.headers.get("content-length");
|
|
1482
1455
|
const result = {
|
|
1483
1456
|
...target,
|
|
@@ -1494,12 +1467,7 @@ export class OxinsiderApiClient {
|
|
|
1494
1467
|
return result;
|
|
1495
1468
|
}
|
|
1496
1469
|
catch (error) {
|
|
1497
|
-
|
|
1498
|
-
throw await owner.release(error);
|
|
1499
|
-
}
|
|
1500
|
-
finally {
|
|
1501
|
-
dispose();
|
|
1502
|
-
}
|
|
1470
|
+
throw await owner.release(error);
|
|
1503
1471
|
}
|
|
1504
1472
|
}
|
|
1505
1473
|
/**
|
|
@@ -1620,9 +1588,6 @@ export class OxinsiderApiClient {
|
|
|
1620
1588
|
}
|
|
1621
1589
|
throw error;
|
|
1622
1590
|
}
|
|
1623
|
-
finally {
|
|
1624
|
-
requestSignal.dispose?.();
|
|
1625
|
-
}
|
|
1626
1591
|
}
|
|
1627
1592
|
async list(operationId, options = {}) {
|
|
1628
1593
|
if (operationId === "getEdgeHunter" && options.query?.["view"] !== "signals" &&
|
|
@@ -1717,14 +1682,6 @@ export class OxinsiderApiClient {
|
|
|
1717
1682
|
batchGetMarketFlow(body, options = {}) {
|
|
1718
1683
|
return this.call("batchGetMarketFlow", { ...options, body });
|
|
1719
1684
|
}
|
|
1720
|
-
/**
|
|
1721
|
-
* @deprecated Use {@link batchGetMarketFlow} (#16312); calls the deprecated
|
|
1722
|
-
* `POST /api/v1/markets/intel/batch`, whose envelope keeps
|
|
1723
|
-
* `object: "market_intel_batch"`.
|
|
1724
|
-
*/
|
|
1725
|
-
batchGetMarketIntel(body, options = {}) {
|
|
1726
|
-
return this.call("batchGetMarketIntel", { ...options, body });
|
|
1727
|
-
}
|
|
1728
1685
|
listLeaderboard(params = {}, options = {}) {
|
|
1729
1686
|
return this.list("listLeaderboard", { ...options, query: params });
|
|
1730
1687
|
}
|
|
@@ -1747,14 +1704,6 @@ export class OxinsiderApiClient {
|
|
|
1747
1704
|
listLargeTradeHistory(params = {}, options = {}) {
|
|
1748
1705
|
return this.list("listLargeTradeHistory", { ...options, query: params });
|
|
1749
1706
|
}
|
|
1750
|
-
/** @deprecated Use {@link listLargeTrades} (#16304); calls the deprecated `/api/v1/whale-trades`. */
|
|
1751
|
-
listWhaleTrades(params = {}, options = {}) {
|
|
1752
|
-
return this.list("listWhaleTrades", { ...options, query: params });
|
|
1753
|
-
}
|
|
1754
|
-
/** @deprecated Use {@link listLargeTradeHistory} (#16304); calls the deprecated `/api/v1/whale-trades/history`. */
|
|
1755
|
-
listWhaleTradeHistory(params = {}, options = {}) {
|
|
1756
|
-
return this.list("listWhaleTradeHistory", { ...options, query: params });
|
|
1757
|
-
}
|
|
1758
1707
|
listPositions(params = {}, options = {}) {
|
|
1759
1708
|
return this.list("listPositions", { ...options, query: params });
|
|
1760
1709
|
}
|
|
@@ -1768,14 +1717,6 @@ export class OxinsiderApiClient {
|
|
|
1768
1717
|
listSharpMoneyFlows(params = {}, options = {}) {
|
|
1769
1718
|
return this.list("listSharpMoneyFlows", { ...options, query: params });
|
|
1770
1719
|
}
|
|
1771
|
-
/**
|
|
1772
|
-
* @deprecated Use {@link listSharpMoneyFlows} (#16308). Kept live; it calls
|
|
1773
|
-
* the deprecated `/api/v1/markets/smart-money-flows`, whose responses carry
|
|
1774
|
-
* `Deprecation` and a `Link rel="successor-version"`.
|
|
1775
|
-
*/
|
|
1776
|
-
listSmartMoneyFlows(params = {}, options = {}) {
|
|
1777
|
-
return this.list("listSmartMoneyFlows", { ...options, query: params });
|
|
1778
|
-
}
|
|
1779
1720
|
/**
|
|
1780
1721
|
* List covered games: both sides with their provider ids and live scores, the
|
|
1781
1722
|
* UTC kickoff, the provider's own status, and every linked Polymarket market
|
|
@@ -1812,17 +1753,6 @@ export class OxinsiderApiClient {
|
|
|
1812
1753
|
path: { condition_id: conditionId },
|
|
1813
1754
|
});
|
|
1814
1755
|
}
|
|
1815
|
-
/**
|
|
1816
|
-
* @deprecated Use {@link getMarketFlow} (#16312); calls the deprecated
|
|
1817
|
-
* `GET /api/v1/market/{condition_id}/intel`, whose envelope keeps
|
|
1818
|
-
* `object: "market_intel"`.
|
|
1819
|
-
*/
|
|
1820
|
-
getMarketIntel(conditionId, options = {}) {
|
|
1821
|
-
return this.call("getMarketIntel", {
|
|
1822
|
-
...options,
|
|
1823
|
-
path: { condition_id: conditionId },
|
|
1824
|
-
});
|
|
1825
|
-
}
|
|
1826
1756
|
getMarketSnapshot(conditionId, options = {}) {
|
|
1827
1757
|
return this.call("getMarketSnapshot", {
|
|
1828
1758
|
...options,
|
|
@@ -1833,7 +1763,7 @@ export class OxinsiderApiClient {
|
|
|
1833
1763
|
* One page of a market's graded (S/A/B) holder roster from a complete
|
|
1834
1764
|
* provider holder scan: the list a Pick of the Day shows, for any market.
|
|
1835
1765
|
* `params.outcome` (`yes` | `no` | `all`), `params.min_grade` (`S` | `A` |
|
|
1836
|
-
* `B`), `params.limit` and `params.cursor` (`
|
|
1766
|
+
* `B`), `params.limit` and `params.cursor` (the previous page's opaque `next_cursor`). The page carries
|
|
1837
1767
|
* the `market`, `scan` and roster `totals` beside `data`; `total` is the
|
|
1838
1768
|
* count matching the filters across every page.
|
|
1839
1769
|
*/
|
|
@@ -1869,31 +1799,9 @@ export class OxinsiderApiClient {
|
|
|
1869
1799
|
listSuspiciousTrades(params = {}, options = {}) {
|
|
1870
1800
|
return this.list("listSuspiciousTrades", { ...options, query: params });
|
|
1871
1801
|
}
|
|
1872
|
-
/**
|
|
1873
|
-
* @deprecated Use `getSuspiciousTrade()`; renamed in #16301. This method
|
|
1874
|
-
* keeps calling the deprecated `GET /api/v1/insider-radar/{id}`, which stays
|
|
1875
|
-
* live with no retirement date and still answers `object: "radar_flag"`, so
|
|
1876
|
-
* an integration branching on that envelope keeps working.
|
|
1877
|
-
*/
|
|
1878
|
-
getInsiderRadarFlag(id, options = {}) {
|
|
1879
|
-
return this.call("getInsiderRadarFlag", { ...options, path: { id } });
|
|
1880
|
-
}
|
|
1881
|
-
/**
|
|
1882
|
-
* @deprecated Use `listSuspiciousTrades()`; renamed in #16301. This method
|
|
1883
|
-
* keeps calling the deprecated `GET /api/v1/insider-radar`, which stays live
|
|
1884
|
-
* with no retirement date and answers with `Deprecation` plus a `Link
|
|
1885
|
-
* rel="successor-version"` header.
|
|
1886
|
-
*/
|
|
1887
|
-
listInsiderRadar(params = {}, options = {}) {
|
|
1888
|
-
return this.list("listInsiderRadar", { ...options, query: params });
|
|
1889
|
-
}
|
|
1890
1802
|
getLargeTrade(id, options = {}) {
|
|
1891
1803
|
return this.call("getLargeTrade", { ...options, path: { id } });
|
|
1892
1804
|
}
|
|
1893
|
-
/** @deprecated Use {@link getLargeTrade} (#16304); calls the deprecated `/api/v1/whale-trades/{id}`. */
|
|
1894
|
-
getWhaleTrade(id, options = {}) {
|
|
1895
|
-
return this.call("getWhaleTrade", { ...options, path: { id } });
|
|
1896
|
-
}
|
|
1897
1805
|
// --- Exports ---
|
|
1898
1806
|
/**
|
|
1899
1807
|
* Cancel a submitted export (`POST /api/v1/trader/{address}/export/cancel`, #16254).
|
|
@@ -1981,13 +1889,6 @@ export class OxinsiderApiClient {
|
|
|
1981
1889
|
getCoverage(options = {}) {
|
|
1982
1890
|
return this.call("getCoverage", options);
|
|
1983
1891
|
}
|
|
1984
|
-
/**
|
|
1985
|
-
* @deprecated Use {@link getCoverage} (#16315); calls the deprecated
|
|
1986
|
-
* `GET /api/v1/platforms`, which serves the same body.
|
|
1987
|
-
*/
|
|
1988
|
-
getPlatforms(options = {}) {
|
|
1989
|
-
return this.call("getPlatforms", options);
|
|
1990
|
-
}
|
|
1991
1892
|
getAccountIdentity(options = {}) {
|
|
1992
1893
|
return this.call("getAccountIdentity", options);
|
|
1993
1894
|
}
|
|
@@ -2117,7 +2018,8 @@ export class OxinsiderApiClient {
|
|
|
2117
2018
|
}
|
|
2118
2019
|
}
|
|
2119
2020
|
if (options.strictQuery || (operation.operationId === "getEdgeHunter" &&
|
|
2120
|
-
requestedEdgeHunterAxes(options.query).length > 0
|
|
2021
|
+
(requestedEdgeHunterAxes(options.query).length > 0 ||
|
|
2022
|
+
requestedEdgeHunterAdmission(options.query) !== undefined))) {
|
|
2121
2023
|
headers.set("x-query-validation", "strict");
|
|
2122
2024
|
}
|
|
2123
2025
|
return headers;
|