@agg-build/sdk 4.36.0 → 4.37.1

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 CHANGED
@@ -156,15 +156,17 @@ const users = await admin.listUsers("your-app-id", { limit: 50 });
156
156
 
157
157
  ## Client options
158
158
 
159
- | Option | Type | Required | Description |
160
- | ---------------- | ---------------------------- | --------------------- | ----------------------------------------------------- |
161
- | `baseUrl` | `string` | Yes | API base URL (e.g. `https://api.agg.market`) |
162
- | `appId` | `string` | One of appId/adminKey | Partner app ID |
163
- | `adminKey` | `string` | One of appId/adminKey | Admin API key for admin-tier routes |
164
- | `wsUrl` | `string` | For WebSocket | WebSocket gateway URL (required by `createWebSocket`) |
165
- | `authDelivery` | `"body" \| "cookie-refresh"` | No | Token delivery mode (default: `"body"`) |
166
- | `persistSession` | `boolean` | No | Persist auth hint to localStorage (default: `true`) |
167
- | `kalshiDemo` | `boolean` | No | Deprecated compatibility option; ignored |
159
+ | Option | Type | Required | Description |
160
+ | ------------------ | ---------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
161
+ | `baseUrl` | `string` | Yes | API base URL (e.g. `https://api.agg.market`) |
162
+ | `appId` | `string` | One of appId/adminKey | Partner app ID |
163
+ | `adminKey` | `string` | One of appId/adminKey | Admin API key for admin-tier routes |
164
+ | `wsUrl` | `string` | For WebSocket | WebSocket gateway URL (required by `createWebSocket`) |
165
+ | `orderbookUrl` | `string` | No | Second socket for the orderbook channel. Unset keeps orderbooks on `wsUrl`. When set, an orderbook-only subscription leaves `wsUrl` idle |
166
+ | `orderbookLatency` | `"conflated" \| "realtime"` | No | Orderbook tier. Default `conflated` omits `latency`; `realtime` sends it |
167
+ | `authDelivery` | `"body" \| "cookie-refresh"` | No | Token delivery mode (default: `"body"`) |
168
+ | `persistSession` | `boolean` | No | Persist auth hint to localStorage (default: `true`) |
169
+ | `kalshiDemo` | `boolean` | No | Deprecated compatibility option; ignored |
168
170
 
169
171
  Call `client.destroy()` when you no longer need the client to release internal resources
170
172
  (BroadcastChannel used for cross-tab auth sync).
@@ -369,20 +371,21 @@ try {
369
371
 
370
372
  ## WebSocket callbacks
371
373
 
372
- | Callback | When it fires |
373
- | ------------------------------------ | ---------------------------------------------- |
374
- | `onSnapshot(outcomeId, book)` | Full orderbook snapshot received |
375
- | `onDelta(outcomeId, book)` | Incremental orderbook update applied |
376
- | `onTrade(trade)` | Trade execution |
377
- | `onHeartbeat(hb)` | Server heartbeat (every 30s) |
378
- | `onSubscribed` / `onUnsubscribed` | Subscription lifecycle |
379
- | `onConnected` / `onAuthenticated` | Connection / auth lifecycle |
380
- | `onOrderSubmitted` | Order placed via WebSocket |
381
- | `onBalanceUpdate` | Balance change event |
382
- | `onMarketResolved` | Market resolution |
383
- | `onDiagnostics(event)` | Diagnostic events (seq gaps, stale connection) |
384
- | `onConnectionStateChange(connected)` | Connection state changed |
385
- | `onError(msg)` | Error message from server |
374
+ | Callback | When it fires |
375
+ | --------------------------------------------- | ------------------------------------------------------------- |
376
+ | `onSnapshot(outcomeId, book)` | Full orderbook snapshot received |
377
+ | `onDelta(outcomeId, book)` | Incremental orderbook update applied |
378
+ | `onTrade(trade)` | Trade execution |
379
+ | `onHeartbeat(hb)` | Server heartbeat (every 30s) |
380
+ | `onSubscribed` / `onUnsubscribed` | Subscription lifecycle |
381
+ | `onConnected` / `onAuthenticated` | Connection / auth lifecycle |
382
+ | `onOrderSubmitted` | Order placed via WebSocket |
383
+ | `onBalanceUpdate` | Balance change event |
384
+ | `onMarketResolved` | Market resolution |
385
+ | `onDiagnostics(event)` | Diagnostic events (seq gaps, stale connection) |
386
+ | `onConnectionStateChange(connected)` | Primary connection state changed |
387
+ | `onOrderbookConnectionStateChange(connected)` | Orderbook socket state. Fires only when `orderbookUrl` is set |
388
+ | `onError(msg)` | Error message from server |
386
389
 
387
390
  Orderbook books are keyed by outcome. `OrderbookState.outcomeId` is the identity of a
388
391
  book; the deprecated `OrderbookState.marketId` holds the same outcome id, **not** a venue
@@ -392,7 +395,7 @@ market.
392
395
 
393
396
  Key behaviors:
394
397
 
395
- - Single persistent connection with refcounted per-market subscriptions.
398
+ - Single persistent connection with refcounted per-market subscriptions. `orderbookUrl` moves the orderbook channel onto a second socket and reports it through `onOrderbookConnectionStateChange`. An orderbook-only subscription does not keep `wsUrl` connected. Trades, arb, catalog, and user events stay on `wsUrl`.
396
399
  - In-memory orderbook state per market (snapshot + delta with CRC32 verification).
397
400
  - Sequence gap or checksum mismatch triggers automatic resnapshot.
398
401
  - `snapshot_unavailable` retries only affected active outcomes, with up to three jittered retries and at most 20 outcomes retried per second per socket. Errors still reach `onError`; successful snapshots, unsubscribe, and socket closure cancel pending retries. Missing replies remain covered by the optional book watchdog.