@polyester/sdk 0.35.0-devnet-20261111024555 → 0.35.0-devnet-20261111025029
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/CHANGELOG.md +5 -1
- package/dist/realtime/private-orders.d.ts.map +1 -1
- package/dist/realtime/private-orders.js +24 -3
- package/dist/realtime/private-orders.js.map +1 -1
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/changelog/changelog.schemas.d.ts +17 -17
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +2 -2
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +52 -52
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-enums.codecs.js +4 -4
- package/dist/services/orders/order-enums.codecs.js.map +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +24 -24
- package/dist/services/orders/orders-input.schemas.d.ts +1 -1
- package/dist/services/orders/orders-modify.schemas.d.ts +5 -5
- package/dist/services/orders/orders-output.schemas.d.ts +17 -17
- package/dist/services/orders/orders.codecs.js +14 -14
- package/dist/services/orders/orders.codecs.js.map +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +3 -3
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +14 -14
- package/dist/services/trades/trades.schemas.d.ts +2 -2
- package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +22 -22
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# @polyester/sdk
|
|
2
2
|
|
|
3
|
-
## 0.35.0-devnet-
|
|
3
|
+
## 0.35.0-devnet-20261111025029
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
+
- Breaking: order enum values are now lowercase everywhere, like the rest of the SDK and the Python, Rust and Go SDKs. `order.timeInForce` returns `"gtc" | "ioc" | "fok" | "gtd"` (was `"GTC" | "IOC" | "FOK" | "GTD"`), and `actionTaken` from `orders.modify`, `orders.batchReplace` and `orders.getBatchReplaceStatus` returns `"amended" | "replaced"` (was `"AMENDED" | "REPLACED"`). `orders.modify` and `orders.batchReplace` take `behavior: "amend_or_replace" | "amend_only" | "replace_only"`, and `orders.listHistory` takes `status: "filled" | "canceled" | "rejected"`. Uppercase inputs are now rejected. ([#245](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/245))
|
|
8
|
+
|
|
7
9
|
- Breaking: `realtime.isConnected` is removed. It was true whenever a socket object existed, even one that never connected. Read `realtime.connection` instead: `{ public, private }`, each `{ state, error }`, where `state` is `"connecting"`, `"connected"` or `"disconnected"` and `error` is the first failure of the current outage (a socket failure after a connection token failure replaces it), cleared once the socket connects. `realtime.onConnectionChange(listener)` calls the listener with the current value after each change, in a microtask, and returns an unsubscribe function. Private order streams run on their own socket and are not included. Custom `PolyesterRealtime` implementations must add both members. ([#232](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/232))
|
|
8
10
|
|
|
9
11
|
A realtime socket that cannot connect now reports it. On the first failed attempt, every channel on that socket gets one `onError` with `type: "transport"` and a retryable `RealtimeError`, not one per reconnect retry; a channel subscribed while the socket is still failing gets it on subscribe. On the private socket, a failed connection token request is reported as `"connection_token"` on each attempt instead. The order book (whose snapshot waits for the channel to open) and trades no longer wait silently forever when the socket is unreachable; `onOpen` follows once it recovers.
|
|
@@ -42,6 +44,8 @@
|
|
|
42
44
|
|
|
43
45
|
- `auth.me()` now returns `rootSmartAccountAddress`, the caller's root smart-account address as lowercase `0x` hex, or `""` when the account has none. It was previously dropped. A new account can read `""` for a moment right after its first login, until the backend records the address. ([#239](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/239))
|
|
44
46
|
|
|
47
|
+
- Bound the private order stream's memory: frames over 4 MiB are dropped undecoded and the connection reconnects, and a snapshot staging more than 100,000 orders or 64 MiB ends its subscription with a `snapshot` error. ([#246](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/246))
|
|
48
|
+
|
|
45
49
|
- A ConnectRPC `resource_exhausted` that carries a `RateLimitDetail`, as wallet sign-in and the public catalog calls now send, maps to a `RateLimitError` with `rateLimit` set and `retryAfterMs` taken from the detail. Its `detail` is `{ service: "rate_limit", code: "RATE_LIMIT_EXCEEDED", rateLimit }`. The gateway's own refusal has no detail: `retryAfterMs` comes from `Retry-After` when present and is `undefined` for a concurrency refusal, so back off without a server hint. ([#236](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/236))
|
|
46
50
|
|
|
47
51
|
- Unsubscribing from a private channel, or from `connectPrivateOrders()`, in the same tick as subscribing without credentials no longer delivers the queued missing-authentication error to that consumer's `onError`. ([#242](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/242))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-orders.d.ts","names":[],"sources":["../../src/realtime/private-orders.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"private-orders.d.ts","names":[],"sources":["../../src/realtime/private-orders.ts"],"mappings":";;;;;KAgCY;;;EAEJ;EAAkB,QAAQ;;;;EAE1B;EAAc,MAAM;;;;;;;EAKpB;EAAe;EAAgB;;UAEtB;;EAEb;EACA,UAAU,OAAO;;EAEjB;;EAEA;EACA,WAAW,KAAK"}
|
|
@@ -12,6 +12,11 @@ const BACKOFF_MAX_MS = 1e4;
|
|
|
12
12
|
const STABLE_CONNECTION_MS = 1e4;
|
|
13
13
|
/** A malformed frame (4400) and a rejected connect token (4403) recur on every reconnect. */
|
|
14
14
|
const TERMINAL_CLOSE_CODES = /* @__PURE__ */ new Set([4400, 4403]);
|
|
15
|
+
/** Larger frames are dropped undecoded with the connection; a full 256-order page is far smaller. */
|
|
16
|
+
const MAX_PRIVATE_FRAME_BYTES = 4194304;
|
|
17
|
+
/** A snapshot staging more pages than this ends its subscription, so a snapshot never ending stays bounded. */
|
|
18
|
+
const MAX_SNAPSHOT_BYTES = 67108864;
|
|
19
|
+
const MAX_SNAPSHOT_ORDERS = 1e5;
|
|
15
20
|
/** 0.5 s doubling to 10 s, jittered over the upper half of each step. */
|
|
16
21
|
function backoffMs(attempt) {
|
|
17
22
|
const ceiling = Math.min(BACKOFF_MAX_MS, BACKOFF_BASE_MS * 2 ** (attempt + 1));
|
|
@@ -73,6 +78,7 @@ var PrivateOrderStream = class {
|
|
|
73
78
|
seq: 0n,
|
|
74
79
|
cursor: "",
|
|
75
80
|
staged: null,
|
|
81
|
+
stagedBytes: 0,
|
|
76
82
|
orders: null,
|
|
77
83
|
state: "pending",
|
|
78
84
|
stale: null,
|
|
@@ -293,6 +299,11 @@ var PrivateOrderStream = class {
|
|
|
293
299
|
this.#reportAll("decode", new RealtimeError("Expected a binary private WebSocket frame"));
|
|
294
300
|
return;
|
|
295
301
|
}
|
|
302
|
+
if (data.byteLength > 4194304) {
|
|
303
|
+
this.#reportAll("decode", new RealtimeError(`Private WebSocket frame of ${data.byteLength} bytes exceeds ${MAX_PRIVATE_FRAME_BYTES}`));
|
|
304
|
+
this.#drop(ws, 1009, "frame too large");
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
296
307
|
let msg;
|
|
297
308
|
try {
|
|
298
309
|
msg = fromBinary(ServerMessageSchema, new Uint8Array(data));
|
|
@@ -351,10 +362,20 @@ var PrivateOrderStream = class {
|
|
|
351
362
|
switch (frame.case) {
|
|
352
363
|
case "snapshotBegin":
|
|
353
364
|
s.staged = [];
|
|
365
|
+
s.stagedBytes = 0;
|
|
354
366
|
return;
|
|
355
|
-
case "snapshotPage":
|
|
356
|
-
s.staged
|
|
367
|
+
case "snapshotPage": {
|
|
368
|
+
if (!s.staged) return;
|
|
369
|
+
s.stagedBytes += data.byteLength;
|
|
370
|
+
const count = s.staged.length + frame.value.orders.length;
|
|
371
|
+
if (s.stagedBytes > 67108864 || count > 1e5) {
|
|
372
|
+
s.staged = null;
|
|
373
|
+
this.#terminate(s, "snapshot", new RealtimeError(`Private order snapshot exceeds ${MAX_SNAPSHOT_ORDERS} orders or ${MAX_SNAPSHOT_BYTES} bytes`));
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
s.staged.push(...frame.value.orders);
|
|
357
377
|
return;
|
|
378
|
+
}
|
|
358
379
|
case "snapshotEnd": {
|
|
359
380
|
const orders = s.staged;
|
|
360
381
|
s.staged = null;
|
|
@@ -589,6 +610,6 @@ var PrivateOrderStream = class {
|
|
|
589
610
|
}
|
|
590
611
|
};
|
|
591
612
|
//#endregion
|
|
592
|
-
export { PRIVATE_WS_SUBPROTOCOL, PrivateOrderStream };
|
|
613
|
+
export { MAX_PRIVATE_FRAME_BYTES, MAX_SNAPSHOT_BYTES, MAX_SNAPSHOT_ORDERS, PRIVATE_WS_SUBPROTOCOL, PrivateOrderStream };
|
|
593
614
|
|
|
594
615
|
//# sourceMappingURL=private-orders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-orders.js","names":["#config","#subs","#pending","#bySub","#unsubscribing","#catchUp","#remove","#ws","#authSent","#subscribe","#connecting","#reconnectTimer","#open","#clearRetry","#shutdown","#isCurrent","#deliverTo","#terminateAll","#generation","#authenticate","#onFrame","#onClosed","#reportAll","#scheduleReconnect","#send","#authSentAt","#armHeartbeat","#reauthenticate","#nextRequestId","#terminate","#report","#retrySubscribe","#refresh","#unsubscribe","#deliver","#onRequestError","#resubscribe","#detach","#reconnectAttempt","#heartbeatTimer","#drop","#teardown","#call","#requestSeq"],"sources":["../../src/realtime/private-orders.ts"],"sourcesContent":["import { create, fromBinary, toBinary, type MessageInitShape } from \"@bufbuild/protobuf\";\nimport type { Order } from \"../gen/orders/v1/orders_read_pb.js\";\nimport {\n Channel,\n ClientMessageSchema,\n RequestError_Code,\n ServerMessageSchema,\n type Unit,\n} from \"../gen/privatews/v1/private_ws_pb.js\";\nimport { ConfigurationError, PolyesterError, RealtimeError } from \"../shared/errors.js\";\nimport {\n createSdkSubscriptionErrorContext,\n publicationHandlerErrorContext,\n type SdkSubscriptionErrorContext,\n} from \"../shared/subscription-errors.js\";\nimport { idToBigInt } from \"../utils/base58-id.js\";\n\nexport const PRIVATE_WS_SUBPROTOCOL = \"polyester.v1.proto\";\nconst HEARTBEAT_TIMEOUT_MS = 3_000;\nconst BACKOFF_BASE_MS = 500;\nconst BACKOFF_MAX_MS = 10_000;\n/** A connection that stayed up this long resets the reconnect backoff. */\nconst STABLE_CONNECTION_MS = 10_000;\n/** A malformed frame (4400) and a rejected connect token (4403) recur on every reconnect. */\nconst TERMINAL_CLOSE_CODES = new Set([4400, 4403]);\n\n/** One delivery of an account's order stream. */\nexport type PrivateOrdersEvent =\n /** The account's full live view; replace local state with it. */\n | { type: \"snapshot\"; orders: Order[] }\n /** One change, applied whole. */\n | { type: \"unit\"; unit: Unit }\n /**\n * The account's live view is temporarily behind (`true`) or caught up (`false`).\n * `orderIds`, when set, names the only orders behind; the rest of the view is current.\n */\n | { type: \"stale\"; stale: boolean; orderIds?: bigint[] };\n\nexport interface ConnectPrivateOrdersParams {\n /** The account's base58 public ID. */\n accountId: string;\n onEvent: (event: PrivateOrdersEvent) => void;\n /** Called when the server confirms the subscription, again after each reconnect. */\n onConnected?: () => void;\n /** Called when the connection carrying the subscription drops. */\n onDisconnected?: () => void;\n onError?: (ctx: SdkSubscriptionErrorContext) => void;\n}\n\nexport interface PrivateOrderStreamConfig {\n url: string;\n fetchConnectToken: () => Promise<string>;\n fetchSubscribeToken: (channel: string) => Promise<string>;\n}\n\ntype ClientOp = MessageInitShape<typeof ClientMessageSchema>[\"op\"];\n\ninterface Consumer {\n params: ConnectPrivateOrdersParams;\n /** False until a consumer that joined a running subscription received its current state. */\n caughtUp: boolean;\n}\n\n/** One server subscription per account, shared by every consumer of that account. */\ninterface StreamSubscription {\n consumers: Set<Consumer>;\n channel: string;\n account: bigint;\n /** Server subscription ID; empty until Subscribed. */\n sub: string;\n seq: bigint;\n /** Last applied resume position, carried across resubscribes and reconnects. */\n cursor: string;\n staged: Order[] | null;\n /** The account's live view as last applied, for consumers that join later; null before the first snapshot. */\n orders: Map<bigint, Order> | null;\n /** The last connection state consumers were told about. */\n state: \"pending\" | \"connected\" | \"disconnected\";\n /** What consumers were last told is stale, until they are told it caught up. */\n stale: { orderIds?: bigint[] } | null;\n /** Subscribe attempts since the subscription last delivered data; drives retry backoff. */\n retries: number;\n retryTimer: ReturnType<typeof setTimeout> | null;\n}\n\ntype PendingRequest = { kind: \"subscribe\" | \"refresh\"; s: StreamSubscription };\n\n/** 0.5 s doubling to 10 s, jittered over the upper half of each step. */\nfunction backoffMs(attempt: number): number {\n const ceiling = Math.min(BACKOFF_MAX_MS, BACKOFF_BASE_MS * 2 ** (attempt + 1));\n return ceiling / 2 + Math.random() * (ceiling / 2);\n}\n\nfunction isTerminalTokenError(error: unknown): boolean {\n return error instanceof PolyesterError && !error.retryable;\n}\n\n/**\n * Account order streams over the private WebSocket (`/v1/ws/private`). One\n * connection carries every subscription; each resumes from its last cursor\n * after a gap, an expired token, or a reconnect.\n */\nexport class PrivateOrderStream {\n readonly #config: PrivateOrderStreamConfig;\n /** Keyed by channel. A subscription whose last consumer left stays until the next microtask. */\n readonly #subs = new Map<string, StreamSubscription>();\n readonly #pending = new Map<string, PendingRequest>();\n readonly #bySub = new Map<string, StreamSubscription>();\n /** IDs of Unsubscribe requests awaiting their answer. */\n readonly #unsubscribing = new Set<string>();\n #ws: WebSocket | null = null;\n /** A connect token fetch for the next socket is in flight. */\n #connecting = false;\n /** Bumped on shutdown so a token fetch that outlived it opens nothing. */\n #generation = 0;\n #authSent = false;\n #authSentAt = 0;\n #reconnectAttempt = 0;\n #reconnectTimer: ReturnType<typeof setTimeout> | null = null;\n #heartbeatTimer: ReturnType<typeof setTimeout> | null = null;\n #requestSeq = 0;\n\n constructor(config: PrivateOrderStreamConfig) {\n this.#config = config;\n }\n\n /** Throws ValidationError when accountId is not a base58 public ID. */\n connect(params: ConnectPrivateOrdersParams): () => void {\n const channel = `private:spot:orders:${params.accountId}`;\n const account = idToBigInt(params.accountId, \"accountId\");\n const existing = this.#subs.get(channel);\n if (existing) {\n const consumer: Consumer = { params, caughtUp: false };\n existing.consumers.add(consumer);\n queueMicrotask(() => this.#catchUp(existing, consumer));\n return () => this.#remove(existing, consumer);\n }\n const consumer: Consumer = { params, caughtUp: true };\n const s: StreamSubscription = {\n consumers: new Set([consumer]),\n channel,\n account,\n sub: \"\",\n seq: 0n,\n cursor: \"\",\n staged: null,\n orders: null,\n state: \"pending\",\n stale: null,\n retries: 0,\n retryTimer: null,\n };\n this.#subs.set(channel, s);\n if (this.#ws && this.#authSent) void this.#subscribe(this.#ws, s);\n else if (!this.#ws && !this.#connecting && !this.#reconnectTimer) this.#open();\n return () => this.#remove(s, consumer);\n }\n\n /** Closes the connection and drops every subscription without callbacks. */\n disconnect(): void {\n for (const s of this.#subs.values()) {\n this.#clearRetry(s);\n // A consumer that disconnects mid-delivery stops deliveries to the rest.\n s.consumers.clear();\n }\n this.#subs.clear();\n this.#shutdown();\n }\n\n /** Accounts with at least one consumer. */\n get activeChannels(): number {\n let count = 0;\n for (const s of this.#subs.values()) if (s.consumers.size > 0) count++;\n return count;\n }\n\n get totalConsumers(): number {\n let count = 0;\n for (const s of this.#subs.values()) count += s.consumers.size;\n return count;\n }\n\n /** Gives a consumer that joined a running subscription what the others already know. */\n #catchUp(s: StreamSubscription, c: Consumer): void {\n if (!this.#isCurrent(s) || !s.consumers.has(c)) return;\n c.caughtUp = true;\n const { params } = c;\n if (s.state === \"connected\") this.#deliverTo(s, c, () => params.onConnected?.());\n const orders = s.orders && [...s.orders.values()];\n if (orders) this.#deliverTo(s, c, () => params.onEvent({ type: \"snapshot\", orders }));\n const { stale } = s;\n if (stale)\n this.#deliverTo(s, c, () => params.onEvent({ type: \"stale\", stale: true, ...stale }));\n }\n\n /** Fetches the connect token first: the server closes a socket that sends no Auth within 5 seconds. */\n #open(): void {\n const WebSocketCtor = globalThis.WebSocket;\n if (!WebSocketCtor) {\n // Reported after connect() returns, like every other connection failure.\n queueMicrotask(() =>\n this.#terminateAll(\n \"connection_token\",\n new ConfigurationError(\"The private order stream requires a global WebSocket.\"),\n ),\n );\n return;\n }\n const generation = this.#generation;\n this.#connecting = true;\n this.#config.fetchConnectToken().then(\n (token) => {\n if (generation !== this.#generation) return;\n this.#connecting = false;\n let ws: WebSocket;\n try {\n ws = new WebSocketCtor(this.#config.url, PRIVATE_WS_SUBPROTOCOL);\n } catch (error) {\n // A bad URL or a blocked insecure socket fails the same way on every retry.\n this.#terminateAll(\"connection\", error);\n return;\n }\n ws.binaryType = \"arraybuffer\";\n this.#ws = ws;\n this.#authSent = false;\n ws.onopen = () => this.#authenticate(ws, token);\n ws.onmessage = (event: MessageEvent) => this.#onFrame(ws, event.data);\n ws.onclose = (event: CloseEvent) => this.#onClosed(ws, event.code, event.reason);\n },\n (error: unknown) => {\n if (generation !== this.#generation) return;\n this.#connecting = false;\n if (isTerminalTokenError(error)) {\n this.#terminateAll(\"connection_token\", error);\n return;\n }\n this.#reportAll(\"connection_token\", error);\n this.#scheduleReconnect();\n },\n );\n }\n\n #authenticate(ws: WebSocket, token: string): void {\n this.#send(ws, { case: \"auth\", value: { token } });\n this.#authSent = true;\n this.#authSentAt = Date.now();\n this.#armHeartbeat(ws);\n for (const s of this.#subs.values()) void this.#subscribe(ws, s);\n }\n\n async #reauthenticate(ws: WebSocket): Promise<void> {\n try {\n const token = await this.#config.fetchConnectToken();\n if (this.#ws === ws) this.#send(ws, { case: \"auth\", value: { token } });\n } catch (error) {\n if (this.#ws !== ws) return;\n if (isTerminalTokenError(error)) this.#terminateAll(\"connection_token\", error);\n else this.#reportAll(\"connection_token\", error);\n }\n }\n\n #isCurrent(s: StreamSubscription): boolean {\n return this.#subs.get(s.channel) === s;\n }\n\n async #subscribe(ws: WebSocket, s: StreamSubscription): Promise<void> {\n if (!this.#isCurrent(s)) return;\n const id = this.#nextRequestId();\n this.#pending.set(id, { kind: \"subscribe\", s });\n let token: string;\n try {\n token = await this.#config.fetchSubscribeToken(s.channel);\n } catch (error) {\n if (this.#pending.get(id)?.s !== s) return;\n this.#pending.delete(id);\n if (isTerminalTokenError(error)) {\n this.#terminate(s, \"subscription_token\", error);\n return;\n }\n this.#report(s, \"subscription_token\", error);\n this.#retrySubscribe(ws, s);\n return;\n }\n if (this.#ws !== ws || this.#pending.get(id)?.s !== s) return;\n this.#send(ws, {\n case: \"subscribe\",\n value: { id, channel: Channel.ORDERS, account: s.account, token, cursor: s.cursor },\n });\n }\n\n /** Subscribes again after a backoff that grows until the subscription delivers data. */\n #retrySubscribe(ws: WebSocket, s: StreamSubscription): void {\n this.#clearRetry(s);\n s.retryTimer = setTimeout(\n () => {\n s.retryTimer = null;\n if (this.#ws === ws && this.#isCurrent(s) && !s.sub) void this.#subscribe(ws, s);\n },\n backoffMs(s.retries++),\n );\n }\n\n #clearRetry(s: StreamSubscription): void {\n if (s.retryTimer) clearTimeout(s.retryTimer);\n s.retryTimer = null;\n }\n\n async #refresh(ws: WebSocket, s: StreamSubscription): Promise<void> {\n const sub = s.sub;\n let token: string;\n try {\n token = await this.#config.fetchSubscribeToken(s.channel);\n } catch (error) {\n // An unrefreshed subscription ends with TOKEN_EXPIRED and resubscribes.\n if (this.#ws === ws && s.sub === sub) this.#report(s, \"subscription_token\", error);\n return;\n }\n if (this.#ws !== ws || s.sub !== sub) return;\n const id = this.#nextRequestId();\n this.#pending.set(id, { kind: \"refresh\", s });\n this.#send(ws, { case: \"subscribeRefresh\", value: { id, sub, token } });\n }\n\n /**\n * Drops the server subscription and subscribes again from the last applied cursor:\n * at once the first time, then with backoff until the subscription delivers data.\n */\n #resubscribe(ws: WebSocket, s: StreamSubscription): void {\n if (s.sub) {\n this.#bySub.delete(s.sub);\n this.#unsubscribe(ws, s.sub);\n }\n s.sub = \"\";\n s.seq = 0n;\n s.staged = null;\n if (s.retries > 0) {\n this.#retrySubscribe(ws, s);\n } else {\n s.retries = 1;\n void this.#subscribe(ws, s);\n }\n // Consumers see the gap as a close and the replacement's Subscribed as a reopen.\n if (s.state === \"connected\") {\n s.state = \"disconnected\";\n this.#deliver(s, (p) => p.onDisconnected?.());\n }\n }\n\n #unsubscribe(ws: WebSocket, sub: string): void {\n const id = this.#nextRequestId();\n this.#unsubscribing.add(id);\n this.#send(ws, { case: \"unsubscribe\", value: { id, sub } });\n }\n\n #onFrame(ws: WebSocket, data: unknown): void {\n if (this.#ws !== ws) return;\n this.#armHeartbeat(ws);\n if (!(data instanceof ArrayBuffer)) {\n this.#reportAll(\n \"decode\",\n new RealtimeError(\"Expected a binary private WebSocket frame\"),\n );\n return;\n }\n let msg;\n try {\n msg = fromBinary(ServerMessageSchema, new Uint8Array(data));\n } catch (error) {\n this.#reportAll(\"decode\", error);\n return;\n }\n const frame = msg.frame;\n\n switch (frame.case) {\n case \"subscribed\": {\n const request = this.#pending.get(frame.value.id);\n if (request?.kind !== \"subscribe\") {\n // Its consumer left before the server confirmed it.\n if (msg.sub) this.#unsubscribe(ws, msg.sub);\n return;\n }\n this.#pending.delete(frame.value.id);\n const s = request.s;\n s.sub = msg.sub;\n s.seq = 0n;\n this.#bySub.set(msg.sub, s);\n if (s.state !== \"connected\") {\n s.state = \"connected\";\n this.#deliver(s, (p) => p.onConnected?.());\n }\n // A new subscription reports Unavailable itself if its view is still behind.\n if (s.stale) {\n s.stale = null;\n this.#deliver(s, (p) => p.onEvent({ type: \"stale\", stale: false }));\n }\n return;\n }\n case \"subscribeRefreshed\":\n this.#pending.delete(frame.value.id);\n return;\n case \"unsubscribed\":\n if (this.#unsubscribing.delete(frame.value.id)) return;\n break;\n case \"error\":\n this.#onRequestError(ws, msg.sub, frame.value);\n return;\n case \"tokenExpiring\":\n void this.#reauthenticate(ws);\n return;\n }\n\n const s = this.#bySub.get(msg.sub);\n if (!s) return;\n if (msg.seq > 0n) {\n if (msg.seq !== s.seq + 1n) {\n this.#resubscribe(ws, s);\n return;\n }\n s.seq = msg.seq;\n }\n\n switch (frame.case) {\n case \"snapshotBegin\":\n s.staged = [];\n return;\n case \"snapshotPage\":\n s.staged?.push(...frame.value.orders);\n return;\n case \"snapshotEnd\": {\n const orders = s.staged;\n s.staged = null;\n if (!orders || orders.length !== frame.value.count) {\n s.cursor = \"\";\n this.#resubscribe(ws, s);\n return;\n }\n s.cursor = frame.value.cursor;\n s.retries = 0;\n s.orders = new Map(orders.map((o) => [o.orderId, o]));\n this.#deliver(s, (p) => p.onEvent({ type: \"snapshot\", orders }));\n return;\n }\n case \"unit\": {\n const unit = frame.value;\n s.cursor = unit.nextCursor;\n s.retries = 0;\n for (const o of unit.orders) s.orders?.set(o.orderId, o);\n for (const id of unit.removedOrderIds) s.orders?.delete(id);\n this.#deliver(s, (p) => p.onEvent({ type: \"unit\", unit }));\n return;\n }\n case \"covered\":\n s.cursor = frame.value.cursor;\n s.retries = 0;\n return;\n case \"ready\":\n // A resumed subscription on a quiet account delivers no data, only this.\n s.retries = 0;\n return;\n case \"unavailable\": {\n // A later Unavailable replaces the earlier one; order IDs narrow it to those orders.\n const { orderIds } = frame.value;\n const stale = orderIds.length > 0 ? { orderIds } : {};\n s.stale = stale;\n this.#deliver(s, (p) => p.onEvent({ type: \"stale\", stale: true, ...stale }));\n return;\n }\n case \"available\":\n s.stale = null;\n this.#deliver(s, (p) => p.onEvent({ type: \"stale\", stale: false }));\n return;\n case \"subscribeExpiring\":\n void this.#refresh(ws, s);\n return;\n case \"unsubscribed\":\n // The server ended it: its token expired, or for a reason this client does not know.\n this.#bySub.delete(s.sub);\n s.sub = \"\";\n this.#resubscribe(ws, s);\n return;\n }\n }\n\n #onRequestError(\n ws: WebSocket,\n sub: string,\n error: { id: string; code: RequestError_Code; message: string },\n ): void {\n if (error.id && this.#unsubscribing.delete(error.id)) return;\n const request = error.id ? this.#pending.get(error.id) : undefined;\n // The answer to a request already answered, or whose subscription has since gone.\n if (error.id && !request) return;\n if (request) this.#pending.delete(error.id);\n const s = request?.s ?? this.#bySub.get(sub);\n const realtimeError = new RealtimeError(\n error.message ||\n `Private order stream request failed: ${RequestError_Code[error.code]}`,\n { realtimeCode: error.code },\n );\n if (!s) {\n this.#reportAll(\"request\", realtimeError);\n return;\n }\n if (request?.kind === \"subscribe\") {\n if (error.code === RequestError_Code.CURSOR_INVALID) {\n s.cursor = \"\";\n void this.#subscribe(ws, s);\n return;\n }\n this.#terminate(s, \"subscribe\", realtimeError);\n return;\n }\n if (error.code === RequestError_Code.SUBSCRIPTION_UNKNOWN && s.sub === sub) {\n this.#bySub.delete(s.sub);\n s.sub = \"\";\n this.#resubscribe(ws, s);\n return;\n }\n this.#report(s, request?.kind ?? \"request\", realtimeError);\n }\n\n #onClosed(ws: WebSocket, code: number, reason: string): void {\n if (this.#ws !== ws) return;\n const stable = this.#authSent && Date.now() - this.#authSentAt >= STABLE_CONNECTION_MS;\n this.#detach();\n if (stable) this.#reconnectAttempt = 0;\n if (this.#subs.size === 0) return;\n\n if (TERMINAL_CLOSE_CODES.has(code)) {\n const error = new RealtimeError(\n reason || `Private WebSocket closed with code ${code}`,\n {\n realtimeCode: code,\n retryable: false,\n },\n );\n this.#terminateAll(\"disconnected\", error);\n return;\n }\n // Scheduled first, so a subscription opened from onDisconnected waits for it.\n this.#scheduleReconnect();\n // A close that reconnects is not an error, like a Centrifugo reconnect.\n for (const s of this.#subs.values()) {\n if (s.state === \"connected\") {\n s.state = \"disconnected\";\n this.#deliver(s, (p) => p.onDisconnected?.());\n }\n }\n }\n\n #scheduleReconnect(): void {\n this.#reconnectTimer = setTimeout(\n () => {\n this.#reconnectTimer = null;\n if (this.#subs.size > 0 && !this.#ws && !this.#connecting) this.#open();\n },\n backoffMs(this.#reconnectAttempt++),\n );\n }\n\n #armHeartbeat(ws: WebSocket): void {\n if (this.#heartbeatTimer) clearTimeout(this.#heartbeatTimer);\n this.#heartbeatTimer = setTimeout(\n () => this.#drop(ws, 4000, \"heartbeat timeout\"),\n HEARTBEAT_TIMEOUT_MS,\n );\n }\n\n /** Treats the socket as closed now; a stale socket may not emit close for a long time. */\n #drop(ws: WebSocket, code: number, reason: string): void {\n if (this.#ws !== ws) return;\n try {\n ws.close(code, reason);\n } catch {\n // noop\n }\n this.#onClosed(ws, code, reason);\n }\n\n #detach(): void {\n const ws = this.#ws;\n this.#ws = null;\n this.#authSent = false;\n if (this.#heartbeatTimer) clearTimeout(this.#heartbeatTimer);\n this.#heartbeatTimer = null;\n this.#pending.clear();\n this.#bySub.clear();\n this.#unsubscribing.clear();\n for (const s of this.#subs.values()) {\n this.#clearRetry(s);\n s.sub = \"\";\n s.seq = 0n;\n s.staged = null;\n }\n if (ws) {\n ws.onopen = null;\n ws.onmessage = null;\n ws.onclose = null;\n }\n }\n\n #shutdown(): void {\n const ws = this.#ws;\n this.#detach();\n this.#generation++;\n this.#connecting = false;\n if (this.#reconnectTimer) clearTimeout(this.#reconnectTimer);\n this.#reconnectTimer = null;\n this.#reconnectAttempt = 0;\n try {\n ws?.close(1000);\n } catch {\n // noop\n }\n }\n\n /** Drops a consumer; the server subscription goes a microtask later unless another joined. */\n #remove(s: StreamSubscription, c: Consumer): void {\n if (!s.consumers.delete(c) || s.consumers.size > 0) return;\n queueMicrotask(() => {\n if (s.consumers.size === 0) this.#teardown(s);\n });\n }\n\n #teardown(s: StreamSubscription): void {\n if (!this.#isCurrent(s)) return;\n this.#subs.delete(s.channel);\n s.consumers.clear();\n this.#clearRetry(s);\n const ws = this.#ws;\n if (ws && s.sub) {\n this.#bySub.delete(s.sub);\n this.#unsubscribe(ws, s.sub);\n }\n s.sub = \"\";\n for (const [id, request] of this.#pending) {\n if (request.s === s) this.#pending.delete(id);\n }\n if (this.#subs.size === 0) this.#shutdown();\n }\n\n #terminate(s: StreamSubscription, type: string, error: unknown): void {\n if (!this.#isCurrent(s)) return;\n this.#report(s, type, error);\n // Tell every consumer that has not been told it is disconnected.\n const told = s.state === \"disconnected\";\n const consumers = [...s.consumers].filter((c) => !c.caughtUp || !told);\n s.state = \"disconnected\";\n this.#teardown(s);\n for (const c of consumers) this.#call(s.channel, c, () => c.params.onDisconnected?.());\n }\n\n /** Spares subscriptions that consumers open from its callbacks. */\n #terminateAll(type: string, error: unknown): void {\n for (const s of [...this.#subs.values()]) this.#terminate(s, type, error);\n }\n\n #send(ws: WebSocket, op: ClientOp): void {\n if (ws.readyState !== 1) return;\n ws.send(toBinary(ClientMessageSchema, create(ClientMessageSchema, { op })));\n }\n\n #nextRequestId(): string {\n return String(++this.#requestSeq);\n }\n\n #report(s: StreamSubscription, type: string, error: unknown): void {\n const ctx = createSdkSubscriptionErrorContext(s.channel, type, error);\n // Only consumers present when the error happened, and still attached.\n for (const c of [...s.consumers]) {\n if (!s.consumers.has(c)) continue;\n try {\n c.params.onError?.(ctx);\n } catch {\n // Keep consumer error-handler failures isolated from the stream.\n }\n }\n }\n\n #reportAll(type: string, error: unknown): void {\n for (const s of [...this.#subs.values()]) this.#report(s, type, error);\n }\n\n /** Delivers to each caught-up consumer still attached when its turn comes. */\n #deliver(s: StreamSubscription, deliver: (params: ConnectPrivateOrdersParams) => void): void {\n for (const c of s.consumers) {\n if (c.caughtUp) this.#deliverTo(s, c, () => deliver(c.params));\n }\n }\n\n #deliverTo(s: StreamSubscription, c: Consumer, deliver: () => void): void {\n if (s.consumers.has(c)) this.#call(s.channel, c, deliver);\n }\n\n #call(channel: string, c: Consumer, deliver: () => void): void {\n try {\n deliver();\n } catch (error) {\n try {\n c.params.onError?.(publicationHandlerErrorContext(channel, error));\n } catch {\n // noop\n }\n }\n }\n}\n"],"mappings":";;;;;;AAiBA,MAAa,yBAAyB;AACtC,MAAM,uBAAuB;AAC7B,MAAM,kBAAkB;AACxB,MAAM,iBAAiB;;AAEvB,MAAM,uBAAuB;;AAE7B,MAAM,uCAAuB,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;;AAgEjD,SAAS,UAAU,SAAyB;CACxC,MAAM,UAAU,KAAK,IAAI,gBAAgB,kBAAkB,MAAM,UAAU,EAAE;CAC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AAI;IACA,EAAE,OAAO,UAAU,+BAA+B,SAAS,KAAK,CAAC;GACrE,QAAQ,CAER;EACJ;CACJ;AACJ"}
|
|
1
|
+
{"version":3,"file":"private-orders.js","names":["#config","#subs","#pending","#bySub","#unsubscribing","#catchUp","#remove","#ws","#authSent","#subscribe","#connecting","#reconnectTimer","#open","#clearRetry","#shutdown","#isCurrent","#deliverTo","#terminateAll","#generation","#authenticate","#onFrame","#onClosed","#reportAll","#scheduleReconnect","#send","#authSentAt","#armHeartbeat","#reauthenticate","#nextRequestId","#terminate","#report","#retrySubscribe","#refresh","#unsubscribe","#deliver","#drop","#onRequestError","#resubscribe","#detach","#reconnectAttempt","#heartbeatTimer","#teardown","#call","#requestSeq"],"sources":["../../src/realtime/private-orders.ts"],"sourcesContent":["import { create, fromBinary, toBinary, type MessageInitShape } from \"@bufbuild/protobuf\";\nimport type { Order } from \"../gen/orders/v1/orders_read_pb.js\";\nimport {\n Channel,\n ClientMessageSchema,\n RequestError_Code,\n ServerMessageSchema,\n type Unit,\n} from \"../gen/privatews/v1/private_ws_pb.js\";\nimport { ConfigurationError, PolyesterError, RealtimeError } from \"../shared/errors.js\";\nimport {\n createSdkSubscriptionErrorContext,\n publicationHandlerErrorContext,\n type SdkSubscriptionErrorContext,\n} from \"../shared/subscription-errors.js\";\nimport { idToBigInt } from \"../utils/base58-id.js\";\n\nexport const PRIVATE_WS_SUBPROTOCOL = \"polyester.v1.proto\";\nconst HEARTBEAT_TIMEOUT_MS = 3_000;\nconst BACKOFF_BASE_MS = 500;\nconst BACKOFF_MAX_MS = 10_000;\n/** A connection that stayed up this long resets the reconnect backoff. */\nconst STABLE_CONNECTION_MS = 10_000;\n/** A malformed frame (4400) and a rejected connect token (4403) recur on every reconnect. */\nconst TERMINAL_CLOSE_CODES = new Set([4400, 4403]);\n/** Larger frames are dropped undecoded with the connection; a full 256-order page is far smaller. */\nexport const MAX_PRIVATE_FRAME_BYTES = 4 * 1024 * 1024;\n/** A snapshot staging more pages than this ends its subscription, so a snapshot never ending stays bounded. */\nexport const MAX_SNAPSHOT_BYTES = 64 * 1024 * 1024;\nexport const MAX_SNAPSHOT_ORDERS = 100_000;\n\n/** One delivery of an account's order stream. */\nexport type PrivateOrdersEvent =\n /** The account's full live view; replace local state with it. */\n | { type: \"snapshot\"; orders: Order[] }\n /** One change, applied whole. */\n | { type: \"unit\"; unit: Unit }\n /**\n * The account's live view is temporarily behind (`true`) or caught up (`false`).\n * `orderIds`, when set, names the only orders behind; the rest of the view is current.\n */\n | { type: \"stale\"; stale: boolean; orderIds?: bigint[] };\n\nexport interface ConnectPrivateOrdersParams {\n /** The account's base58 public ID. */\n accountId: string;\n onEvent: (event: PrivateOrdersEvent) => void;\n /** Called when the server confirms the subscription, again after each reconnect. */\n onConnected?: () => void;\n /** Called when the connection carrying the subscription drops. */\n onDisconnected?: () => void;\n onError?: (ctx: SdkSubscriptionErrorContext) => void;\n}\n\nexport interface PrivateOrderStreamConfig {\n url: string;\n fetchConnectToken: () => Promise<string>;\n fetchSubscribeToken: (channel: string) => Promise<string>;\n}\n\ntype ClientOp = MessageInitShape<typeof ClientMessageSchema>[\"op\"];\n\ninterface Consumer {\n params: ConnectPrivateOrdersParams;\n /** False until a consumer that joined a running subscription received its current state. */\n caughtUp: boolean;\n}\n\n/** One server subscription per account, shared by every consumer of that account. */\ninterface StreamSubscription {\n consumers: Set<Consumer>;\n channel: string;\n account: bigint;\n /** Server subscription ID; empty until Subscribed. */\n sub: string;\n seq: bigint;\n /** Last applied resume position, carried across resubscribes and reconnects. */\n cursor: string;\n staged: Order[] | null;\n /** Frame bytes of the staged pages. */\n stagedBytes: number;\n /** The account's live view as last applied, for consumers that join later; null before the first snapshot. */\n orders: Map<bigint, Order> | null;\n /** The last connection state consumers were told about. */\n state: \"pending\" | \"connected\" | \"disconnected\";\n /** What consumers were last told is stale, until they are told it caught up. */\n stale: { orderIds?: bigint[] } | null;\n /** Subscribe attempts since the subscription last delivered data; drives retry backoff. */\n retries: number;\n retryTimer: ReturnType<typeof setTimeout> | null;\n}\n\ntype PendingRequest = { kind: \"subscribe\" | \"refresh\"; s: StreamSubscription };\n\n/** 0.5 s doubling to 10 s, jittered over the upper half of each step. */\nfunction backoffMs(attempt: number): number {\n const ceiling = Math.min(BACKOFF_MAX_MS, BACKOFF_BASE_MS * 2 ** (attempt + 1));\n return ceiling / 2 + Math.random() * (ceiling / 2);\n}\n\nfunction isTerminalTokenError(error: unknown): boolean {\n return error instanceof PolyesterError && !error.retryable;\n}\n\n/**\n * Account order streams over the private WebSocket (`/v1/ws/private`). One\n * connection carries every subscription; each resumes from its last cursor\n * after a gap, an expired token, or a reconnect.\n */\nexport class PrivateOrderStream {\n readonly #config: PrivateOrderStreamConfig;\n /** Keyed by channel. A subscription whose last consumer left stays until the next microtask. */\n readonly #subs = new Map<string, StreamSubscription>();\n readonly #pending = new Map<string, PendingRequest>();\n readonly #bySub = new Map<string, StreamSubscription>();\n /** IDs of Unsubscribe requests awaiting their answer. */\n readonly #unsubscribing = new Set<string>();\n #ws: WebSocket | null = null;\n /** A connect token fetch for the next socket is in flight. */\n #connecting = false;\n /** Bumped on shutdown so a token fetch that outlived it opens nothing. */\n #generation = 0;\n #authSent = false;\n #authSentAt = 0;\n #reconnectAttempt = 0;\n #reconnectTimer: ReturnType<typeof setTimeout> | null = null;\n #heartbeatTimer: ReturnType<typeof setTimeout> | null = null;\n #requestSeq = 0;\n\n constructor(config: PrivateOrderStreamConfig) {\n this.#config = config;\n }\n\n /** Throws ValidationError when accountId is not a base58 public ID. */\n connect(params: ConnectPrivateOrdersParams): () => void {\n const channel = `private:spot:orders:${params.accountId}`;\n const account = idToBigInt(params.accountId, \"accountId\");\n const existing = this.#subs.get(channel);\n if (existing) {\n const consumer: Consumer = { params, caughtUp: false };\n existing.consumers.add(consumer);\n queueMicrotask(() => this.#catchUp(existing, consumer));\n return () => this.#remove(existing, consumer);\n }\n const consumer: Consumer = { params, caughtUp: true };\n const s: StreamSubscription = {\n consumers: new Set([consumer]),\n channel,\n account,\n sub: \"\",\n seq: 0n,\n cursor: \"\",\n staged: null,\n stagedBytes: 0,\n orders: null,\n state: \"pending\",\n stale: null,\n retries: 0,\n retryTimer: null,\n };\n this.#subs.set(channel, s);\n if (this.#ws && this.#authSent) void this.#subscribe(this.#ws, s);\n else if (!this.#ws && !this.#connecting && !this.#reconnectTimer) this.#open();\n return () => this.#remove(s, consumer);\n }\n\n /** Closes the connection and drops every subscription without callbacks. */\n disconnect(): void {\n for (const s of this.#subs.values()) {\n this.#clearRetry(s);\n // A consumer that disconnects mid-delivery stops deliveries to the rest.\n s.consumers.clear();\n }\n this.#subs.clear();\n this.#shutdown();\n }\n\n /** Accounts with at least one consumer. */\n get activeChannels(): number {\n let count = 0;\n for (const s of this.#subs.values()) if (s.consumers.size > 0) count++;\n return count;\n }\n\n get totalConsumers(): number {\n let count = 0;\n for (const s of this.#subs.values()) count += s.consumers.size;\n return count;\n }\n\n /** Gives a consumer that joined a running subscription what the others already know. */\n #catchUp(s: StreamSubscription, c: Consumer): void {\n if (!this.#isCurrent(s) || !s.consumers.has(c)) return;\n c.caughtUp = true;\n const { params } = c;\n if (s.state === \"connected\") this.#deliverTo(s, c, () => params.onConnected?.());\n const orders = s.orders && [...s.orders.values()];\n if (orders) this.#deliverTo(s, c, () => params.onEvent({ type: \"snapshot\", orders }));\n const { stale } = s;\n if (stale)\n this.#deliverTo(s, c, () => params.onEvent({ type: \"stale\", stale: true, ...stale }));\n }\n\n /** Fetches the connect token first: the server closes a socket that sends no Auth within 5 seconds. */\n #open(): void {\n const WebSocketCtor = globalThis.WebSocket;\n if (!WebSocketCtor) {\n // Reported after connect() returns, like every other connection failure.\n queueMicrotask(() =>\n this.#terminateAll(\n \"connection_token\",\n new ConfigurationError(\"The private order stream requires a global WebSocket.\"),\n ),\n );\n return;\n }\n const generation = this.#generation;\n this.#connecting = true;\n this.#config.fetchConnectToken().then(\n (token) => {\n if (generation !== this.#generation) return;\n this.#connecting = false;\n let ws: WebSocket;\n try {\n ws = new WebSocketCtor(this.#config.url, PRIVATE_WS_SUBPROTOCOL);\n } catch (error) {\n // A bad URL or a blocked insecure socket fails the same way on every retry.\n this.#terminateAll(\"connection\", error);\n return;\n }\n ws.binaryType = \"arraybuffer\";\n this.#ws = ws;\n this.#authSent = false;\n ws.onopen = () => this.#authenticate(ws, token);\n ws.onmessage = (event: MessageEvent) => this.#onFrame(ws, event.data);\n ws.onclose = (event: CloseEvent) => this.#onClosed(ws, event.code, event.reason);\n },\n (error: unknown) => {\n if (generation !== this.#generation) return;\n this.#connecting = false;\n if (isTerminalTokenError(error)) {\n this.#terminateAll(\"connection_token\", error);\n return;\n }\n this.#reportAll(\"connection_token\", error);\n this.#scheduleReconnect();\n },\n );\n }\n\n #authenticate(ws: WebSocket, token: string): void {\n this.#send(ws, { case: \"auth\", value: { token } });\n this.#authSent = true;\n this.#authSentAt = Date.now();\n this.#armHeartbeat(ws);\n for (const s of this.#subs.values()) void this.#subscribe(ws, s);\n }\n\n async #reauthenticate(ws: WebSocket): Promise<void> {\n try {\n const token = await this.#config.fetchConnectToken();\n if (this.#ws === ws) this.#send(ws, { case: \"auth\", value: { token } });\n } catch (error) {\n if (this.#ws !== ws) return;\n if (isTerminalTokenError(error)) this.#terminateAll(\"connection_token\", error);\n else this.#reportAll(\"connection_token\", error);\n }\n }\n\n #isCurrent(s: StreamSubscription): boolean {\n return this.#subs.get(s.channel) === s;\n }\n\n async #subscribe(ws: WebSocket, s: StreamSubscription): Promise<void> {\n if (!this.#isCurrent(s)) return;\n const id = this.#nextRequestId();\n this.#pending.set(id, { kind: \"subscribe\", s });\n let token: string;\n try {\n token = await this.#config.fetchSubscribeToken(s.channel);\n } catch (error) {\n if (this.#pending.get(id)?.s !== s) return;\n this.#pending.delete(id);\n if (isTerminalTokenError(error)) {\n this.#terminate(s, \"subscription_token\", error);\n return;\n }\n this.#report(s, \"subscription_token\", error);\n this.#retrySubscribe(ws, s);\n return;\n }\n if (this.#ws !== ws || this.#pending.get(id)?.s !== s) return;\n this.#send(ws, {\n case: \"subscribe\",\n value: { id, channel: Channel.ORDERS, account: s.account, token, cursor: s.cursor },\n });\n }\n\n /** Subscribes again after a backoff that grows until the subscription delivers data. */\n #retrySubscribe(ws: WebSocket, s: StreamSubscription): void {\n this.#clearRetry(s);\n s.retryTimer = setTimeout(\n () => {\n s.retryTimer = null;\n if (this.#ws === ws && this.#isCurrent(s) && !s.sub) void this.#subscribe(ws, s);\n },\n backoffMs(s.retries++),\n );\n }\n\n #clearRetry(s: StreamSubscription): void {\n if (s.retryTimer) clearTimeout(s.retryTimer);\n s.retryTimer = null;\n }\n\n async #refresh(ws: WebSocket, s: StreamSubscription): Promise<void> {\n const sub = s.sub;\n let token: string;\n try {\n token = await this.#config.fetchSubscribeToken(s.channel);\n } catch (error) {\n // An unrefreshed subscription ends with TOKEN_EXPIRED and resubscribes.\n if (this.#ws === ws && s.sub === sub) this.#report(s, \"subscription_token\", error);\n return;\n }\n if (this.#ws !== ws || s.sub !== sub) return;\n const id = this.#nextRequestId();\n this.#pending.set(id, { kind: \"refresh\", s });\n this.#send(ws, { case: \"subscribeRefresh\", value: { id, sub, token } });\n }\n\n /**\n * Drops the server subscription and subscribes again from the last applied cursor:\n * at once the first time, then with backoff until the subscription delivers data.\n */\n #resubscribe(ws: WebSocket, s: StreamSubscription): void {\n if (s.sub) {\n this.#bySub.delete(s.sub);\n this.#unsubscribe(ws, s.sub);\n }\n s.sub = \"\";\n s.seq = 0n;\n s.staged = null;\n if (s.retries > 0) {\n this.#retrySubscribe(ws, s);\n } else {\n s.retries = 1;\n void this.#subscribe(ws, s);\n }\n // Consumers see the gap as a close and the replacement's Subscribed as a reopen.\n if (s.state === \"connected\") {\n s.state = \"disconnected\";\n this.#deliver(s, (p) => p.onDisconnected?.());\n }\n }\n\n #unsubscribe(ws: WebSocket, sub: string): void {\n const id = this.#nextRequestId();\n this.#unsubscribing.add(id);\n this.#send(ws, { case: \"unsubscribe\", value: { id, sub } });\n }\n\n #onFrame(ws: WebSocket, data: unknown): void {\n if (this.#ws !== ws) return;\n this.#armHeartbeat(ws);\n if (!(data instanceof ArrayBuffer)) {\n this.#reportAll(\n \"decode\",\n new RealtimeError(\"Expected a binary private WebSocket frame\"),\n );\n return;\n }\n if (data.byteLength > MAX_PRIVATE_FRAME_BYTES) {\n this.#reportAll(\n \"decode\",\n new RealtimeError(\n `Private WebSocket frame of ${data.byteLength} bytes exceeds ${MAX_PRIVATE_FRAME_BYTES}`,\n ),\n );\n // Reconnects with backoff; dropping the socket releases every staged snapshot.\n this.#drop(ws, 1009, \"frame too large\");\n return;\n }\n let msg;\n try {\n msg = fromBinary(ServerMessageSchema, new Uint8Array(data));\n } catch (error) {\n this.#reportAll(\"decode\", error);\n return;\n }\n const frame = msg.frame;\n\n switch (frame.case) {\n case \"subscribed\": {\n const request = this.#pending.get(frame.value.id);\n if (request?.kind !== \"subscribe\") {\n // Its consumer left before the server confirmed it.\n if (msg.sub) this.#unsubscribe(ws, msg.sub);\n return;\n }\n this.#pending.delete(frame.value.id);\n const s = request.s;\n s.sub = msg.sub;\n s.seq = 0n;\n this.#bySub.set(msg.sub, s);\n if (s.state !== \"connected\") {\n s.state = \"connected\";\n this.#deliver(s, (p) => p.onConnected?.());\n }\n // A new subscription reports Unavailable itself if its view is still behind.\n if (s.stale) {\n s.stale = null;\n this.#deliver(s, (p) => p.onEvent({ type: \"stale\", stale: false }));\n }\n return;\n }\n case \"subscribeRefreshed\":\n this.#pending.delete(frame.value.id);\n return;\n case \"unsubscribed\":\n if (this.#unsubscribing.delete(frame.value.id)) return;\n break;\n case \"error\":\n this.#onRequestError(ws, msg.sub, frame.value);\n return;\n case \"tokenExpiring\":\n void this.#reauthenticate(ws);\n return;\n }\n\n const s = this.#bySub.get(msg.sub);\n if (!s) return;\n if (msg.seq > 0n) {\n if (msg.seq !== s.seq + 1n) {\n this.#resubscribe(ws, s);\n return;\n }\n s.seq = msg.seq;\n }\n\n switch (frame.case) {\n case \"snapshotBegin\":\n s.staged = [];\n s.stagedBytes = 0;\n return;\n case \"snapshotPage\": {\n if (!s.staged) return;\n s.stagedBytes += data.byteLength;\n const count = s.staged.length + frame.value.orders.length;\n if (s.stagedBytes > MAX_SNAPSHOT_BYTES || count > MAX_SNAPSHOT_ORDERS) {\n s.staged = null;\n // The same account sends the same snapshot again, so retrying cannot help.\n this.#terminate(\n s,\n \"snapshot\",\n new RealtimeError(\n `Private order snapshot exceeds ${MAX_SNAPSHOT_ORDERS} orders or ${MAX_SNAPSHOT_BYTES} bytes`,\n ),\n );\n return;\n }\n s.staged.push(...frame.value.orders);\n return;\n }\n case \"snapshotEnd\": {\n const orders = s.staged;\n s.staged = null;\n if (!orders || orders.length !== frame.value.count) {\n s.cursor = \"\";\n this.#resubscribe(ws, s);\n return;\n }\n s.cursor = frame.value.cursor;\n s.retries = 0;\n s.orders = new Map(orders.map((o) => [o.orderId, o]));\n this.#deliver(s, (p) => p.onEvent({ type: \"snapshot\", orders }));\n return;\n }\n case \"unit\": {\n const unit = frame.value;\n s.cursor = unit.nextCursor;\n s.retries = 0;\n for (const o of unit.orders) s.orders?.set(o.orderId, o);\n for (const id of unit.removedOrderIds) s.orders?.delete(id);\n this.#deliver(s, (p) => p.onEvent({ type: \"unit\", unit }));\n return;\n }\n case \"covered\":\n s.cursor = frame.value.cursor;\n s.retries = 0;\n return;\n case \"ready\":\n // A resumed subscription on a quiet account delivers no data, only this.\n s.retries = 0;\n return;\n case \"unavailable\": {\n // A later Unavailable replaces the earlier one; order IDs narrow it to those orders.\n const { orderIds } = frame.value;\n const stale = orderIds.length > 0 ? { orderIds } : {};\n s.stale = stale;\n this.#deliver(s, (p) => p.onEvent({ type: \"stale\", stale: true, ...stale }));\n return;\n }\n case \"available\":\n s.stale = null;\n this.#deliver(s, (p) => p.onEvent({ type: \"stale\", stale: false }));\n return;\n case \"subscribeExpiring\":\n void this.#refresh(ws, s);\n return;\n case \"unsubscribed\":\n // The server ended it: its token expired, or for a reason this client does not know.\n this.#bySub.delete(s.sub);\n s.sub = \"\";\n this.#resubscribe(ws, s);\n return;\n }\n }\n\n #onRequestError(\n ws: WebSocket,\n sub: string,\n error: { id: string; code: RequestError_Code; message: string },\n ): void {\n if (error.id && this.#unsubscribing.delete(error.id)) return;\n const request = error.id ? this.#pending.get(error.id) : undefined;\n // The answer to a request already answered, or whose subscription has since gone.\n if (error.id && !request) return;\n if (request) this.#pending.delete(error.id);\n const s = request?.s ?? this.#bySub.get(sub);\n const realtimeError = new RealtimeError(\n error.message ||\n `Private order stream request failed: ${RequestError_Code[error.code]}`,\n { realtimeCode: error.code },\n );\n if (!s) {\n this.#reportAll(\"request\", realtimeError);\n return;\n }\n if (request?.kind === \"subscribe\") {\n if (error.code === RequestError_Code.CURSOR_INVALID) {\n s.cursor = \"\";\n void this.#subscribe(ws, s);\n return;\n }\n this.#terminate(s, \"subscribe\", realtimeError);\n return;\n }\n if (error.code === RequestError_Code.SUBSCRIPTION_UNKNOWN && s.sub === sub) {\n this.#bySub.delete(s.sub);\n s.sub = \"\";\n this.#resubscribe(ws, s);\n return;\n }\n this.#report(s, request?.kind ?? \"request\", realtimeError);\n }\n\n #onClosed(ws: WebSocket, code: number, reason: string): void {\n if (this.#ws !== ws) return;\n const stable = this.#authSent && Date.now() - this.#authSentAt >= STABLE_CONNECTION_MS;\n this.#detach();\n if (stable) this.#reconnectAttempt = 0;\n if (this.#subs.size === 0) return;\n\n if (TERMINAL_CLOSE_CODES.has(code)) {\n const error = new RealtimeError(\n reason || `Private WebSocket closed with code ${code}`,\n {\n realtimeCode: code,\n retryable: false,\n },\n );\n this.#terminateAll(\"disconnected\", error);\n return;\n }\n // Scheduled first, so a subscription opened from onDisconnected waits for it.\n this.#scheduleReconnect();\n // A close that reconnects is not an error, like a Centrifugo reconnect.\n for (const s of this.#subs.values()) {\n if (s.state === \"connected\") {\n s.state = \"disconnected\";\n this.#deliver(s, (p) => p.onDisconnected?.());\n }\n }\n }\n\n #scheduleReconnect(): void {\n this.#reconnectTimer = setTimeout(\n () => {\n this.#reconnectTimer = null;\n if (this.#subs.size > 0 && !this.#ws && !this.#connecting) this.#open();\n },\n backoffMs(this.#reconnectAttempt++),\n );\n }\n\n #armHeartbeat(ws: WebSocket): void {\n if (this.#heartbeatTimer) clearTimeout(this.#heartbeatTimer);\n this.#heartbeatTimer = setTimeout(\n () => this.#drop(ws, 4000, \"heartbeat timeout\"),\n HEARTBEAT_TIMEOUT_MS,\n );\n }\n\n /** Treats the socket as closed now; a stale socket may not emit close for a long time. */\n #drop(ws: WebSocket, code: number, reason: string): void {\n if (this.#ws !== ws) return;\n try {\n ws.close(code, reason);\n } catch {\n // noop\n }\n this.#onClosed(ws, code, reason);\n }\n\n #detach(): void {\n const ws = this.#ws;\n this.#ws = null;\n this.#authSent = false;\n if (this.#heartbeatTimer) clearTimeout(this.#heartbeatTimer);\n this.#heartbeatTimer = null;\n this.#pending.clear();\n this.#bySub.clear();\n this.#unsubscribing.clear();\n for (const s of this.#subs.values()) {\n this.#clearRetry(s);\n s.sub = \"\";\n s.seq = 0n;\n s.staged = null;\n }\n if (ws) {\n ws.onopen = null;\n ws.onmessage = null;\n ws.onclose = null;\n }\n }\n\n #shutdown(): void {\n const ws = this.#ws;\n this.#detach();\n this.#generation++;\n this.#connecting = false;\n if (this.#reconnectTimer) clearTimeout(this.#reconnectTimer);\n this.#reconnectTimer = null;\n this.#reconnectAttempt = 0;\n try {\n ws?.close(1000);\n } catch {\n // noop\n }\n }\n\n /** Drops a consumer; the server subscription goes a microtask later unless another joined. */\n #remove(s: StreamSubscription, c: Consumer): void {\n if (!s.consumers.delete(c) || s.consumers.size > 0) return;\n queueMicrotask(() => {\n if (s.consumers.size === 0) this.#teardown(s);\n });\n }\n\n #teardown(s: StreamSubscription): void {\n if (!this.#isCurrent(s)) return;\n this.#subs.delete(s.channel);\n s.consumers.clear();\n this.#clearRetry(s);\n const ws = this.#ws;\n if (ws && s.sub) {\n this.#bySub.delete(s.sub);\n this.#unsubscribe(ws, s.sub);\n }\n s.sub = \"\";\n for (const [id, request] of this.#pending) {\n if (request.s === s) this.#pending.delete(id);\n }\n if (this.#subs.size === 0) this.#shutdown();\n }\n\n #terminate(s: StreamSubscription, type: string, error: unknown): void {\n if (!this.#isCurrent(s)) return;\n this.#report(s, type, error);\n // Tell every consumer that has not been told it is disconnected.\n const told = s.state === \"disconnected\";\n const consumers = [...s.consumers].filter((c) => !c.caughtUp || !told);\n s.state = \"disconnected\";\n this.#teardown(s);\n for (const c of consumers) this.#call(s.channel, c, () => c.params.onDisconnected?.());\n }\n\n /** Spares subscriptions that consumers open from its callbacks. */\n #terminateAll(type: string, error: unknown): void {\n for (const s of [...this.#subs.values()]) this.#terminate(s, type, error);\n }\n\n #send(ws: WebSocket, op: ClientOp): void {\n if (ws.readyState !== 1) return;\n ws.send(toBinary(ClientMessageSchema, create(ClientMessageSchema, { op })));\n }\n\n #nextRequestId(): string {\n return String(++this.#requestSeq);\n }\n\n #report(s: StreamSubscription, type: string, error: unknown): void {\n const ctx = createSdkSubscriptionErrorContext(s.channel, type, error);\n // Only consumers present when the error happened, and still attached.\n for (const c of [...s.consumers]) {\n if (!s.consumers.has(c)) continue;\n try {\n c.params.onError?.(ctx);\n } catch {\n // Keep consumer error-handler failures isolated from the stream.\n }\n }\n }\n\n #reportAll(type: string, error: unknown): void {\n for (const s of [...this.#subs.values()]) this.#report(s, type, error);\n }\n\n /** Delivers to each caught-up consumer still attached when its turn comes. */\n #deliver(s: StreamSubscription, deliver: (params: ConnectPrivateOrdersParams) => void): void {\n for (const c of s.consumers) {\n if (c.caughtUp) this.#deliverTo(s, c, () => deliver(c.params));\n }\n }\n\n #deliverTo(s: StreamSubscription, c: Consumer, deliver: () => void): void {\n if (s.consumers.has(c)) this.#call(s.channel, c, deliver);\n }\n\n #call(channel: string, c: Consumer, deliver: () => void): void {\n try {\n deliver();\n } catch (error) {\n try {\n c.params.onError?.(publicationHandlerErrorContext(channel, error));\n } catch {\n // noop\n }\n }\n }\n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,CAAC,CAAC;CAC9E;CAEA,iBAAyB;EACrB,OAAO,OAAO,EAAE,KAAKc,WAAW;CACpC;CAEA,QAAQ,GAAuB,MAAc,OAAsB;EAC/D,MAAM,MAAM,kCAAkC,EAAE,SAAS,MAAM,KAAK;EAEpE,KAAK,MAAM,KAAK,CAAC,GAAG,EAAE,SAAS,GAAG;GAC9B,IAAI,CAAC,EAAE,UAAU,IAAI,CAAC,GAAG;GACzB,IAAI;IACA,EAAE,OAAO,UAAU,GAAG;GAC1B,QAAQ,CAER;EACJ;CACJ;CAEA,WAAW,MAAc,OAAsB;EAC3C,KAAK,MAAM,KAAK,CAAC,GAAG,KAAK1C,MAAM,OAAO,CAAC,GAAG,KAAK6B,QAAQ,GAAG,MAAM,KAAK;CACzE;;CAGA,SAAS,GAAuB,SAA6D;EACzF,KAAK,MAAM,KAAK,EAAE,WACd,IAAI,EAAE,UAAU,KAAKd,WAAW,GAAG,SAAS,QAAQ,EAAE,MAAM,CAAC;CAErE;CAEA,WAAW,GAAuB,GAAa,SAA2B;EACtE,IAAI,EAAE,UAAU,IAAI,CAAC,GAAG,KAAK0B,MAAM,EAAE,SAAS,GAAG,OAAO;CAC5D;CAEA,MAAM,SAAiB,GAAa,SAA2B;EAC3D,IAAI;GACA,QAAQ;EACZ,SAAS,OAAO;GACZ,IAAI;IACA,EAAE,OAAO,UAAU,+BAA+B,SAAS,KAAK,CAAC;GACrE,QAAQ,CAER;EACJ;CACJ;AACJ"}
|
|
@@ -297,7 +297,7 @@ declare const AddressBookSchema: v.ObjectSchema<{
|
|
|
297
297
|
rootAccountId: string;
|
|
298
298
|
subaccountId: bigint;
|
|
299
299
|
}, AddressBookAccountScope>]>, undefined>;
|
|
300
|
-
readonly callerRole: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "
|
|
300
|
+
readonly callerRole: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified">]>;
|
|
301
301
|
readonly label: v.StringSchema<undefined>;
|
|
302
302
|
readonly ownerUsername: v.StringSchema<undefined>;
|
|
303
303
|
readonly smartAccountAddress: v.StringSchema<undefined>;
|
|
@@ -1102,7 +1102,7 @@ declare const AddressBookViewSchema: v.ObjectSchema<{
|
|
|
1102
1102
|
rootAccountId: string;
|
|
1103
1103
|
subaccountId: bigint;
|
|
1104
1104
|
}, AddressBookAccountScope>]>, undefined>;
|
|
1105
|
-
readonly callerRole: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "
|
|
1105
|
+
readonly callerRole: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified">]>;
|
|
1106
1106
|
readonly label: v.StringSchema<undefined>;
|
|
1107
1107
|
readonly ownerUsername: v.StringSchema<undefined>;
|
|
1108
1108
|
readonly smartAccountAddress: v.StringSchema<undefined>;
|
|
@@ -31,7 +31,7 @@ declare const ListChangelogChangesInputSchema: v.SchemaWithPipe<readonly [v.Stri
|
|
|
31
31
|
}, undefined>, v.CheckAction<{
|
|
32
32
|
categories: ("breaking_change" | "new_feature" | "improvement" | "bug_fix")[];
|
|
33
33
|
actionRequired?: boolean | undefined;
|
|
34
|
-
surfaces: ("trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
34
|
+
surfaces: ("rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
35
35
|
audiences: ("all_users" | "traders" | "market_makers" | "developers")[];
|
|
36
36
|
startTime?: number | undefined;
|
|
37
37
|
endTime?: number | undefined;
|
|
@@ -42,7 +42,7 @@ declare const ListChangelogChangesInputSchema: v.SchemaWithPipe<readonly [v.Stri
|
|
|
42
42
|
}, "endTime: must be after startTime">, v.TransformAction<{
|
|
43
43
|
categories: ("breaking_change" | "new_feature" | "improvement" | "bug_fix")[];
|
|
44
44
|
actionRequired?: boolean | undefined;
|
|
45
|
-
surfaces: ("trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
45
|
+
surfaces: ("rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
46
46
|
audiences: ("all_users" | "traders" | "market_makers" | "developers")[];
|
|
47
47
|
startTime?: number | undefined;
|
|
48
48
|
endTime?: number | undefined;
|
|
@@ -73,14 +73,14 @@ declare const ChangelogChangeSchema: v.ObjectSchema<{
|
|
|
73
73
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
74
74
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
75
75
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
76
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
76
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
77
77
|
}, undefined>;
|
|
78
78
|
type ChangelogChange = v.InferOutput<typeof ChangelogChangeSchema>;
|
|
79
79
|
/** `surface` is the product area the section covers, `"unspecified"` when it spans several. */
|
|
80
80
|
declare const ChangelogSectionSchema: v.ObjectSchema<{
|
|
81
81
|
readonly heading: v.StringSchema<undefined>;
|
|
82
82
|
readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
83
|
-
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
83
|
+
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>;
|
|
84
84
|
readonly changes: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
85
85
|
readonly id: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
86
86
|
readonly title: v.StringSchema<undefined>;
|
|
@@ -90,7 +90,7 @@ declare const ChangelogSectionSchema: v.ObjectSchema<{
|
|
|
90
90
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
91
91
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
92
92
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
93
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
93
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
94
94
|
}, undefined>, undefined>, readonly []>;
|
|
95
95
|
}, undefined>;
|
|
96
96
|
type ChangelogSection = v.InferOutput<typeof ChangelogSectionSchema>;
|
|
@@ -209,7 +209,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
209
209
|
readonly sections: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
210
210
|
readonly heading: v.StringSchema<undefined>;
|
|
211
211
|
readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
212
|
-
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
212
|
+
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>;
|
|
213
213
|
readonly changes: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
214
214
|
readonly id: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
215
215
|
readonly title: v.StringSchema<undefined>;
|
|
@@ -219,7 +219,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
219
219
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
220
220
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
221
221
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
222
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
222
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
223
223
|
}, undefined>, undefined>, readonly []>;
|
|
224
224
|
}, undefined>, undefined>, readonly []>;
|
|
225
225
|
}, undefined>, v.TransformAction<{
|
|
@@ -241,7 +241,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
241
241
|
sections: {
|
|
242
242
|
heading: string;
|
|
243
243
|
summary?: string | undefined;
|
|
244
|
-
surface: "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
244
|
+
surface: "unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap";
|
|
245
245
|
changes: {
|
|
246
246
|
id: string;
|
|
247
247
|
title: string;
|
|
@@ -251,14 +251,14 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
251
251
|
actionRequired: boolean;
|
|
252
252
|
migrationGuidance?: string | undefined;
|
|
253
253
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
254
|
-
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
254
|
+
surfaces: ("unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
255
255
|
}[];
|
|
256
256
|
}[];
|
|
257
257
|
}, {
|
|
258
258
|
sections: {
|
|
259
259
|
heading: string;
|
|
260
260
|
summary?: string | undefined;
|
|
261
|
-
surface: "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
261
|
+
surface: "unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap";
|
|
262
262
|
changes: {
|
|
263
263
|
id: string;
|
|
264
264
|
title: string;
|
|
@@ -268,7 +268,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
268
268
|
actionRequired: boolean;
|
|
269
269
|
migrationGuidance?: string | undefined;
|
|
270
270
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
271
|
-
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
271
|
+
surfaces: ("unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
272
272
|
}[];
|
|
273
273
|
}[];
|
|
274
274
|
slug: string;
|
|
@@ -296,7 +296,7 @@ declare const ChangelogChangeEntrySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
296
296
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
297
297
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
298
298
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
299
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
299
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
300
300
|
}, undefined>;
|
|
301
301
|
readonly postSlug: v.StringSchema<undefined>;
|
|
302
302
|
readonly publishedAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -317,7 +317,7 @@ declare const ChangelogChangeEntrySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
317
317
|
actionRequired: boolean;
|
|
318
318
|
migrationGuidance?: string | undefined;
|
|
319
319
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
320
|
-
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
320
|
+
surfaces: ("unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
321
321
|
};
|
|
322
322
|
postSlug: string;
|
|
323
323
|
publishedAt: number;
|
|
@@ -334,7 +334,7 @@ declare const ChangelogChangeEntrySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
334
334
|
actionRequired: boolean;
|
|
335
335
|
migrationGuidance?: string | undefined;
|
|
336
336
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
337
|
-
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
337
|
+
surfaces: ("unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
338
338
|
}>]>;
|
|
339
339
|
/** A change with the slug, first publication time and section heading of the post that announced it. */
|
|
340
340
|
type ChangelogChangeEntry = v.InferOutput<typeof ChangelogChangeEntrySchema>;
|
|
@@ -349,7 +349,7 @@ declare const ListChangelogChangesResultSchema: v.ObjectSchema<{
|
|
|
349
349
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
350
350
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
351
351
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
352
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
352
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
353
353
|
}, undefined>;
|
|
354
354
|
readonly postSlug: v.StringSchema<undefined>;
|
|
355
355
|
readonly publishedAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -370,7 +370,7 @@ declare const ListChangelogChangesResultSchema: v.ObjectSchema<{
|
|
|
370
370
|
actionRequired: boolean;
|
|
371
371
|
migrationGuidance?: string | undefined;
|
|
372
372
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
373
|
-
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
373
|
+
surfaces: ("unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
374
374
|
};
|
|
375
375
|
postSlug: string;
|
|
376
376
|
publishedAt: number;
|
|
@@ -387,7 +387,7 @@ declare const ListChangelogChangesResultSchema: v.ObjectSchema<{
|
|
|
387
387
|
actionRequired: boolean;
|
|
388
388
|
migrationGuidance?: string | undefined;
|
|
389
389
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
390
|
-
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap"
|
|
390
|
+
surfaces: ("unspecified" | "rewards" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
391
391
|
}>]>, undefined>, readonly []>;
|
|
392
392
|
readonly nextPageToken: v.StringSchema<undefined>;
|
|
393
393
|
}, undefined>;
|
|
@@ -49,7 +49,7 @@ declare const CheckpointBiggestTradeSchema: v.SchemaWithPipe<readonly [v.ObjectS
|
|
|
49
49
|
side: number;
|
|
50
50
|
at: number;
|
|
51
51
|
}, {
|
|
52
|
-
side: "
|
|
52
|
+
side: "unspecified" | "buy" | "sell";
|
|
53
53
|
symbolId: number;
|
|
54
54
|
symbol: string;
|
|
55
55
|
at: number;
|
|
@@ -229,7 +229,7 @@ declare const CheckpointSchema: v.ObjectSchema<{
|
|
|
229
229
|
side: number;
|
|
230
230
|
at: number;
|
|
231
231
|
}, {
|
|
232
|
-
side: "
|
|
232
|
+
side: "unspecified" | "buy" | "sell";
|
|
233
233
|
symbolId: number;
|
|
234
234
|
symbol: string;
|
|
235
235
|
at: number;
|
|
@@ -14,7 +14,7 @@ type TimestampInit = {
|
|
|
14
14
|
declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
15
15
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
16
16
|
readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1s" | "1m" | "5m" | "1h", HeatmapInterval>]>;
|
|
17
|
-
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<1 | 5 | 10 | 20 | 100 | 500 |
|
|
17
|
+
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<1 | 5 | 10 | 20 | 100 | 500 | 200 | 50 | 1000, HeatmapDepth>]>;
|
|
18
18
|
readonly quantityMode: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["close", "peak"], undefined>, "close">, v.TransformAction<"close" | "peak", HeatmapQuantityMode>]>;
|
|
19
19
|
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 20000, undefined>]>;
|
|
20
20
|
readonly startTsSec: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
|
|
@@ -227,7 +227,7 @@ type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;
|
|
|
227
227
|
declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
228
228
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
229
229
|
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "5m" | "1h">>]>;
|
|
230
|
-
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 1 | 5 | 10 | 20 |
|
|
230
|
+
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 1 | "unspecified" | 5 | 10 | 20 | 100 | 500 | 200 | 50 | 1000>]>;
|
|
231
231
|
readonly chain: v.OptionalSchema<v.ObjectSchema<{
|
|
232
232
|
readonly baseKeyframe: v.OptionalSchema<v.ObjectSchema<{
|
|
233
233
|
readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
@@ -287,7 +287,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
287
287
|
}, undefined>, v.TransformAction<{
|
|
288
288
|
symbolId: number;
|
|
289
289
|
interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
|
|
290
|
-
depth: 1 | 5 | 10 | 20 |
|
|
290
|
+
depth: 1 | "unspecified" | 5 | 10 | 20 | 100 | 500 | 200 | 50 | 1000;
|
|
291
291
|
chain?: {
|
|
292
292
|
baseKeyframe?: {
|
|
293
293
|
tsSec: number;
|
|
@@ -347,7 +347,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
347
347
|
}, {
|
|
348
348
|
symbolId: number;
|
|
349
349
|
interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
|
|
350
|
-
depth: 1 | 5 | 10 | 20 |
|
|
350
|
+
depth: 1 | "unspecified" | 5 | 10 | 20 | 100 | 500 | 200 | 50 | 1000;
|
|
351
351
|
chain: {
|
|
352
352
|
baseKeyframe: {
|
|
353
353
|
tsSec: number;
|
|
@@ -138,7 +138,7 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
|
|
|
138
138
|
subaccountId: string | undefined;
|
|
139
139
|
smartAccountAddress: string | undefined;
|
|
140
140
|
}>]>, undefined>;
|
|
141
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
141
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "accepted" | "rejected">]>;
|
|
142
142
|
}, undefined>, v.TransformAction<{
|
|
143
143
|
requestId: string;
|
|
144
144
|
transferId: string;
|
|
@@ -155,7 +155,7 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
|
|
|
155
155
|
subaccountId: string | undefined;
|
|
156
156
|
smartAccountAddress: string | undefined;
|
|
157
157
|
} | undefined;
|
|
158
|
-
status: "unspecified" | "
|
|
158
|
+
status: "unspecified" | "failed" | "accepted" | "rejected";
|
|
159
159
|
}, {
|
|
160
160
|
acceptedAtUnixMs: number;
|
|
161
161
|
quantity: string;
|
|
@@ -169,7 +169,7 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
|
|
|
169
169
|
subaccountId: string | undefined;
|
|
170
170
|
smartAccountAddress: string | undefined;
|
|
171
171
|
} | undefined;
|
|
172
|
-
status: "unspecified" | "
|
|
172
|
+
status: "unspecified" | "failed" | "accepted" | "rejected";
|
|
173
173
|
}>]>;
|
|
174
174
|
type CreateInternalTransferResult = v.InferOutput<ReturnType<typeof createCreateInternalTransferResultSchema>>;
|
|
175
175
|
//#endregion
|