@0xinsider/sdk 0.31.0 → 0.35.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 +40 -8
- package/dist/client.d.ts +271 -151
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +295 -145
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +6 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +13 -5
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +4 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/pagination.d.ts +3 -3
- package/dist/pagination.js +2 -2
- package/dist/provenance.d.ts +2 -2
- package/dist/provenance.d.ts.map +1 -1
- package/dist/provenance.js +3 -3
- package/dist/provenance.js.map +1 -1
- package/dist/schema.d.ts +1501 -211
- package/dist/schema.d.ts.map +1 -1
- package/dist/webhooks.d.ts +8 -60
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ explore.data[0].title; // compile error: an ExploreEntry has no title
|
|
|
85
85
|
const batch = await client.batchGetTraders(["swisstony", "0xabc..."], { expand: ["trust"] });
|
|
86
86
|
if (batch.object === "trader_batch") batch.meta.request_cost; // BatchResponseMeta
|
|
87
87
|
|
|
88
|
-
client.
|
|
88
|
+
client.listSuspiciousTrades({ min_grade: "S" }); // compile error: the route takes min_suspicion and severity
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
Every method forwards the same transport options, so a conditional read,
|
|
@@ -120,6 +120,27 @@ SDK 0.30.0 follows the API to sports and esports markets only. A market or event
|
|
|
120
120
|
|
|
121
121
|
SDK 0.31.0 types the deprecated `supersedes_pick_id` on `PickOfTheDayNoEntitledPicks` as `string | null`, the same as every other Pick of the Day shape. Earlier releases typed it `null`. The API still always sends `null`. Code that assigns the field to a variable typed `null` no longer compiles: type it `string | null`, or stop reading it and identify picks by `pick_id`.
|
|
122
122
|
|
|
123
|
+
SDK 0.32.0 removes the old names from the September 2026 renames. Each removed name was an alias of the name that replaces it, so the replacement takes the same arguments and returns the same data. Code that uses an old name stops compiling; switch to the new name. The API paths behind the old methods still answer until their sunset on 2027-02-01, and `call()` and `paginate()` accept only the new operation ids.
|
|
124
|
+
|
|
125
|
+
| Removed | Use |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| `listWhaleTrades()`, `WhaleTradeListParams` | `listLargeTrades()`, `LargeTradeListParams` |
|
|
128
|
+
| `listWhaleTradeHistory()`, `WhaleTradeHistoryParams` | `listLargeTradeHistory()`, `LargeTradeHistoryParams` |
|
|
129
|
+
| `getWhaleTrade()` | `getLargeTrade()` |
|
|
130
|
+
| `WhaleTrade`, `WhaleTradeDetail`, `WhaleTradeHistoryMeta` | `LargeTrade`, `LargeTradeDetail`, `LargeTradeHistoryMeta` |
|
|
131
|
+
| `listInsiderRadar()`, `InsiderRadarListParams` | `listSuspiciousTrades()`, `SuspiciousTradesListParams` |
|
|
132
|
+
| `getInsiderRadarFlag()`, `RadarFlag` | `getSuspiciousTrade()`, `SuspiciousTrade` |
|
|
133
|
+
| `getMarketIntel()`, `MarketIntel` | `getMarketFlow()`, `MarketFlow` |
|
|
134
|
+
| `batchGetMarketIntel()`, `BatchMarketIntelItem` | `batchGetMarketFlow()`, `BatchMarketFlowItem` |
|
|
135
|
+
| `listSmartMoneyFlows()` | `listSharpMoneyFlows()` |
|
|
136
|
+
| `getPlatforms()` | `getCoverage()` |
|
|
137
|
+
| `WhaleTradesInsertedEvent`, `WhaleTradesInsertedData` | `LargeTradesInsertedEvent`, `LargeTradesInsertedData` |
|
|
138
|
+
| `WhaleTraderSyncedEvent`, `WhaleTraderSyncedData` | `TraderSyncedEvent`, `TraderSyncedData` |
|
|
139
|
+
| `InsiderRadarFlagRaisedEvent`, `InsiderRadarFlagRaisedData` | `SuspiciousTradeFlaggedEvent`, `SuspiciousTradeFlaggedData` |
|
|
140
|
+
| `SmartMoneyFlowDetectedEvent`, `SmartMoneyFlowDetectedData` | `SharpMoneyFlowDetectedEvent`, `SharpMoneyFlowDetectedData` |
|
|
141
|
+
|
|
142
|
+
Two differences remain on the wire. The new methods call the new paths, so a response has the new `object`: `large_trade` instead of `whale_trade`, `suspicious_trade` instead of `radar_flag`, and `market_flow` and `market_flow_batch` instead of `market_intel` and `market_intel_batch`. The old webhook event names are still delivered, so a subscription made under an old name keeps the old `type` literal. `WebhookEvent` still includes those literals: narrow on `event.type` rather than on a removed event type.
|
|
143
|
+
|
|
123
144
|
## Combos
|
|
124
145
|
|
|
125
146
|
`client.combos.fills()` returns observed Polymarket combo fills with their legs, wallet context, and coverage. `client.combos.summary()` reads the live combo count, and `client.combos.get(conditionId)` reads one combo's fills and lifecycle. These reads require an active Pro or Max credential.
|
|
@@ -139,6 +160,17 @@ Keep the same filters while paging. For `sort: "recent"`, send `next_cursor` as
|
|
|
139
160
|
|
|
140
161
|
Read `coverage` before treating the observed fills as a complete history. An unavailable live count is `null`, not zero; the response types preserve nullable and optional provider values.
|
|
141
162
|
|
|
163
|
+
## A past day's Pick of the Day
|
|
164
|
+
|
|
165
|
+
SDK 0.35.0 adds `getPickOfTheDayForDate(date)`. It reads a past product day's slate (America/New_York, `YYYY-MM-DD`), gated by your key's tier the same way the dated web page is. `getPickOfTheDay()` still reads today.
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
const slate = await client.getPickOfTheDayForDate("2026-10-30");
|
|
169
|
+
if (slate.object === "pick_of_the_day") console.log(slate.data.pick_date, slate.data.picks);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
A past day with no published pick throws the 404 `not_found` with `error.param` `date`. A past day does not change, so do not retry it. A date after today throws the 400 `bad_request`.
|
|
173
|
+
|
|
142
174
|
## Pick proof by stable identity
|
|
143
175
|
|
|
144
176
|
`getPickOfTheDayLedgerEntry(pickId)` reads the public proof for one pick without an API key. Keep `pick_id` as its decimal string; converting it to `Number` can lose precision.
|
|
@@ -489,7 +521,7 @@ A sandbox key from `POST https://api.0xinsider.com/api/v1/agents/register` (`oxi
|
|
|
489
521
|
```ts
|
|
490
522
|
import { paginate } from "@0xinsider/sdk";
|
|
491
523
|
|
|
492
|
-
for await (const trade of paginate(client, "
|
|
524
|
+
for await (const trade of paginate(client, "listLargeTrades", {
|
|
493
525
|
query: { min_grade: "S", limit: 100 },
|
|
494
526
|
})) {
|
|
495
527
|
console.log(trade);
|
|
@@ -504,7 +536,7 @@ The loop ends when a page says `has_more: false`, whatever its `next_cursor` say
|
|
|
504
536
|
import { paginatePages, type PaginationProgress } from "@0xinsider/sdk";
|
|
505
537
|
|
|
506
538
|
const progress: PaginationProgress = {};
|
|
507
|
-
for await (const page of paginatePages(client, "
|
|
539
|
+
for await (const page of paginatePages(client, "listLargeTrades", {
|
|
508
540
|
query: { min_grade: "S", limit: 100 },
|
|
509
541
|
maxPages: 3,
|
|
510
542
|
progress,
|
|
@@ -542,7 +574,7 @@ Each page request retries on its own (see [Retries](#retries)). If a page still
|
|
|
542
574
|
import { paginate, paginationResumePoint } from "@0xinsider/sdk";
|
|
543
575
|
|
|
544
576
|
try {
|
|
545
|
-
for await (const trade of paginate(client, "
|
|
577
|
+
for await (const trade of paginate(client, "listLargeTrades", { query })) handle(trade);
|
|
546
578
|
} catch (err) {
|
|
547
579
|
const resume = paginationResumePoint(err); // { cursor, pagesFetched } or undefined
|
|
548
580
|
if (resume) scheduleLater({ ...query, cursor: resume.cursor });
|
|
@@ -762,7 +794,7 @@ The endpoint's `secret_rotation.status` is `idle`, `pending`, or `overlap`. `rot
|
|
|
762
794
|
|
|
763
795
|
The client retries a failed request when retrying is safe and can help. `maxRetries` defaults to 2 and can be set on the client or on one call; `0` sends exactly one request.
|
|
764
796
|
|
|
765
|
-
- **What is retried:** a GET, a read-only POST (`batchGetTraders`, `batchGetMarketFlow
|
|
797
|
+
- **What is retried:** a GET, a read-only POST (`batchGetTraders`, `batchGetMarketFlow`, which resolve their inputs and store nothing), a convergent write (`cancelTraderExport`, exported as `CONVERGENT_WRITE_OPERATIONS`: a repeat answers the state the first one reached and never repeats a transition), or one of the nine writes the API replays under `Idempotency-Key` (`createWebhook`, `updateWebhook`, `deleteWebhook`, `rotateWebhookSecret`, `prepareWebhookSecret`, `activateWebhookSecret`, `retireWebhookSecret`, `redeliverWebhookDelivery`, `createWebhookVerificationAttempt`, exported as `IDEMPOTENT_WRITE_OPERATIONS` and pinned to the OpenAPI contract by the drift check) when it carries a key; each when it fails with 408, 429, 502, 503, or 504, or with a network error before any response. A 408 is the server's own 30-second timeout (`error.code` `request_timeout`, thrown as `ServerTimeoutError` when retries run out); it carries `Retry-After` on a GET, and a keyed write replays safely. `retryEligibility(operation)` returns `"read"`, `"keyed"` or `"never"`.
|
|
766
798
|
- **How long it waits:** the response's `Retry-After` plus up to 250 ms of jitter; delta-seconds and HTTP-date forms both parse (`parseRetryAfter` is exported), and a negative, non-finite or malformed value is treated as absent. To show or forward the wait as a validated whole number of seconds, use `parseRetryAfterStrict`: it accepts only the RFC 9110 forms (digits, or one of the three HTTP-date formats with a valid calendar date and weekday), rounds a date up to whole seconds, and returns `null` for anything else, a fractional delay included. Without the header, a jittered exponential backoff from 500 ms, capped at 8 s. A `Retry-After` longer than 60 s (`RETRY_AFTER_CEILING_MS`) is not waited out; the error is thrown for you to schedule from `retryAfterSeconds` or `retryAt`. No wait is ever handed to a timer past Node's 2147483647 ms range, which would fire at once.
|
|
767
799
|
- **What is never retried:** 400, 401, 402, 403, 404, 409, 500, a write without an idempotency key, any other write outside the nine above (`verifyWebhook` sends a challenge to your URL each time; `submitTraderExport` starts a job; an MCP call runs a tool), the client's own timeout (`RequestTimeoutError`), or your own abort. A key on one of those writes is refused before the request is sent, because the server would ignore it and the retry it seemed to license could repeat the effect.
|
|
768
800
|
- **Deadline:** all attempts share one `timeoutMs` deadline (15 s by default). A retry that cannot finish before it is not started, so you get the real error, not a timeout. An `AbortSignal` ends a backoff immediately.
|
|
@@ -774,7 +806,7 @@ await client.call("createWebhook", {
|
|
|
774
806
|
body: {
|
|
775
807
|
name: "Large trades",
|
|
776
808
|
url: "https://example.com/hooks/0xinsider",
|
|
777
|
-
event_types: ["
|
|
809
|
+
event_types: ["large_trades_inserted"],
|
|
778
810
|
},
|
|
779
811
|
idempotencyKey: crypto.randomUUID(), // reuse the SAME key if you retry by hand
|
|
780
812
|
});
|
|
@@ -812,7 +844,7 @@ An owned JSON/text body that fails during consumption throws `ResponseBodyReadEr
|
|
|
812
844
|
import { RateLimitedError, OxinsiderApiError } from "@0xinsider/sdk";
|
|
813
845
|
|
|
814
846
|
try {
|
|
815
|
-
await client.
|
|
847
|
+
await client.listLargeTrades({ min_grade: "S" });
|
|
816
848
|
} catch (err) {
|
|
817
849
|
// Thrown after the client's own retries (see Retries) are exhausted.
|
|
818
850
|
if (err instanceof RateLimitedError) {
|
|
@@ -829,7 +861,7 @@ Direct error constructors accept optional `ApiErrorTransportMetadata` after thei
|
|
|
829
861
|
|
|
830
862
|
## Authentication
|
|
831
863
|
|
|
832
|
-
Pass `apiKey` to the client constructor. Public operations (`getApiDiscovery`, `
|
|
864
|
+
Pass `apiKey` to the client constructor. Public operations (`getApiDiscovery`, `getCoverage`, `getHealth`, `getPickOfTheDayLedger`, and `registerAgent`, which mints the sandbox key) do not require a key; everything else does, and the SDK throws before making a request if a key is missing for a bearer operation, unless the client is in [sandbox](#sandbox) mode, where no operation needs one. Pro-only data (graded webhook events, parts of the stream) requires a key on an active Pro subscription.
|
|
833
865
|
|
|
834
866
|
## Examples
|
|
835
867
|
|