@agg-build/sdk 4.25.0 → 4.27.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/dist/agg-websocket-BstVWtLA.d.mts +6004 -0
- package/dist/agg-websocket-BstVWtLA.d.mts.map +1 -0
- package/dist/agg-websocket-BstVWtLA.d.ts +6004 -0
- package/dist/agg-websocket-BstVWtLA.d.ts.map +1 -0
- package/dist/agg-websocket-CK2iXfti.mjs +1427 -0
- package/dist/agg-websocket-CK2iXfti.mjs.map +1 -0
- package/dist/agg-websocket-DJbIfxKb.js +1478 -0
- package/dist/browser.d.mts +67 -66
- package/dist/browser.d.mts.map +1 -0
- package/dist/browser.d.ts +67 -66
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +720 -2047
- package/dist/browser.mjs +423 -799
- package/dist/browser.mjs.map +1 -0
- package/dist/candle-builder-BNewIe9K.mjs +148 -0
- package/dist/candle-builder-BNewIe9K.mjs.map +1 -0
- package/dist/candle-builder-BULYdxB4.js +151 -0
- package/dist/index.d.mts +2 -1342
- package/dist/index.d.ts +2 -1342
- package/dist/index.js +2794 -4656
- package/dist/index.mjs +2788 -2486
- package/dist/index.mjs.map +1 -0
- package/dist/market-data.d.mts +6 -6
- package/dist/market-data.d.mts.map +1 -0
- package/dist/market-data.d.ts +6 -6
- package/dist/market-data.d.ts.map +1 -0
- package/dist/market-data.js +314 -1774
- package/dist/market-data.mjs +314 -350
- package/dist/market-data.mjs.map +1 -0
- package/dist/server.d.mts +235 -234
- package/dist/server.d.mts.map +1 -0
- package/dist/server.d.ts +235 -234
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +168 -296
- package/dist/server.mjs +163 -234
- package/dist/server.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/agg-websocket-Bxt9PzTz.d.mts +0 -4479
- package/dist/agg-websocket-Bxt9PzTz.d.ts +0 -4479
- package/dist/chunk-QXBVA5TW.mjs +0 -2073
- package/dist/chunk-VD5UTAVD.mjs +0 -158
- package/dist/chunk-WNQUEZJF.mjs +0 -58
|
@@ -1,4479 +0,0 @@
|
|
|
1
|
-
type CandleInterval = "1m" | "5m" | "1h" | "1d";
|
|
2
|
-
/** Universal OHLCV candle. Chart-library-agnostic. */
|
|
3
|
-
interface Candle {
|
|
4
|
-
/** Interval-aligned open time in seconds. */
|
|
5
|
-
openTime: number;
|
|
6
|
-
o: number;
|
|
7
|
-
h: number;
|
|
8
|
-
l: number;
|
|
9
|
-
c: number;
|
|
10
|
-
/** Accumulated trade volume. 0 if no trades in interval. */
|
|
11
|
-
v: number;
|
|
12
|
-
tradeCount: number;
|
|
13
|
-
isFinal: boolean;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Accumulates OHLCV candles from orderbook delta midpoints and trades.
|
|
17
|
-
* All 4 intervals computed simultaneously. onChange batched via rAF (~16ms).
|
|
18
|
-
*/
|
|
19
|
-
declare class CandleBuilder {
|
|
20
|
-
private forming;
|
|
21
|
-
private closedMap;
|
|
22
|
-
private listeners;
|
|
23
|
-
private _midpoint;
|
|
24
|
-
private dirty;
|
|
25
|
-
private scheduled;
|
|
26
|
-
constructor();
|
|
27
|
-
/** Feed a midpoint (from orderbook delta). Updates O/H/L/C for all intervals. */
|
|
28
|
-
addMidpoint(midpoint: number, timestampSecs: number): void;
|
|
29
|
-
/** Feed a trade. Updates volume + refines H/L/C from trade price. */
|
|
30
|
-
addTrade(price: number, size: number, timestampSecs: number): void;
|
|
31
|
-
/** Current forming candle for an interval. */
|
|
32
|
-
getForming(interval: CandleInterval): Candle | null;
|
|
33
|
-
/** Closed candles for an interval (ring buffer, max 500, newest last). */
|
|
34
|
-
getClosed(interval: CandleInterval): Candle[];
|
|
35
|
-
/** Apply a bounded Worker view without recomputing candles from presentation samples. */
|
|
36
|
-
replaceTail(tail: Record<CandleInterval, {
|
|
37
|
-
forming: Candle | null;
|
|
38
|
-
closed: Candle[];
|
|
39
|
-
}>): void;
|
|
40
|
-
/** Current midpoint (latest value fed). */
|
|
41
|
-
get midpoint(): number | null;
|
|
42
|
-
/**
|
|
43
|
-
* Subscribe to state changes. Returns unsubscribe function.
|
|
44
|
-
* BATCHED: callbacks fire at most once per rAF frame (~16ms).
|
|
45
|
-
* In non-browser environments, falls back to 16ms setTimeout.
|
|
46
|
-
*/
|
|
47
|
-
onChange(listener: () => void): () => void;
|
|
48
|
-
/** Clear all state (on reconnect). */
|
|
49
|
-
reset(): void;
|
|
50
|
-
/** Clear all state AND unsubscribe all listeners. Called on store eviction. */
|
|
51
|
-
dispose(): void;
|
|
52
|
-
private updateCandle;
|
|
53
|
-
private markDirty;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* WebSocket protocol types for the Agg platform.
|
|
58
|
-
* All callback timestamps are in **seconds** (converted from server ms at SDK dispatch).
|
|
59
|
-
* These are plain TS interfaces — no Zod dependency for partner-side usage.
|
|
60
|
-
*/
|
|
61
|
-
/** Aggregated level wire format: [price, totalSize, {venue: sizeAtPrice}] */
|
|
62
|
-
type WsAttributedLevel = [number, number, Record<string, number>];
|
|
63
|
-
/** Per-venue level wire format: [price, size] */
|
|
64
|
-
type WsVenueLevel = [number, number];
|
|
65
|
-
interface WsVenueInfo {
|
|
66
|
-
bestBid: number | null;
|
|
67
|
-
bestAsk: number | null;
|
|
68
|
-
}
|
|
69
|
-
interface WsVenueBook {
|
|
70
|
-
bids: WsVenueLevel[];
|
|
71
|
-
asks: WsVenueLevel[];
|
|
72
|
-
}
|
|
73
|
-
interface WsOrderbookSnapshot {
|
|
74
|
-
type: "orderbook_snapshot";
|
|
75
|
-
outcomeId: string;
|
|
76
|
-
channel?: "orderbook" | "trades";
|
|
77
|
-
seq: number;
|
|
78
|
-
checksum: number;
|
|
79
|
-
bids: WsAttributedLevel[];
|
|
80
|
-
asks: WsAttributedLevel[];
|
|
81
|
-
venueOrderbooks: Record<string, WsVenueBook>;
|
|
82
|
-
venues: Record<string, WsVenueInfo>;
|
|
83
|
-
midpoint: number | null;
|
|
84
|
-
spread: number | null;
|
|
85
|
-
/** @unit seconds (converted from server ms) */
|
|
86
|
-
timestamp: number;
|
|
87
|
-
/**
|
|
88
|
-
* Sticky tick of this outcome's book, inferred at runtime by the engine.
|
|
89
|
-
* `null` until inferred. Optional — older snapshot producers (REST fallback)
|
|
90
|
-
* may omit this field entirely.
|
|
91
|
-
*/
|
|
92
|
-
tick?: number | null;
|
|
93
|
-
/** Provenance of the published `midpoint`. See {@link MarkSource}. */
|
|
94
|
-
markSource?: MarkSource$1;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Provenance tag for a published midpoint. Mirrors the Rust engine
|
|
98
|
-
* `MarkSource::as_str()` output.
|
|
99
|
-
*/
|
|
100
|
-
type WsMarkSource = "local" | "local_merged" | "local_one_sided" | "sibling" | "local_boundary" | "none";
|
|
101
|
-
type MarkSource$1 = WsMarkSource;
|
|
102
|
-
interface WsOrderbookDelta {
|
|
103
|
-
type: "orderbook_delta";
|
|
104
|
-
outcomeId: string;
|
|
105
|
-
channel?: "orderbook" | "trades";
|
|
106
|
-
seq: number;
|
|
107
|
-
checksum: number;
|
|
108
|
-
bidChanges: WsAttributedLevel[];
|
|
109
|
-
askChanges: WsAttributedLevel[];
|
|
110
|
-
venueDeltaBooks: Record<string, {
|
|
111
|
-
bidChanges: WsVenueLevel[];
|
|
112
|
-
askChanges: WsVenueLevel[];
|
|
113
|
-
}>;
|
|
114
|
-
venues: Record<string, WsVenueInfo>;
|
|
115
|
-
midpoint: number | null;
|
|
116
|
-
spread: number | null;
|
|
117
|
-
/** @unit seconds (converted from server ms) */
|
|
118
|
-
timestamp: number;
|
|
119
|
-
}
|
|
120
|
-
interface WsTrade {
|
|
121
|
-
type: "trade";
|
|
122
|
-
outcomeId: string;
|
|
123
|
-
channel?: "orderbook" | "trades";
|
|
124
|
-
venue: string;
|
|
125
|
-
side: "buy" | "sell";
|
|
126
|
-
price: number;
|
|
127
|
-
size: number;
|
|
128
|
-
/** @unit seconds (converted from server ms) */
|
|
129
|
-
timestamp: number;
|
|
130
|
-
}
|
|
131
|
-
type WsCandleInterval = "1m" | "5m" | "1h" | "1d";
|
|
132
|
-
interface WsSubscribed {
|
|
133
|
-
type: "subscribed";
|
|
134
|
-
/** Confirmed ids. For `orderbook`/`trades` these are venueMarketOutcomeIds.
|
|
135
|
-
* For `arb` this historically mirrors the marketIds — prefer `marketIds`. */
|
|
136
|
-
outcomeIds: string[];
|
|
137
|
-
/** Confirmed marketIds — only set on `arb` confirmations, whose
|
|
138
|
-
* subscriptions are keyed by marketIds, not outcomeIds. */
|
|
139
|
-
marketIds?: string[];
|
|
140
|
-
channel: "orderbook" | "trades" | "arb" | "arb-feed";
|
|
141
|
-
}
|
|
142
|
-
interface WsUnsubscribed {
|
|
143
|
-
type: "unsubscribed";
|
|
144
|
-
/** See {@link WsSubscribed.outcomeIds}. */
|
|
145
|
-
outcomeIds: string[];
|
|
146
|
-
/** Confirmed marketIds — only set on `arb` confirmations. */
|
|
147
|
-
marketIds?: string[];
|
|
148
|
-
channel: "orderbook" | "trades" | "arb" | "arb-feed";
|
|
149
|
-
}
|
|
150
|
-
interface WsConnected {
|
|
151
|
-
type: "connected";
|
|
152
|
-
appId: string;
|
|
153
|
-
userId?: string;
|
|
154
|
-
}
|
|
155
|
-
interface WsAuthenticated {
|
|
156
|
-
type: "authenticated";
|
|
157
|
-
userId: string;
|
|
158
|
-
}
|
|
159
|
-
interface WsHeartbeat {
|
|
160
|
-
type: "heartbeat";
|
|
161
|
-
/** @unit seconds (converted from server ms) */
|
|
162
|
-
ts: number;
|
|
163
|
-
}
|
|
164
|
-
interface WsResolvedOutcome {
|
|
165
|
-
label: string;
|
|
166
|
-
winner?: boolean;
|
|
167
|
-
externalIdentifier?: string;
|
|
168
|
-
/**
|
|
169
|
-
* Per-share USDC payout in [0, 1] once settled. A void or split pays less
|
|
170
|
-
* than 1 on every side (e.g. 0.5), so `winner` alone can't tell it from a
|
|
171
|
-
* win. Absent when unknown.
|
|
172
|
-
*/
|
|
173
|
-
payoutPerShare?: number;
|
|
174
|
-
/** Venue refunded every holder their stake (valued at entry price). */
|
|
175
|
-
refundAtCost?: boolean;
|
|
176
|
-
}
|
|
177
|
-
interface WsMarketResolved {
|
|
178
|
-
type: "market_resolved";
|
|
179
|
-
outcomeId: string;
|
|
180
|
-
status: "resolved" | "closed";
|
|
181
|
-
/** Winning outcome label, or null if unknown. */
|
|
182
|
-
result: string | null;
|
|
183
|
-
/** Per-outcome resolution data. */
|
|
184
|
-
outcomes: WsResolvedOutcome[];
|
|
185
|
-
/** @unit seconds (converted from server ms) */
|
|
186
|
-
timestamp: number;
|
|
187
|
-
}
|
|
188
|
-
interface WsError {
|
|
189
|
-
type: "error";
|
|
190
|
-
message: string;
|
|
191
|
-
}
|
|
192
|
-
interface WsOrderSubmitted {
|
|
193
|
-
type: "order_submitted";
|
|
194
|
-
venue: string;
|
|
195
|
-
orderId: string;
|
|
196
|
-
side: string;
|
|
197
|
-
price: number;
|
|
198
|
-
size: number;
|
|
199
|
-
outcomeId?: string;
|
|
200
|
-
/** @unit seconds (converted from server ms) */
|
|
201
|
-
timestamp: number;
|
|
202
|
-
}
|
|
203
|
-
interface WsBalanceUpdate {
|
|
204
|
-
type: "balance_update";
|
|
205
|
-
venue: string;
|
|
206
|
-
tradingBalanceCents: number;
|
|
207
|
-
walletBalanceCents?: number;
|
|
208
|
-
/** @unit seconds (converted from server ms) */
|
|
209
|
-
timestamp: number;
|
|
210
|
-
}
|
|
211
|
-
type WsOrderEventType = "cancelled" | "created" | "signed" | "pending_bridge" | "bridge_complete" | "submitting" | "submitted" | "expired" | "dag_started" | "dag_completed" | "dag_failed" | "dag_cancelled" | "step_started" | "step_completed" | "step_waiting" | "step_failed" | "step_retrying" | "filled" | "partial_fill" | "failed" | "bridge_ws_subscribed" | "bridge_ws_subscribe_failed" | "bridge_polling_fallback";
|
|
212
|
-
interface WsOrderEvent {
|
|
213
|
-
type: "order_event";
|
|
214
|
-
event: WsOrderEventType;
|
|
215
|
-
userId: string;
|
|
216
|
-
orderId: string;
|
|
217
|
-
/** Partner trade id from `placeOrder()`, when the order carried one. */
|
|
218
|
-
externalId?: string;
|
|
219
|
-
venue: string;
|
|
220
|
-
dagRunId?: string;
|
|
221
|
-
stepId?: string;
|
|
222
|
-
stepType?: string;
|
|
223
|
-
/** 1-based step index. Pair with `totalSteps` to render "Step 3 of 7". */
|
|
224
|
-
sequence?: number;
|
|
225
|
-
totalSteps?: number;
|
|
226
|
-
templateName?: string;
|
|
227
|
-
/** Maps sequence → stepType for all steps — sent on dag_started so labels are available upfront. */
|
|
228
|
-
stepTypes?: Record<number, string>;
|
|
229
|
-
filledAmountRaw?: string;
|
|
230
|
-
remainingAmountRaw?: string;
|
|
231
|
-
/**
|
|
232
|
-
* Quote-time and actual shares + payout. All 6-decimal atomic units
|
|
233
|
-
* (so 1.234567 shares = "1234567", "$50 to win" = "50000000"). Set
|
|
234
|
-
* on `filled` / `partial_fill` so the UI can render "Quoted X / Got Y"
|
|
235
|
-
* without re-deriving from cost ÷ price (which loses precision on
|
|
236
|
-
* fractional fills and divides by zero before `executionPrice` exists).
|
|
237
|
-
*/
|
|
238
|
-
quotedSharesRaw?: string;
|
|
239
|
-
actualSharesRaw?: string;
|
|
240
|
-
quotedToWinRaw?: string;
|
|
241
|
-
actualToWinRaw?: string;
|
|
242
|
-
/** Quote-time price (decimal string, e.g. "0.5"). Pair with `executionPriceRaw`
|
|
243
|
-
* to render the slippage diff inline. */
|
|
244
|
-
quotedPriceRaw?: string;
|
|
245
|
-
/** Actual avg fill price (decimal string). */
|
|
246
|
-
executionPriceRaw?: string;
|
|
247
|
-
/**
|
|
248
|
-
* Set on `partial_fill` events only. One of `"venue_capacity"`,
|
|
249
|
-
* `"price_slipped"`, `"user_cancelled"`, `"timeout"`, `"bridge_short"`,
|
|
250
|
-
* or a venue-specific tag.
|
|
251
|
-
*/
|
|
252
|
-
partialFillReason?: string;
|
|
253
|
-
errorReason?: string;
|
|
254
|
-
attempt?: number;
|
|
255
|
-
correlationId?: string;
|
|
256
|
-
/** @unit milliseconds (raw from server — NOT converted like other WS types) */
|
|
257
|
-
timestamp: number;
|
|
258
|
-
}
|
|
259
|
-
interface WsRedeemEvent {
|
|
260
|
-
type: "redeem_event";
|
|
261
|
-
redeemId: string;
|
|
262
|
-
venueMarketOutcomeId: string;
|
|
263
|
-
status: "submitted" | "confirmed" | "failed";
|
|
264
|
-
callsId: string | null;
|
|
265
|
-
pendingUserOpId: string | null;
|
|
266
|
-
txHash: string | null;
|
|
267
|
-
errorMessage: string | null;
|
|
268
|
-
/** @unit seconds (converted from server ms) */
|
|
269
|
-
timestamp: number;
|
|
270
|
-
}
|
|
271
|
-
/** Top-level withdrawal lifecycle states surfaced to partner clients. */
|
|
272
|
-
type WsWithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
273
|
-
type WsWithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
274
|
-
interface WsWithdrawalLifecycleLeg {
|
|
275
|
-
sourceChainId: number;
|
|
276
|
-
destChainId: number;
|
|
277
|
-
type: "transfer" | "bridge";
|
|
278
|
-
status: WsWithdrawalLegStatus;
|
|
279
|
-
amountRaw: string;
|
|
280
|
-
txHash: string | null;
|
|
281
|
-
bridgeOperationId: string | null;
|
|
282
|
-
/** Human-readable failure reason when `status === "failed"`. Null/absent when succeeded or in-flight. */
|
|
283
|
-
errorMessage?: string | null;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Per-withdrawal lifecycle event. Wire shape is intentionally additive:
|
|
287
|
-
* consumers should pass through unknown enum values rather than failing.
|
|
288
|
-
*/
|
|
289
|
-
interface WsWithdrawalLifecycleEvent {
|
|
290
|
-
type: "withdrawal_lifecycle";
|
|
291
|
-
withdrawalId: string;
|
|
292
|
-
userId: string;
|
|
293
|
-
status: WsWithdrawalLifecycleStatus;
|
|
294
|
-
/** Requested withdrawal amount in destination-token native decimals. */
|
|
295
|
-
requestedAmountRaw?: string;
|
|
296
|
-
/** Terminal settled amount in destination-token native decimals. */
|
|
297
|
-
completedAmountRaw?: string | null;
|
|
298
|
-
/** Realized platform fee in destination-token native decimals. Only present on terminal events. */
|
|
299
|
-
feeRaw?: string | null;
|
|
300
|
-
/** True when `status` is terminal (`completed` / `partial` / `failed`). */
|
|
301
|
-
terminal: boolean;
|
|
302
|
-
/** Optional leg delta — present when this event was triggered by a leg flip. */
|
|
303
|
-
leg?: WsWithdrawalLifecycleLeg;
|
|
304
|
-
/** All legs at the moment of emission (snapshot). */
|
|
305
|
-
legs?: WsWithdrawalLifecycleLeg[];
|
|
306
|
-
/** Failure reason for terminal `failed` / `partial`. */
|
|
307
|
-
errorMessage?: string;
|
|
308
|
-
correlationId?: string;
|
|
309
|
-
/** @unit milliseconds (raw from server — NOT converted like other WS types) */
|
|
310
|
-
timestamp: number;
|
|
311
|
-
}
|
|
312
|
-
interface WsArbMarketUpdate {
|
|
313
|
-
type: "arb_market_update";
|
|
314
|
-
marketId: string;
|
|
315
|
-
/** Producer assertion that globally inactive venues were excluded. */
|
|
316
|
-
activeVenuesOnly: true;
|
|
317
|
-
venueEventId: string | null;
|
|
318
|
-
arbReturn: number;
|
|
319
|
-
ts: number;
|
|
320
|
-
liquidityUsd?: number;
|
|
321
|
-
liquidityTier?: "deep" | "shallow";
|
|
322
|
-
}
|
|
323
|
-
interface WsArbFeedEntry {
|
|
324
|
-
marketId: string;
|
|
325
|
-
venueEventId: string | null;
|
|
326
|
-
arbReturn: number;
|
|
327
|
-
ts: number;
|
|
328
|
-
liquidityUsd?: number;
|
|
329
|
-
liquidityTier?: "deep" | "shallow";
|
|
330
|
-
}
|
|
331
|
-
interface WsArbFeedBatch {
|
|
332
|
-
type: "arb_feed_batch";
|
|
333
|
-
feed: "arb";
|
|
334
|
-
/** Producer assertion that globally inactive venues were excluded. */
|
|
335
|
-
activeVenuesOnly: true;
|
|
336
|
-
entries: WsArbFeedEntry[];
|
|
337
|
-
flushTs: number;
|
|
338
|
-
chunk: number;
|
|
339
|
-
chunkCount: number;
|
|
340
|
-
}
|
|
341
|
-
type WsServerMessage = WsOrderbookSnapshot | WsOrderbookDelta | WsTrade | WsSubscribed | WsUnsubscribed | WsConnected | WsAuthenticated | WsHeartbeat | WsMarketResolved | WsError | WsOrderSubmitted | WsBalanceUpdate | WsOrderEvent | WsRedeemEvent | WsWithdrawalLifecycleEvent | WsArbMarketUpdate | WsArbFeedBatch;
|
|
342
|
-
type WsClientMessage = {
|
|
343
|
-
action: "subscribe";
|
|
344
|
-
channel: "orderbook" | "trades";
|
|
345
|
-
outcomeIds: string[];
|
|
346
|
-
} | {
|
|
347
|
-
action: "unsubscribe";
|
|
348
|
-
channel: "orderbook" | "trades";
|
|
349
|
-
outcomeIds: string[];
|
|
350
|
-
} | {
|
|
351
|
-
action: "resnapshot";
|
|
352
|
-
channel: "orderbook";
|
|
353
|
-
outcomeIds: string[];
|
|
354
|
-
} | {
|
|
355
|
-
action: "subscribe";
|
|
356
|
-
channel: "arb";
|
|
357
|
-
marketIds: string[];
|
|
358
|
-
} | {
|
|
359
|
-
action: "unsubscribe";
|
|
360
|
-
channel: "arb";
|
|
361
|
-
marketIds: string[];
|
|
362
|
-
} | {
|
|
363
|
-
action: "subscribe";
|
|
364
|
-
channel: "arb-feed";
|
|
365
|
-
} | {
|
|
366
|
-
action: "unsubscribe";
|
|
367
|
-
channel: "arb-feed";
|
|
368
|
-
} | {
|
|
369
|
-
action: "authenticate";
|
|
370
|
-
token: string;
|
|
371
|
-
};
|
|
372
|
-
type DiagnosticEvent = {
|
|
373
|
-
type: "seq_gap";
|
|
374
|
-
marketId: string;
|
|
375
|
-
outcomeId: string;
|
|
376
|
-
expected: number;
|
|
377
|
-
received: number;
|
|
378
|
-
} | {
|
|
379
|
-
type: "checksum_mismatch";
|
|
380
|
-
marketId: string;
|
|
381
|
-
outcomeId: string;
|
|
382
|
-
expected: number;
|
|
383
|
-
computed: number;
|
|
384
|
-
} | {
|
|
385
|
-
type: "reconnect";
|
|
386
|
-
attempt: number;
|
|
387
|
-
delayMs: number;
|
|
388
|
-
} | {
|
|
389
|
-
type: "stale_connection";
|
|
390
|
-
lastMessageAge: number;
|
|
391
|
-
};
|
|
392
|
-
type DiagnosticCallback = (event: DiagnosticEvent) => void;
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Immutable orderbook utility functions for the SDK.
|
|
396
|
-
* Applies WS deltas to local book state, computes checksums for integrity verification.
|
|
397
|
-
* Every function returns a **new object** — never mutates inputs.
|
|
398
|
-
*/
|
|
399
|
-
|
|
400
|
-
interface OrderbookLevel {
|
|
401
|
-
price: number;
|
|
402
|
-
size: number;
|
|
403
|
-
venues: Record<string, number>;
|
|
404
|
-
}
|
|
405
|
-
interface VenueOrderbookLevel {
|
|
406
|
-
price: number;
|
|
407
|
-
size: number;
|
|
408
|
-
}
|
|
409
|
-
interface OrderbookState {
|
|
410
|
-
marketId: string;
|
|
411
|
-
/** The outcome whose price the midpoint represents (e.g. the "Yes" outcome in binary markets). */
|
|
412
|
-
outcomeId?: string | null;
|
|
413
|
-
bids: OrderbookLevel[];
|
|
414
|
-
asks: OrderbookLevel[];
|
|
415
|
-
venueOrderbooks: Record<string, {
|
|
416
|
-
bids: VenueOrderbookLevel[];
|
|
417
|
-
asks: VenueOrderbookLevel[];
|
|
418
|
-
}>;
|
|
419
|
-
venues: Record<string, WsVenueInfo>;
|
|
420
|
-
midpoint: number | null;
|
|
421
|
-
spread: number | null;
|
|
422
|
-
seq: number;
|
|
423
|
-
checksum: number;
|
|
424
|
-
/** @unit seconds */
|
|
425
|
-
timestamp: number;
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Compute the XOR-based checksum of an orderbook.
|
|
429
|
-
* Matches the Rust engine's checksum: XOR of crc32("B{price}:{size}") for each
|
|
430
|
-
* bid and crc32("A{price}:{size}") for each ask, independently hashed then XOR'd.
|
|
431
|
-
*/
|
|
432
|
-
declare function computeChecksum(book: {
|
|
433
|
-
bids: OrderbookLevel[];
|
|
434
|
-
asks: OrderbookLevel[];
|
|
435
|
-
}): number;
|
|
436
|
-
/**
|
|
437
|
-
* Convert a WS snapshot message into local OrderbookState.
|
|
438
|
-
* Timestamp is expected to already be in seconds (converted by AggWebSocket).
|
|
439
|
-
*/
|
|
440
|
-
declare function snapshotToOrderbook(snapshot: WsOrderbookSnapshot): OrderbookState;
|
|
441
|
-
/**
|
|
442
|
-
* Apply a WS delta to an existing OrderbookState, returning a new state.
|
|
443
|
-
* Bids sorted descending, asks ascending (maintained invariant).
|
|
444
|
-
*/
|
|
445
|
-
declare function applyOrderbookDelta(state: OrderbookState, delta: WsOrderbookDelta): OrderbookState;
|
|
446
|
-
|
|
447
|
-
/** Use these constants instead of hardcoding "kalshi" or "polymarket". */
|
|
448
|
-
declare enum Venue {
|
|
449
|
-
kalshi = "kalshi",
|
|
450
|
-
polymarket = "polymarket",
|
|
451
|
-
limitless = "limitless",
|
|
452
|
-
opinion = "opinion",
|
|
453
|
-
predict = "predict",
|
|
454
|
-
pred = "pred",
|
|
455
|
-
tiprun = "tiprun",
|
|
456
|
-
probable = "probable",
|
|
457
|
-
myriad = "myriad",
|
|
458
|
-
hyperliquid = "hyperliquid",
|
|
459
|
-
novig = "novig",
|
|
460
|
-
prophetx = "prophetx",
|
|
461
|
-
betdex = "betdex"
|
|
462
|
-
}
|
|
463
|
-
/** Single source of truth for venue identifiers. */
|
|
464
|
-
declare const VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.pred, Venue.tiprun, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig, Venue.prophetx, Venue.betdex];
|
|
465
|
-
/** Canonical destination chain for venues with on-chain funding or settlement. */
|
|
466
|
-
declare const VENUE_CHAIN_IDS: Partial<Record<Venue, number>>;
|
|
467
|
-
/**
|
|
468
|
-
* Venues that participate in new discovery, market-data, and execution flows.
|
|
469
|
-
*
|
|
470
|
-
* Keep retired venues in {@link Venue} and {@link VENUES}: historical orders,
|
|
471
|
-
* positions, settlement, and redemption still rely on those identifiers.
|
|
472
|
-
* Re-activating a venue is therefore an intentional code change here rather
|
|
473
|
-
* than a runtime configuration toggle.
|
|
474
|
-
*/
|
|
475
|
-
declare const ACTIVE_VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.pred, Venue.tiprun, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig, Venue.prophetx, Venue.betdex];
|
|
476
|
-
/**
|
|
477
|
-
* Venues excluded from new user-facing activity. BETDEX is active at the
|
|
478
|
-
* compile-time boundary now that discovery and execution are implemented;
|
|
479
|
-
* partner rollout remains controlled by app policy and runtime flags.
|
|
480
|
-
*/
|
|
481
|
-
declare const INACTIVE_VENUES: readonly [];
|
|
482
|
-
/** Whether a venue may participate in new user-facing activity. */
|
|
483
|
-
declare function isVenueActive(venue: string): boolean;
|
|
484
|
-
/** Whether a venue is intentionally retained only for wind-down/history flows. */
|
|
485
|
-
declare function isVenueInactive(venue: string): boolean;
|
|
486
|
-
/**
|
|
487
|
-
* Data-plane visibility (listings/search/orderbook DISPLAY). Distinct from
|
|
488
|
-
* {@link isVenueActive} (execution/routing) — this predicate never affects
|
|
489
|
-
* whether a venue can trade. `dataVisibleOverride` un-hides specific venues
|
|
490
|
-
* for DATA surfaces only; callers pass an env-derived list.
|
|
491
|
-
*/
|
|
492
|
-
declare function isVenueDataVisible(venue: string, dataVisibleOverride?: readonly Venue[]): boolean;
|
|
493
|
-
/**
|
|
494
|
-
* Merge app-specific disabled venues with the compile-time retired set, then
|
|
495
|
-
* remove any venue explicitly opted into data visibility via
|
|
496
|
-
* `dataVisibleVenues` (see {@link isVenueDataVisible}). Results use the
|
|
497
|
-
* canonical {@link VENUES} order and ignore unknown values.
|
|
498
|
-
*/
|
|
499
|
-
declare function getEffectiveDisabledVenues(disabledVenues?: readonly (Venue | string)[], dataVisibleVenues?: readonly Venue[]): Venue[];
|
|
500
|
-
|
|
501
|
-
declare enum AccountType {
|
|
502
|
-
oauth = "oauth",
|
|
503
|
-
siwe = "siwe",
|
|
504
|
-
siws = "siws",
|
|
505
|
-
email = "email"
|
|
506
|
-
}
|
|
507
|
-
declare enum AccountProvider {
|
|
508
|
-
wallet = "wallet",
|
|
509
|
-
solana_wallet = "solana_wallet",
|
|
510
|
-
google = "google",
|
|
511
|
-
twitter = "twitter",
|
|
512
|
-
apple = "apple",
|
|
513
|
-
email = "email"
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
declare enum Chain {
|
|
517
|
-
evm = "evm",
|
|
518
|
-
svm = "svm"
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
declare enum MatchStatus {
|
|
522
|
-
pending = "pending",
|
|
523
|
-
unmatched = "unmatched",
|
|
524
|
-
review = "review",
|
|
525
|
-
matched = "matched",
|
|
526
|
-
verified = "verified",
|
|
527
|
-
rejected = "rejected"
|
|
528
|
-
}
|
|
529
|
-
declare enum MatchType {
|
|
530
|
-
manual = "manual",
|
|
531
|
-
llm = "llm"
|
|
532
|
-
}
|
|
533
|
-
/** Match statuses considered "confirmed" for user-facing data (orderbooks, listings, aggregation). */
|
|
534
|
-
declare const CONFIRMED_MATCH_STATUSES: MatchStatus[];
|
|
535
|
-
declare enum MarketStatus {
|
|
536
|
-
open = "open",
|
|
537
|
-
closed = "closed",
|
|
538
|
-
resolved = "resolved",
|
|
539
|
-
unopened = "unopened",
|
|
540
|
-
paused = "paused"
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
declare enum OrderStatus {
|
|
544
|
-
pending = "pending",
|
|
545
|
-
signing = "signing",
|
|
546
|
-
pending_bridge = "pending_bridge",
|
|
547
|
-
submitting = "submitting",
|
|
548
|
-
submitted = "submitted",
|
|
549
|
-
open = "open",
|
|
550
|
-
partially_filled_open = "partially_filled_open",
|
|
551
|
-
cancel_pending = "cancel_pending",
|
|
552
|
-
filled = "filled",
|
|
553
|
-
partial_fill = "partial_fill",
|
|
554
|
-
failed = "failed",
|
|
555
|
-
expired = "expired",
|
|
556
|
-
cancelled = "cancelled"
|
|
557
|
-
}
|
|
558
|
-
declare enum TradeSide$1 {
|
|
559
|
-
Buy = "buy",
|
|
560
|
-
Sell = "sell"
|
|
561
|
-
}
|
|
562
|
-
declare enum OrderType {
|
|
563
|
-
Market = "market",
|
|
564
|
-
Limit = "limit"
|
|
565
|
-
}
|
|
566
|
-
declare enum TimeInForce {
|
|
567
|
-
GTC = "GTC",
|
|
568
|
-
GTD = "GTD",
|
|
569
|
-
FOK = "FOK",
|
|
570
|
-
FAK = "FAK",
|
|
571
|
-
IOC = "IOC",
|
|
572
|
-
ALO = "ALO"
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* Standalone type definitions — no Zod dependency.
|
|
577
|
-
* These mirror the types in types/index.ts but are defined as plain interfaces.
|
|
578
|
-
* Used by the types-only barrel to avoid leaking Zod into SDK/hooks declarations.
|
|
579
|
-
*/
|
|
580
|
-
|
|
581
|
-
type HelloResponse = {
|
|
582
|
-
message: string;
|
|
583
|
-
};
|
|
584
|
-
type App = {
|
|
585
|
-
id: string;
|
|
586
|
-
name: string;
|
|
587
|
-
allowedOrigins: string[];
|
|
588
|
-
active: boolean;
|
|
589
|
-
blockedCountries: string[];
|
|
590
|
-
blockedRegions: string[];
|
|
591
|
-
orderFee: string;
|
|
592
|
-
signupBonus: string;
|
|
593
|
-
createdAt: string;
|
|
594
|
-
updatedAt: string;
|
|
595
|
-
};
|
|
596
|
-
type CreateApp = {
|
|
597
|
-
name: string;
|
|
598
|
-
allowedOrigins: string[];
|
|
599
|
-
blockedCountries: string[];
|
|
600
|
-
blockedRegions: string[];
|
|
601
|
-
};
|
|
602
|
-
type NonceResponse = {
|
|
603
|
-
nonce: string;
|
|
604
|
-
};
|
|
605
|
-
type AuthUser = {
|
|
606
|
-
id: string;
|
|
607
|
-
};
|
|
608
|
-
type UserProfile = {
|
|
609
|
-
id: string;
|
|
610
|
-
username: string | null;
|
|
611
|
-
avatarUrl: string | null;
|
|
612
|
-
externalId: string | null;
|
|
613
|
-
isLocationBlocked: boolean;
|
|
614
|
-
accounts: {
|
|
615
|
-
type: AccountType;
|
|
616
|
-
provider: AccountProvider;
|
|
617
|
-
providerAccountId: string;
|
|
618
|
-
}[];
|
|
619
|
-
wallets: {
|
|
620
|
-
chain: Chain;
|
|
621
|
-
address: string;
|
|
622
|
-
}[];
|
|
623
|
-
venueAccounts: {
|
|
624
|
-
status: string;
|
|
625
|
-
id: string;
|
|
626
|
-
venue: Venue;
|
|
627
|
-
kycStatus: string;
|
|
628
|
-
}[] | null;
|
|
629
|
-
};
|
|
630
|
-
type Account = {
|
|
631
|
-
type: AccountType;
|
|
632
|
-
provider: AccountProvider;
|
|
633
|
-
providerAccountId: string;
|
|
634
|
-
};
|
|
635
|
-
type ServerWallet = {
|
|
636
|
-
chain: Chain;
|
|
637
|
-
address: string;
|
|
638
|
-
};
|
|
639
|
-
type UpdateUserBody = {
|
|
640
|
-
username?: string | undefined;
|
|
641
|
-
confirmAvatar?: true | undefined;
|
|
642
|
-
removeAvatar?: true | undefined;
|
|
643
|
-
};
|
|
644
|
-
type VerifyBody = {
|
|
645
|
-
message: string;
|
|
646
|
-
signature: string;
|
|
647
|
-
};
|
|
648
|
-
type VerifyResponse = {
|
|
649
|
-
accessToken: string;
|
|
650
|
-
user: {
|
|
651
|
-
id: string;
|
|
652
|
-
};
|
|
653
|
-
refreshToken?: string | undefined;
|
|
654
|
-
};
|
|
655
|
-
type AuthTokenResponse = {
|
|
656
|
-
accessToken: string;
|
|
657
|
-
user: {
|
|
658
|
-
id: string;
|
|
659
|
-
};
|
|
660
|
-
refreshToken?: string | undefined;
|
|
661
|
-
};
|
|
662
|
-
type AuthCodeResponse = {
|
|
663
|
-
code: string;
|
|
664
|
-
};
|
|
665
|
-
type ProphetxExecutionMode = "clearinghouse" | "direct";
|
|
666
|
-
type NovigExecutionMode = "clearinghouse" | "direct";
|
|
667
|
-
type UpsertVenueKey = {
|
|
668
|
-
venue: Venue.novig;
|
|
669
|
-
credentials: {
|
|
670
|
-
keyId: string;
|
|
671
|
-
privateKey: string;
|
|
672
|
-
};
|
|
673
|
-
} | {
|
|
674
|
-
venue: Venue.prophetx;
|
|
675
|
-
credentials: {
|
|
676
|
-
accessKey: string;
|
|
677
|
-
secretKey: string;
|
|
678
|
-
};
|
|
679
|
-
} | {
|
|
680
|
-
venue: Venue.kalshi;
|
|
681
|
-
credentials: {
|
|
682
|
-
keyId: string;
|
|
683
|
-
privateKey: string;
|
|
684
|
-
};
|
|
685
|
-
} | {
|
|
686
|
-
venue: Venue.polymarket;
|
|
687
|
-
credentials: {
|
|
688
|
-
apiKey: string;
|
|
689
|
-
secret: string;
|
|
690
|
-
passphrase: string;
|
|
691
|
-
};
|
|
692
|
-
};
|
|
693
|
-
type VenueKeySummary = {
|
|
694
|
-
updatedAt: string;
|
|
695
|
-
venue: Venue;
|
|
696
|
-
};
|
|
697
|
-
type VenueKeyStatus = {
|
|
698
|
-
hasAccountHistory?: boolean;
|
|
699
|
-
venue: Venue;
|
|
700
|
-
connected: boolean;
|
|
701
|
-
validatedAt: string | null;
|
|
702
|
-
kycStatus: string;
|
|
703
|
-
};
|
|
704
|
-
type TradeSplit = {
|
|
705
|
-
venue: Venue;
|
|
706
|
-
venueMarketOutcomeId: string;
|
|
707
|
-
side: TradeSide$1;
|
|
708
|
-
price: number;
|
|
709
|
-
size: number;
|
|
710
|
-
signedOrder?: any;
|
|
711
|
-
negRisk?: boolean | undefined;
|
|
712
|
-
outcomeExternalIdentifier?: string | undefined;
|
|
713
|
-
};
|
|
714
|
-
type ComputeSplitsSelection = {
|
|
715
|
-
venue: Venue;
|
|
716
|
-
venueMarketOutcomeId: string;
|
|
717
|
-
};
|
|
718
|
-
type SetupVenueKeyStep = {
|
|
719
|
-
type: "setup_venue_key";
|
|
720
|
-
venue: Venue;
|
|
721
|
-
stepPayload: {
|
|
722
|
-
instructions: string;
|
|
723
|
-
setupUrl?: string | undefined;
|
|
724
|
-
};
|
|
725
|
-
};
|
|
726
|
-
type DepositStep = {
|
|
727
|
-
type: "deposit";
|
|
728
|
-
venue: Venue;
|
|
729
|
-
currency: string;
|
|
730
|
-
stepPayload?: {
|
|
731
|
-
instructions: string;
|
|
732
|
-
setupUrl?: string | undefined;
|
|
733
|
-
depositUrl?: string | undefined;
|
|
734
|
-
} | undefined;
|
|
735
|
-
requiredAmountCents?: number | undefined;
|
|
736
|
-
requiredAmountUsd?: string | undefined;
|
|
737
|
-
transactionData?: {
|
|
738
|
-
value: string;
|
|
739
|
-
chainId: number;
|
|
740
|
-
to: string;
|
|
741
|
-
data: string;
|
|
742
|
-
} | undefined;
|
|
743
|
-
};
|
|
744
|
-
type SetupDepositAddressStep = {
|
|
745
|
-
type: "setup_deposit_address";
|
|
746
|
-
venue: Venue.polymarket;
|
|
747
|
-
stepPayload: {
|
|
748
|
-
setupUrl: string;
|
|
749
|
-
instructions: string;
|
|
750
|
-
};
|
|
751
|
-
};
|
|
752
|
-
type ValidateBalanceOnClientStep = {
|
|
753
|
-
type: "validate_balance_on_client";
|
|
754
|
-
venue: Venue.polymarket;
|
|
755
|
-
stepPayload: {
|
|
756
|
-
requiredAmountUsd: string;
|
|
757
|
-
instructions?: string | undefined;
|
|
758
|
-
currency?: string | undefined;
|
|
759
|
-
};
|
|
760
|
-
};
|
|
761
|
-
type TradeStep = {
|
|
762
|
-
type: "setup_venue_key";
|
|
763
|
-
venue: Venue;
|
|
764
|
-
stepPayload: {
|
|
765
|
-
instructions: string;
|
|
766
|
-
setupUrl?: string | undefined;
|
|
767
|
-
};
|
|
768
|
-
} | {
|
|
769
|
-
type: "deposit";
|
|
770
|
-
venue: Venue;
|
|
771
|
-
currency: string;
|
|
772
|
-
stepPayload?: {
|
|
773
|
-
instructions: string;
|
|
774
|
-
setupUrl?: string | undefined;
|
|
775
|
-
depositUrl?: string | undefined;
|
|
776
|
-
} | undefined;
|
|
777
|
-
requiredAmountCents?: number | undefined;
|
|
778
|
-
requiredAmountUsd?: string | undefined;
|
|
779
|
-
transactionData?: {
|
|
780
|
-
value: string;
|
|
781
|
-
chainId: number;
|
|
782
|
-
to: string;
|
|
783
|
-
data: string;
|
|
784
|
-
} | undefined;
|
|
785
|
-
} | {
|
|
786
|
-
type: "setup_deposit_address";
|
|
787
|
-
venue: Venue.polymarket;
|
|
788
|
-
stepPayload: {
|
|
789
|
-
setupUrl: string;
|
|
790
|
-
instructions: string;
|
|
791
|
-
};
|
|
792
|
-
} | {
|
|
793
|
-
type: "validate_balance_on_client";
|
|
794
|
-
venue: Venue.polymarket;
|
|
795
|
-
stepPayload: {
|
|
796
|
-
requiredAmountUsd: string;
|
|
797
|
-
instructions?: string | undefined;
|
|
798
|
-
currency?: string | undefined;
|
|
799
|
-
};
|
|
800
|
-
};
|
|
801
|
-
type ValidateTradeRequest = {
|
|
802
|
-
splits: {
|
|
803
|
-
venue: Venue;
|
|
804
|
-
venueMarketOutcomeId: string;
|
|
805
|
-
side: TradeSide$1;
|
|
806
|
-
price: number;
|
|
807
|
-
size: number;
|
|
808
|
-
signedOrder?: any;
|
|
809
|
-
negRisk?: boolean | undefined;
|
|
810
|
-
outcomeExternalIdentifier?: string | undefined;
|
|
811
|
-
}[];
|
|
812
|
-
};
|
|
813
|
-
type ValidateTradeResponse = {
|
|
814
|
-
steps: ({
|
|
815
|
-
type: "setup_venue_key";
|
|
816
|
-
venue: Venue;
|
|
817
|
-
stepPayload: {
|
|
818
|
-
instructions: string;
|
|
819
|
-
setupUrl?: string | undefined;
|
|
820
|
-
};
|
|
821
|
-
} | {
|
|
822
|
-
type: "deposit";
|
|
823
|
-
venue: Venue;
|
|
824
|
-
currency: string;
|
|
825
|
-
stepPayload?: {
|
|
826
|
-
instructions: string;
|
|
827
|
-
setupUrl?: string | undefined;
|
|
828
|
-
depositUrl?: string | undefined;
|
|
829
|
-
} | undefined;
|
|
830
|
-
requiredAmountCents?: number | undefined;
|
|
831
|
-
requiredAmountUsd?: string | undefined;
|
|
832
|
-
transactionData?: {
|
|
833
|
-
value: string;
|
|
834
|
-
chainId: number;
|
|
835
|
-
to: string;
|
|
836
|
-
data: string;
|
|
837
|
-
} | undefined;
|
|
838
|
-
} | {
|
|
839
|
-
type: "setup_deposit_address";
|
|
840
|
-
venue: Venue.polymarket;
|
|
841
|
-
stepPayload: {
|
|
842
|
-
setupUrl: string;
|
|
843
|
-
instructions: string;
|
|
844
|
-
};
|
|
845
|
-
} | {
|
|
846
|
-
type: "validate_balance_on_client";
|
|
847
|
-
venue: Venue.polymarket;
|
|
848
|
-
stepPayload: {
|
|
849
|
-
requiredAmountUsd: string;
|
|
850
|
-
instructions?: string | undefined;
|
|
851
|
-
currency?: string | undefined;
|
|
852
|
-
};
|
|
853
|
-
})[];
|
|
854
|
-
canExecute: boolean;
|
|
855
|
-
};
|
|
856
|
-
type ExecuteTradeRequest = {
|
|
857
|
-
splits: {
|
|
858
|
-
venue: Venue;
|
|
859
|
-
venueMarketOutcomeId: string;
|
|
860
|
-
side: TradeSide$1;
|
|
861
|
-
price: number;
|
|
862
|
-
size: number;
|
|
863
|
-
signedOrder?: any;
|
|
864
|
-
negRisk?: boolean | undefined;
|
|
865
|
-
outcomeExternalIdentifier?: string | undefined;
|
|
866
|
-
}[];
|
|
867
|
-
};
|
|
868
|
-
type ExecuteTradeResponse = {
|
|
869
|
-
orders: {
|
|
870
|
-
venue: Venue;
|
|
871
|
-
orders: {
|
|
872
|
-
orderId: string;
|
|
873
|
-
}[];
|
|
874
|
-
}[];
|
|
875
|
-
errors?: {
|
|
876
|
-
message: string;
|
|
877
|
-
venue: Venue;
|
|
878
|
-
}[] | undefined;
|
|
879
|
-
};
|
|
880
|
-
type GetBalanceQuery = {
|
|
881
|
-
venue: Venue;
|
|
882
|
-
};
|
|
883
|
-
type GetBalanceResponse = {
|
|
884
|
-
venue: Venue;
|
|
885
|
-
currency: string;
|
|
886
|
-
balances: {
|
|
887
|
-
tradingBalanceCents?: number | undefined;
|
|
888
|
-
walletBalanceCents?: number | undefined;
|
|
889
|
-
};
|
|
890
|
-
};
|
|
891
|
-
type WalletChainBalance = {
|
|
892
|
-
chainId: number;
|
|
893
|
-
tokenAddress: string;
|
|
894
|
-
balanceRaw: string;
|
|
895
|
-
heldRaw?: string | undefined;
|
|
896
|
-
availableRaw?: string | undefined;
|
|
897
|
-
decimals: number;
|
|
898
|
-
lastSyncedAt: string;
|
|
899
|
-
tokenSymbol?: string | undefined;
|
|
900
|
-
};
|
|
901
|
-
type WalletTokenBalance = {
|
|
902
|
-
tokenSymbol: string;
|
|
903
|
-
totalRaw: string;
|
|
904
|
-
availableRaw?: string | undefined;
|
|
905
|
-
reservedRaw?: string | undefined;
|
|
906
|
-
decimals: number;
|
|
907
|
-
chains: {
|
|
908
|
-
chainId: number;
|
|
909
|
-
tokenAddress: string;
|
|
910
|
-
tokenSymbol?: string | undefined;
|
|
911
|
-
balanceRaw: string;
|
|
912
|
-
heldRaw?: string | undefined;
|
|
913
|
-
availableRaw?: string | undefined;
|
|
914
|
-
decimals: number;
|
|
915
|
-
lastSyncedAt: string;
|
|
916
|
-
}[];
|
|
917
|
-
};
|
|
918
|
-
type PriceSource = "orderbook" | "cached" | "entry" | "settled";
|
|
919
|
-
/**
|
|
920
|
-
* Health of the orderbook a position was marked against — passthrough of
|
|
921
|
-
* the engine's `BookQuality` verdict. `priceSource` says where a mark came
|
|
922
|
-
* from; this says whether that source was trustworthy. Anything other than
|
|
923
|
-
* `healthy` is a low-confidence mark.
|
|
924
|
-
*
|
|
925
|
-
* Read `priceSource` first — this only qualifies book-derived marks. A
|
|
926
|
-
* `settled` position is exact (1/0) and consults no book, so it reports
|
|
927
|
-
* `empty`; that is not a confidence signal.
|
|
928
|
-
*/
|
|
929
|
-
type BookQuality = "healthy" | "wide_spread" | "bid_only" | "ask_only" | "endpoint_stub" | "crossed" | "empty";
|
|
930
|
-
type VenuePositionBalance = {
|
|
931
|
-
venue: Venue;
|
|
932
|
-
balance: number;
|
|
933
|
-
costBasis: number;
|
|
934
|
-
unrealizedPnl: number;
|
|
935
|
-
realizedPnl: number;
|
|
936
|
-
priceSource: PriceSource;
|
|
937
|
-
bookQuality: BookQuality;
|
|
938
|
-
};
|
|
939
|
-
type UnifiedBalanceResponse = {
|
|
940
|
-
cash: {
|
|
941
|
-
tokenSymbol: string;
|
|
942
|
-
totalRaw: string;
|
|
943
|
-
availableRaw?: string | undefined;
|
|
944
|
-
reservedRaw?: string | undefined;
|
|
945
|
-
decimals: number;
|
|
946
|
-
chains: {
|
|
947
|
-
chainId: number;
|
|
948
|
-
tokenAddress: string;
|
|
949
|
-
tokenSymbol?: string | undefined;
|
|
950
|
-
balanceRaw: string;
|
|
951
|
-
heldRaw?: string | undefined;
|
|
952
|
-
availableRaw?: string | undefined;
|
|
953
|
-
decimals: number;
|
|
954
|
-
lastSyncedAt: string;
|
|
955
|
-
/** Chain wallet address; native venue collateral uses account IDs instead. */
|
|
956
|
-
address?: string | undefined;
|
|
957
|
-
custodyKind?: "EOA" | "DEPOSIT_WALLET" | "POLYMARKET_LEGACY" | "VENUE_ACCOUNT" | undefined;
|
|
958
|
-
/** Native cash is venue-scoped, not fungible EOA inventory. */
|
|
959
|
-
venue?: Venue | undefined;
|
|
960
|
-
venueAccountId?: string | undefined;
|
|
961
|
-
externalAccountId?: string | undefined;
|
|
962
|
-
isFresh?: boolean | undefined;
|
|
963
|
-
/**
|
|
964
|
-
* A `proxy` balance is spendable on Polymarket only, yet is still part
|
|
965
|
-
* of the parent token's `totalRaw`/`availableRaw`; subtract these rows
|
|
966
|
-
* for fungible-only spending power.
|
|
967
|
-
*/
|
|
968
|
-
legacyKind?: "safe" | "proxy" | undefined;
|
|
969
|
-
}[];
|
|
970
|
-
}[];
|
|
971
|
-
positions: {
|
|
972
|
-
venue: Venue;
|
|
973
|
-
balance: number;
|
|
974
|
-
costBasis: number;
|
|
975
|
-
unrealizedPnl: number;
|
|
976
|
-
realizedPnl: number;
|
|
977
|
-
}[];
|
|
978
|
-
venueCash?: {
|
|
979
|
-
transferable?: boolean;
|
|
980
|
-
executionBackend?: ProphetxExecutionMode;
|
|
981
|
-
venue: Venue;
|
|
982
|
-
balanceCents: number;
|
|
983
|
-
accountModel?: "platform-hosted";
|
|
984
|
-
asset?: "USDC";
|
|
985
|
-
decimals?: 6;
|
|
986
|
-
balanceRaw?: string;
|
|
987
|
-
availableRaw?: string;
|
|
988
|
-
unmatchedExposureRaw?: string;
|
|
989
|
-
portfolioValueCents?: number | undefined;
|
|
990
|
-
updatedAt: string;
|
|
991
|
-
}[];
|
|
992
|
-
/**
|
|
993
|
-
* Paper-account summary. Present only when the request resolved to paper
|
|
994
|
-
* mode; absent in a live response. Mirrors `UnifiedBalanceResponseSchemaTB`
|
|
995
|
-
* in `typebox/schemas/trading.ts` — keep the two in sync. All dollars.
|
|
996
|
-
*/
|
|
997
|
-
paper?: {
|
|
998
|
-
startingBalance: number;
|
|
999
|
-
cashBalance: number;
|
|
1000
|
-
positionsValue: number;
|
|
1001
|
-
/** Banked P&L from closed trades — account-level, not summable from positions. */
|
|
1002
|
-
realizedPnl: number;
|
|
1003
|
-
unrealizedPnl: number;
|
|
1004
|
-
/** realized + unrealized. */
|
|
1005
|
-
earnings: number;
|
|
1006
|
-
};
|
|
1007
|
-
};
|
|
1008
|
-
type UserHolding = {
|
|
1009
|
-
venue: Venue;
|
|
1010
|
-
side: "long" | "short";
|
|
1011
|
-
size: number;
|
|
1012
|
-
marketId: string;
|
|
1013
|
-
outcomeId: string;
|
|
1014
|
-
outcomeLabel?: string | undefined;
|
|
1015
|
-
conditionId?: string | undefined;
|
|
1016
|
-
avgPrice?: number | undefined;
|
|
1017
|
-
pnl?: number | undefined;
|
|
1018
|
-
};
|
|
1019
|
-
type GetHoldingsResponse = {
|
|
1020
|
-
data: {
|
|
1021
|
-
venue: Venue;
|
|
1022
|
-
side: "long" | "short";
|
|
1023
|
-
size: number;
|
|
1024
|
-
marketId: string;
|
|
1025
|
-
outcomeId: string;
|
|
1026
|
-
outcomeLabel?: string | undefined;
|
|
1027
|
-
conditionId?: string | undefined;
|
|
1028
|
-
avgPrice?: number | undefined;
|
|
1029
|
-
pnl?: number | undefined;
|
|
1030
|
-
}[];
|
|
1031
|
-
nextCursor: string | null;
|
|
1032
|
-
hasMore: boolean;
|
|
1033
|
-
};
|
|
1034
|
-
type GetHoldingsQuery = {
|
|
1035
|
-
venue: Venue;
|
|
1036
|
-
venueMarketId?: string | undefined;
|
|
1037
|
-
venueEventId?: string | undefined;
|
|
1038
|
-
cursor?: string | undefined;
|
|
1039
|
-
};
|
|
1040
|
-
type GetOrdersQuery = {
|
|
1041
|
-
status?: OrderStatus | undefined;
|
|
1042
|
-
orderType?: "market" | "limit" | undefined;
|
|
1043
|
-
orderId?: string | undefined;
|
|
1044
|
-
/** Filter to all legs of one quote (multi-venue split routes). */
|
|
1045
|
-
quoteId?: string | undefined;
|
|
1046
|
-
/** Filter to the order(s) carrying this partner trade id. */
|
|
1047
|
-
externalId?: string | undefined;
|
|
1048
|
-
/** Filter to orders on any of these venue markets. */
|
|
1049
|
-
venueMarketIds?: string[] | undefined;
|
|
1050
|
-
cursor?: string | undefined;
|
|
1051
|
-
limit?: number | undefined;
|
|
1052
|
-
};
|
|
1053
|
-
type GetPositionsQuery = {
|
|
1054
|
-
cursor?: string | undefined;
|
|
1055
|
-
limit?: number | undefined;
|
|
1056
|
-
status?: "active" | "closed" | undefined;
|
|
1057
|
-
};
|
|
1058
|
-
type OrderListItem = {
|
|
1059
|
-
status: string;
|
|
1060
|
-
id: string;
|
|
1061
|
-
/**
|
|
1062
|
-
* Parent quote — lets the frontend correlate legs of a multi-venue
|
|
1063
|
-
* split route without a second request. Nullable for sell-side /
|
|
1064
|
-
* standalone orders without a Quote row.
|
|
1065
|
-
*/
|
|
1066
|
-
quoteId: string | null;
|
|
1067
|
-
/** Partner-supplied trade id from POST /execution/orders. */
|
|
1068
|
-
externalId: string | null;
|
|
1069
|
-
/** Partner-supplied order id from POST /execution/limit-orders. */
|
|
1070
|
-
clientOrderId: string | null;
|
|
1071
|
-
createdAt: Date;
|
|
1072
|
-
updatedAt: Date;
|
|
1073
|
-
venue: Venue;
|
|
1074
|
-
side: string;
|
|
1075
|
-
amountRaw: string;
|
|
1076
|
-
orderType?: "market" | "limit" | undefined;
|
|
1077
|
-
limitPriceRaw: string | null;
|
|
1078
|
-
limitSizeRaw?: string | null | undefined;
|
|
1079
|
-
timeInForce: TimeInForce | null;
|
|
1080
|
-
postOnly?: boolean | undefined;
|
|
1081
|
-
expiresAt: Date | string | null;
|
|
1082
|
-
reservedCostRaw?: string | null | undefined;
|
|
1083
|
-
filledSizeRaw?: string | null | undefined;
|
|
1084
|
-
filledCostRaw?: string | null | undefined;
|
|
1085
|
-
remainingSizeRaw?: string | null | undefined;
|
|
1086
|
-
averageFillPriceRaw?: string | null | undefined;
|
|
1087
|
-
venueOrderId?: string | null | undefined;
|
|
1088
|
-
cancelRequestedAt?: Date | string | null | undefined;
|
|
1089
|
-
cancelledAt?: Date | string | null | undefined;
|
|
1090
|
-
slippageBps: number | null;
|
|
1091
|
-
quotedPriceRaw: string | null;
|
|
1092
|
-
quotedCostRaw: string | null;
|
|
1093
|
-
/**
|
|
1094
|
-
* Quote-time shares + payout, 6-decimal atomic. Lets the UI render
|
|
1095
|
-
* "Quoted X shares / $Y to win" without re-deriving from cost ÷
|
|
1096
|
-
* price (precision drift on fractional fills; divide-by-zero before
|
|
1097
|
-
* `executionPrice` exists).
|
|
1098
|
-
*/
|
|
1099
|
-
quotedSharesRaw: string | null;
|
|
1100
|
-
quotedToWinRaw: string | null;
|
|
1101
|
-
filledAmountRaw: string | null;
|
|
1102
|
-
executionPrice: string | null;
|
|
1103
|
-
/**
|
|
1104
|
-
* Actual shares + payout, populated by the venue's finalize handler.
|
|
1105
|
-
* Pair with the quoted-side fields above to render the diff inline.
|
|
1106
|
-
*/
|
|
1107
|
-
actualSharesRaw: string | null;
|
|
1108
|
-
actualToWinRaw: string | null;
|
|
1109
|
-
/**
|
|
1110
|
-
* Set only on `partial_fill`. One of `"venue_capacity"`,
|
|
1111
|
-
* `"price_slipped"`, `"user_cancelled"`, `"timeout"`, `"bridge_short"`,
|
|
1112
|
-
* or a venue-specific tag.
|
|
1113
|
-
*/
|
|
1114
|
-
partialFillReason: string | null;
|
|
1115
|
-
/**
|
|
1116
|
-
* Fee breakdown. Optional so paper-trading orders, which have no venue
|
|
1117
|
-
* fees, no bridges and no app-fee charge, stay valid without fabricating
|
|
1118
|
-
* a zeroed breakdown that would read as "this trade was free".
|
|
1119
|
-
*
|
|
1120
|
-
* `quoted` is what the route promised at accept time; `actual` is money
|
|
1121
|
-
* that moved. `actual.appFee` and `actual.bridge` are TRADE-level and
|
|
1122
|
-
* shared by every order under one `actual.dagRunId` — group by it before
|
|
1123
|
-
* summing. `quoted.venueFeeRaw` and `actual.venueFeeRaw` are per-leg.
|
|
1124
|
-
*/
|
|
1125
|
-
fees?: {
|
|
1126
|
-
/**
|
|
1127
|
-
* How the venue charges: `"fill"`, `"fill_in_game_only"`,
|
|
1128
|
-
* `"winnings"`, `"exit"`, or null when the schedule cannot be
|
|
1129
|
-
* expressed as a rate. Decides what the venue-fee figures mean.
|
|
1130
|
-
*/
|
|
1131
|
-
venueFeeBasis: string | null;
|
|
1132
|
-
quoted: {
|
|
1133
|
-
/** 6-dec USD atoms. Null when the router emitted no fee for this leg. */
|
|
1134
|
-
venueFeeRaw: string | null;
|
|
1135
|
-
/** Worst-case partner fee if the route fills 100%. */
|
|
1136
|
-
appFeeRaw: string | null;
|
|
1137
|
-
appFeeBips: number | null;
|
|
1138
|
-
};
|
|
1139
|
-
actual: {
|
|
1140
|
-
/** Null until the order reaches a DAG run. */
|
|
1141
|
-
dagRunId: string | null;
|
|
1142
|
-
/** Venue-reported fee, 6-dec USD atoms. Null = unknown, never free. */
|
|
1143
|
-
venueFeeRaw: string | null;
|
|
1144
|
-
appFee: {
|
|
1145
|
-
bips: number;
|
|
1146
|
-
/** floor(filled × bips / 10_000). */
|
|
1147
|
-
dueRaw: string;
|
|
1148
|
-
/** Below `dueRaw` on `under_collected`, "0" on skips. */
|
|
1149
|
-
collectedRaw: string;
|
|
1150
|
-
status: string;
|
|
1151
|
-
} | null;
|
|
1152
|
-
bridge: {
|
|
1153
|
-
relayFeeUsd: string | null;
|
|
1154
|
-
originGasCostUsd: string | null;
|
|
1155
|
-
operationCount: number;
|
|
1156
|
-
pricedOperationCount: number;
|
|
1157
|
-
} | null;
|
|
1158
|
-
};
|
|
1159
|
-
} | undefined;
|
|
1160
|
-
txHash: string | null;
|
|
1161
|
-
errorMessage: string | null;
|
|
1162
|
-
dagRunId: string | null;
|
|
1163
|
-
venueMarket: {
|
|
1164
|
-
id: string;
|
|
1165
|
-
venueEventId?: string | undefined;
|
|
1166
|
-
question: string;
|
|
1167
|
-
image: string | null;
|
|
1168
|
-
} | null;
|
|
1169
|
-
venueMarketOutcome: {
|
|
1170
|
-
label: string;
|
|
1171
|
-
title: string | null;
|
|
1172
|
-
} | null;
|
|
1173
|
-
};
|
|
1174
|
-
type PositionGroup = {
|
|
1175
|
-
venueMarket: {
|
|
1176
|
-
venueEventId: string;
|
|
1177
|
-
question: string;
|
|
1178
|
-
image: string | null;
|
|
1179
|
-
status: MarketStatus;
|
|
1180
|
-
venueMarketOutcomes: {
|
|
1181
|
-
unrealizedPnl: number;
|
|
1182
|
-
label: string;
|
|
1183
|
-
title: string | null;
|
|
1184
|
-
winner: boolean | null;
|
|
1185
|
-
venueBreakdown: {
|
|
1186
|
-
executionBackend?: ProphetxExecutionMode;
|
|
1187
|
-
venue: Venue;
|
|
1188
|
-
size: number;
|
|
1189
|
-
venueMarketId: string;
|
|
1190
|
-
venueMarketOutcomeId: string;
|
|
1191
|
-
custodyKind?: "EOA" | "DEPOSIT_WALLET" | "VENUE_OMNIBUS" | "VENUE_ACCOUNT";
|
|
1192
|
-
venueAccountId?: string;
|
|
1193
|
-
externalAccountId?: string;
|
|
1194
|
-
}[];
|
|
1195
|
-
totalSize: number;
|
|
1196
|
-
/** Weighted over legs with a known entry price — see `costBasisUnknown`. */
|
|
1197
|
-
avgEntryPrice: number;
|
|
1198
|
-
/**
|
|
1199
|
-
* At least one leg was imported from an externally-acquired self-custody
|
|
1200
|
-
* balance with no acquisition price we could reconcile. `totalValue`
|
|
1201
|
-
* covers every leg; `avgEntryPrice` and `unrealizedPnl` cover only the
|
|
1202
|
-
* legs with a known entry, and are 0 when none of them do.
|
|
1203
|
-
*/
|
|
1204
|
-
costBasisUnknown?: boolean;
|
|
1205
|
-
currentPrice: number;
|
|
1206
|
-
totalValue: number;
|
|
1207
|
-
unrealizedPnlPercent: number;
|
|
1208
|
-
priceSource: PriceSource;
|
|
1209
|
-
bookQuality: BookQuality;
|
|
1210
|
-
}[];
|
|
1211
|
-
};
|
|
1212
|
-
targetMarketId: string;
|
|
1213
|
-
eventId?: string | undefined;
|
|
1214
|
-
redeemStatus: "eligible" | "pending" | "redeemed" | "ineligible";
|
|
1215
|
-
status: "active" | "closed";
|
|
1216
|
-
resolutionDate: string | null;
|
|
1217
|
-
};
|
|
1218
|
-
type VenueMarket = {
|
|
1219
|
-
id: string;
|
|
1220
|
-
venue: Venue;
|
|
1221
|
-
question: string;
|
|
1222
|
-
venueMarketOutcomes: {
|
|
1223
|
-
id: string;
|
|
1224
|
-
/** REMOVED — no longer returned; use GET /midpoints for live prices. */
|
|
1225
|
-
price?: number | undefined;
|
|
1226
|
-
venueMarketId: string;
|
|
1227
|
-
label: string;
|
|
1228
|
-
title?: string | null | undefined;
|
|
1229
|
-
externalIdentifier?: string | null | undefined;
|
|
1230
|
-
winner?: boolean | null | undefined;
|
|
1231
|
-
/** Per-share USDC payout of this outcome in [0, 1] once settled; source of truth over `winner` when set. */
|
|
1232
|
-
payoutPerShare?: number | null | undefined;
|
|
1233
|
-
/** Venue voided the market and refunds every holder their stake: value at avgEntryPrice. Check before `payoutPerShare`. */
|
|
1234
|
-
refundAtCost?: boolean | undefined;
|
|
1235
|
-
/** Counterpart outcomes on matched sibling markets — only populated
|
|
1236
|
-
* on the parent (queried) market's outcomes. Each entry is a
|
|
1237
|
-
* `{ venueMarketId, venueMarketOutcomeId }` ref into the same
|
|
1238
|
-
* response's `matchedVenueMarkets[].venueMarketOutcomes[]`. */
|
|
1239
|
-
matchedVenueMarketOutcomes?: {
|
|
1240
|
-
venueMarketId: string;
|
|
1241
|
-
venueMarketOutcomeId: string;
|
|
1242
|
-
}[];
|
|
1243
|
-
}[];
|
|
1244
|
-
externalIdentifier: string;
|
|
1245
|
-
status?: MarketStatus | undefined;
|
|
1246
|
-
createdAt?: string | null | undefined;
|
|
1247
|
-
negRisk?: boolean | undefined;
|
|
1248
|
-
marketId?: string | null | undefined;
|
|
1249
|
-
conditionId?: string | null | undefined;
|
|
1250
|
-
venueEventId?: string | null | undefined;
|
|
1251
|
-
image?: string | null | undefined;
|
|
1252
|
-
description?: string | null | undefined;
|
|
1253
|
-
rulesPrimary?: string | null | undefined;
|
|
1254
|
-
rulesSecondary?: string | null | undefined;
|
|
1255
|
-
volume?: number | null | undefined;
|
|
1256
|
-
startDate?: string | null | undefined;
|
|
1257
|
-
endDate?: string | null | undefined;
|
|
1258
|
-
creationDate?: string | null | undefined;
|
|
1259
|
-
resolutionDate?: string | null | undefined;
|
|
1260
|
-
/** Sports market classification for type-aware sorting (moneyline, spread, total, etc.). */
|
|
1261
|
-
sportsMarketType?: string | null | undefined;
|
|
1262
|
-
/** Sort rank within a sports section (0=moneyline, 1=spread, 2=total, 3+=other). */
|
|
1263
|
-
sectionRank?: number | null | undefined;
|
|
1264
|
-
/** Period identifier for sports markets (e.g., "1H", "2H", "Q1", etc.). */
|
|
1265
|
-
period?: string | null | undefined;
|
|
1266
|
-
/** Normalized subject category for prop-tab grouping (e.g., game_lines, exact_score, etc.). */
|
|
1267
|
-
marketCategory?: string | null | undefined;
|
|
1268
|
-
/** Section/tab grouping key for sports markets (e.g. "player_props", "totals"). */
|
|
1269
|
-
marketGroup?: string | null | undefined;
|
|
1270
|
-
/** Fine-grained sub-classification within a marketGroup (e.g. "moneyline", "rushing_yards"). */
|
|
1271
|
-
marketSubtype?: string | null | undefined;
|
|
1272
|
-
/** Line value for spread/total markets (e.g., 2.5 for totals, 3 for spreads). */
|
|
1273
|
-
lineValue?: number | null | undefined;
|
|
1274
|
-
/** Per-market minimum order size in shares/contracts, where AGG ingests one:
|
|
1275
|
-
* Polymarket (the market's own floor) and PRED (0.001); null elsewhere.
|
|
1276
|
-
* POST /execution/limit-orders validates `sizeRaw` against it on Polymarket.
|
|
1277
|
-
* `null` means no value was ingested — NOT that the market is unconstrained;
|
|
1278
|
-
* other venues enforce floors this field does not carry. */
|
|
1279
|
-
minOrderSize?: number | null | undefined;
|
|
1280
|
-
/** Price increment from venue metadata — a seed, not a guarantee. Prefer the
|
|
1281
|
-
* runtime-inferred `tick` from the orderbook endpoints when aligning a limit
|
|
1282
|
-
* price: the live grid can be finer than this. */
|
|
1283
|
-
tickSize?: number | null | undefined;
|
|
1284
|
-
matchedVenueMarkets?: {
|
|
1285
|
-
id: string;
|
|
1286
|
-
venue: Venue;
|
|
1287
|
-
question: string;
|
|
1288
|
-
externalIdentifier: string;
|
|
1289
|
-
status?: MarketStatus | undefined;
|
|
1290
|
-
conditionId?: string | null | undefined;
|
|
1291
|
-
description?: string | null | undefined;
|
|
1292
|
-
rulesPrimary?: string | null | undefined;
|
|
1293
|
-
rulesSecondary?: string | null | undefined;
|
|
1294
|
-
venueMarketOutcomes?: {
|
|
1295
|
-
id: string;
|
|
1296
|
-
/** REMOVED — no longer returned; use GET /midpoints for live prices. */
|
|
1297
|
-
price?: number | undefined;
|
|
1298
|
-
venueMarketId: string;
|
|
1299
|
-
label: string;
|
|
1300
|
-
winner?: boolean | null | undefined;
|
|
1301
|
-
/** Per-share USDC payout of this outcome in [0, 1] once settled; source of truth over `winner` when set. */
|
|
1302
|
-
payoutPerShare?: number | null | undefined;
|
|
1303
|
-
/** Venue voided the market and refunds every holder their stake: value at avgEntryPrice. Check before `payoutPerShare`. */
|
|
1304
|
-
refundAtCost?: boolean | undefined;
|
|
1305
|
-
}[] | undefined;
|
|
1306
|
-
volume?: number | null | undefined;
|
|
1307
|
-
venueEvent?: {
|
|
1308
|
-
id: string;
|
|
1309
|
-
externalIdentifier: string;
|
|
1310
|
-
slug?: string | null | undefined;
|
|
1311
|
-
series?: {
|
|
1312
|
-
id: string;
|
|
1313
|
-
venue: string;
|
|
1314
|
-
externalIdentifier: string;
|
|
1315
|
-
name?: string | null | undefined;
|
|
1316
|
-
} | null | undefined;
|
|
1317
|
-
} | null | undefined;
|
|
1318
|
-
}[] | undefined;
|
|
1319
|
-
};
|
|
1320
|
-
type VenueEvent = {
|
|
1321
|
-
id: string;
|
|
1322
|
-
venue: Venue;
|
|
1323
|
-
image: string | null;
|
|
1324
|
-
title: string;
|
|
1325
|
-
externalIdentifier: string;
|
|
1326
|
-
categories: {
|
|
1327
|
-
id: string;
|
|
1328
|
-
category: {
|
|
1329
|
-
id: string;
|
|
1330
|
-
name: string;
|
|
1331
|
-
displayName: string | null;
|
|
1332
|
-
parentId: string | null;
|
|
1333
|
-
eventCount: number;
|
|
1334
|
-
volume24hr: number;
|
|
1335
|
-
volume: number;
|
|
1336
|
-
};
|
|
1337
|
-
}[];
|
|
1338
|
-
status?: MarketStatus | undefined;
|
|
1339
|
-
updatedAt?: string | null | undefined;
|
|
1340
|
-
description?: string | null | undefined;
|
|
1341
|
-
volume?: number | null | undefined;
|
|
1342
|
-
startDate?: string | null | undefined;
|
|
1343
|
-
endDate?: string | null | undefined;
|
|
1344
|
-
creationDate?: string | null | undefined;
|
|
1345
|
-
/**
|
|
1346
|
-
* Scheduled kickoff/start of the underlying game (sports events only).
|
|
1347
|
-
* Distinct from `endDate` (market close/expiration), which can sit well
|
|
1348
|
-
* after the game. The FE prefers this over `endDate` for the game-date
|
|
1349
|
-
* title suffix. Null for non-sports events.
|
|
1350
|
-
*/
|
|
1351
|
-
gameStartTime?: string | null | undefined;
|
|
1352
|
-
slug?: string | null | undefined;
|
|
1353
|
-
subtitle?: string | null | undefined;
|
|
1354
|
-
venues?: Venue[];
|
|
1355
|
-
venueCount?: number | undefined;
|
|
1356
|
-
groupMarketCount?: number | undefined;
|
|
1357
|
-
/**
|
|
1358
|
-
* Same-venue companion grouping: the id of this event's group base. NULL means
|
|
1359
|
-
* the event IS the base, or is standalone. A venue splits one game into several
|
|
1360
|
-
* events (`… - More Markets`, `… : Spread`), and same-venue events never share
|
|
1361
|
-
* a matched cluster — so on a companion, `matchedVenueEvents[]` lists the other
|
|
1362
|
-
* venues' EQUIVALENT companions, not the game's cluster. Use this id (or the
|
|
1363
|
-
* shared `aggKey`) to reach the base.
|
|
1364
|
-
*/
|
|
1365
|
-
groupParentId?: string | null | undefined;
|
|
1366
|
-
marketCount?: number | undefined;
|
|
1367
|
-
/**
|
|
1368
|
-
* ISO-8601 duration denormalized from Series.recurrence. `null` means
|
|
1369
|
-
* the event has no recurring schedule (one-off). Use this value with
|
|
1370
|
-
* the `?recurrence=` filter on /venue-events using public recurrence
|
|
1371
|
-
* enum values.
|
|
1372
|
-
*/
|
|
1373
|
-
recurrence?: string | null | undefined;
|
|
1374
|
-
/** Deterministic game-level canonical key for cross-venue sports detail loading. */
|
|
1375
|
-
aggKey?: string | null | undefined;
|
|
1376
|
-
/** Type-aware structure classification used to sort markets under this event. */
|
|
1377
|
-
structureType?: "candidate" | "sport" | "axis" | "dates" | null | undefined;
|
|
1378
|
-
/** Canonical sport slug for sports events (e.g. "basketball", "soccer"); null for non-sports. */
|
|
1379
|
-
sport?: string | null | undefined;
|
|
1380
|
-
/** Structured per-venue settlement key-differences for this event's cluster. */
|
|
1381
|
-
settlementDiff?: SettlementDiff | null | undefined;
|
|
1382
|
-
};
|
|
1383
|
-
type Orderbook = {
|
|
1384
|
-
bids: {
|
|
1385
|
-
price: number;
|
|
1386
|
-
size: number;
|
|
1387
|
-
}[];
|
|
1388
|
-
asks: {
|
|
1389
|
-
price: number;
|
|
1390
|
-
size: number;
|
|
1391
|
-
}[];
|
|
1392
|
-
negRisk?: boolean | undefined;
|
|
1393
|
-
};
|
|
1394
|
-
type AttributedOrderbookLevel = {
|
|
1395
|
-
price: number;
|
|
1396
|
-
size: number;
|
|
1397
|
-
venues: Record<string, number>;
|
|
1398
|
-
};
|
|
1399
|
-
type AttributedOrderbook = {
|
|
1400
|
-
bids: {
|
|
1401
|
-
price: number;
|
|
1402
|
-
size: number;
|
|
1403
|
-
venues: Record<string, number>;
|
|
1404
|
-
}[];
|
|
1405
|
-
asks: {
|
|
1406
|
-
price: number;
|
|
1407
|
-
size: number;
|
|
1408
|
-
venues: Record<string, number>;
|
|
1409
|
-
}[];
|
|
1410
|
-
};
|
|
1411
|
-
type PricePoint = {
|
|
1412
|
-
price: number;
|
|
1413
|
-
timestamp: number;
|
|
1414
|
-
open?: number | undefined;
|
|
1415
|
-
high?: number | undefined;
|
|
1416
|
-
low?: number | undefined;
|
|
1417
|
-
close?: number | undefined;
|
|
1418
|
-
};
|
|
1419
|
-
type MarketPriceHistory = {
|
|
1420
|
-
venue: Venue;
|
|
1421
|
-
marketId: string;
|
|
1422
|
-
marketTicker: string;
|
|
1423
|
-
points: {
|
|
1424
|
-
price: number;
|
|
1425
|
-
timestamp: number;
|
|
1426
|
-
open?: number | undefined;
|
|
1427
|
-
high?: number | undefined;
|
|
1428
|
-
low?: number | undefined;
|
|
1429
|
-
close?: number | undefined;
|
|
1430
|
-
}[];
|
|
1431
|
-
};
|
|
1432
|
-
type PricesHistoryResponse = {
|
|
1433
|
-
data: {
|
|
1434
|
-
venue: Venue;
|
|
1435
|
-
marketId: string;
|
|
1436
|
-
marketTicker: string;
|
|
1437
|
-
points: {
|
|
1438
|
-
price: number;
|
|
1439
|
-
timestamp: number;
|
|
1440
|
-
open?: number | undefined;
|
|
1441
|
-
high?: number | undefined;
|
|
1442
|
-
low?: number | undefined;
|
|
1443
|
-
close?: number | undefined;
|
|
1444
|
-
}[];
|
|
1445
|
-
}[];
|
|
1446
|
-
};
|
|
1447
|
-
type OrderbookHistoryPoint = {
|
|
1448
|
-
volume: number | null;
|
|
1449
|
-
timestamp: number;
|
|
1450
|
-
midpoint: number;
|
|
1451
|
-
bestBid: number | null;
|
|
1452
|
-
bestAsk: number | null;
|
|
1453
|
-
spread: number | null;
|
|
1454
|
-
open?: number | undefined;
|
|
1455
|
-
high?: number | undefined;
|
|
1456
|
-
low?: number | undefined;
|
|
1457
|
-
close?: number | undefined;
|
|
1458
|
-
};
|
|
1459
|
-
type OrderbookHistoryResponse = {
|
|
1460
|
-
venueMarketOutcomeId: string;
|
|
1461
|
-
points: {
|
|
1462
|
-
volume: number | null;
|
|
1463
|
-
timestamp: number;
|
|
1464
|
-
midpoint: number;
|
|
1465
|
-
bestBid: number | null;
|
|
1466
|
-
bestAsk: number | null;
|
|
1467
|
-
spread: number | null;
|
|
1468
|
-
open?: number | undefined;
|
|
1469
|
-
high?: number | undefined;
|
|
1470
|
-
low?: number | undefined;
|
|
1471
|
-
close?: number | undefined;
|
|
1472
|
-
}[];
|
|
1473
|
-
};
|
|
1474
|
-
/** Reference to a counterpart outcome on a matched sibling market.
|
|
1475
|
-
* Resolves into the same response's `matchedVenueMarkets[].venueMarketOutcomes[]`
|
|
1476
|
-
* by id. Sourced from `MatchedVenueMarketOutcome` so the alignment is
|
|
1477
|
-
* robust to inversely-framed binary markets and multi-outcome markets. */
|
|
1478
|
-
type MatchedVenueMarketOutcomeRef = {
|
|
1479
|
-
venueMarketId: string;
|
|
1480
|
-
venueMarketOutcomeId: string;
|
|
1481
|
-
};
|
|
1482
|
-
type VenueMarketOutcome = {
|
|
1483
|
-
id: string;
|
|
1484
|
-
/**
|
|
1485
|
-
* REMOVED — /venue-events and /venue-markets no longer return outcome
|
|
1486
|
-
* prices. Fetch live prices from GET /midpoints (or the live-price hooks),
|
|
1487
|
-
* keyed by this outcome's `id`.
|
|
1488
|
-
*/
|
|
1489
|
-
price?: number | undefined;
|
|
1490
|
-
venueMarketId: string;
|
|
1491
|
-
label: string;
|
|
1492
|
-
title?: string | null | undefined;
|
|
1493
|
-
externalIdentifier?: string | null | undefined;
|
|
1494
|
-
winner?: boolean | null | undefined;
|
|
1495
|
-
/** Per-share USDC payout of this outcome in [0, 1] once settled; source of truth over `winner` when set. */
|
|
1496
|
-
payoutPerShare?: number | null | undefined;
|
|
1497
|
-
/** Venue voided the market and refunds every holder their stake: value at avgEntryPrice. Check before `payoutPerShare`. */
|
|
1498
|
-
refundAtCost?: boolean | undefined;
|
|
1499
|
-
/** Counterpart outcomes on matched sibling markets — only populated on
|
|
1500
|
-
* the parent (queried) market's outcomes. */
|
|
1501
|
-
matchedVenueMarketOutcomes?: MatchedVenueMarketOutcomeRef[];
|
|
1502
|
-
};
|
|
1503
|
-
type VenueEventWithMarkets = VenueEvent & {
|
|
1504
|
-
venueMarkets: VenueMarket[];
|
|
1505
|
-
};
|
|
1506
|
-
type VenueMarketListItem = Omit<VenueMarket, "matchedVenueMarkets">;
|
|
1507
|
-
type VenueEventListItem = VenueEvent & {
|
|
1508
|
-
venueMarkets: VenueMarketListItem[];
|
|
1509
|
-
marketCount: number;
|
|
1510
|
-
};
|
|
1511
|
-
/** Per-outcome midpoint inside a matched-sibling entry. Aligned via MVMO
|
|
1512
|
-
* so the `venueMarketOutcomeId` resolves the same outcome the parent's
|
|
1513
|
-
* `matchedVenueMarketOutcomes` ref points to. */
|
|
1514
|
-
type MatchedMidpointOutcome = {
|
|
1515
|
-
venueMarketOutcomeId: string;
|
|
1516
|
-
midpoint: number | null;
|
|
1517
|
-
bestBid?: number | null;
|
|
1518
|
-
bestAsk?: number | null;
|
|
1519
|
-
};
|
|
1520
|
-
type MatchedMidpoint = {
|
|
1521
|
-
venueMarketId: string;
|
|
1522
|
-
venue: string;
|
|
1523
|
-
/** Sibling's market-level midpoint. Kept for backwards compat — the
|
|
1524
|
-
* authoritative cross-venue alignment lives in `outcomes`. */
|
|
1525
|
-
midpoint: number | null;
|
|
1526
|
-
/** Per-outcome midpoints keyed by sibling outcome id. Optional during
|
|
1527
|
-
* rollout — older engine builds may omit it. */
|
|
1528
|
-
outcomes?: MatchedMidpointOutcome[];
|
|
1529
|
-
};
|
|
1530
|
-
type OutcomeMidpoint = {
|
|
1531
|
-
venueMarketOutcomeId: string;
|
|
1532
|
-
label: string;
|
|
1533
|
-
midpoint: number | null;
|
|
1534
|
-
bestBid?: number | null;
|
|
1535
|
-
bestAsk?: number | null;
|
|
1536
|
-
};
|
|
1537
|
-
type MidpointItem = {
|
|
1538
|
-
venueMarketId: string;
|
|
1539
|
-
venue: string;
|
|
1540
|
-
midpoint: number | null;
|
|
1541
|
-
spread: number | null;
|
|
1542
|
-
timestamp: number | null;
|
|
1543
|
-
outcomes: OutcomeMidpoint[];
|
|
1544
|
-
matched: MatchedMidpoint[];
|
|
1545
|
-
arbReturn?: number | null | undefined;
|
|
1546
|
-
};
|
|
1547
|
-
type ComputeSplitsRequest = {
|
|
1548
|
-
side: TradeSide$1;
|
|
1549
|
-
selections: {
|
|
1550
|
-
venue: Venue;
|
|
1551
|
-
venueMarketOutcomeId: string;
|
|
1552
|
-
}[];
|
|
1553
|
-
maxDollarAmount: number;
|
|
1554
|
-
};
|
|
1555
|
-
type ComputeSplitsResponse = {
|
|
1556
|
-
splits: {
|
|
1557
|
-
venue: Venue;
|
|
1558
|
-
venueMarketOutcomeId: string;
|
|
1559
|
-
side: TradeSide$1;
|
|
1560
|
-
price: number;
|
|
1561
|
-
size: number;
|
|
1562
|
-
signedOrder?: any;
|
|
1563
|
-
negRisk?: boolean | undefined;
|
|
1564
|
-
outcomeExternalIdentifier?: string | undefined;
|
|
1565
|
-
}[];
|
|
1566
|
-
totalSize: number;
|
|
1567
|
-
totalCost: number;
|
|
1568
|
-
};
|
|
1569
|
-
type Category = {
|
|
1570
|
-
id: string;
|
|
1571
|
-
name: string;
|
|
1572
|
-
displayName: string | null;
|
|
1573
|
-
parentId: string | null;
|
|
1574
|
-
eventCount: number;
|
|
1575
|
-
volume24hr: number;
|
|
1576
|
-
volume: number;
|
|
1577
|
-
};
|
|
1578
|
-
type SettlementSource = {
|
|
1579
|
-
name: string;
|
|
1580
|
-
url?: string | null | undefined;
|
|
1581
|
-
};
|
|
1582
|
-
type SettlementDifference = {
|
|
1583
|
-
type: string;
|
|
1584
|
-
title: string;
|
|
1585
|
-
perVenue: Record<string, string>;
|
|
1586
|
-
summary?: string | undefined;
|
|
1587
|
-
};
|
|
1588
|
-
type SettlementDiff = {
|
|
1589
|
-
sharedSummary: string;
|
|
1590
|
-
differences: SettlementDifference[];
|
|
1591
|
-
};
|
|
1592
|
-
type ExecuteManagedRequest = {
|
|
1593
|
-
quoteId: string;
|
|
1594
|
-
};
|
|
1595
|
-
type ValidateManagedRequest = {
|
|
1596
|
-
venueMarketOutcomeIds: string[];
|
|
1597
|
-
side: "buy" | "sell";
|
|
1598
|
-
amount: number;
|
|
1599
|
-
};
|
|
1600
|
-
type WithdrawTokenSymbol$1 = "USDC" | "USDC.e" | "USDT";
|
|
1601
|
-
type WithdrawalSourceTokenSymbol$1 = WithdrawTokenSymbol$1 | "pUSD" | "USD1";
|
|
1602
|
-
type WithdrawManagedRequest = {
|
|
1603
|
-
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
1604
|
-
amountRaw: string;
|
|
1605
|
-
tokenSymbol: WithdrawTokenSymbol$1;
|
|
1606
|
-
/** EVM 0x-prefixed 20-byte recipient address. */
|
|
1607
|
-
destinationAddress: string;
|
|
1608
|
-
/** EVM chain ID where the recipient should receive funds. Required since v2026.04. */
|
|
1609
|
-
destinationChainId: number;
|
|
1610
|
-
};
|
|
1611
|
-
type WithdrawalSourceStatus$1 = "pending" | "submitted" | "confirmed" | "failed";
|
|
1612
|
-
type WithdrawalSourceItem = {
|
|
1613
|
-
sourceId: string;
|
|
1614
|
-
chainId: number;
|
|
1615
|
-
tokenSymbol: WithdrawalSourceTokenSymbol$1;
|
|
1616
|
-
/** On-chain token address on `chainId`. */
|
|
1617
|
-
tokenAddress: string;
|
|
1618
|
-
/**
|
|
1619
|
-
* On-chain decimals for `(chainId, tokenAddress)`. Critical for clients
|
|
1620
|
-
* because `amountRaw` is in source-native decimals (BNB USDC is 18-dec,
|
|
1621
|
-
* EVM USDC is 6-dec).
|
|
1622
|
-
*/
|
|
1623
|
-
decimals: number;
|
|
1624
|
-
amountRaw: string;
|
|
1625
|
-
custodyKind?: "DEPOSIT_WALLET" | "VENUE_ACCOUNT";
|
|
1626
|
-
venue?: string;
|
|
1627
|
-
sourceVenueAccountId?: string;
|
|
1628
|
-
sourceExternalAccountId?: string;
|
|
1629
|
-
status: WithdrawalSourceStatus$1;
|
|
1630
|
-
txHash: string | null;
|
|
1631
|
-
bridgeOperationId: string | null;
|
|
1632
|
-
};
|
|
1633
|
-
/** @deprecated Use `WithdrawalSourceItem` from the lifecycle response. */
|
|
1634
|
-
type WithdrawalSource = {
|
|
1635
|
-
amountRaw: string;
|
|
1636
|
-
chainId: number;
|
|
1637
|
-
txHash?: string | undefined;
|
|
1638
|
-
bridgeOperationId?: string | undefined;
|
|
1639
|
-
};
|
|
1640
|
-
type SyncBalancesResponse = {
|
|
1641
|
-
synced: true;
|
|
1642
|
-
};
|
|
1643
|
-
|
|
1644
|
-
/** App-level paper/live mode. An app is one or the other, never both. */
|
|
1645
|
-
type AppTradingMode = "live" | "paper";
|
|
1646
|
-
interface AppClientConfigResponse {
|
|
1647
|
-
prophetxExecutionMode?: "clearinghouse" | "direct";
|
|
1648
|
-
novigExecutionMode?: "clearinghouse" | "direct";
|
|
1649
|
-
disabledVenues: Venue[];
|
|
1650
|
-
disabledCategoryPresets: string[];
|
|
1651
|
-
earlyAccessEnabled: boolean;
|
|
1652
|
-
authOptions: AppClientAuthOption[];
|
|
1653
|
-
/**
|
|
1654
|
-
* Server-owned execution mode. Prefer this over any locally-configured
|
|
1655
|
-
* `trading.executionMode` — the API enforces it regardless of what the
|
|
1656
|
-
* client sends, and end users cannot change it.
|
|
1657
|
-
*/
|
|
1658
|
-
tradingMode: AppTradingMode;
|
|
1659
|
-
/**
|
|
1660
|
-
* One-time simulated balance granted on first paper use, in dollars.
|
|
1661
|
-
* Interpolate this into paper copy rather than hardcoding a figure.
|
|
1662
|
-
*/
|
|
1663
|
-
paperStartingBalance: number;
|
|
1664
|
-
}
|
|
1665
|
-
interface VenueGeoPolicyEntry {
|
|
1666
|
-
venue: Venue;
|
|
1667
|
-
/** ISO 3166-1 alpha-2, upper-case. Empty means no country restriction. */
|
|
1668
|
-
blockedCountries: string[];
|
|
1669
|
-
/**
|
|
1670
|
-
* ISO 3166-1 alpha-2, upper-case. When present, this venue is ALLOWLIST
|
|
1671
|
-
* mode: ONLY these countries are permitted (`blockedCountries` is always
|
|
1672
|
-
* `[]` alongside this and must be ignored). Absent/undefined ⇒ ordinary
|
|
1673
|
-
* denylist mode, use `blockedCountries` as before. Only Novig uses this
|
|
1674
|
-
* today — a client that reads only `blockedCountries` sees an allowlisted
|
|
1675
|
-
* venue as unrestricted, which is exactly the misread this field closes.
|
|
1676
|
-
*/
|
|
1677
|
-
allowedCountries?: string[];
|
|
1678
|
-
}
|
|
1679
|
-
interface VenueGeoPolicyResponse {
|
|
1680
|
-
venues: VenueGeoPolicyEntry[];
|
|
1681
|
-
}
|
|
1682
|
-
interface RpcTokenResponse {
|
|
1683
|
-
token: string;
|
|
1684
|
-
expiresAt: number;
|
|
1685
|
-
}
|
|
1686
|
-
type AggAuthProviderType = "siwe" | "siws" | "google" | "twitter" | "apple" | "email";
|
|
1687
|
-
interface AppClientAuthOption {
|
|
1688
|
-
provider: AggAuthProviderType;
|
|
1689
|
-
type: "oauth" | "email" | "wallet";
|
|
1690
|
-
enabled: boolean;
|
|
1691
|
-
callbackUrl?: string;
|
|
1692
|
-
statement?: string;
|
|
1693
|
-
}
|
|
1694
|
-
type AggAuthDeliveryMode = "body" | "cookie-refresh";
|
|
1695
|
-
interface AggClientAuthOptions {
|
|
1696
|
-
getEarlyAccessCode?: () => string | null;
|
|
1697
|
-
}
|
|
1698
|
-
type AggAuthStartBody = {
|
|
1699
|
-
provider: Exclude<AggAuthProviderType, "email">;
|
|
1700
|
-
redirectUrl?: string;
|
|
1701
|
-
/** Cloudflare Turnstile token — required when a prior authStart returned `challenge_required`. */
|
|
1702
|
-
turnstileToken?: string;
|
|
1703
|
-
earlyAccessCode?: string;
|
|
1704
|
-
} | {
|
|
1705
|
-
provider: "email";
|
|
1706
|
-
email: string;
|
|
1707
|
-
redirectUrl?: string;
|
|
1708
|
-
/** Cloudflare Turnstile token — required when a prior authStart returned `challenge_required`. */
|
|
1709
|
-
turnstileToken?: string;
|
|
1710
|
-
earlyAccessCode?: string;
|
|
1711
|
-
};
|
|
1712
|
-
/** SIWE / SIWS sign-in. `kind` is optional so callers that predate the discriminator still compile. */
|
|
1713
|
-
interface AggAuthWalletVerifyBody {
|
|
1714
|
-
kind?: "wallet";
|
|
1715
|
-
message: string;
|
|
1716
|
-
signature: string;
|
|
1717
|
-
earlyAccessCode?: string;
|
|
1718
|
-
}
|
|
1719
|
-
/** Privy sign-in. Requires the app's wallet provider to be Privy; the token must come from that Privy app. */
|
|
1720
|
-
interface AggAuthPrivyVerifyBody {
|
|
1721
|
-
kind: "privy";
|
|
1722
|
-
privyToken: string;
|
|
1723
|
-
earlyAccessCode?: string;
|
|
1724
|
-
}
|
|
1725
|
-
/** Body for `POST /auth/verify` — mirrors the API's union on `kind`. */
|
|
1726
|
-
type AggAuthVerifyBody = AggAuthWalletVerifyBody | AggAuthPrivyVerifyBody;
|
|
1727
|
-
type AggAuthStartResult = {
|
|
1728
|
-
type: "nonce";
|
|
1729
|
-
nonce: string;
|
|
1730
|
-
statement?: string;
|
|
1731
|
-
} | {
|
|
1732
|
-
type: "redirect";
|
|
1733
|
-
url: string;
|
|
1734
|
-
} | {
|
|
1735
|
-
type: "magic_link";
|
|
1736
|
-
success: true;
|
|
1737
|
-
} | {
|
|
1738
|
-
type: "challenge_required";
|
|
1739
|
-
siteKey: string;
|
|
1740
|
-
};
|
|
1741
|
-
/**
|
|
1742
|
-
* Body for `POST /users/me/link-account/start` — authenticated account linking.
|
|
1743
|
-
*
|
|
1744
|
-
* `redirectUrl` is required for OAuth/email providers: the callback / magic-link
|
|
1745
|
-
* verify hands the partner a `link_confirm_token` by redirecting to `redirectUrl`,
|
|
1746
|
-
* and the partner app completes the flow by calling `/confirm` from that page.
|
|
1747
|
-
*
|
|
1748
|
-
* Wallet providers (`siwe`/`siws`) instead return a `wallet_challenge` with a
|
|
1749
|
-
* `message` the user signs VERBATIM; the signature is then confirmed with
|
|
1750
|
-
* `{ kind: "wallet_signature", message, signature }`.
|
|
1751
|
-
*/
|
|
1752
|
-
type AggLinkAccountBody = {
|
|
1753
|
-
provider: "google" | "twitter" | "apple";
|
|
1754
|
-
redirectUrl: string;
|
|
1755
|
-
} | {
|
|
1756
|
-
provider: "email";
|
|
1757
|
-
email: string;
|
|
1758
|
-
redirectUrl: string;
|
|
1759
|
-
} | {
|
|
1760
|
-
provider: "siwe" | "siws";
|
|
1761
|
-
address: string;
|
|
1762
|
-
};
|
|
1763
|
-
type AggLinkAccountResult = {
|
|
1764
|
-
type: "redirect";
|
|
1765
|
-
url: string;
|
|
1766
|
-
} | {
|
|
1767
|
-
type: "magic_link";
|
|
1768
|
-
success: true;
|
|
1769
|
-
} | {
|
|
1770
|
-
type: "wallet_challenge";
|
|
1771
|
-
message: string;
|
|
1772
|
-
};
|
|
1773
|
-
/**
|
|
1774
|
-
* Wallet branch of `POST /users/me/link-account/confirm`. Requires `kind` so it
|
|
1775
|
-
* can never be confused with the `token` branch. `message` MUST be the exact
|
|
1776
|
-
* `message` returned by `/start`'s `wallet_challenge` — the server compares it
|
|
1777
|
-
* byte-for-byte, so do not reconstruct or edit it client-side.
|
|
1778
|
-
*/
|
|
1779
|
-
type AggLinkAccountWalletConfirmBody = {
|
|
1780
|
-
kind: "wallet_signature";
|
|
1781
|
-
message: string;
|
|
1782
|
-
signature: string;
|
|
1783
|
-
};
|
|
1784
|
-
/**
|
|
1785
|
-
* Success result of /users/me/link-account/confirm.
|
|
1786
|
-
* - `linked` — new Account row written.
|
|
1787
|
-
* - `already_linked_same` — identity was already attached to the caller's Principal
|
|
1788
|
-
* (idempotent; safe to retry).
|
|
1789
|
-
*
|
|
1790
|
-
* Collisions with a different Principal surface as HTTP 409 and are thrown by the
|
|
1791
|
-
* SDK's request layer — catch them at the call site, don't expect them here.
|
|
1792
|
-
*/
|
|
1793
|
-
type AggLinkAccountConfirmResult = {
|
|
1794
|
-
status: "linked" | "already_linked_same";
|
|
1795
|
-
provider: string;
|
|
1796
|
-
};
|
|
1797
|
-
type AggSessionUser = AuthUser | UserProfile;
|
|
1798
|
-
interface AggClientSessionInput {
|
|
1799
|
-
accessToken: string;
|
|
1800
|
-
refreshToken?: string;
|
|
1801
|
-
user?: AggSessionUser;
|
|
1802
|
-
}
|
|
1803
|
-
/** Non-sensitive auth snapshot persisted to localStorage for UI bootstrapping.
|
|
1804
|
-
* Tokens are NEVER included — they exist only in process memory. */
|
|
1805
|
-
interface PersistedAuthSnapshot {
|
|
1806
|
-
user: {
|
|
1807
|
-
id: string;
|
|
1808
|
-
username: string | null;
|
|
1809
|
-
avatarUrl: string | null;
|
|
1810
|
-
walletAddress?: string | null;
|
|
1811
|
-
} | null;
|
|
1812
|
-
authHint: {
|
|
1813
|
-
wasAuthenticated: boolean;
|
|
1814
|
-
};
|
|
1815
|
-
}
|
|
1816
|
-
/** Auth lifecycle status for UI state machines. */
|
|
1817
|
-
type AuthStatus = "unknown" | "authenticated" | "unauthenticated";
|
|
1818
|
-
type SignatureRequestType = "eip712" | "personal_sign"
|
|
1819
|
-
/** EVM transaction — bridge legs and approvals. secp256k1. */
|
|
1820
|
-
| "transaction"
|
|
1821
|
-
/** Solana transaction — bridge legs on SVM. ed25519, NOT secp256k1. */
|
|
1822
|
-
| "solana_transaction" | "hl_l1_action"
|
|
1823
|
-
/**
|
|
1824
|
-
* EIP-7702 authorization over `{ contractAddress, chainId, nonce }`.
|
|
1825
|
-
*
|
|
1826
|
-
* A signature over a RAW digest — `keccak(0x05 ‖ rlp([chainId, delegate,
|
|
1827
|
-
* nonce]))` — not EIP-191 and not EIP-712. Many wallets do not expose this,
|
|
1828
|
-
* and that is expected: reject it and the server falls back to asking the
|
|
1829
|
-
* user to broadcast a plain approve instead.
|
|
1830
|
-
*/
|
|
1831
|
-
| "eip7702_authorization"
|
|
1832
|
-
/**
|
|
1833
|
-
* A Gnosis Safe transaction relayed through Polymarket — a legacy Polymarket
|
|
1834
|
-
* wallet funding a fill. The payload is the SafeTx as EIP-712 typed data,
|
|
1835
|
-
* but the wallet must `personal_sign` the RAW 32 bytes of
|
|
1836
|
-
* `hashTypedData(payload)` (`signMessage({ message: { raw: hash } })`):
|
|
1837
|
-
* Polymarket's relayer only accepts that shape. `payload.safeTxHash` carries
|
|
1838
|
-
* the digest for convenience; the server recomputes it from the typed data.
|
|
1839
|
-
*/
|
|
1840
|
-
| "safe_tx";
|
|
1841
|
-
/** One payload the client must sign before a fill can proceed. */
|
|
1842
|
-
interface SignatureRequest {
|
|
1843
|
-
/** Echo this back with the signature. */
|
|
1844
|
-
stepId: string;
|
|
1845
|
-
/** Payload shape. Discriminates how to sign — not which venue. */
|
|
1846
|
-
type: SignatureRequestType;
|
|
1847
|
-
venue: string;
|
|
1848
|
-
/** The address that must produce this signature. Sign with this key, not another. */
|
|
1849
|
-
signerAddress: string;
|
|
1850
|
-
/** Absent for non-EVM payloads (e.g. Hyperliquid L1 actions). */
|
|
1851
|
-
chainId?: number;
|
|
1852
|
-
/** Sign verbatim. */
|
|
1853
|
-
payload: unknown;
|
|
1854
|
-
expiresAt: string;
|
|
1855
|
-
/** Why this signature is being asked for, when the server knows (e.g. `"fee"`, `"funding_and_fee"`). Display only. */
|
|
1856
|
-
purpose?: string;
|
|
1857
|
-
/**
|
|
1858
|
-
* The fill proceeds without this one (e.g. `purpose: "hl_referral"`, a
|
|
1859
|
-
* partner referral parked beside a Hyperliquid order). `fillSelfCustody`
|
|
1860
|
-
* skips it if your signer throws or it has expired, instead of failing the
|
|
1861
|
-
* fill.
|
|
1862
|
-
*/
|
|
1863
|
-
optional?: boolean;
|
|
1864
|
-
}
|
|
1865
|
-
/**
|
|
1866
|
-
* Supplied by the partner. Receives a payload, returns a signature. The SDK
|
|
1867
|
-
* never sees the key.
|
|
1868
|
-
*
|
|
1869
|
-
* Return a 0x-prefixed hex string for anything the wallet SIGNS:
|
|
1870
|
-
*
|
|
1871
|
-
* - `eip712` — `signTypedData` over `payload`.
|
|
1872
|
-
* - `personal_sign` — EIP-191 over `payload`: a UTF-8 string or `{ raw: "0x…" }
|
|
1873
|
-
* bytes (Polymarket proxy batches). Pass it directly as viem `message`.
|
|
1874
|
-
* - `safe_tx` — `personal_sign` over the RAW 32 bytes of
|
|
1875
|
-
* `hashTypedData(payload)` (viem: `signMessage({ message: { raw: hash } })`,
|
|
1876
|
-
* MetaMask: `personal_sign` with the hex hash). The wallet shows a hash, not
|
|
1877
|
-
* a structured prompt — that is what Polymarket's own relayer requires.
|
|
1878
|
-
* - `hl_l1_action` — Hyperliquid L1 action, EIP-712 in phantom-agent form.
|
|
1879
|
-
* - `eip7702_authorization` — an EIP-7702 authorization over
|
|
1880
|
-
* `{ contractAddress, chainId, nonce }`. This is a signature over a RAW
|
|
1881
|
-
* digest, not EIP-191 and not EIP-712, and many wallets do not expose it.
|
|
1882
|
-
* **Throwing here does not help**: there is no reject verb, so a thrown
|
|
1883
|
-
* signer is indistinguishable from a slow user — the request simply expires
|
|
1884
|
-
* and the fill dies. If your wallet cannot produce this signature, declare
|
|
1885
|
-
* `approveMode: "user_broadcast"` on the fill instead and the approve is
|
|
1886
|
-
* requested as a `transaction` the user sends themselves. Handling this
|
|
1887
|
-
* request is what makes funding gasless.
|
|
1888
|
-
*
|
|
1889
|
-
* Return `{ txHash }` for anything the wallet BROADCASTS:
|
|
1890
|
-
*
|
|
1891
|
-
* - `transaction` — send it, then return the hash **immediately, without
|
|
1892
|
-
* awaiting the receipt**. The server watches for the mined receipt itself
|
|
1893
|
-
* and will not resume until it matches the request byte-for-byte.
|
|
1894
|
-
*/
|
|
1895
|
-
type SignerFn = (req: SignatureRequest) => Promise<string | {
|
|
1896
|
-
txHash: string;
|
|
1897
|
-
}>;
|
|
1898
|
-
/**
|
|
1899
|
-
* How long `fillSelfCustody` will keep waiting before giving up.
|
|
1900
|
-
*
|
|
1901
|
-
* Covers a first-time user: sign the wallet-setup batch, wait for it on-chain,
|
|
1902
|
-
* then sign the order. Generous because the wait is a relayer transaction
|
|
1903
|
-
* confirming, not a human deciding.
|
|
1904
|
-
*/
|
|
1905
|
-
declare const SELF_CUSTODY_FILL_TIMEOUT_MS: number;
|
|
1906
|
-
/** Gap between re-reads while an on-chain step is in flight. */
|
|
1907
|
-
declare const SELF_CUSTODY_POLL_INTERVAL_MS = 2000;
|
|
1908
|
-
/**
|
|
1909
|
-
* How long `fillSelfCustody` waits on the `signer` for ONE optional request
|
|
1910
|
-
* signed by a wallet other than the user's — e.g. a partner's activation
|
|
1911
|
-
* sponsor. Such a request can delay the batch's submission by at most this long,
|
|
1912
|
-
* after which it is declined and the required signatures go out without it.
|
|
1913
|
-
* Required requests, and optional ones the user's own wallet signs (the fill's
|
|
1914
|
-
* `signingAddress` or any required request's `signerAddress`, e.g. a referral
|
|
1915
|
-
* code), are never bounded by this.
|
|
1916
|
-
*/
|
|
1917
|
-
declare const OPTIONAL_SIGNATURE_TIMEOUT_MS = 15000;
|
|
1918
|
-
/**
|
|
1919
|
-
* States a run never leaves. Everything else means "still working".
|
|
1920
|
-
*
|
|
1921
|
-
* Typed against `ExecutionOverallState` so a typo'd or renamed literal (e.g.
|
|
1922
|
-
* `cancelled` drifting to `canceled`) is a compile error instead of a state
|
|
1923
|
-
* that silently stops being treated as terminal. Mirrors
|
|
1924
|
-
* `ExecutionOverallStateTB` in the contract; keep the two in step.
|
|
1925
|
-
*/
|
|
1926
|
-
declare const TERMINAL_EXECUTION_STATES: ReadonlySet<ExecutionOverallState>;
|
|
1927
|
-
type SportsGameStatus = "scheduled" | "live" | "paused" | "finished" | "cancelled" | "postponed" | "unknown";
|
|
1928
|
-
interface SportsLiveParticipant {
|
|
1929
|
-
position: "first" | "second";
|
|
1930
|
-
name: string;
|
|
1931
|
-
shortName: string | null;
|
|
1932
|
-
imageUrl: string | null;
|
|
1933
|
-
score: string | null;
|
|
1934
|
-
}
|
|
1935
|
-
interface SportsLiveState {
|
|
1936
|
-
eventId: string;
|
|
1937
|
-
sport: string;
|
|
1938
|
-
status: SportsGameStatus;
|
|
1939
|
-
participants: [SportsLiveParticipant, SportsLiveParticipant];
|
|
1940
|
-
period: string | null;
|
|
1941
|
-
clock: string | null;
|
|
1942
|
-
updatedAt: string | null;
|
|
1943
|
-
}
|
|
1944
|
-
interface SportsLiveResponse {
|
|
1945
|
-
data: SportsLiveState[];
|
|
1946
|
-
missingEventIds: string[];
|
|
1947
|
-
}
|
|
1948
|
-
interface AggClientOptions {
|
|
1949
|
-
/** Browser adapters can inject a Worker transport; other runtimes keep the native client. */
|
|
1950
|
-
webSocketFactory?: (options: AggWebSocketOptions) => AggWebSocket;
|
|
1951
|
-
baseUrl: string;
|
|
1952
|
-
/** Public App ID — sent as x-app-id header. For client-side partner usage. */
|
|
1953
|
-
appId?: string;
|
|
1954
|
-
/** Secret admin key — sent as x-admin-key header. Server-side only. */
|
|
1955
|
-
adminKey?: string;
|
|
1956
|
-
/**
|
|
1957
|
-
* Partner API key for server-side use. Sent as `x-app-api-key`. NEVER embed
|
|
1958
|
-
* in browser bundles, source maps, or logs. Keys start with `agg_<appId>_`.
|
|
1959
|
-
*/
|
|
1960
|
-
apiKey?: string;
|
|
1961
|
-
/** WebSocket URL for real-time feeds. Must be set explicitly to use createWebSocket(). */
|
|
1962
|
-
wsUrl?: string;
|
|
1963
|
-
/** Opt in after immutable history publication/CDN rollout. Defaults false. */
|
|
1964
|
-
preferImmutableHistory?: boolean;
|
|
1965
|
-
/**
|
|
1966
|
-
* @deprecated Kalshi live discovery and trading are retired. This ignored
|
|
1967
|
-
* compatibility option remains to avoid breaking existing SDK consumers.
|
|
1968
|
-
*/
|
|
1969
|
-
kalshiDemo?: boolean;
|
|
1970
|
-
/** Optional auth request hooks used to enrich auth payloads. */
|
|
1971
|
-
auth?: AggClientAuthOptions;
|
|
1972
|
-
/** Move refresh delivery to an HttpOnly cookie on auth endpoints. Defaults to "body". */
|
|
1973
|
-
authDelivery?: AggAuthDeliveryMode;
|
|
1974
|
-
/** Persist a non-sensitive auth hint to localStorage for UI bootstrapping.
|
|
1975
|
-
* Tokens are NEVER persisted — they exist only in process memory.
|
|
1976
|
-
* When authDelivery is "body", refresh tokens are lost on page reload.
|
|
1977
|
-
* When authDelivery is "cookie-refresh", refresh tokens survive via HttpOnly cookies
|
|
1978
|
-
* and the SDK attempts a silent refresh on cold start. Defaults to true. */
|
|
1979
|
-
persistSession?: boolean;
|
|
1980
|
-
/**
|
|
1981
|
-
* Supplies signatures for self-custodial fills. Required whenever
|
|
1982
|
-
* `fillSelfCustody()` is called with `signingAddress` — the SDK never
|
|
1983
|
-
* holds a key itself, so without this option a fill that needs a
|
|
1984
|
-
* client-side signature cannot proceed. The signature requests never
|
|
1985
|
-
* come back on `POST /execution/fill` itself: `fillSelfCustody()` polls
|
|
1986
|
-
* `GET /execution/status` for them (`pendingSignatures`), signs each one
|
|
1987
|
-
* with this function, and posts the result to
|
|
1988
|
-
* `POST /execution/fill/:quoteId/signatures`.
|
|
1989
|
-
*/
|
|
1990
|
-
signer?: SignerFn;
|
|
1991
|
-
}
|
|
1992
|
-
interface SiweMessageParams {
|
|
1993
|
-
domain: string;
|
|
1994
|
-
address: string;
|
|
1995
|
-
uri: string;
|
|
1996
|
-
nonce: string;
|
|
1997
|
-
chainId?: number;
|
|
1998
|
-
statement?: string;
|
|
1999
|
-
issuedAt?: string;
|
|
2000
|
-
}
|
|
2001
|
-
interface SiwsMessageParams {
|
|
2002
|
-
domain: string;
|
|
2003
|
-
/** Base58-encoded Solana public key. */
|
|
2004
|
-
address: string;
|
|
2005
|
-
uri: string;
|
|
2006
|
-
nonce: string;
|
|
2007
|
-
/** Solana chain ID: "mainnet", "devnet", "testnet", or "localnet". Defaults to "mainnet". */
|
|
2008
|
-
chainId?: string;
|
|
2009
|
-
statement?: string;
|
|
2010
|
-
issuedAt?: string;
|
|
2011
|
-
}
|
|
2012
|
-
/** OHLCV bar point for chart rendering. */
|
|
2013
|
-
interface ChartCandle {
|
|
2014
|
-
/** Venue average; distinct from OHLC close. */
|
|
2015
|
-
mean?: number;
|
|
2016
|
-
/** Open time in Unix milliseconds. */
|
|
2017
|
-
t: number;
|
|
2018
|
-
/** Open price (0-1). */
|
|
2019
|
-
o: number;
|
|
2020
|
-
/** High price (0-1). */
|
|
2021
|
-
h: number;
|
|
2022
|
-
/** Low price (0-1). */
|
|
2023
|
-
l: number;
|
|
2024
|
-
/** Close price (0-1). */
|
|
2025
|
-
c: number;
|
|
2026
|
-
/** Volume (null if unavailable). */
|
|
2027
|
-
v: number | null;
|
|
2028
|
-
}
|
|
2029
|
-
/** @deprecated Historical chart bars are canonical per outcome. Use ChartBarsResponse instead. */
|
|
2030
|
-
interface ChartVenueCandles {
|
|
2031
|
-
venue: string;
|
|
2032
|
-
candles: ChartCandle[];
|
|
2033
|
-
}
|
|
2034
|
-
type ChartResolution = "1m" | "5m" | "1h" | "1d";
|
|
2035
|
-
/**
|
|
2036
|
-
* Freshness signal embedded in every chart response. Compare
|
|
2037
|
-
* `staleSeconds` against the resolution to decide whether to show a
|
|
2038
|
-
* "delayed" badge on the chart.
|
|
2039
|
-
*/
|
|
2040
|
-
interface ChartBarsMeta {
|
|
2041
|
-
state?: "ready" | "warming" | "unsupported" | "failed" | "empty";
|
|
2042
|
-
complete?: boolean;
|
|
2043
|
-
retryAfterMs?: number;
|
|
2044
|
-
/** Agg fetch/publication time. Does not measure upstream delivery latency. */
|
|
2045
|
-
fetchedAtMs?: number;
|
|
2046
|
-
/** Server-side wall clock when the response was assembled, in milliseconds. */
|
|
2047
|
-
serverTime: number;
|
|
2048
|
-
/** `open_time` of the most-recent bar in `data`, in milliseconds. Null if `data` is empty. */
|
|
2049
|
-
lastBarOpenTime: number | null;
|
|
2050
|
-
/** `serverTime - lastBarOpenTime` in seconds. Null if `data` is empty. */
|
|
2051
|
-
staleSeconds: number | null;
|
|
2052
|
-
}
|
|
2053
|
-
/** Response from GET /charts/bars. */
|
|
2054
|
-
interface ChartBarsResponse {
|
|
2055
|
-
/** VenueMarketOutcome.id requested by the caller. */
|
|
2056
|
-
venueMarketOutcomeId: string;
|
|
2057
|
-
/** Venue of the canonical historical series. */
|
|
2058
|
-
venue: string;
|
|
2059
|
-
/** Resolution returned by the backend. */
|
|
2060
|
-
resolution: ChartResolution;
|
|
2061
|
-
/** Bars sorted in ascending open time. */
|
|
2062
|
-
data: ChartCandle[];
|
|
2063
|
-
/** Freshness signal — see {@link ChartBarsMeta}. */
|
|
2064
|
-
meta: ChartBarsMeta;
|
|
2065
|
-
}
|
|
2066
|
-
interface ChartHistoryManifest {
|
|
2067
|
-
version: 1;
|
|
2068
|
-
revision: string | null;
|
|
2069
|
-
venueMarketOutcomeId: string;
|
|
2070
|
-
venue: string;
|
|
2071
|
-
resolution: ChartResolution;
|
|
2072
|
-
semantics: "venue-ohlcv-v1" | "polymarket-price-samples-v1" | "kalshi-ohlcv-quote-fallback-v2";
|
|
2073
|
-
from: number;
|
|
2074
|
-
to: number;
|
|
2075
|
-
finalizedThrough: number;
|
|
2076
|
-
chunks: Array<{
|
|
2077
|
-
key: string;
|
|
2078
|
-
url: string;
|
|
2079
|
-
sha256: string;
|
|
2080
|
-
from: number;
|
|
2081
|
-
to: number;
|
|
2082
|
-
points: number;
|
|
2083
|
-
}>;
|
|
2084
|
-
meta: ChartBarsMeta;
|
|
2085
|
-
}
|
|
2086
|
-
/** Matched market reference returned by batch/aggregate endpoints. */
|
|
2087
|
-
interface VenueMarketRef {
|
|
2088
|
-
venue: string;
|
|
2089
|
-
venueMarketId: string;
|
|
2090
|
-
}
|
|
2091
|
-
type OrderbookBatchItemStatus = "ok" | "market_not_found" | "market_resolved" | "market_closed" | "market_paused" | "market_unopened" | "book_not_loaded";
|
|
2092
|
-
type OrderbookBatchItemErrorCode = "market_not_found" | "market_resolved" | "market_closed" | "market_paused" | "market_unopened" | "book_not_loaded";
|
|
2093
|
-
interface OrderbookBatchItemError {
|
|
2094
|
-
code: OrderbookBatchItemErrorCode;
|
|
2095
|
-
message: string;
|
|
2096
|
-
retryable: boolean;
|
|
2097
|
-
}
|
|
2098
|
-
interface OrderbooksOnlyError {
|
|
2099
|
-
code: "use_orderbooks_endpoint";
|
|
2100
|
-
message: string;
|
|
2101
|
-
retryable: boolean;
|
|
2102
|
-
}
|
|
2103
|
-
interface OrderbookServiceUnavailableError {
|
|
2104
|
-
code: "orderbook_service_unavailable";
|
|
2105
|
-
message: string;
|
|
2106
|
-
retryable: boolean;
|
|
2107
|
-
}
|
|
2108
|
-
interface RequestedOrderbookMarket {
|
|
2109
|
-
venueMarketId: string;
|
|
2110
|
-
venue: string;
|
|
2111
|
-
marketStatus: "open" | "closed" | "resolved" | "unopened" | "paused";
|
|
2112
|
-
tickSize: number | null;
|
|
2113
|
-
endDate: string | null;
|
|
2114
|
-
resolutionDate: string | null;
|
|
2115
|
-
}
|
|
2116
|
-
interface MatchedOrderbookMarket extends VenueMarketRef {
|
|
2117
|
-
marketStatus: "open" | "closed" | "resolved" | "unopened" | "paused";
|
|
2118
|
-
tickSize: number | null;
|
|
2119
|
-
hasOrderbook: boolean;
|
|
2120
|
-
/**
|
|
2121
|
-
* Hyperliquid HIP-4 deployer namespace this member belongs to (e.g. "ap").
|
|
2122
|
-
* `null` for every other venue and for Hyperliquid members without one.
|
|
2123
|
-
* Names which deployer this cluster member is — distinct from whether its
|
|
2124
|
-
* book was published (see `hasOrderbook`).
|
|
2125
|
-
*/
|
|
2126
|
-
deployerVenue?: string | null;
|
|
2127
|
-
}
|
|
2128
|
-
/**
|
|
2129
|
-
* Provenance of a published `midpoint`. Mirrors the engine's `MarkSource`.
|
|
2130
|
-
*
|
|
2131
|
-
* - `local` — true two-sided midpoint from the venue's own book
|
|
2132
|
-
* - `local_merged` — midpoint from the cross-venue merged book
|
|
2133
|
-
* - `local_one_sided` — only one side present; mark is the live side, NOT a midpoint
|
|
2134
|
-
* - `sibling` — derived from the complementary outcome (e.g. NO from YES)
|
|
2135
|
-
* - `local_boundary` — clamped to the [tick, 1-tick] boundary
|
|
2136
|
-
* - `none` — no mark available
|
|
2137
|
-
*/
|
|
2138
|
-
type MarkSource = "local" | "local_merged" | "local_one_sided" | "sibling" | "local_boundary" | "none";
|
|
2139
|
-
declare const RECURRENCE_CADENCES: readonly ["PT5M", "PT10M", "PT15M", "PT30M", "PT1H", "PT4H", "P1D", "P1W", "P1M", "P1Y"];
|
|
2140
|
-
type RecurrenceCadence = (typeof RECURRENCE_CADENCES)[number];
|
|
2141
|
-
type RecurrenceFilter = RecurrenceCadence | "null";
|
|
2142
|
-
type RecurringCryptoDuration = "PT5M" | "PT15M" | "PT30M" | "PT1H" | "PT4H" | "P1D";
|
|
2143
|
-
type RecurringCryptoDurationInput = RecurringCryptoDuration | "5m" | "15m" | "30m" | "1h" | "4h" | "1d";
|
|
2144
|
-
type RecurringCryptoSourceConfidence = "verified" | "inferred" | "missing";
|
|
2145
|
-
interface ListRecurringCryptoMarketsOptions {
|
|
2146
|
-
assets?: string[];
|
|
2147
|
-
durations?: RecurringCryptoDurationInput[];
|
|
2148
|
-
interval?: RecurringCryptoDurationInput;
|
|
2149
|
-
window?: "current";
|
|
2150
|
-
venues?: Venue[];
|
|
2151
|
-
status?: MarketStatus[];
|
|
2152
|
-
windowStartFrom?: string;
|
|
2153
|
-
windowStartTo?: string;
|
|
2154
|
-
cursor?: string;
|
|
2155
|
-
limit?: number;
|
|
2156
|
-
includeOrderbookPrices?: boolean;
|
|
2157
|
-
includeReferencePrices?: boolean;
|
|
2158
|
-
includeDirectVenueMarkets?: boolean;
|
|
2159
|
-
includeOrderbookDepth?: boolean;
|
|
2160
|
-
orderbookDepth?: number;
|
|
2161
|
-
orderbookDepthAmountUsd?: number;
|
|
2162
|
-
}
|
|
2163
|
-
interface RecurringCryptoOrderbookDepthLevel {
|
|
2164
|
-
price: number;
|
|
2165
|
-
size: number;
|
|
2166
|
-
notionalUsd: number;
|
|
2167
|
-
cumulativeSize: number;
|
|
2168
|
-
cumulativeNotionalUsd: number;
|
|
2169
|
-
fillSize: number | null;
|
|
2170
|
-
fillNotionalUsd: number | null;
|
|
2171
|
-
}
|
|
2172
|
-
interface RecurringCryptoOrderbookDepthSide {
|
|
2173
|
-
levels: RecurringCryptoOrderbookDepthLevel[];
|
|
2174
|
-
totalSize: number;
|
|
2175
|
-
totalNotionalUsd: number;
|
|
2176
|
-
requestedNotionalUsd: number | null;
|
|
2177
|
-
filledSize: number | null;
|
|
2178
|
-
filledNotionalUsd: number | null;
|
|
2179
|
-
unfilledNotionalUsd: number | null;
|
|
2180
|
-
avgPrice: number | null;
|
|
2181
|
-
worstPrice: number | null;
|
|
2182
|
-
fillsComplete: boolean | null;
|
|
2183
|
-
}
|
|
2184
|
-
interface RecurringCryptoOutcomeOrderbookDepth {
|
|
2185
|
-
currency: "USD";
|
|
2186
|
-
amountUsd: number | null;
|
|
2187
|
-
buy: RecurringCryptoOrderbookDepthSide;
|
|
2188
|
-
sell: RecurringCryptoOrderbookDepthSide;
|
|
2189
|
-
}
|
|
2190
|
-
interface RecurringCryptoOutcome {
|
|
2191
|
-
/**
|
|
2192
|
-
* Canonical Agg outcome id. Null for direct live venue rows because those
|
|
2193
|
-
* rows are discovery data and cannot be passed to smart order routing.
|
|
2194
|
-
*/
|
|
2195
|
-
venueMarketOutcomeId: string | null;
|
|
2196
|
-
/** Venue-native outcome id or synthetic external id for direct live rows. */
|
|
2197
|
-
externalOutcomeId: string | null;
|
|
2198
|
-
/** False for this endpoint; live crypto markets are not smart-route inputs. */
|
|
2199
|
-
routeable: boolean;
|
|
2200
|
-
/** False for this endpoint; split-order routing is not supported here. */
|
|
2201
|
-
splitOrdersAllowed: boolean;
|
|
2202
|
-
label: string;
|
|
2203
|
-
title: string | null;
|
|
2204
|
-
midpoint: number | null;
|
|
2205
|
-
bestBid: number | null;
|
|
2206
|
-
bestAsk: number | null;
|
|
2207
|
-
markSource: MarkSource | string | null;
|
|
2208
|
-
lastKnownPrice: number | null;
|
|
2209
|
-
orderbookDepth: RecurringCryptoOutcomeOrderbookDepth | null;
|
|
2210
|
-
}
|
|
2211
|
-
interface RecurringCryptoMarketMetrics {
|
|
2212
|
-
volume: number | null;
|
|
2213
|
-
volume24h: number | null;
|
|
2214
|
-
openInterest: number | null;
|
|
2215
|
-
liquidity: number | null;
|
|
2216
|
-
spread: number | null;
|
|
2217
|
-
}
|
|
2218
|
-
interface RecurringCryptoResolution {
|
|
2219
|
-
sourceName: string | null;
|
|
2220
|
-
sourceUrl: string | null;
|
|
2221
|
-
sourceDomain: string | null;
|
|
2222
|
-
rawCriteria: unknown;
|
|
2223
|
-
confidence: RecurringCryptoSourceConfidence;
|
|
2224
|
-
}
|
|
2225
|
-
interface RecurringCryptoReferencePrice {
|
|
2226
|
-
asset: string;
|
|
2227
|
-
quoteAsset: "USD";
|
|
2228
|
-
raw: string | null;
|
|
2229
|
-
decimals: number | null;
|
|
2230
|
-
normalized: number | null;
|
|
2231
|
-
timestamp: string | null;
|
|
2232
|
-
provider: string | null;
|
|
2233
|
-
providerMarketId: string | null;
|
|
2234
|
-
confidence: RecurringCryptoSourceConfidence;
|
|
2235
|
-
fetchedAt?: string | null;
|
|
2236
|
-
ageMs?: number | null;
|
|
2237
|
-
refreshing?: boolean;
|
|
2238
|
-
stale?: boolean;
|
|
2239
|
-
}
|
|
2240
|
-
type CryptoReferencePriceTarget = {
|
|
2241
|
-
type: "venueMarket";
|
|
2242
|
-
venueMarketId: string;
|
|
2243
|
-
} | {
|
|
2244
|
-
type: "venueEvent";
|
|
2245
|
-
venueEventId: string;
|
|
2246
|
-
} | {
|
|
2247
|
-
type: "externalVenueMarket";
|
|
2248
|
-
venue: Venue;
|
|
2249
|
-
externalMarketId: string;
|
|
2250
|
-
} | {
|
|
2251
|
-
type: "market";
|
|
2252
|
-
venue: Venue;
|
|
2253
|
-
venueEventId?: string;
|
|
2254
|
-
venueMarketId: string;
|
|
2255
|
-
externalEventId?: string | null;
|
|
2256
|
-
externalMarketId?: string;
|
|
2257
|
-
asset: string;
|
|
2258
|
-
quoteAsset?: "USD";
|
|
2259
|
-
resolution: RecurringCryptoResolution;
|
|
2260
|
-
};
|
|
2261
|
-
interface CryptoReferencePriceExternalMarketInput {
|
|
2262
|
-
venue: Venue;
|
|
2263
|
-
externalMarketId: string;
|
|
2264
|
-
}
|
|
2265
|
-
interface CryptoReferencePriceMarketInput extends RecurringCryptoVenueMarket {
|
|
2266
|
-
asset: string;
|
|
2267
|
-
quoteAsset?: "USD";
|
|
2268
|
-
}
|
|
2269
|
-
interface GetCryptoReferencePricesOptions {
|
|
2270
|
-
targets?: CryptoReferencePriceTarget[];
|
|
2271
|
-
venueMarketIds?: string[];
|
|
2272
|
-
venueEventIds?: string[];
|
|
2273
|
-
externalMarkets?: CryptoReferencePriceExternalMarketInput[];
|
|
2274
|
-
markets?: CryptoReferencePriceMarketInput[];
|
|
2275
|
-
windowMarkets?: RecurringCryptoWindowMarket[];
|
|
2276
|
-
signal?: AbortSignal;
|
|
2277
|
-
}
|
|
2278
|
-
interface CryptoReferencePriceError {
|
|
2279
|
-
code: "not_found" | "not_recurring_crypto" | "reference_feed_missing" | "price_unavailable" | "stale_price";
|
|
2280
|
-
message: string;
|
|
2281
|
-
}
|
|
2282
|
-
interface CryptoReferencePriceSource {
|
|
2283
|
-
provider: string | null;
|
|
2284
|
-
providerMarketId: string | null;
|
|
2285
|
-
confidence: RecurringCryptoSourceConfidence;
|
|
2286
|
-
}
|
|
2287
|
-
interface CryptoReferencePriceResult {
|
|
2288
|
-
target: CryptoReferencePriceTarget;
|
|
2289
|
-
venue: Venue | null;
|
|
2290
|
-
venueEventId: string | null;
|
|
2291
|
-
venueMarketId: string | null;
|
|
2292
|
-
externalEventId: string | null;
|
|
2293
|
-
externalMarketId: string | null;
|
|
2294
|
-
asset: string | null;
|
|
2295
|
-
quoteAsset: "USD" | null;
|
|
2296
|
-
raw: string | null;
|
|
2297
|
-
decimals: number | null;
|
|
2298
|
-
normalized: number | null;
|
|
2299
|
-
providerTimestamp: string | null;
|
|
2300
|
-
fetchedAt: string | null;
|
|
2301
|
-
ageMs: number | null;
|
|
2302
|
-
refreshing: boolean;
|
|
2303
|
-
stale: boolean;
|
|
2304
|
-
source: CryptoReferencePriceSource;
|
|
2305
|
-
error: CryptoReferencePriceError | null;
|
|
2306
|
-
}
|
|
2307
|
-
interface CryptoReferencePricesResponse {
|
|
2308
|
-
data: CryptoReferencePriceResult[];
|
|
2309
|
-
softRefreshMs: number;
|
|
2310
|
-
hardMaxAgeMs: number;
|
|
2311
|
-
}
|
|
2312
|
-
type RecurringCryptoComparisonPriceSource = "referencePrice" | "midpoint" | "lastKnownPrice";
|
|
2313
|
-
interface RecurringCryptoComparisonPoint {
|
|
2314
|
-
venue: Venue;
|
|
2315
|
-
venueMarketId: string;
|
|
2316
|
-
value: number;
|
|
2317
|
-
label: string | null;
|
|
2318
|
-
source: RecurringCryptoComparisonPriceSource;
|
|
2319
|
-
provider: string | null;
|
|
2320
|
-
providerMarketId: string | null;
|
|
2321
|
-
timestamp: string | null;
|
|
2322
|
-
confidence: RecurringCryptoSourceConfidence | null;
|
|
2323
|
-
}
|
|
2324
|
-
interface RecurringCryptoPriceComparison {
|
|
2325
|
-
count: number;
|
|
2326
|
-
min: RecurringCryptoComparisonPoint | null;
|
|
2327
|
-
max: RecurringCryptoComparisonPoint | null;
|
|
2328
|
-
spread: number | null;
|
|
2329
|
-
spreadBps: number | null;
|
|
2330
|
-
byVenue: RecurringCryptoComparisonPoint[];
|
|
2331
|
-
}
|
|
2332
|
-
interface RecurringCryptoWindowComparisons {
|
|
2333
|
-
referencePrice: RecurringCryptoPriceComparison;
|
|
2334
|
-
outcomePrices: {
|
|
2335
|
-
up: RecurringCryptoPriceComparison;
|
|
2336
|
-
down: RecurringCryptoPriceComparison;
|
|
2337
|
-
};
|
|
2338
|
-
}
|
|
2339
|
-
interface RecurringCryptoVenueMarket {
|
|
2340
|
-
venue: Venue;
|
|
2341
|
-
venueEventId: string;
|
|
2342
|
-
venueMarketId: string;
|
|
2343
|
-
externalEventId: string | null;
|
|
2344
|
-
externalMarketId: string;
|
|
2345
|
-
question: string;
|
|
2346
|
-
status: MarketStatus;
|
|
2347
|
-
priceSource: "snag" | "direct";
|
|
2348
|
-
/** False for this endpoint; live crypto markets are not smart-route inputs. */
|
|
2349
|
-
routeable: boolean;
|
|
2350
|
-
/** False for this endpoint; split-order routing is not supported here. */
|
|
2351
|
-
splitOrdersAllowed: boolean;
|
|
2352
|
-
outcomes: RecurringCryptoOutcome[];
|
|
2353
|
-
metrics: RecurringCryptoMarketMetrics;
|
|
2354
|
-
resolution: RecurringCryptoResolution;
|
|
2355
|
-
referencePrice: RecurringCryptoReferencePrice;
|
|
2356
|
-
}
|
|
2357
|
-
interface RecurringCryptoWindowMarket {
|
|
2358
|
-
id: string;
|
|
2359
|
-
asset: string;
|
|
2360
|
-
quoteAsset: "USD";
|
|
2361
|
-
duration: RecurringCryptoDuration;
|
|
2362
|
-
windowStart: string;
|
|
2363
|
-
windowEnd: string;
|
|
2364
|
-
status: MarketStatus;
|
|
2365
|
-
markets: RecurringCryptoVenueMarket[];
|
|
2366
|
-
comparisons: RecurringCryptoWindowComparisons;
|
|
2367
|
-
}
|
|
2368
|
-
interface RecurringCryptoMarketsResponse {
|
|
2369
|
-
data: RecurringCryptoWindowMarket[];
|
|
2370
|
-
nextCursor: string | null;
|
|
2371
|
-
hasMore: boolean;
|
|
2372
|
-
}
|
|
2373
|
-
/** Per-venue orderbook entry with native tick spacing. */
|
|
2374
|
-
interface VenueOrderbookEntry {
|
|
2375
|
-
venueMarketId: string;
|
|
2376
|
-
tickSize: number | null;
|
|
2377
|
-
orderbook: Orderbook;
|
|
2378
|
-
/**
|
|
2379
|
-
* Sticky tick of this venue's book inferred at runtime by the engine. May
|
|
2380
|
-
* differ from the seed `tickSize` when the live grid is finer than the DB
|
|
2381
|
-
* metadata. Optional — only populated when the engine has emitted runtime
|
|
2382
|
-
* metadata for this entry.
|
|
2383
|
-
*/
|
|
2384
|
-
tick?: number | null;
|
|
2385
|
-
/** Provenance of this venue book's published midpoint. See {@link MarkSource}. */
|
|
2386
|
-
markSource?: MarkSource;
|
|
2387
|
-
/**
|
|
2388
|
-
* Hyperliquid HIP-4 deployer namespace whose book this entry publishes
|
|
2389
|
-
* (e.g. "ap"). `null` for every other venue. When a cluster has more than
|
|
2390
|
-
* one Hyperliquid deployer member, only one member's book is published per
|
|
2391
|
-
* request — this names which one, so a caller never pairs this entry's depth
|
|
2392
|
-
* with a different member's `venueMarketId`.
|
|
2393
|
-
*/
|
|
2394
|
-
deployerVenue?: string | null;
|
|
2395
|
-
}
|
|
2396
|
-
/** Response from GET /orderbooks (batch). */
|
|
2397
|
-
interface BatchOrderbooksResponse {
|
|
2398
|
-
data: Array<{
|
|
2399
|
-
venueMarketId: string;
|
|
2400
|
-
status: OrderbookBatchItemStatus;
|
|
2401
|
-
error: OrderbookBatchItemError | null;
|
|
2402
|
-
requestedMarket: RequestedOrderbookMarket | null;
|
|
2403
|
-
venueOrderbooks: Record<string, VenueOrderbookEntry>;
|
|
2404
|
-
matchedMarkets: MatchedOrderbookMarket[];
|
|
2405
|
-
}>;
|
|
2406
|
-
meta: {
|
|
2407
|
-
requestedCount: number;
|
|
2408
|
-
okCount: number;
|
|
2409
|
-
errorCount: number;
|
|
2410
|
-
};
|
|
2411
|
-
}
|
|
2412
|
-
/** A single market midpoint row returned by GET /midpoints. */
|
|
2413
|
-
interface MidpointRow {
|
|
2414
|
-
venueMarketId: string;
|
|
2415
|
-
venue: string;
|
|
2416
|
-
midpoint: number | null;
|
|
2417
|
-
spread: number | null;
|
|
2418
|
-
timestamp: number | null;
|
|
2419
|
-
arbReturn?: number | null;
|
|
2420
|
-
/** Provenance of `midpoint`. */
|
|
2421
|
-
markSource?: MarkSource;
|
|
2422
|
-
/**
|
|
2423
|
-
* When `markSource === "sibling"`, the matched venueMarketId whose book
|
|
2424
|
-
* supplied the headline mark. Allows the FE to label "sourced from venue X"
|
|
2425
|
-
* without re-running the matching logic.
|
|
2426
|
-
*/
|
|
2427
|
-
siblingVenueMarketId?: string;
|
|
2428
|
-
/** Top-of-book buy-side price. Only present when `bestPrice=true`. */
|
|
2429
|
-
bestBid?: number | null;
|
|
2430
|
-
/** Top-of-book sell-side price. Only present when `bestPrice=true`. */
|
|
2431
|
-
bestAsk?: number | null;
|
|
2432
|
-
}
|
|
2433
|
-
/** Per-outcome midpoint from a live orderbook. */
|
|
2434
|
-
interface OutcomeMidpointRow {
|
|
2435
|
-
venueMarketOutcomeId: string;
|
|
2436
|
-
label: string;
|
|
2437
|
-
midpoint: number | null;
|
|
2438
|
-
/** Provenance of `midpoint`. */
|
|
2439
|
-
markSource?: MarkSource;
|
|
2440
|
-
/** Top-of-book buy-side price. Only present when `bestPrice=true`. */
|
|
2441
|
-
bestBid?: number | null;
|
|
2442
|
-
/** Top-of-book sell-side price. Only present when `bestPrice=true`. */
|
|
2443
|
-
bestAsk?: number | null;
|
|
2444
|
-
}
|
|
2445
|
-
/** Response from GET /midpoints (batch). */
|
|
2446
|
-
interface BatchMidpointsResponse {
|
|
2447
|
-
data: Array<MidpointRow & {
|
|
2448
|
-
outcomes: OutcomeMidpointRow[];
|
|
2449
|
-
matched: MidpointRow[];
|
|
2450
|
-
/**
|
|
2451
|
-
* Live, quality-gated cross-venue arbitrage return for this market's
|
|
2452
|
-
* cluster as a decimal fraction (`0.0085` = 0.85%), computed fresh by
|
|
2453
|
-
* the engine on this request. Prefer it over the `arbReturn` embedded
|
|
2454
|
-
* in venue-event listings, which a background sync can leave stale.
|
|
2455
|
-
* Only present when the request set `bestPrice=true`.
|
|
2456
|
-
*/
|
|
2457
|
-
arbReturn?: number | null;
|
|
2458
|
-
/**
|
|
2459
|
-
* DB status of the requested market. Present whenever the id resolves
|
|
2460
|
-
* to a known market. Resolved markets never serve a price (see `error`).
|
|
2461
|
-
*/
|
|
2462
|
-
marketStatus?: MarketStatus;
|
|
2463
|
-
/**
|
|
2464
|
-
* Structured refusal, mirroring GET /orderbooks per-item errors:
|
|
2465
|
-
* `market_resolved` for settled markets (prices are nulled instead of
|
|
2466
|
-
* serving a stale mark), `market_not_found` for unknown ids.
|
|
2467
|
-
*/
|
|
2468
|
-
error?: {
|
|
2469
|
-
code: "market_resolved" | "market_not_found";
|
|
2470
|
-
message: string;
|
|
2471
|
-
retryable: boolean;
|
|
2472
|
-
};
|
|
2473
|
-
}>;
|
|
2474
|
-
}
|
|
2475
|
-
/** Response from GET /orderbook/outcome/:id (single outcome). */
|
|
2476
|
-
interface OutcomeOrderbookResponse {
|
|
2477
|
-
/** CRC of returned depth-limited levels; full engine checksum remains unchanged. */
|
|
2478
|
-
snapshotChecksum?: number;
|
|
2479
|
-
venueMarketOutcomeId: string;
|
|
2480
|
-
venueMarketId: string;
|
|
2481
|
-
venue: string;
|
|
2482
|
-
orderbook: {
|
|
2483
|
-
bids: Array<{
|
|
2484
|
-
price: number;
|
|
2485
|
-
size: number;
|
|
2486
|
-
}>;
|
|
2487
|
-
asks: Array<{
|
|
2488
|
-
price: number;
|
|
2489
|
-
size: number;
|
|
2490
|
-
}>;
|
|
2491
|
-
};
|
|
2492
|
-
midpoint: number | null;
|
|
2493
|
-
spread: number | null;
|
|
2494
|
-
seq: number;
|
|
2495
|
-
checksum: number;
|
|
2496
|
-
timestamp: number;
|
|
2497
|
-
/** Sticky tick of this outcome's book, inferred at runtime. `null` until inferred. */
|
|
2498
|
-
tick: number | null;
|
|
2499
|
-
/** Provenance of `midpoint`. See {@link MarkSource}. */
|
|
2500
|
-
markSource: MarkSource;
|
|
2501
|
-
}
|
|
2502
|
-
/** Standard paginated list response from the API. */
|
|
2503
|
-
interface PaginatedResponse<T> {
|
|
2504
|
-
data: T[];
|
|
2505
|
-
nextCursor: string | null;
|
|
2506
|
-
hasMore: boolean;
|
|
2507
|
-
}
|
|
2508
|
-
interface OrderListQuery {
|
|
2509
|
-
userId?: string;
|
|
2510
|
-
status?: string;
|
|
2511
|
-
limit?: number;
|
|
2512
|
-
offset?: number;
|
|
2513
|
-
}
|
|
2514
|
-
interface TradeExecutorOrder {
|
|
2515
|
-
id: string;
|
|
2516
|
-
userId: string;
|
|
2517
|
-
venue: string;
|
|
2518
|
-
status: string;
|
|
2519
|
-
marketId: string;
|
|
2520
|
-
tokenId: string;
|
|
2521
|
-
side: string;
|
|
2522
|
-
amountRaw: string;
|
|
2523
|
-
quoteId: string | null;
|
|
2524
|
-
externalId: string | null;
|
|
2525
|
-
clientOrderId: string | null;
|
|
2526
|
-
dagRunId: string | null;
|
|
2527
|
-
filledAmountRaw: string | null;
|
|
2528
|
-
executionPrice: string | null;
|
|
2529
|
-
txHash: string | null;
|
|
2530
|
-
errorMessage: string | null;
|
|
2531
|
-
createdAt: string;
|
|
2532
|
-
updatedAt: string;
|
|
2533
|
-
}
|
|
2534
|
-
interface TradeExecutorOrderListResponse {
|
|
2535
|
-
orders: TradeExecutorOrder[];
|
|
2536
|
-
total: number;
|
|
2537
|
-
}
|
|
2538
|
-
/** A single level in the aggregated orderbook with per-venue attribution. */
|
|
2539
|
-
interface AggregatedOrderbookLevel {
|
|
2540
|
-
price: number;
|
|
2541
|
-
size: number;
|
|
2542
|
-
venues: Record<string, number>;
|
|
2543
|
-
}
|
|
2544
|
-
/** A simple orderbook level without venue attribution. */
|
|
2545
|
-
interface SimpleOrderbookLevel {
|
|
2546
|
-
price: number;
|
|
2547
|
-
size: number;
|
|
2548
|
-
}
|
|
2549
|
-
/** Per-venue best-bid/ask info. */
|
|
2550
|
-
interface VenuePriceInfo {
|
|
2551
|
-
bestBid: number | null;
|
|
2552
|
-
bestAsk: number | null;
|
|
2553
|
-
}
|
|
2554
|
-
/** Response from GET /orderbook/:venueMarketId — canonical aggregated orderbook. */
|
|
2555
|
-
interface AggregatedOrderbookResponse {
|
|
2556
|
-
venueMarketId: string;
|
|
2557
|
-
orderbook: {
|
|
2558
|
-
bids: AggregatedOrderbookLevel[];
|
|
2559
|
-
asks: AggregatedOrderbookLevel[];
|
|
2560
|
-
};
|
|
2561
|
-
venueOrderbooks: Record<string, {
|
|
2562
|
-
bids: SimpleOrderbookLevel[];
|
|
2563
|
-
asks: SimpleOrderbookLevel[];
|
|
2564
|
-
}>;
|
|
2565
|
-
venues: Record<string, VenuePriceInfo>;
|
|
2566
|
-
midpoint: number | null;
|
|
2567
|
-
spread: number | null;
|
|
2568
|
-
timestamp: number;
|
|
2569
|
-
/** Sequence number (present in live responses). */
|
|
2570
|
-
seq?: number;
|
|
2571
|
-
/** CRC32 checksum (present in live responses). */
|
|
2572
|
-
checksum?: number | null;
|
|
2573
|
-
/** Markets matched across venues for this canonical market. */
|
|
2574
|
-
matchedMarkets?: Array<{
|
|
2575
|
-
venue: string;
|
|
2576
|
-
venueMarketId: string;
|
|
2577
|
-
}>;
|
|
2578
|
-
}
|
|
2579
|
-
interface ExecuteManagedParams {
|
|
2580
|
-
quoteId: string;
|
|
2581
|
-
/** Trading mode. Defaults to live. */
|
|
2582
|
-
mode?: ExecutionMode;
|
|
2583
|
-
/**
|
|
2584
|
-
* Optional intent fallback. When the supplied `quoteId` has expired in the
|
|
2585
|
-
* cache (e.g. user clicked Buy after a tab was inactive), the server
|
|
2586
|
-
* resolves the latest quote for this intent and refreshes/executes against
|
|
2587
|
-
* that instead of returning 400 `quote_not_found`. Same intent = same buttons
|
|
2588
|
-
* the user pressed in the UI; a different `maxSpend`, mode, or venue scope is
|
|
2589
|
-
* a different intent and won't match.
|
|
2590
|
-
*/
|
|
2591
|
-
fallbackToLatest?: {
|
|
2592
|
-
outcomeId: string;
|
|
2593
|
-
side: "buy" | "sell";
|
|
2594
|
-
maxSpend?: number;
|
|
2595
|
-
sellShares?: number;
|
|
2596
|
-
allowedVenues?: Venue[];
|
|
2597
|
-
};
|
|
2598
|
-
/**
|
|
2599
|
-
* Self-custody: the wallet that will sign this fill. Must be a wallet
|
|
2600
|
-
* already linked to this account. Omit for managed custody (the default).
|
|
2601
|
-
*/
|
|
2602
|
-
signingAddress?: string;
|
|
2603
|
-
/**
|
|
2604
|
-
* Self-custody only: which approve shape a cross-chain fill uses when the
|
|
2605
|
-
* bridge needs an ERC20 approve. Omit (the default) for "sponsored" — the
|
|
2606
|
-
* approve costs the wallet no gas, but the wallet must sign a one-time
|
|
2607
|
-
* EIP-7702 authorization over a RAW DIGEST, which many wallets cannot
|
|
2608
|
-
* produce. Send "user_broadcast" when yours cannot: the user sends the
|
|
2609
|
-
* approve from their own wallet and pays its gas. Only your client can know
|
|
2610
|
-
* which applies — it is a property of the wallet software, not of the
|
|
2611
|
-
* address or the chain.
|
|
2612
|
-
*
|
|
2613
|
-
* Worth surfacing in your UI: "user_broadcast" never establishes the
|
|
2614
|
-
* delegation, so an approve is needed on EVERY bridge. "sponsored" costs one
|
|
2615
|
-
* signature once per chain.
|
|
2616
|
-
*
|
|
2617
|
-
* Neither mode makes bridging free — the approve is only one of the costs.
|
|
2618
|
-
* Relay's fee comes out of the amount delivered on every bridge, and one-time
|
|
2619
|
-
* costs apply per route. Quote with `deepEstimate` and read
|
|
2620
|
-
* `feeBreakdown.bridgeFees` and `feeBreakdown.setupCosts` rather than
|
|
2621
|
-
* inferring cost from the approve mode.
|
|
2622
|
-
*/
|
|
2623
|
-
approveMode?: "sponsored" | "user_broadcast";
|
|
2624
|
-
}
|
|
2625
|
-
interface ExecuteManagedResponse {
|
|
2626
|
-
alreadyAccepted?: boolean;
|
|
2627
|
-
quoteId: string;
|
|
2628
|
-
orderIds: string[];
|
|
2629
|
-
status: "pending";
|
|
2630
|
-
redeemId?: string;
|
|
2631
|
-
message?: string;
|
|
2632
|
-
/**
|
|
2633
|
-
* What this fill is waiting to be signed, if anything. On the immediate
|
|
2634
|
-
* `POST /execution/fill` response this is always absent or empty — even
|
|
2635
|
-
* for a self-custody fill, the DAG parks asynchronously, after this
|
|
2636
|
-
* response has already been sent. Real entries only ever come back from
|
|
2637
|
-
* polling `GET /execution/status` or from the next
|
|
2638
|
-
* `POST /execution/fill/:quoteId/signatures` response (this same shape,
|
|
2639
|
-
* reused). Drive the whole round trip through `fillSelfCustody()` rather
|
|
2640
|
-
* than reading this field on the fill response by hand.
|
|
2641
|
-
*/
|
|
2642
|
-
pendingSignatures?: SignatureRequest[];
|
|
2643
|
-
}
|
|
2644
|
-
type LimitOrderTimeInForce = "GTC" | "GTD" | "FOK" | "FAK" | "IOC" | "ALO";
|
|
2645
|
-
type CancelOrderSignature = {
|
|
2646
|
-
signature: string;
|
|
2647
|
-
timestamp: number;
|
|
2648
|
-
} | {
|
|
2649
|
-
venue: "hyperliquid";
|
|
2650
|
-
action: {
|
|
2651
|
-
type: "cancel";
|
|
2652
|
-
cancels: Array<{
|
|
2653
|
-
a: number;
|
|
2654
|
-
o: number;
|
|
2655
|
-
}>;
|
|
2656
|
-
};
|
|
2657
|
-
nonce: number;
|
|
2658
|
-
signature: {
|
|
2659
|
-
r: string;
|
|
2660
|
-
s: string;
|
|
2661
|
-
v: 27 | 28;
|
|
2662
|
-
};
|
|
2663
|
-
};
|
|
2664
|
-
interface CancelVenueOrderParams {
|
|
2665
|
-
venue: "polymarket" | "hyperliquid";
|
|
2666
|
-
venueOrderId: string;
|
|
2667
|
-
signerAddress: string;
|
|
2668
|
-
cancelSignature: CancelOrderSignature;
|
|
2669
|
-
}
|
|
2670
|
-
interface PlaceLimitOrderParams {
|
|
2671
|
-
/** BETDEX uses hosted cash: GTC/IOC only, no signer, post-only or expiry.
|
|
2672
|
-
* Native odds are rounded conservatively and stake is rounded down. GTC
|
|
2673
|
-
* unmatched liquidity is cancelled at the in-play transition. SELL closes
|
|
2674
|
-
* the same For outcome and requires collateral as well as owned inventory.
|
|
2675
|
-
*/
|
|
2676
|
-
venue: Venue;
|
|
2677
|
-
venueMarketOutcomeId: string;
|
|
2678
|
-
side: "buy" | "sell";
|
|
2679
|
-
limitPriceRaw: string;
|
|
2680
|
-
sizeRaw: string;
|
|
2681
|
-
timeInForce: LimitOrderTimeInForce;
|
|
2682
|
-
postOnly?: boolean;
|
|
2683
|
-
expiresAt?: string;
|
|
2684
|
-
clientOrderId?: string;
|
|
2685
|
-
/** Linked account EOA. Polymarket supports GTC/GTD buys; Hyperliquid supports GTC/ALO buys and sells. Agent keys stay on the client. Omit for managed custody. */
|
|
2686
|
-
signingAddress?: string;
|
|
2687
|
-
/** Same bridge approval mode as market fills; defaults to sponsored. */
|
|
2688
|
-
approveMode?: ExecuteManagedParams["approveMode"];
|
|
2689
|
-
/** Self-custody buys only: other wallets linked to this account whose balances may bridge in to fund the order. Requires signingAddress. */
|
|
2690
|
-
fundingAddresses?: string[];
|
|
2691
|
-
}
|
|
2692
|
-
interface PlaceLimitOrderResponse {
|
|
2693
|
-
orderId: string;
|
|
2694
|
-
/** Poll getExecutionStatus and answer submitFillSignatures using this ID. */
|
|
2695
|
-
quoteId?: string;
|
|
2696
|
-
status: "pending" | "submitting" | "submitted" | "cancel_pending" | "partial_fill" | "open" | "partially_filled_open" | "filled" | "cancelled" | "expired" | "failed";
|
|
2697
|
-
venue: Venue;
|
|
2698
|
-
venueOrderId?: string | null;
|
|
2699
|
-
reservedCostRaw?: string | null;
|
|
2700
|
-
limitPriceRaw: string;
|
|
2701
|
-
limitSizeRaw: string;
|
|
2702
|
-
filledSizeRaw: string;
|
|
2703
|
-
remainingSizeRaw: string;
|
|
2704
|
-
}
|
|
2705
|
-
interface PlaceOrderParams {
|
|
2706
|
-
venue: Venue;
|
|
2707
|
-
venueMarketOutcomeId: string;
|
|
2708
|
-
side: "buy" | "sell";
|
|
2709
|
-
/** Buy only. Maximum all-in USD spend, inclusive of app fee. */
|
|
2710
|
-
maxSpend?: number;
|
|
2711
|
-
/** Sell only. Number of contracts to sell. */
|
|
2712
|
-
sellShares?: number;
|
|
2713
|
-
/**
|
|
2714
|
-
* Your trade id. Required, unique within your app — two different users of
|
|
2715
|
-
* the same app cannot share one. A repeat returns 409 instead of trading twice.
|
|
2716
|
-
*/
|
|
2717
|
-
externalId: string;
|
|
2718
|
-
/** Slippage cap in bps. Defaults to 500 (5%). Set explicitly on sells. */
|
|
2719
|
-
slipCapBps?: number;
|
|
2720
|
-
/** Restrict funding to these chain IDs. Omit to allow every funded chain. */
|
|
2721
|
-
allowedSourceChainIds?: number[];
|
|
2722
|
-
/** USD budgets capped by refreshed wallet balances; omitted chains cannot fund. */
|
|
2723
|
-
chainBalances?: Record<string, number>;
|
|
2724
|
-
/** Per-trade app fee in bips (0..10000), replacing the app's configured rate. Needs an app API key. Buy only. */
|
|
2725
|
-
appFeeBips?: number;
|
|
2726
|
-
/** Per-venue app fee in bips (each 0..10000), e.g. `{ polymarket: 20, hyperliquid: 10 }`. Wins over `appFeeBips` on the venues it names; `appFeeBips` still covers the rest. Needs an app API key. Buy only. */
|
|
2727
|
-
appFeeBipsByVenue?: Record<string, number>;
|
|
2728
|
-
/** Referral: EVM address that receives the referral fee. Needs an app API key. */
|
|
2729
|
-
referrer?: string;
|
|
2730
|
-
/** Referral fee in bips of routed notional (1..10000). Snag-free. */
|
|
2731
|
-
referrerFeeBips?: number;
|
|
2732
|
-
/** Per-venue referral fee in bips (each 0..10000; 0 = none on that venue). Wins over `referrerFeeBips` on the venues it names. Needs `referrer` and an app API key. Not for `skipQuote`. */
|
|
2733
|
-
referrerFeeBipsByVenue?: Record<string, number>;
|
|
2734
|
-
/** Who funds the referral: "user" (default) reserves it from maxSpend; "app" pays from `referralPayerAddress` after the fill. */
|
|
2735
|
-
referralPayer?: "user" | "app";
|
|
2736
|
-
/** Required with `referralPayer: "app"`: the wallet that signs the parked payout transaction. */
|
|
2737
|
-
referralPayerAddress?: string;
|
|
2738
|
-
/**
|
|
2739
|
-
* User-paid referral only: a wallet that pays Hyperliquid's one-time 1 USDC
|
|
2740
|
-
* activation fee for a referrer with no HyperCore account (self-custody
|
|
2741
|
-
* Hyperliquid buys). Before the fill a pending signature with this
|
|
2742
|
-
* `signerAddress` and `purpose: "hl_activation_sponsor"` is passed to your
|
|
2743
|
-
* `signer`; it is `optional`, so declining it — or not answering within
|
|
2744
|
-
* `OPTIONAL_SIGNATURE_TIMEOUT_MS` — never costs the trade.
|
|
2745
|
-
*/
|
|
2746
|
-
referralActivationSponsorAddress?: string;
|
|
2747
|
-
/**
|
|
2748
|
-
* Skip the smart-route solver and send one order straight to `venue` (predict,
|
|
2749
|
-
* hyperliquid, novig and prophetx only; others return 400). Requires a `read_write` `x-app-api-key`. No
|
|
2750
|
-
* bridging: funds must already sit on the venue's own chain, and `allowedSourceChainIds` /
|
|
2751
|
-
* `chainBalances` are ignored alongside it. You own price and minimum
|
|
2752
|
-
* checks — an order the venue refuses fails after acceptance and uses up its `externalId`.
|
|
2753
|
-
*/
|
|
2754
|
-
skipQuote?: boolean;
|
|
2755
|
-
/**
|
|
2756
|
-
* With `skipQuote`, skip the balance check and fund hold on a buy: nothing checks the
|
|
2757
|
-
* balance and an underfunded order fails at the venue. Sells still check the position.
|
|
2758
|
-
* Without `skipQuote`, skip only the quote-time balance refresh: the route uses the last
|
|
2759
|
-
* stored balances, and the fund hold and balance check still run. Faster, but a stale
|
|
2760
|
-
* balance can fail the order after it was accepted. Requires a `read_write` `x-app-api-key`.
|
|
2761
|
-
*/
|
|
2762
|
-
skipBalance?: boolean;
|
|
2763
|
-
/**
|
|
2764
|
-
* With `skipQuote`, the price to trade at (e.g. `0.52`). Optional: if omitted, the best
|
|
2765
|
-
* available price at submission is used (best ask to buy, bid to sell). Ignored on
|
|
2766
|
-
* prophetx, which prices the order itself within `slipCapBps`.
|
|
2767
|
-
*/
|
|
2768
|
-
price?: number;
|
|
2769
|
-
}
|
|
2770
|
-
interface PlaceOrderResponse {
|
|
2771
|
-
orderId: string;
|
|
2772
|
-
externalId: string;
|
|
2773
|
-
venue: Venue;
|
|
2774
|
-
status: "pending";
|
|
2775
|
-
quoteId: string;
|
|
2776
|
-
/** `null` if the order row doesn't carry a quoted price. Not zero. */
|
|
2777
|
-
quotedPriceRaw: string | null;
|
|
2778
|
-
/** `null` under the same conditions as `quotedPriceRaw`. Not zero. */
|
|
2779
|
-
quotedCostRaw: string | null;
|
|
2780
|
-
/** `null` under the same conditions as `quotedPriceRaw`. Not zero. */
|
|
2781
|
-
quotedSharesRaw: string | null;
|
|
2782
|
-
}
|
|
2783
|
-
interface ValidateManagedParams {
|
|
2784
|
-
venueMarketOutcomeIds: string[];
|
|
2785
|
-
side: "buy" | "sell";
|
|
2786
|
-
amount: number;
|
|
2787
|
-
}
|
|
2788
|
-
interface ValidateManagedResponse {
|
|
2789
|
-
canExecute: boolean;
|
|
2790
|
-
availableBalanceRaw: string;
|
|
2791
|
-
requiredBalanceRaw: string;
|
|
2792
|
-
bridgeSourceChainId?: number;
|
|
2793
|
-
bridgeAmountRaw?: string;
|
|
2794
|
-
}
|
|
2795
|
-
type BalanceRefillPolicyStatus = "enabled" | "paused";
|
|
2796
|
-
type BalanceRefillAttemptStatus = "reserved" | "executing" | "completed" | "failed";
|
|
2797
|
-
interface BalanceRefillAttempt {
|
|
2798
|
-
id: string;
|
|
2799
|
-
policyId: string;
|
|
2800
|
-
status: BalanceRefillAttemptStatus;
|
|
2801
|
-
/** Target-chain balance when the threshold was crossed, in 6-decimal USD units. */
|
|
2802
|
-
triggerBalanceRaw: string;
|
|
2803
|
-
/** Minimum amount the refill must deliver, in 6-decimal USD units. */
|
|
2804
|
-
requestedDeliveryRaw: string;
|
|
2805
|
-
/** Reserved source amount, in 6-decimal USD units. */
|
|
2806
|
-
sourceAmountRaw: string;
|
|
2807
|
-
completedAmountRaw: string | null;
|
|
2808
|
-
sourceChainId: number;
|
|
2809
|
-
targetChainId: number;
|
|
2810
|
-
feeRaw: string | null;
|
|
2811
|
-
errorMessage: string | null;
|
|
2812
|
-
startedAt: string | null;
|
|
2813
|
-
completedAt: string | null;
|
|
2814
|
-
createdAt: string;
|
|
2815
|
-
}
|
|
2816
|
-
interface BalanceRefillPolicy {
|
|
2817
|
-
id: string;
|
|
2818
|
-
targetChainId: number;
|
|
2819
|
-
targetTokenAddress: string;
|
|
2820
|
-
targetTokenSymbol: "USDC";
|
|
2821
|
-
/** Balance floor, in 6-decimal USD units. */
|
|
2822
|
-
minimumRaw: string;
|
|
2823
|
-
/** Minimum delivered amount per refill, in 6-decimal USD units. */
|
|
2824
|
-
refillAmountRaw: string;
|
|
2825
|
-
dailyCapRaw: string;
|
|
2826
|
-
maxFeeRaw: string;
|
|
2827
|
-
status: BalanceRefillPolicyStatus;
|
|
2828
|
-
cooldownSeconds: number;
|
|
2829
|
-
lastObservedRaw: string | null;
|
|
2830
|
-
lastEvaluatedAt: string | null;
|
|
2831
|
-
nextEligibleAt: string | null;
|
|
2832
|
-
consentedAt: string;
|
|
2833
|
-
createdAt: string;
|
|
2834
|
-
updatedAt: string;
|
|
2835
|
-
latestAttempt: BalanceRefillAttempt | null;
|
|
2836
|
-
}
|
|
2837
|
-
interface CreateBalanceRefillPolicyParams {
|
|
2838
|
-
targetChainId: number;
|
|
2839
|
-
targetTokenSymbol?: "USDC";
|
|
2840
|
-
minimumRaw: string;
|
|
2841
|
-
refillAmountRaw: string;
|
|
2842
|
-
/** Optional daily refill limit. Defaults to $1,002 in 6-decimal USD units. */
|
|
2843
|
-
dailyCapRaw?: string;
|
|
2844
|
-
/** Optional per-refill fee limit. Defaults to $2 in 6-decimal USD units. */
|
|
2845
|
-
maxFeeRaw?: string;
|
|
2846
|
-
}
|
|
2847
|
-
interface UpdateBalanceRefillPolicyParams {
|
|
2848
|
-
minimumRaw?: string;
|
|
2849
|
-
refillAmountRaw?: string;
|
|
2850
|
-
dailyCapRaw?: string;
|
|
2851
|
-
maxFeeRaw?: string;
|
|
2852
|
-
status?: BalanceRefillPolicyStatus;
|
|
2853
|
-
}
|
|
2854
|
-
type WithdrawTokenSymbol = "USDC" | "USDC.e" | "USDT";
|
|
2855
|
-
type WithdrawalSourceTokenSymbol = WithdrawTokenSymbol | "pUSD" | "USD1";
|
|
2856
|
-
interface WithdrawManagedParams {
|
|
2857
|
-
/** Idempotency key for exact-amount transfers. Retry the same request, never a new key, after a lost response. Not combined with max. */
|
|
2858
|
-
requestId?: string;
|
|
2859
|
-
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
2860
|
-
amountRaw: string;
|
|
2861
|
-
tokenSymbol: WithdrawTokenSymbol;
|
|
2862
|
-
/** Recipient address. EVM destinations use 0x-prefixed 20-byte hex; Solana uses base58. */
|
|
2863
|
-
destinationAddress: string;
|
|
2864
|
-
/** Chain ID where the recipient should receive funds. Required as of v2026.04. */
|
|
2865
|
-
destinationChainId: number;
|
|
2866
|
-
/**
|
|
2867
|
-
* When `true`, the server caps the withdrawal to the maximum deliverable amount
|
|
2868
|
-
* instead of rejecting an over-balance request. Use only when the user explicitly
|
|
2869
|
-
* clicked Max — manual over-typed amounts must still surface the unviable state.
|
|
2870
|
-
*/
|
|
2871
|
-
max?: boolean;
|
|
2872
|
-
}
|
|
2873
|
-
type WithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
2874
|
-
type WithdrawalSourceStatus = "pending" | "submitted" | "confirmed" | "failed";
|
|
2875
|
-
type WithdrawalLegType = "transfer" | "bridge";
|
|
2876
|
-
type WithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
2877
|
-
interface WithdrawalLeg {
|
|
2878
|
-
type: WithdrawalLegType;
|
|
2879
|
-
status: WithdrawalLegStatus;
|
|
2880
|
-
sourceChainId: number;
|
|
2881
|
-
destChainId: number;
|
|
2882
|
-
amountRaw: string;
|
|
2883
|
-
txHash: string | null;
|
|
2884
|
-
bridgeOperationId: string | null;
|
|
2885
|
-
/** Human-readable failure reason when `status === "failed"`. Null when succeeded or in-flight. */
|
|
2886
|
-
errorMessage?: string | null;
|
|
2887
|
-
}
|
|
2888
|
-
interface WithdrawManagedSourceItem {
|
|
2889
|
-
sourceId: string;
|
|
2890
|
-
chainId: number;
|
|
2891
|
-
tokenSymbol: WithdrawalSourceTokenSymbol;
|
|
2892
|
-
/** On-chain token address on `chainId`. */
|
|
2893
|
-
tokenAddress: string;
|
|
2894
|
-
/**
|
|
2895
|
-
* On-chain decimals for `(chainId, tokenAddress)`. Required to interpret
|
|
2896
|
-
* `amountRaw`: BNB USDC is 18-dec, EVM USDC is 6-dec.
|
|
2897
|
-
*/
|
|
2898
|
-
decimals: number;
|
|
2899
|
-
amountRaw: string;
|
|
2900
|
-
/** Smart-wallet or native-account custody; absent for ordinary EOA sources. */
|
|
2901
|
-
custodyKind?: "DEPOSIT_WALLET" | "VENUE_ACCOUNT";
|
|
2902
|
-
/** Venue that owns the source (for example, `pred` or `tiprun`). */
|
|
2903
|
-
venue?: string;
|
|
2904
|
-
sourceVenueAccountId?: string;
|
|
2905
|
-
/** Lossless native account ID, not an EVM address. */
|
|
2906
|
-
sourceExternalAccountId?: string;
|
|
2907
|
-
status: WithdrawalSourceStatus;
|
|
2908
|
-
txHash: string | null;
|
|
2909
|
-
bridgeOperationId: string | null;
|
|
2910
|
-
}
|
|
2911
|
-
/**
|
|
2912
|
-
* `pricingStatus === "quoted"` means the response includes a fresh preflight
|
|
2913
|
-
* quote; other states may carry null `expected.*` fields. Do NOT treat null
|
|
2914
|
-
* fields as missing.
|
|
2915
|
-
*/
|
|
2916
|
-
interface WithdrawalExpected {
|
|
2917
|
-
outputRaw: string | null;
|
|
2918
|
-
feeRaw: string | null;
|
|
2919
|
-
etaSeconds: number | null;
|
|
2920
|
-
}
|
|
2921
|
-
/** Body for POST /execution/withdraw/preview — identical to a withdraw request. */
|
|
2922
|
-
type WithdrawPreviewParams = WithdrawManagedParams;
|
|
2923
|
-
interface WithdrawalQuoteParams {
|
|
2924
|
-
tokenSymbol: WithdrawTokenSymbol;
|
|
2925
|
-
destinationChainId: number;
|
|
2926
|
-
}
|
|
2927
|
-
interface WithdrawalQuoteResponse {
|
|
2928
|
-
tokenSymbol: WithdrawTokenSymbol;
|
|
2929
|
-
destinationChainId: number;
|
|
2930
|
-
maxDeliverableRaw: string;
|
|
2931
|
-
rawBalanceRaw: string;
|
|
2932
|
-
decimals: number;
|
|
2933
|
-
}
|
|
2934
|
-
/** Response from POST /execution/withdraw/preview. All amounts are raw strings in destination-token native decimals. */
|
|
2935
|
-
interface WithdrawPreviewResponse {
|
|
2936
|
-
receiveAmountRaw: string | null;
|
|
2937
|
-
feeRaw: string | null;
|
|
2938
|
-
relayFeeRaw: string | null;
|
|
2939
|
-
networkFeeRaw: string | null;
|
|
2940
|
-
pricingStatus: "quoted" | "unviable";
|
|
2941
|
-
quoteExpiresAt: string | null;
|
|
2942
|
-
unviableReason: string | null;
|
|
2943
|
-
maxDeliverableRaw: string | null;
|
|
2944
|
-
}
|
|
2945
|
-
interface WithdrawManagedResponse {
|
|
2946
|
-
withdrawalId: string;
|
|
2947
|
-
status: WithdrawalLifecycleStatus;
|
|
2948
|
-
requested: {
|
|
2949
|
-
tokenSymbol: WithdrawTokenSymbol;
|
|
2950
|
-
amountRaw: string;
|
|
2951
|
-
};
|
|
2952
|
-
/**
|
|
2953
|
-
* Terminal settled amount in destination-token native decimals.
|
|
2954
|
-
* Null until at least one source confirms.
|
|
2955
|
-
*/
|
|
2956
|
-
completedAmountRaw: string | null;
|
|
2957
|
-
destination: {
|
|
2958
|
-
chainId: number;
|
|
2959
|
-
address: string;
|
|
2960
|
-
tokenSymbol: WithdrawTokenSymbol;
|
|
2961
|
-
};
|
|
2962
|
-
legs: WithdrawalLeg[];
|
|
2963
|
-
expected: WithdrawalExpected;
|
|
2964
|
-
pricingStatus: "unquoted" | "quoting" | "quoted" | "unviable";
|
|
2965
|
-
/**
|
|
2966
|
-
* Persisted terminal-state error reason. Always `null` until the
|
|
2967
|
-
* withdrawal reaches `failed` / `partial`. The submit response always
|
|
2968
|
-
* returns `null`; populated values arrive via the GET status endpoint or
|
|
2969
|
-
* via a terminal `withdrawal_lifecycle` WS event.
|
|
2970
|
-
*/
|
|
2971
|
-
errorMessage: string | null;
|
|
2972
|
-
sources: WithdrawManagedSourceItem[];
|
|
2973
|
-
}
|
|
2974
|
-
interface DepositAddressesToken {
|
|
2975
|
-
symbol: string;
|
|
2976
|
-
address: string;
|
|
2977
|
-
decimals: number;
|
|
2978
|
-
}
|
|
2979
|
-
interface DepositAddressesSupportedChain {
|
|
2980
|
-
chainId: number;
|
|
2981
|
-
name: string;
|
|
2982
|
-
tokens: DepositAddressesToken[];
|
|
2983
|
-
}
|
|
2984
|
-
interface DepositAddressesReadyResponse {
|
|
2985
|
-
ready: true;
|
|
2986
|
-
evmAddress: string;
|
|
2987
|
-
svmAddress: string;
|
|
2988
|
-
supportedChains: DepositAddressesSupportedChain[];
|
|
2989
|
-
}
|
|
2990
|
-
interface DepositAddressesPendingResponse {
|
|
2991
|
-
ready: false;
|
|
2992
|
-
}
|
|
2993
|
-
type DepositAddressesResponse = DepositAddressesReadyResponse | DepositAddressesPendingResponse;
|
|
2994
|
-
interface GetPositionsParams {
|
|
2995
|
-
cursor?: string;
|
|
2996
|
-
limit?: number;
|
|
2997
|
-
status?: "active" | "closed";
|
|
2998
|
-
mode?: ExecutionMode;
|
|
2999
|
-
}
|
|
3000
|
-
interface GetOrdersParams {
|
|
3001
|
-
status?: string;
|
|
3002
|
-
cursor?: string;
|
|
3003
|
-
limit?: number;
|
|
3004
|
-
}
|
|
3005
|
-
interface OrderbookQuoteParams {
|
|
3006
|
-
marketId: string;
|
|
3007
|
-
side: "buy" | "sell";
|
|
3008
|
-
size: number;
|
|
3009
|
-
}
|
|
3010
|
-
interface OrderbookQuoteFill {
|
|
3011
|
-
venue: string;
|
|
3012
|
-
size: number;
|
|
3013
|
-
avgPrice: number;
|
|
3014
|
-
cost: number;
|
|
3015
|
-
}
|
|
3016
|
-
interface OrderbookQuoteResponse {
|
|
3017
|
-
marketId: string;
|
|
3018
|
-
side: "buy" | "sell";
|
|
3019
|
-
requestedSize: number;
|
|
3020
|
-
filledSize: number;
|
|
3021
|
-
avgPrice: number | null;
|
|
3022
|
-
totalCost: number;
|
|
3023
|
-
slippage: number | null;
|
|
3024
|
-
fills: OrderbookQuoteFill[];
|
|
3025
|
-
}
|
|
3026
|
-
type ExecutionOrdersQuery = GetOrdersQuery & {
|
|
3027
|
-
mode?: ExecutionMode;
|
|
3028
|
-
};
|
|
3029
|
-
type ExecutionOrderItem = OrderListItem;
|
|
3030
|
-
type ExecutionStatusQuery = {
|
|
3031
|
-
quoteId: string;
|
|
3032
|
-
mode?: ExecutionMode;
|
|
3033
|
-
};
|
|
3034
|
-
type ExecutionOverallState = "created" | "routing" | "quoting" | "placing" | "confirming" | "filled" | "partially_filled" | "failed" | "cancelled" | "expired";
|
|
3035
|
-
interface ExecutionDagProgress {
|
|
3036
|
-
dagRunId: string;
|
|
3037
|
-
totalSteps: number;
|
|
3038
|
-
currentSequence: number;
|
|
3039
|
-
currentStepType: string | null;
|
|
3040
|
-
completedSequences: number[];
|
|
3041
|
-
stepTypes: Record<number, string>;
|
|
3042
|
-
status: "running" | "completed" | "failed";
|
|
3043
|
-
errorReason: string | null;
|
|
3044
|
-
}
|
|
3045
|
-
type ExecutionDisplayStepKind = "submit" | "setup" | "bridge" | "fill" | "internal";
|
|
3046
|
-
type ExecutionDisplayGroupStatus = "pending" | "in_progress" | "completed" | "failed" | "skipped";
|
|
3047
|
-
interface ExecutionStatusStep {
|
|
3048
|
-
sequence: number;
|
|
3049
|
-
stepType: string;
|
|
3050
|
-
status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
|
|
3051
|
-
attempt: number;
|
|
3052
|
-
startedAt: string | null;
|
|
3053
|
-
completedAt: string | null;
|
|
3054
|
-
errorReason: string | null;
|
|
3055
|
-
/** Venue legs this step funds or executes; join to `orders[].orderId`. */
|
|
3056
|
-
orderIds: string[];
|
|
3057
|
-
/** Display class. `internal` steps are not meant to be rendered. */
|
|
3058
|
-
kind: ExecutionDisplayStepKind;
|
|
3059
|
-
/** Steps sharing a groupId render as ONE row. */
|
|
3060
|
-
groupId: string;
|
|
3061
|
-
/** Rolled-up status for the group; identical on every member. */
|
|
3062
|
-
groupStatus: ExecutionDisplayGroupStatus;
|
|
3063
|
-
/** Row copy, phrased for the current `groupStatus`. */
|
|
3064
|
-
label: string;
|
|
3065
|
-
/** Set on `kind: "bridge"` only. */
|
|
3066
|
-
bridge?: {
|
|
3067
|
-
amount: string;
|
|
3068
|
-
tokenSymbol: string;
|
|
3069
|
-
fromChain: string;
|
|
3070
|
-
toChain: string;
|
|
3071
|
-
};
|
|
3072
|
-
}
|
|
3073
|
-
interface ExecutionStatusOrder {
|
|
3074
|
-
orderId: string;
|
|
3075
|
-
venue: string;
|
|
3076
|
-
status: string;
|
|
3077
|
-
event: "filled" | "partial_fill" | "failed" | null;
|
|
3078
|
-
filledAmountRaw?: string;
|
|
3079
|
-
remainingAmountRaw?: string;
|
|
3080
|
-
quotedSharesRaw?: string;
|
|
3081
|
-
actualSharesRaw?: string;
|
|
3082
|
-
quotedToWinRaw?: string;
|
|
3083
|
-
actualToWinRaw?: string;
|
|
3084
|
-
quotedPriceRaw?: string;
|
|
3085
|
-
executionPriceRaw?: string;
|
|
3086
|
-
partialFillReason?: string;
|
|
3087
|
-
errorReason?: string;
|
|
3088
|
-
venueOrderId?: string;
|
|
3089
|
-
txHash?: string;
|
|
3090
|
-
updatedAt: string;
|
|
3091
|
-
}
|
|
3092
|
-
interface ExecutionStatusResponse {
|
|
3093
|
-
executionId: string | null;
|
|
3094
|
-
quoteId: string;
|
|
3095
|
-
orderIds: string[];
|
|
3096
|
-
overallState: ExecutionOverallState;
|
|
3097
|
-
terminal: boolean;
|
|
3098
|
-
errorReason: string | null;
|
|
3099
|
-
pollAfterMs: number | null;
|
|
3100
|
-
dagProgress: ExecutionDagProgress | null;
|
|
3101
|
-
steps: ExecutionStatusStep[];
|
|
3102
|
-
orders: ExecutionStatusOrder[];
|
|
3103
|
-
/**
|
|
3104
|
-
* What this run is waiting to be signed, mirroring the fill response's
|
|
3105
|
-
* field of the same name. This is the polling route `fillSelfCustody` reads
|
|
3106
|
-
* while an on-chain step is in flight — a caller polling this route for
|
|
3107
|
-
* progress learns about newly-parked steps here too, not just from the
|
|
3108
|
-
* signatures endpoint.
|
|
3109
|
-
*/
|
|
3110
|
-
pendingSignatures?: SignatureRequest[];
|
|
3111
|
-
}
|
|
3112
|
-
type ExecutionPositionsQuery = GetPositionsQuery & {
|
|
3113
|
-
mode?: ExecutionMode;
|
|
3114
|
-
};
|
|
3115
|
-
type ExecutionPositionGroup = PositionGroup;
|
|
3116
|
-
/** Whose cash to return: the managed server wallet (default) or the account's linked wallets. */
|
|
3117
|
-
type BalanceCustody = "managed" | "self";
|
|
3118
|
-
type ManagedBalancesParams = {
|
|
3119
|
-
mode?: ExecutionMode;
|
|
3120
|
-
custody?: BalanceCustody;
|
|
3121
|
-
};
|
|
3122
|
-
interface PaperTradingAppOptions {
|
|
3123
|
-
/** App ID for the paper account namespace. Defaults to AggClient appId. */
|
|
3124
|
-
appId?: string;
|
|
3125
|
-
}
|
|
3126
|
-
interface PaperTradingListParams {
|
|
3127
|
-
limit?: number;
|
|
3128
|
-
cursor?: string;
|
|
3129
|
-
}
|
|
3130
|
-
interface PaperTradingAccountListParams extends PaperTradingListParams {
|
|
3131
|
-
externalId?: string;
|
|
3132
|
-
}
|
|
3133
|
-
interface CreatePaperTradingAccountParams {
|
|
3134
|
-
name?: string;
|
|
3135
|
-
externalId?: string;
|
|
3136
|
-
initialBalanceRaw?: string;
|
|
3137
|
-
initialBalance?: number;
|
|
3138
|
-
}
|
|
3139
|
-
interface SetPaperTradingBalanceParams {
|
|
3140
|
-
balanceRaw?: string;
|
|
3141
|
-
balance?: number;
|
|
3142
|
-
reason?: string;
|
|
3143
|
-
}
|
|
3144
|
-
interface ResetPaperTradingAccountParams {
|
|
3145
|
-
balanceRaw?: string;
|
|
3146
|
-
balance?: number;
|
|
3147
|
-
reason?: string;
|
|
3148
|
-
}
|
|
3149
|
-
interface PlacePaperTradingOrderParams {
|
|
3150
|
-
venueMarketOutcomeId: string;
|
|
3151
|
-
side: "buy" | "sell";
|
|
3152
|
-
spendRaw?: string;
|
|
3153
|
-
spend?: number;
|
|
3154
|
-
shares?: number;
|
|
3155
|
-
slippageBps?: number;
|
|
3156
|
-
clientOrderId?: string;
|
|
3157
|
-
}
|
|
3158
|
-
type PaperTradingMarkSource = "orderbook_midpoint" | "orderbook_best_bid" | "catalog_price";
|
|
3159
|
-
type PaperTradingLiquidityStatus = "full" | "partial" | "none";
|
|
3160
|
-
interface PaperTradingAccount {
|
|
3161
|
-
id: string;
|
|
3162
|
-
appId: string;
|
|
3163
|
-
name: string | null;
|
|
3164
|
-
externalId: string | null;
|
|
3165
|
-
currency: string;
|
|
3166
|
-
startingBalanceRaw: string;
|
|
3167
|
-
startingBalance: number;
|
|
3168
|
-
cashBalanceRaw: string;
|
|
3169
|
-
cashBalance: number;
|
|
3170
|
-
realizedPnlRaw: string;
|
|
3171
|
-
realizedPnl: number;
|
|
3172
|
-
kycStatus: "verified";
|
|
3173
|
-
kycVerified: true;
|
|
3174
|
-
status: "active" | "archived";
|
|
3175
|
-
createdAt: string;
|
|
3176
|
-
updatedAt: string;
|
|
3177
|
-
}
|
|
3178
|
-
interface PaperTradingPosition {
|
|
3179
|
-
id: string;
|
|
3180
|
-
accountId: string;
|
|
3181
|
-
venue: string;
|
|
3182
|
-
venueMarketId: string;
|
|
3183
|
-
venueMarketOutcomeId: string;
|
|
3184
|
-
marketQuestion: string;
|
|
3185
|
-
outcomeLabel: string;
|
|
3186
|
-
size: number;
|
|
3187
|
-
avgEntryPrice: number;
|
|
3188
|
-
markPrice: number;
|
|
3189
|
-
markSource: PaperTradingMarkSource;
|
|
3190
|
-
markTimestamp: number | null;
|
|
3191
|
-
bestBidPrice: number | null;
|
|
3192
|
-
bestAskPrice: number | null;
|
|
3193
|
-
midpoint: number | null;
|
|
3194
|
-
spread: number | null;
|
|
3195
|
-
marketValueRaw: string;
|
|
3196
|
-
marketValue: number;
|
|
3197
|
-
unrealizedPnlRaw: string;
|
|
3198
|
-
unrealizedPnl: number;
|
|
3199
|
-
liquidationPrice: number | null;
|
|
3200
|
-
liquidationValueRaw: string;
|
|
3201
|
-
liquidationValue: number;
|
|
3202
|
-
liquidationPnlRaw: string;
|
|
3203
|
-
liquidationPnl: number;
|
|
3204
|
-
liquidityShares: number;
|
|
3205
|
-
liquidityStatus: PaperTradingLiquidityStatus;
|
|
3206
|
-
realizedPnlRaw: string;
|
|
3207
|
-
realizedPnl: number;
|
|
3208
|
-
createdAt: string;
|
|
3209
|
-
updatedAt: string;
|
|
3210
|
-
}
|
|
3211
|
-
interface PaperTradingOrder {
|
|
3212
|
-
id: string;
|
|
3213
|
-
accountId: string;
|
|
3214
|
-
venue: string;
|
|
3215
|
-
venueMarketId: string;
|
|
3216
|
-
venueMarketOutcomeId: string;
|
|
3217
|
-
marketQuestion: string;
|
|
3218
|
-
outcomeLabel: string;
|
|
3219
|
-
side: "buy" | "sell";
|
|
3220
|
-
status: "filled" | "rejected";
|
|
3221
|
-
clientOrderId: string | null;
|
|
3222
|
-
requestedSpendRaw: string | null;
|
|
3223
|
-
requestedSpend: number | null;
|
|
3224
|
-
requestedShares: number | null;
|
|
3225
|
-
filledShares: number;
|
|
3226
|
-
avgPrice: number | null;
|
|
3227
|
-
slippageBps: number | null;
|
|
3228
|
-
notionalRaw: string;
|
|
3229
|
-
notional: number;
|
|
3230
|
-
cashDeltaRaw: string;
|
|
3231
|
-
cashDelta: number;
|
|
3232
|
-
realizedPnlRaw: string;
|
|
3233
|
-
realizedPnl: number;
|
|
3234
|
-
rejectionReason: string | null;
|
|
3235
|
-
createdAt: string;
|
|
3236
|
-
}
|
|
3237
|
-
interface PaperTradingBalanceAdjustment {
|
|
3238
|
-
id: string;
|
|
3239
|
-
accountId: string;
|
|
3240
|
-
type: "set_balance" | "reset";
|
|
3241
|
-
amountRaw: string;
|
|
3242
|
-
amount: number;
|
|
3243
|
-
previousCashBalanceRaw: string;
|
|
3244
|
-
previousCashBalance: number;
|
|
3245
|
-
newCashBalanceRaw: string;
|
|
3246
|
-
newCashBalance: number;
|
|
3247
|
-
reason: string | null;
|
|
3248
|
-
createdAt: string;
|
|
3249
|
-
}
|
|
3250
|
-
interface PaperTradingPortfolio {
|
|
3251
|
-
account: PaperTradingAccount;
|
|
3252
|
-
cashBalanceRaw: string;
|
|
3253
|
-
cashBalance: number;
|
|
3254
|
-
marketValueRaw: string;
|
|
3255
|
-
marketValue: number;
|
|
3256
|
-
equityRaw: string;
|
|
3257
|
-
equity: number;
|
|
3258
|
-
realizedPnlRaw: string;
|
|
3259
|
-
realizedPnl: number;
|
|
3260
|
-
unrealizedPnlRaw: string;
|
|
3261
|
-
unrealizedPnl: number;
|
|
3262
|
-
liquidationValueRaw: string;
|
|
3263
|
-
liquidationValue: number;
|
|
3264
|
-
liquidationEquityRaw: string;
|
|
3265
|
-
liquidationEquity: number;
|
|
3266
|
-
liquidationPnlRaw: string;
|
|
3267
|
-
liquidationPnl: number;
|
|
3268
|
-
positions: PaperTradingPosition[];
|
|
3269
|
-
}
|
|
3270
|
-
interface PaperTradingAccountsPage {
|
|
3271
|
-
data: PaperTradingAccount[];
|
|
3272
|
-
nextCursor: string | null;
|
|
3273
|
-
hasMore: boolean;
|
|
3274
|
-
}
|
|
3275
|
-
interface PaperTradingPositionsPage {
|
|
3276
|
-
data: PaperTradingPosition[];
|
|
3277
|
-
nextCursor: string | null;
|
|
3278
|
-
hasMore: boolean;
|
|
3279
|
-
}
|
|
3280
|
-
interface PaperTradingOrdersPage {
|
|
3281
|
-
data: PaperTradingOrder[];
|
|
3282
|
-
nextCursor: string | null;
|
|
3283
|
-
hasMore: boolean;
|
|
3284
|
-
}
|
|
3285
|
-
interface PaperTradingBalanceResponse {
|
|
3286
|
-
account: PaperTradingAccount;
|
|
3287
|
-
adjustment: PaperTradingBalanceAdjustment;
|
|
3288
|
-
}
|
|
3289
|
-
type UserActivityType = "trade" | "withdrawal" | "bridge" | "deposit" | "user_op" | "redeem";
|
|
3290
|
-
interface UserActivityBase {
|
|
3291
|
-
id: string;
|
|
3292
|
-
createdAt: string;
|
|
3293
|
-
updatedAt: string;
|
|
3294
|
-
status: string;
|
|
3295
|
-
}
|
|
3296
|
-
interface UserActivityVenueMarket {
|
|
3297
|
-
id: string;
|
|
3298
|
-
venueEventId: string;
|
|
3299
|
-
question: string | null;
|
|
3300
|
-
image: string | null;
|
|
3301
|
-
}
|
|
3302
|
-
interface UserActivityVenueMarketOutcome {
|
|
3303
|
-
id: string;
|
|
3304
|
-
label: string;
|
|
3305
|
-
title: string | null;
|
|
3306
|
-
price: number;
|
|
3307
|
-
}
|
|
3308
|
-
interface UserActivityTrade extends UserActivityBase {
|
|
3309
|
-
type: "trade";
|
|
3310
|
-
venue: string;
|
|
3311
|
-
side: string;
|
|
3312
|
-
amountRaw: string;
|
|
3313
|
-
filledAmountRaw: string | null;
|
|
3314
|
-
executionPrice: string | null;
|
|
3315
|
-
venueMarket: UserActivityVenueMarket | null;
|
|
3316
|
-
venueMarketOutcome: UserActivityVenueMarketOutcome | null;
|
|
3317
|
-
txHash: string | null;
|
|
3318
|
-
errorMessage: string | null;
|
|
3319
|
-
/** @deprecated Use venueMarket.question. */
|
|
3320
|
-
marketQuestion?: string | null;
|
|
3321
|
-
/** @deprecated Use venueMarketOutcome.label/title. */
|
|
3322
|
-
outcomeLabel?: string | null;
|
|
3323
|
-
}
|
|
3324
|
-
interface UserActivityWithdrawal extends UserActivityBase {
|
|
3325
|
-
type: "withdrawal";
|
|
3326
|
-
tokenSymbol: string;
|
|
3327
|
-
amountRaw: string;
|
|
3328
|
-
destinationAddress: string;
|
|
3329
|
-
destinationChainId: string;
|
|
3330
|
-
completedAmountRaw: string | null;
|
|
3331
|
-
chainId?: string | null;
|
|
3332
|
-
txHash?: string | null;
|
|
3333
|
-
errorMessage: string | null;
|
|
3334
|
-
}
|
|
3335
|
-
interface UserActivityBridge extends UserActivityBase {
|
|
3336
|
-
type: "bridge";
|
|
3337
|
-
tokenSymbol: string;
|
|
3338
|
-
amountRaw: string;
|
|
3339
|
-
sourceChainId: string;
|
|
3340
|
-
destChainId: string;
|
|
3341
|
-
sourceTxHash: string | null;
|
|
3342
|
-
destTxHash: string | null;
|
|
3343
|
-
}
|
|
3344
|
-
interface UserActivityDeposit extends UserActivityBase {
|
|
3345
|
-
type: "deposit";
|
|
3346
|
-
tokenSymbol: string;
|
|
3347
|
-
amountRaw: string;
|
|
3348
|
-
chainId: string;
|
|
3349
|
-
fromAddress: string;
|
|
3350
|
-
txHash: string;
|
|
3351
|
-
source: "connected_wallet" | "external_wallet";
|
|
3352
|
-
}
|
|
3353
|
-
interface UserActivityUserOp extends UserActivityBase {
|
|
3354
|
-
type: "user_op";
|
|
3355
|
-
callsId: string;
|
|
3356
|
-
chainId: string;
|
|
3357
|
-
walletAddress: string;
|
|
3358
|
-
txHash: string | null;
|
|
3359
|
-
confirmedAt: string | null;
|
|
3360
|
-
}
|
|
3361
|
-
interface UserActivityRedeemLeg {
|
|
3362
|
-
id: string;
|
|
3363
|
-
venueMarketOutcomeId: string;
|
|
3364
|
-
venue: string;
|
|
3365
|
-
status: string;
|
|
3366
|
-
chainId: string;
|
|
3367
|
-
payoutTokenSymbol: string;
|
|
3368
|
-
payoutAmountRaw: string | null;
|
|
3369
|
-
txHash: string | null;
|
|
3370
|
-
errorMessage: string | null;
|
|
3371
|
-
venueMarket: UserActivityVenueMarket | null;
|
|
3372
|
-
venueMarketOutcome: Omit<UserActivityVenueMarketOutcome, "price"> | null;
|
|
3373
|
-
}
|
|
3374
|
-
interface UserActivityRedeem extends UserActivityBase {
|
|
3375
|
-
type: "redeem";
|
|
3376
|
-
totalPayoutRaw: string | null;
|
|
3377
|
-
legs: UserActivityRedeemLeg[];
|
|
3378
|
-
}
|
|
3379
|
-
type UserActivityItem = UserActivityTrade | UserActivityWithdrawal | UserActivityBridge | UserActivityDeposit | UserActivityUserOp | UserActivityRedeem;
|
|
3380
|
-
interface UserActivityQuery {
|
|
3381
|
-
type?: UserActivityType;
|
|
3382
|
-
cursor?: string;
|
|
3383
|
-
limit?: number;
|
|
3384
|
-
}
|
|
3385
|
-
/** Column a leaderboard is ranked by. */
|
|
3386
|
-
type LeaderboardMetric = "realizedPnl" | "volume";
|
|
3387
|
-
interface LeaderboardQuery {
|
|
3388
|
-
/** Inclusive UTC calendar day, `YYYY-MM-DD`. Omit both for all time. */
|
|
3389
|
-
from?: string;
|
|
3390
|
-
/** Inclusive UTC calendar day, `YYYY-MM-DD`. */
|
|
3391
|
-
to?: string;
|
|
3392
|
-
/** Default `realizedPnl`. */
|
|
3393
|
-
metric?: LeaderboardMetric;
|
|
3394
|
-
/** 1..100, default 50. */
|
|
3395
|
-
limit?: number;
|
|
3396
|
-
cursor?: string;
|
|
3397
|
-
}
|
|
3398
|
-
interface LeaderboardRow {
|
|
3399
|
-
/** Exact within the top 100, `null` beyond. */
|
|
3400
|
-
rank: number | null;
|
|
3401
|
-
userId: string;
|
|
3402
|
-
/** Null unless the app's `leaderboardIdentity` is `profile`. */
|
|
3403
|
-
username: string | null;
|
|
3404
|
-
/** Null unless the app's `leaderboardIdentity` is `profile`. */
|
|
3405
|
-
avatarUrl: string | null;
|
|
3406
|
-
/** Null under `anonymous`; primary wallet under `wallet` or `profile`. */
|
|
3407
|
-
walletAddress: string | null;
|
|
3408
|
-
/** Filled orders in the range. */
|
|
3409
|
-
orders: number;
|
|
3410
|
-
/** USD notional of every filled order in the range, buys and sells. */
|
|
3411
|
-
volume: number;
|
|
3412
|
-
/** USD notional of filled buy orders only — what the trader put in. */
|
|
3413
|
-
spent: number;
|
|
3414
|
-
/** Gross realized P&L in USD (sells + settlements, before fees). */
|
|
3415
|
-
realizedPnl: number;
|
|
3416
|
-
}
|
|
3417
|
-
/** Exactly one of `userId`, `externalId`, `username`, `walletAddress` is required. */
|
|
3418
|
-
interface LeaderboardSeriesQuery {
|
|
3419
|
-
/** Inclusive UTC calendar day, `YYYY-MM-DD`. Default: 29 days before `to`. */
|
|
3420
|
-
from?: string;
|
|
3421
|
-
/** Inclusive UTC calendar day, `YYYY-MM-DD`. Default and maximum: today. */
|
|
3422
|
-
to?: string;
|
|
3423
|
-
userId?: string;
|
|
3424
|
-
externalId?: string;
|
|
3425
|
-
/** Only when the app's `leaderboardIdentity` is `profile`. */
|
|
3426
|
-
username?: string;
|
|
3427
|
-
/** Not when the app's `leaderboardIdentity` is `anonymous`. */
|
|
3428
|
-
walletAddress?: string;
|
|
3429
|
-
}
|
|
3430
|
-
interface LeaderboardSeriesPoint {
|
|
3431
|
-
/** UTC calendar day, `YYYY-MM-DD`. */
|
|
3432
|
-
day: string;
|
|
3433
|
-
/** Filled orders on this day. */
|
|
3434
|
-
orders: number;
|
|
3435
|
-
/** USD notional of every filled order on this day, buys and sells. */
|
|
3436
|
-
volume: number;
|
|
3437
|
-
/** USD notional of filled buy orders only. */
|
|
3438
|
-
spent: number;
|
|
3439
|
-
/** Gross realized P&L in USD booked this day (sells + settlements, before fees). */
|
|
3440
|
-
realizedPnl: number;
|
|
3441
|
-
/** Running total of `realizedPnl` from `from` through this day. */
|
|
3442
|
-
cumulativeRealizedPnl: number;
|
|
3443
|
-
}
|
|
3444
|
-
interface LeaderboardSeries {
|
|
3445
|
-
userId: string;
|
|
3446
|
-
from: string;
|
|
3447
|
-
to: string;
|
|
3448
|
-
/** One point per day in `[from, to]`, oldest first; days without activity are 0. */
|
|
3449
|
-
points: LeaderboardSeriesPoint[];
|
|
3450
|
-
}
|
|
3451
|
-
interface RampQuoteRequest {
|
|
3452
|
-
sourceAmount: string;
|
|
3453
|
-
sourceCurrencyCode: string;
|
|
3454
|
-
destinationCurrencyCode: string;
|
|
3455
|
-
paymentMethodType?: string;
|
|
3456
|
-
}
|
|
3457
|
-
interface RampQuote {
|
|
3458
|
-
serviceProvider: string;
|
|
3459
|
-
transactionType: string;
|
|
3460
|
-
sourceAmount: number;
|
|
3461
|
-
sourceCurrencyCode: string;
|
|
3462
|
-
destinationAmount: number;
|
|
3463
|
-
destinationCurrencyCode: string;
|
|
3464
|
-
exchangeRate: number;
|
|
3465
|
-
totalFee: number;
|
|
3466
|
-
networkFee: number;
|
|
3467
|
-
transactionFee: number;
|
|
3468
|
-
partnerFee: number;
|
|
3469
|
-
fiatAmountWithoutFees: number;
|
|
3470
|
-
paymentMethodType: string;
|
|
3471
|
-
countryCode: string;
|
|
3472
|
-
rampScore: number;
|
|
3473
|
-
lowKyc: boolean;
|
|
3474
|
-
}
|
|
3475
|
-
interface RampSessionRequest {
|
|
3476
|
-
sourceAmount: string;
|
|
3477
|
-
sourceCurrencyCode: string;
|
|
3478
|
-
destinationCurrencyCode: string;
|
|
3479
|
-
serviceProvider: string;
|
|
3480
|
-
walletAddress: string;
|
|
3481
|
-
redirectUrl?: string;
|
|
3482
|
-
}
|
|
3483
|
-
interface RampWidgetSession {
|
|
3484
|
-
id: string;
|
|
3485
|
-
token: string;
|
|
3486
|
-
widgetUrl: string;
|
|
3487
|
-
serviceProviderWidgetUrl: string;
|
|
3488
|
-
}
|
|
3489
|
-
type SmartRouteStatus = "ok" | "infeasible" | "checker_rejected" | "solver_error" | "invalid_input" | "no_orderbooks" | "min_order_size_violated" | "insufficient_input_amount" | "engine_unavailable" | "insufficient_position" | "insufficient_depth" | "no_bids_above_min_price" | "insufficient_balance";
|
|
3490
|
-
/** A single fill at a price level within a venue. */
|
|
3491
|
-
interface SmartRouteFill {
|
|
3492
|
-
price: number;
|
|
3493
|
-
size: number;
|
|
3494
|
-
fill: number;
|
|
3495
|
-
}
|
|
3496
|
-
/** Per-venue routing result with fills and chain info. */
|
|
3497
|
-
interface SmartRouteVenueFill {
|
|
3498
|
-
/** CH executable price and normalized input, in micro-USDC. */
|
|
3499
|
-
limitPriceMicroUsdc?: string;
|
|
3500
|
-
inAmount?: string;
|
|
3501
|
-
outAmount?: string;
|
|
3502
|
-
venue: string;
|
|
3503
|
-
venueMarketId: string;
|
|
3504
|
-
venueMarketOutcomeId: string;
|
|
3505
|
-
chain: string;
|
|
3506
|
-
avgPrice: number;
|
|
3507
|
-
yesPrice: number;
|
|
3508
|
-
noPrice: number;
|
|
3509
|
-
fills: SmartRouteFill[];
|
|
3510
|
-
executionBackend?: "clearinghouse" | "direct";
|
|
3511
|
-
venueAccountId?: string;
|
|
3512
|
-
venueQty: number;
|
|
3513
|
-
/**
|
|
3514
|
-
* Builder fee for this fill in USD — the slice paid to a builder code
|
|
3515
|
-
* rather than to the venue. Excluded from `venueFee`. Optional so an
|
|
3516
|
-
* older engine build that does not emit it still validates.
|
|
3517
|
-
*/
|
|
3518
|
-
builderFee?: number;
|
|
3519
|
-
/**
|
|
3520
|
-
* What the venue takes from this leg's payout if the outcome wins (USD):
|
|
3521
|
-
* Hyperliquid HIP-4's close fee on the $1 settlement, 0 elsewhere. Not a
|
|
3522
|
-
* cost at fill; already netted out of `estimatedPayout`.
|
|
3523
|
-
*/
|
|
3524
|
-
settlementFee?: number;
|
|
3525
|
-
/** Inclusive fee/reserve funding budget. For fee display, use the route's
|
|
3526
|
-
* feeBreakdown.venueFees and executionReserve instead. */
|
|
3527
|
-
venueFee?: number;
|
|
3528
|
-
}
|
|
3529
|
-
interface SmartRouteAllocation {
|
|
3530
|
-
sourceChainId: string;
|
|
3531
|
-
venue: string;
|
|
3532
|
-
amount: number;
|
|
3533
|
-
sourceTokenAddress?: string;
|
|
3534
|
-
custodyKind?: "EOA" | "DEPOSIT_WALLET" | "POLYMARKET_LEGACY" | "VENUE_ACCOUNT";
|
|
3535
|
-
custodyAddress?: string;
|
|
3536
|
-
/** Native venue cash identifies an account, not an EVM custody address. */
|
|
3537
|
-
sourceVenueAccountId?: string;
|
|
3538
|
-
/** Lossless decimal native account ID; never convert this to a JS number. */
|
|
3539
|
-
sourceExternalAccountId?: string;
|
|
3540
|
-
/** On-chain funding wallet, when present; absent for native venue cash. */
|
|
3541
|
-
sourceAddress?: string;
|
|
3542
|
-
exactToken?: boolean;
|
|
3543
|
-
}
|
|
3544
|
-
interface SmartRouteBridgeStep {
|
|
3545
|
-
sourceChainId: string;
|
|
3546
|
-
destChainId: string;
|
|
3547
|
-
/** Source-side amount sent into the bridge, in USD: the allocations this lane funds plus `cost`. */
|
|
3548
|
-
amount: number;
|
|
3549
|
-
/**
|
|
3550
|
-
* Delivery margin, in USD, sent on top of the allocations so the destination
|
|
3551
|
-
* still receives them in full after the bridge takes its fee. A planning
|
|
3552
|
-
* reserve, not the expected fee: excluded from `feeBreakdown.bridgeFees` and
|
|
3553
|
-
* `totalCost`, and whatever the bridge does not charge arrives at the
|
|
3554
|
-
* destination as the user's balance. Read `feeBreakdown.bridgeFees` for the
|
|
3555
|
-
* expected bridge fee.
|
|
3556
|
-
*/
|
|
3557
|
-
cost: number;
|
|
3558
|
-
sourceTokenAddress?: string;
|
|
3559
|
-
destTokenAddress?: string;
|
|
3560
|
-
}
|
|
3561
|
-
interface VenueSoloQuote {
|
|
3562
|
-
quoteFailure?: {
|
|
3563
|
-
venue: string;
|
|
3564
|
-
code: string;
|
|
3565
|
-
retryAt?: string;
|
|
3566
|
-
};
|
|
3567
|
-
/**
|
|
3568
|
-
* Minted by the API per successful + executable solo; send this to
|
|
3569
|
-
* /execution/fill to execute single-venue. `null` when the solo is not
|
|
3570
|
-
* executable (status !== "ok", filledQty === 0, or venue not in
|
|
3571
|
-
* SUPPORTED_FILL_VENUES). FE filters on truthiness.
|
|
3572
|
-
*/
|
|
3573
|
-
quoteId: string | null;
|
|
3574
|
-
/** Why this venue cannot execute when quoteId is null (or execution is geo-gated). */
|
|
3575
|
-
unavailableReason?: string;
|
|
3576
|
-
venue: string;
|
|
3577
|
-
/**
|
|
3578
|
-
* The outcome this solo is bound to. `venue` alone is NOT unique — one venue
|
|
3579
|
-
* can list the same matched outcome more than once (e.g. two Hyperliquid
|
|
3580
|
-
* deployers listing the same game), producing two solo cards with the same
|
|
3581
|
-
* `venue`. Key on this alongside `venue` when identifying a card.
|
|
3582
|
-
*/
|
|
3583
|
-
venueMarketOutcomeId?: string;
|
|
3584
|
-
avgPrice: number | null;
|
|
3585
|
-
filledQty: number;
|
|
3586
|
-
rawExecCost: number;
|
|
3587
|
-
estimatedPayout: number;
|
|
3588
|
-
estimatedProfit: number;
|
|
3589
|
-
returnPct: number;
|
|
3590
|
-
/**
|
|
3591
|
-
* `feeBreakdown.totalCost` plus this solo's own user-paid app fee and
|
|
3592
|
-
* referral — same composition as the primary route's `totalCostIncFees`.
|
|
3593
|
-
* `estimatedProfit`/`returnPct` stay router values, unaffected. Absent
|
|
3594
|
-
* when the router sent no `feeBreakdown` for this solo.
|
|
3595
|
-
*/
|
|
3596
|
-
totalCostIncFees?: number;
|
|
3597
|
-
status: string;
|
|
3598
|
-
/** Per-price-level fills, identical shape to primary fills. Empty for non-ok statuses. */
|
|
3599
|
-
fills: SmartRouteVenueFill[];
|
|
3600
|
-
allocations?: SmartRouteAllocation[];
|
|
3601
|
-
bridgeSteps?: SmartRouteBridgeStep[];
|
|
3602
|
-
/**
|
|
3603
|
-
* One-time setup costs for this solo's chosen venue + market. Populated
|
|
3604
|
-
* only when the originating quote opted in via `deepEstimate=true`; absent
|
|
3605
|
-
* on cheap quotes and on non-executable / failed solos. Same shape as the
|
|
3606
|
-
* multi-route `feeBreakdown.setupCosts`. The solo's `estimatedProfit` and
|
|
3607
|
-
* `returnPct` are recomputed against `cost basis + setupCostsTotal` so
|
|
3608
|
-
* per-venue comparisons are setup-inclusive.
|
|
3609
|
-
*/
|
|
3610
|
-
setupCosts?: SmartRouteSetupCostLine[];
|
|
3611
|
-
/** Sum of this solo's `setupCosts` entries where `alreadyPaid=false`. */
|
|
3612
|
-
setupCostsTotal?: number;
|
|
3613
|
-
/**
|
|
3614
|
-
* Cost breakdown for executing THIS venue alone. Present when
|
|
3615
|
-
* `status === "ok"`; absent otherwise.
|
|
3616
|
-
*
|
|
3617
|
-
* Read this — not the top-level `feeBreakdown` — when rendering fees for a
|
|
3618
|
-
* single venue. A solo's bridge lanes and venue fee are its own, so a venue
|
|
3619
|
-
* needing no bridge reports `bridgeFees: 0` here even when the multi-route
|
|
3620
|
-
* plan bridged.
|
|
3621
|
-
*/
|
|
3622
|
-
feeBreakdown?: SmartRouteFeeBreakdown;
|
|
3623
|
-
}
|
|
3624
|
-
/** @deprecated Smart-route side overrides are kept only for source compatibility. */
|
|
3625
|
-
type SmartRouteSide = "yes" | "no";
|
|
3626
|
-
/** Trade direction for order routing. "buy" (default) reads asks, "sell" reads bids. */
|
|
3627
|
-
type TradeSide = "buy" | "sell";
|
|
3628
|
-
/** Trading mode for normal execution endpoints. Defaults to live. */
|
|
3629
|
-
type ExecutionMode = "live" | "paper";
|
|
3630
|
-
/** Request params for GET /orderbook/:venueMarketOutcomeId/route. */
|
|
3631
|
-
interface SmartRouteParams {
|
|
3632
|
-
venueMarketOutcomeId?: string;
|
|
3633
|
-
/** @deprecated Use venueMarketOutcomeId. */
|
|
3634
|
-
venueMarketId?: string;
|
|
3635
|
-
/** @deprecated Use venueMarketOutcomeId. */
|
|
3636
|
-
outcomeId?: string;
|
|
3637
|
-
/** @deprecated Side is ignored for routing and echoed back only for legacy consumers. */
|
|
3638
|
-
side?: SmartRouteSide;
|
|
3639
|
-
/** Trade direction: "buy" (default) or "sell". */
|
|
3640
|
-
tradeSide?: TradeSide;
|
|
3641
|
-
/** Trading mode. Defaults to live. */
|
|
3642
|
-
mode?: ExecutionMode;
|
|
3643
|
-
maxSpend?: number;
|
|
3644
|
-
/** Sell only: target number of contracts to sell. Required for sell unless maxSpend is given. */
|
|
3645
|
-
sellShares?: number;
|
|
3646
|
-
chainBalances?: Record<string, number>;
|
|
3647
|
-
slipCapBps?: number;
|
|
3648
|
-
compareVenues?: boolean;
|
|
3649
|
-
/** Restrict this quote to one or more executable venues. */
|
|
3650
|
-
allowedVenues?: Venue[];
|
|
3651
|
-
/**
|
|
3652
|
-
* Opt in to the deep cost-estimate surface. When `true`, the response
|
|
3653
|
-
* `feeBreakdown` includes `setupCosts` (one-time chain approvals + Kalshi
|
|
3654
|
-
* SPL token-account rents) with per-item `alreadyPaid` flags from the
|
|
3655
|
-
* user's prior trade history. Buy-only; ignored for sells.
|
|
3656
|
-
*
|
|
3657
|
-
* Deep quotes also pre-deduct the unpaid setup total from `maxSpend`
|
|
3658
|
-
* before routing, so `totalCostIncFees` (and the recomputed
|
|
3659
|
-
* `estimatedProfit` / `returnPct`) stay within the partner's stated
|
|
3660
|
-
* budget.
|
|
3661
|
-
*/
|
|
3662
|
-
deepEstimate?: boolean;
|
|
3663
|
-
/** Per-trade app fee in bips (0..10000), replacing the app's configured rate. Needs an app API key. Buy only. */
|
|
3664
|
-
appFeeBips?: number;
|
|
3665
|
-
/** Per-venue app fee in bips (each 0..10000), e.g. `{ polymarket: 20, hyperliquid: 10 }`. Wins over `appFeeBips` on the venues it names; `appFeeBips` still covers the rest. Needs an app API key. Buy only. */
|
|
3666
|
-
appFeeBipsByVenue?: Record<string, number>;
|
|
3667
|
-
/** Referral: EVM address that receives the referral fee. Needs an app API key. */
|
|
3668
|
-
referrer?: string;
|
|
3669
|
-
/** Referral fee in bips of routed notional (1..10000). Snag-free. */
|
|
3670
|
-
referrerFeeBips?: number;
|
|
3671
|
-
/** Per-venue referral fee in bips (each 0..10000; 0 = none on that venue). Wins over `referrerFeeBips` on the venues it names. Needs `referrer` and an app API key. Not for `skipQuote`. */
|
|
3672
|
-
referrerFeeBipsByVenue?: Record<string, number>;
|
|
3673
|
-
/** Who funds the referral: "user" (default) reserves it from maxSpend; "app" pays from `referralPayerAddress` after the fill. */
|
|
3674
|
-
referralPayer?: "user" | "app";
|
|
3675
|
-
/** Required with `referralPayer: "app"`: the wallet that signs the parked payout transaction. */
|
|
3676
|
-
referralPayerAddress?: string;
|
|
3677
|
-
/**
|
|
3678
|
-
* User-paid referral only: a wallet that pays Hyperliquid's one-time 1 USDC
|
|
3679
|
-
* activation fee for a referrer with no HyperCore account (self-custody
|
|
3680
|
-
* Hyperliquid buys). Before the fill a pending signature with this
|
|
3681
|
-
* `signerAddress` and `purpose: "hl_activation_sponsor"` is passed to your
|
|
3682
|
-
* `signer`; it is `optional`, so declining it — or not answering within
|
|
3683
|
-
* `OPTIONAL_SIGNATURE_TIMEOUT_MS` — never costs the trade.
|
|
3684
|
-
*/
|
|
3685
|
-
referralActivationSponsorAddress?: string;
|
|
3686
|
-
}
|
|
3687
|
-
/** One-time setup line item — populated only on deep-estimate quotes. */
|
|
3688
|
-
interface SmartRouteSetupCostLine {
|
|
3689
|
-
/** "chainApproval" = ERC-20 + venue-contract approvals on the venue's
|
|
3690
|
-
* chain (Polymarket / Polygon, Limitless / Base, predict.fun / BNB).
|
|
3691
|
-
* "venueMarketAta" = Kalshi-on-Solana per-market token-account rent.
|
|
3692
|
-
* "hyperliquidActivation" = Hyperliquid's one-time 1 USDC fee to activate
|
|
3693
|
-
* the user's address on its first deposit; `alreadyPaid` once the address
|
|
3694
|
-
* exists on Hyperliquid. Deducted from the bridged amount, not a step. */
|
|
3695
|
-
kind: "chainApproval" | "venueMarketAta" | "hyperliquidActivation";
|
|
3696
|
-
venue: string;
|
|
3697
|
-
/** Set when `kind === "chainApproval"`. */
|
|
3698
|
-
chainId?: number;
|
|
3699
|
-
/** Set when `kind === "venueMarketAta"`. */
|
|
3700
|
-
venueMarketId?: string;
|
|
3701
|
-
/** Per-item cost in USD. Sourced from documented chain-paymaster floors
|
|
3702
|
-
* (Polygon/Base/Arbitrum ≈ $0.05, BNB $0.20, Solana ATA ≈ $0.30). */
|
|
3703
|
-
costUsd: number;
|
|
3704
|
-
/** True if the user has already paid this on a prior fill — render as a
|
|
3705
|
-
* strike-through "first-time fee" chip rather than charging again. */
|
|
3706
|
-
alreadyPaid: boolean;
|
|
3707
|
-
}
|
|
3708
|
-
/** Cost breakdown for a route quote. */
|
|
3709
|
-
interface SmartRouteFeeBreakdown {
|
|
3710
|
-
rawExecCost: number;
|
|
3711
|
-
venueFees: number;
|
|
3712
|
-
/**
|
|
3713
|
-
* Builder fee in USD — the slice paid to a builder code rather than to the
|
|
3714
|
-
* venue. Partners with their own builder code see their own rate here;
|
|
3715
|
-
* everyone else sees the platform default. Excluded from `venueFees`,
|
|
3716
|
-
* included in `totalCost`.
|
|
3717
|
-
*/
|
|
3718
|
-
builderFee?: number;
|
|
3719
|
-
/** Additional CH funding reserve for slippage or possible venue charges.
|
|
3720
|
-
* Excluded from venueFees and totalCost; included in funding allocations.
|
|
3721
|
-
* Only the unused portion is released after execution. */
|
|
3722
|
-
executionReserve?: number;
|
|
3723
|
-
bridgeFees: number;
|
|
3724
|
-
executionGas: number;
|
|
3725
|
-
totalCost: number;
|
|
3726
|
-
/** Populated only when the request specified `deepEstimate=true`. */
|
|
3727
|
-
setupCosts?: SmartRouteSetupCostLine[];
|
|
3728
|
-
/** Sum of `setupCosts` entries where `alreadyPaid === false`. */
|
|
3729
|
-
setupCostsTotal?: number;
|
|
3730
|
-
/**
|
|
3731
|
-
* Partner-level execution fee in USD. The worst-case fee the user will
|
|
3732
|
-
* pay against the routed buy notional at quote time. Buy-side only —
|
|
3733
|
-
* sell quotes don't carry this field.
|
|
3734
|
-
*
|
|
3735
|
-
* Actual collection happens after the trade fills, against realized
|
|
3736
|
-
* notional (which may be less on partial fills). Partner UIs should
|
|
3737
|
-
* render this as "you'll pay up to $X in app fees".
|
|
3738
|
-
*
|
|
3739
|
-
* Both `appFee` and `appFeeBips` are present iff `appFee > 0`.
|
|
3740
|
-
*/
|
|
3741
|
-
appFee?: number;
|
|
3742
|
-
/** The rate that produced `appFee` — the partner's configured bips, or the request's `appFeeBips`. When the venues this route fills have different rates, the highest of them; see `appFeeBipsByVenue`. */
|
|
3743
|
-
appFeeBips?: number;
|
|
3744
|
-
/** App fee rate per venue this route fills, in bips. Present only when those rates differ. */
|
|
3745
|
-
appFeeBipsByVenue?: Record<string, number>;
|
|
3746
|
-
/** Category key the bips resolved against (e.g. "sports", "all" for the fallback, "override" for a per-request `appFeeBips`). */
|
|
3747
|
-
appFeeCategory?: string;
|
|
3748
|
-
/** The `executionGas` line when it is actually collected with the app fee. Present iff > 0; already inside `totalCost`. */
|
|
3749
|
-
gasReimbursement?: number;
|
|
3750
|
-
/** Referral fee the USER pays, in USD. Present iff > 0 and `referralPayer` is "user"; already inside `totalCostIncFees`. An app-paid referral never appears here. */
|
|
3751
|
-
referralFee?: number;
|
|
3752
|
-
/** Referral fee rate per venue this route fills, in bips. Present with `referralFee`, only when those rates differ. */
|
|
3753
|
-
referralFeeBipsByVenue?: Record<string, number>;
|
|
3754
|
-
}
|
|
3755
|
-
/** Response from GET /orderbook/:venueMarketOutcomeId/route. */
|
|
3756
|
-
interface SmartRouteSettlementLeg {
|
|
3757
|
-
action: "redeem";
|
|
3758
|
-
venue: string;
|
|
3759
|
-
venueMarketId: string;
|
|
3760
|
-
venueMarketOutcomeId: string;
|
|
3761
|
-
positionId: string;
|
|
3762
|
-
size: string;
|
|
3763
|
-
redeemPath: "evm" | "svm";
|
|
3764
|
-
}
|
|
3765
|
-
interface SmartRouteSettlementPlan {
|
|
3766
|
-
redeemId: string;
|
|
3767
|
-
status: "redeem_only" | "partial_redeem";
|
|
3768
|
-
message: string;
|
|
3769
|
-
totalRedeemableShares: number;
|
|
3770
|
-
totalRedeemShares: number;
|
|
3771
|
-
totalSellShares: number;
|
|
3772
|
-
redeemLegs: SmartRouteSettlementLeg[];
|
|
3773
|
-
}
|
|
3774
|
-
/** Slippage metrics for the route. Mirrors `SmartRouteResponseTB.slippage`. */
|
|
3775
|
-
interface SmartRouteSlippage {
|
|
3776
|
-
/** Volume-weighted average price. */
|
|
3777
|
-
vwap: number;
|
|
3778
|
-
/** Reference midpoint used by the optimizer. */
|
|
3779
|
-
refMidpoint: number;
|
|
3780
|
-
/** Route slippage = max(0, VWAP - refMidpoint). */
|
|
3781
|
-
slippage: number;
|
|
3782
|
-
/** Slippage in basis points relative to ref midpoint. */
|
|
3783
|
-
slippageBps: number;
|
|
3784
|
-
}
|
|
3785
|
-
interface SmartRouteResponse {
|
|
3786
|
-
quoteRefreshNotBefore?: string;
|
|
3787
|
-
quoteFailure?: {
|
|
3788
|
-
venue: string;
|
|
3789
|
-
code: string;
|
|
3790
|
-
retryAt?: string;
|
|
3791
|
-
};
|
|
3792
|
-
quoteId: string;
|
|
3793
|
-
venueMarketOutcomeId: string;
|
|
3794
|
-
venueMarketId: string;
|
|
3795
|
-
estimatedCostRaw: string;
|
|
3796
|
-
expiresAt: string;
|
|
3797
|
-
/**
|
|
3798
|
-
* Timestamp at which the quote begins to drift — frontends should refetch
|
|
3799
|
-
* a fresh `getSmartRoute` at this point even though the cached quoteId
|
|
3800
|
-
* remains executable until `expiresAt`. Always earlier than `expiresAt`.
|
|
3801
|
-
*/
|
|
3802
|
-
refreshAt: string;
|
|
3803
|
-
status: SmartRouteStatus;
|
|
3804
|
-
fills: SmartRouteVenueFill[];
|
|
3805
|
-
totalFilled: number;
|
|
3806
|
-
rawExecCost: number;
|
|
3807
|
-
solveTimeMs: number;
|
|
3808
|
-
verifyTimeMs: number;
|
|
3809
|
-
matchedMarkets: Array<{
|
|
3810
|
-
venue: string;
|
|
3811
|
-
venueMarketId: string;
|
|
3812
|
-
}>;
|
|
3813
|
-
error?: string;
|
|
3814
|
-
message?: string;
|
|
3815
|
-
settlementPlan?: SmartRouteSettlementPlan;
|
|
3816
|
-
warnings?: Array<{
|
|
3817
|
-
venue: string;
|
|
3818
|
-
venueMarketOutcomeId: string;
|
|
3819
|
-
reason: string;
|
|
3820
|
-
}>;
|
|
3821
|
-
venueSoloQuotes?: VenueSoloQuote[];
|
|
3822
|
-
allocations?: SmartRouteAllocation[];
|
|
3823
|
-
bridgeSteps?: SmartRouteBridgeStep[];
|
|
3824
|
-
/**
|
|
3825
|
-
* Route slippage metrics. Present on the wire (`SmartRouteResponseTB`) but
|
|
3826
|
-
* missing from this mirror until now — `@agg-build/hooks` already reads
|
|
3827
|
-
* `slippage.slippageBps` to flag thin liquidity.
|
|
3828
|
-
*/
|
|
3829
|
-
slippage?: SmartRouteSlippage;
|
|
3830
|
-
/** Estimated payout if the outcome wins (= totalFilled shares × $1, less
|
|
3831
|
-
* settlement fees — see `fills[].settlementFee`). */
|
|
3832
|
-
estimatedPayout?: number;
|
|
3833
|
-
/** Total cost including all fees (rawExecCost + venueFees + bridgeFees +
|
|
3834
|
-
* executionGas). For deep-estimate quotes, `setupCostsTotal` is folded
|
|
3835
|
-
* into this number and `estimatedProfit` / `returnPct` are recomputed
|
|
3836
|
-
* against it. */
|
|
3837
|
-
totalCostIncFees?: number;
|
|
3838
|
-
/** Estimated profit if the outcome wins (= estimatedPayout − totalCostIncFees). */
|
|
3839
|
-
estimatedProfit?: number;
|
|
3840
|
-
/** Return on investment percentage (= estimatedProfit / totalCostIncFees × 100). */
|
|
3841
|
-
returnPct?: number;
|
|
3842
|
-
/** Per-route fee breakdown. Always present when the engine produced a
|
|
3843
|
-
* feasible plan; omitted on solo / failed quotes. The `setupCosts` and
|
|
3844
|
-
* `setupCostsTotal` fields are populated only when the request set
|
|
3845
|
-
* `deepEstimate=true`. */
|
|
3846
|
-
feeBreakdown?: SmartRouteFeeBreakdown;
|
|
3847
|
-
/**
|
|
3848
|
-
* Quote-time snapshot of the partner fee configuration that produced
|
|
3849
|
-
* `feeBreakdown.appFee`, frozen so config drift between quote and execute
|
|
3850
|
-
* cannot change what the user is charged.
|
|
3851
|
-
*
|
|
3852
|
-
* This is NOT the display number — that is `feeBreakdown.appFee`, in USD.
|
|
3853
|
-
* This is the audit record: `quotedAppFeeRaw` is the worst-case charge in
|
|
3854
|
-
* 6-decimal USD atoms, and is what a partner reconciles against their
|
|
3855
|
-
* `AppFeeCharge` rows. `null` when the app has no fee configured.
|
|
3856
|
-
*/
|
|
3857
|
-
appFee?: {
|
|
3858
|
-
/** The route rate: the highest among the venues this route fills. */
|
|
3859
|
-
bips: number;
|
|
3860
|
-
categoryKey: string;
|
|
3861
|
-
quotedAppFeeRaw: string;
|
|
3862
|
-
/** Rate per venue this route fills. Present only when those rates differ. */
|
|
3863
|
-
bipsByVenue?: Record<string, number>;
|
|
3864
|
-
} | null;
|
|
3865
|
-
/** Referral snapshot; null/absent when no referrer was accepted. */
|
|
3866
|
-
referral?: {
|
|
3867
|
-
referrer: string;
|
|
3868
|
-
/** The highest rate among the venues this route fills. */
|
|
3869
|
-
feeBips: number;
|
|
3870
|
-
/** Rate per venue this route fills. Present only when those rates differ. */
|
|
3871
|
-
feeBipsByVenue?: Record<string, number>;
|
|
3872
|
-
payer: "user" | "app";
|
|
3873
|
-
payerAddress?: string;
|
|
3874
|
-
/** Wallet sponsoring the referrer's HyperCore activation, when sent. */
|
|
3875
|
-
activationSponsorAddress?: string;
|
|
3876
|
-
quotedFeeUsd: number;
|
|
3877
|
-
} | null;
|
|
3878
|
-
/** Populated only when status === "insufficient_position". */
|
|
3879
|
-
positionAvailability?: {
|
|
3880
|
-
totalSellableShares: number;
|
|
3881
|
-
venueMarketOutcomes: Array<{
|
|
3882
|
-
id: string;
|
|
3883
|
-
venue: string;
|
|
3884
|
-
venueMarketId: string;
|
|
3885
|
-
availableShares: number;
|
|
3886
|
-
}>;
|
|
3887
|
-
};
|
|
3888
|
-
/** @deprecated Echoed only when the deprecated request-side override is provided. */
|
|
3889
|
-
side?: SmartRouteSide;
|
|
3890
|
-
}
|
|
3891
|
-
interface CancelManagedExecutionResponse {
|
|
3892
|
-
quoteId: string | null;
|
|
3893
|
-
orderIds: string[];
|
|
3894
|
-
status: "cancelled" | "cancel_pending";
|
|
3895
|
-
}
|
|
3896
|
-
type PositionRedeemStatus = "eligible" | "pending" | "redeemed" | "ineligible";
|
|
3897
|
-
type RedeemLegStatus = "submitted" | "confirmed" | "ineligible" | "rejected";
|
|
3898
|
-
interface RedeemLegResult {
|
|
3899
|
-
venueMarketOutcomeId: string;
|
|
3900
|
-
status: RedeemLegStatus;
|
|
3901
|
-
callsId: string | null;
|
|
3902
|
-
pendingUserOpId: string | null;
|
|
3903
|
-
txHash: string | null;
|
|
3904
|
-
reason: string | null;
|
|
3905
|
-
}
|
|
3906
|
-
interface RedeemRequest {
|
|
3907
|
-
venueMarketOutcomeIds: string[];
|
|
3908
|
-
/**
|
|
3909
|
-
* Trading mode. Defaults to live, matching the other execution methods.
|
|
3910
|
-
* Honoured on a live app; ignored on a paper app, which has no real-money
|
|
3911
|
-
* path and always settles on paper.
|
|
3912
|
-
*/
|
|
3913
|
-
mode?: ExecutionMode;
|
|
3914
|
-
}
|
|
3915
|
-
interface RedeemResponse {
|
|
3916
|
-
redeemId: string;
|
|
3917
|
-
results: RedeemLegResult[];
|
|
3918
|
-
}
|
|
3919
|
-
type SearchType = "events" | "markets";
|
|
3920
|
-
interface SearchParams {
|
|
3921
|
-
mode?: "instant" | "full";
|
|
3922
|
-
q: string;
|
|
3923
|
-
type: SearchType;
|
|
3924
|
-
categoryIds?: string[];
|
|
3925
|
-
/**
|
|
3926
|
-
* Filter results by status (e.g. `["open"]` for tradeable-only). Without
|
|
3927
|
-
* it the server returns all statuses; recurring series ("BTC Up or Down -
|
|
3928
|
-
* 5 Min") can then fill a page with resolved history, which a UI that
|
|
3929
|
-
* hides non-open rows renders as an empty result.
|
|
3930
|
-
*/
|
|
3931
|
-
status?: MarketStatus[];
|
|
3932
|
-
limit?: number;
|
|
3933
|
-
cursor?: string;
|
|
3934
|
-
/**
|
|
3935
|
-
* Opt in to the server-side reranker for higher-quality top results.
|
|
3936
|
-
*
|
|
3937
|
-
* Send `deep: true` for the final search-results page (submit / Enter) and
|
|
3938
|
-
* leave it off for debounced typeahead. Adds ~100–150 ms on a cold rerank
|
|
3939
|
-
* cache and ~3 ms on a warm one — typeahead can't afford the cold cost,
|
|
3940
|
-
* and the result orderings differ enough that the server gives the two
|
|
3941
|
-
* modes separate cache slots.
|
|
3942
|
-
*
|
|
3943
|
-
* Defaults to `false`.
|
|
3944
|
-
*/
|
|
3945
|
-
deep?: boolean;
|
|
3946
|
-
}
|
|
3947
|
-
type SearchResponse<T> = {
|
|
3948
|
-
meta?: {
|
|
3949
|
-
complete?: boolean;
|
|
3950
|
-
degradedSignals?: string[];
|
|
3951
|
-
};
|
|
3952
|
-
type: SearchType;
|
|
3953
|
-
data: T[];
|
|
3954
|
-
nextCursor: string | null;
|
|
3955
|
-
hasMore: boolean;
|
|
3956
|
-
};
|
|
3957
|
-
interface NewsFeedPageOptions {
|
|
3958
|
-
cursor?: string;
|
|
3959
|
-
since?: string;
|
|
3960
|
-
before?: string;
|
|
3961
|
-
limit?: number;
|
|
3962
|
-
}
|
|
3963
|
-
interface NewsFeedMarketNewsParams {
|
|
3964
|
-
venueMarketIds?: string[];
|
|
3965
|
-
venueEventIds?: string[];
|
|
3966
|
-
customQuery?: string;
|
|
3967
|
-
tbs?: string;
|
|
3968
|
-
limit?: number;
|
|
3969
|
-
}
|
|
3970
|
-
interface NewsFeedArticleWithSummary {
|
|
3971
|
-
title: string;
|
|
3972
|
-
url: string;
|
|
3973
|
-
snippet: string;
|
|
3974
|
-
source: string;
|
|
3975
|
-
imageUrl: string | null;
|
|
3976
|
-
publishedAt: string | null;
|
|
3977
|
-
summary: string;
|
|
3978
|
-
relevanceScore: number;
|
|
3979
|
-
}
|
|
3980
|
-
interface NewsFeedMarketNewsResult {
|
|
3981
|
-
venueMarketId: string;
|
|
3982
|
-
venueEventId: string;
|
|
3983
|
-
question: string;
|
|
3984
|
-
eventTitle: string;
|
|
3985
|
-
category: string;
|
|
3986
|
-
searchQuery: string;
|
|
3987
|
-
timeRange: string;
|
|
3988
|
-
timeRangeLabel: string;
|
|
3989
|
-
articles: NewsFeedArticleWithSummary[];
|
|
3990
|
-
}
|
|
3991
|
-
interface NewsFeedMarketNewsResponse {
|
|
3992
|
-
results: NewsFeedMarketNewsResult[];
|
|
3993
|
-
}
|
|
3994
|
-
interface NewsFeedLinkedMarket {
|
|
3995
|
-
venueMarketId: string;
|
|
3996
|
-
question: string;
|
|
3997
|
-
venue: string;
|
|
3998
|
-
yesPrice: number;
|
|
3999
|
-
eventTitle: string;
|
|
4000
|
-
eventId: string;
|
|
4001
|
-
summary: string;
|
|
4002
|
-
relevanceScore: number;
|
|
4003
|
-
}
|
|
4004
|
-
interface NewsFeedArticleFeedItem {
|
|
4005
|
-
article: {
|
|
4006
|
-
id: string;
|
|
4007
|
-
title: string;
|
|
4008
|
-
url: string;
|
|
4009
|
-
snippet: string;
|
|
4010
|
-
source: string;
|
|
4011
|
-
imageUrl: string | null;
|
|
4012
|
-
publishedAt: string | null;
|
|
4013
|
-
};
|
|
4014
|
-
markets: NewsFeedLinkedMarket[];
|
|
4015
|
-
category: string;
|
|
4016
|
-
id: string;
|
|
4017
|
-
seq: number;
|
|
4018
|
-
timestamp: string;
|
|
4019
|
-
}
|
|
4020
|
-
interface NewsFeedMarketFeedArticle {
|
|
4021
|
-
title: string;
|
|
4022
|
-
url: string;
|
|
4023
|
-
source: string;
|
|
4024
|
-
imageUrl: string | null;
|
|
4025
|
-
publishedAt: string | null;
|
|
4026
|
-
summary: string;
|
|
4027
|
-
relevanceScore: number;
|
|
4028
|
-
seq: number;
|
|
4029
|
-
addedAt: string;
|
|
4030
|
-
}
|
|
4031
|
-
interface NewsFeedMarketFeedItem {
|
|
4032
|
-
venueMarketId: string;
|
|
4033
|
-
question: string;
|
|
4034
|
-
venue: string;
|
|
4035
|
-
yesPrice: number;
|
|
4036
|
-
eventTitle: string;
|
|
4037
|
-
eventId: string;
|
|
4038
|
-
category: string;
|
|
4039
|
-
articleCount: number;
|
|
4040
|
-
articles: NewsFeedMarketFeedArticle[];
|
|
4041
|
-
}
|
|
4042
|
-
interface NewsFeedArticleFeedResponse {
|
|
4043
|
-
data: NewsFeedArticleFeedItem[];
|
|
4044
|
-
nextCursor: string | null;
|
|
4045
|
-
hasMore: boolean;
|
|
4046
|
-
}
|
|
4047
|
-
interface NewsFeedMarketFeedResponse {
|
|
4048
|
-
data: NewsFeedMarketFeedItem[];
|
|
4049
|
-
nextCursor: string | null;
|
|
4050
|
-
hasMore: boolean;
|
|
4051
|
-
}
|
|
4052
|
-
interface NewsFeedListResponse {
|
|
4053
|
-
feeds: Array<{
|
|
4054
|
-
id: string;
|
|
4055
|
-
name: string;
|
|
4056
|
-
itemCount: number;
|
|
4057
|
-
}>;
|
|
4058
|
-
}
|
|
4059
|
-
interface NewsFeedStatusResponse {
|
|
4060
|
-
articles: {
|
|
4061
|
-
total: number;
|
|
4062
|
-
today: number;
|
|
4063
|
-
};
|
|
4064
|
-
feedItems: {
|
|
4065
|
-
total: number;
|
|
4066
|
-
today: number;
|
|
4067
|
-
};
|
|
4068
|
-
perCategory: Array<{
|
|
4069
|
-
category: string;
|
|
4070
|
-
todayCount: number;
|
|
4071
|
-
dailyLimit: number;
|
|
4072
|
-
}>;
|
|
4073
|
-
config: {
|
|
4074
|
-
cronEnabled: boolean;
|
|
4075
|
-
itemsPerDay: number;
|
|
4076
|
-
batchSize: number;
|
|
4077
|
-
categories: string[];
|
|
4078
|
-
};
|
|
4079
|
-
}
|
|
4080
|
-
type CorrelatedMarketSide = "yes" | "no";
|
|
4081
|
-
type CorrelatedMarketSignalDirection = "more_likely" | "less_likely";
|
|
4082
|
-
interface CorrelatedMarketSignal {
|
|
4083
|
-
id: string;
|
|
4084
|
-
text: string;
|
|
4085
|
-
side: CorrelatedMarketSide;
|
|
4086
|
-
direction: CorrelatedMarketSignalDirection;
|
|
4087
|
-
domain: string;
|
|
4088
|
-
}
|
|
4089
|
-
interface CorrelatedMarketSignalBatch {
|
|
4090
|
-
id: string;
|
|
4091
|
-
venueMarketId: string;
|
|
4092
|
-
sourceModel: string;
|
|
4093
|
-
promptVersion: number;
|
|
4094
|
-
createdAt: string;
|
|
4095
|
-
signals: CorrelatedMarketSignal[];
|
|
4096
|
-
}
|
|
4097
|
-
interface CorrelatedMarketsStatus {
|
|
4098
|
-
markets: {
|
|
4099
|
-
total: number;
|
|
4100
|
-
processed: number;
|
|
4101
|
-
coverage: number;
|
|
4102
|
-
};
|
|
4103
|
-
signals: {
|
|
4104
|
-
total: number;
|
|
4105
|
-
withEmbeddings: number;
|
|
4106
|
-
missingEmbeddings: number;
|
|
4107
|
-
};
|
|
4108
|
-
eventTitleEmbeddings: {
|
|
4109
|
-
total: number;
|
|
4110
|
-
events: number;
|
|
4111
|
-
coverage: number;
|
|
4112
|
-
};
|
|
4113
|
-
config: {
|
|
4114
|
-
batchSize: number;
|
|
4115
|
-
jobsEnabled: boolean;
|
|
4116
|
-
backfillInterval: string;
|
|
4117
|
-
reembedInterval: string;
|
|
4118
|
-
eventEmbeddingInterval: string;
|
|
4119
|
-
};
|
|
4120
|
-
}
|
|
4121
|
-
interface CorrelatedMarketQueryResult {
|
|
4122
|
-
venueMarketId: string;
|
|
4123
|
-
marketQuestion: string;
|
|
4124
|
-
marketStatus: MarketStatus;
|
|
4125
|
-
marketStartDate: string;
|
|
4126
|
-
marketEndDate: string | null;
|
|
4127
|
-
eventTitle: string;
|
|
4128
|
-
eventStatus: MarketStatus;
|
|
4129
|
-
eventStartDate: string;
|
|
4130
|
-
eventEndDate: string | null;
|
|
4131
|
-
score: number;
|
|
4132
|
-
matchedSignal: CorrelatedMarketSignal;
|
|
4133
|
-
matchSource: "signal" | "title_fallback";
|
|
4134
|
-
venue: string;
|
|
4135
|
-
}
|
|
4136
|
-
interface CorrelatedMarketCascadeItem {
|
|
4137
|
-
venueEventId: string;
|
|
4138
|
-
eventTitle: string;
|
|
4139
|
-
eventStatus: MarketStatus;
|
|
4140
|
-
eventStartDate: string;
|
|
4141
|
-
eventEndDate: string | null;
|
|
4142
|
-
score: number;
|
|
4143
|
-
action: string;
|
|
4144
|
-
reason: string;
|
|
4145
|
-
reasonDomain: string;
|
|
4146
|
-
}
|
|
4147
|
-
interface CorrelatedMarketCascadeResponse {
|
|
4148
|
-
data: CorrelatedMarketCascadeItem[];
|
|
4149
|
-
nextCursor: string | null;
|
|
4150
|
-
hasMore: boolean;
|
|
4151
|
-
}
|
|
4152
|
-
interface ResolveCorrelatedMarketsParams {
|
|
4153
|
-
venue?: string;
|
|
4154
|
-
externalId?: string;
|
|
4155
|
-
slug?: string;
|
|
4156
|
-
conditionId?: string;
|
|
4157
|
-
q?: string;
|
|
4158
|
-
side?: CorrelatedMarketSide;
|
|
4159
|
-
mode?: "expand" | "hedge";
|
|
4160
|
-
limit?: number;
|
|
4161
|
-
cursor?: string;
|
|
4162
|
-
includeResolved?: boolean;
|
|
4163
|
-
}
|
|
4164
|
-
type ResolveCorrelatedMarketsResponse = ({
|
|
4165
|
-
market: {
|
|
4166
|
-
id: string;
|
|
4167
|
-
question: string;
|
|
4168
|
-
};
|
|
4169
|
-
} & CorrelatedMarketCascadeResponse) | {
|
|
4170
|
-
market: {
|
|
4171
|
-
id: string;
|
|
4172
|
-
question: string;
|
|
4173
|
-
};
|
|
4174
|
-
status: "processing";
|
|
4175
|
-
message: string;
|
|
4176
|
-
};
|
|
4177
|
-
interface ResolvedCorrelatedMarketsResponse extends CorrelatedMarketCascadeResponse {
|
|
4178
|
-
market: {
|
|
4179
|
-
id: string;
|
|
4180
|
-
question: string;
|
|
4181
|
-
};
|
|
4182
|
-
}
|
|
4183
|
-
/** Display-first event navigation payload; market pages remain cursor paginated. */
|
|
4184
|
-
interface EventBootstrapResponse {
|
|
4185
|
-
detailsDeferred: true;
|
|
4186
|
-
event: VenueEvent;
|
|
4187
|
-
markets: PaginatedResponse<VenueMarket>;
|
|
4188
|
-
selectedOutcomeIds: string[];
|
|
4189
|
-
references: {
|
|
4190
|
-
historyManifestPath: "/charts/history/manifest";
|
|
4191
|
-
liveChannel: "orderbook";
|
|
4192
|
-
};
|
|
4193
|
-
freshness: {
|
|
4194
|
-
assembledAt: number;
|
|
4195
|
-
marketStatus: "open" | null;
|
|
4196
|
-
};
|
|
4197
|
-
}
|
|
4198
|
-
|
|
4199
|
-
type MarketSubscription = {
|
|
4200
|
-
id: string;
|
|
4201
|
-
channel: "orderbook" | "trades" | "arb" | "arb-feed";
|
|
4202
|
-
};
|
|
4203
|
-
type CandleTail = Record<CandleInterval, {
|
|
4204
|
-
forming: Candle | null;
|
|
4205
|
-
closed: Candle[];
|
|
4206
|
-
}>;
|
|
4207
|
-
interface MarketView {
|
|
4208
|
-
revision: number;
|
|
4209
|
-
integrity: "ok" | "resyncing";
|
|
4210
|
-
outcomeId: string;
|
|
4211
|
-
book: OrderbookState | null;
|
|
4212
|
-
snapshot: boolean;
|
|
4213
|
-
candles: CandleTail;
|
|
4214
|
-
trades: WsTrade[];
|
|
4215
|
-
receivedAtMs: number;
|
|
4216
|
-
}
|
|
4217
|
-
interface MarketViewBatch {
|
|
4218
|
-
generation: number;
|
|
4219
|
-
views: MarketView[];
|
|
4220
|
-
publishedAtMs: number;
|
|
4221
|
-
}
|
|
4222
|
-
type EngineEvent = {
|
|
4223
|
-
name: keyof AggWebSocketCallbacks;
|
|
4224
|
-
args: unknown[];
|
|
4225
|
-
revision: number;
|
|
4226
|
-
};
|
|
4227
|
-
interface HistoryRangeRequest {
|
|
4228
|
-
key: string;
|
|
4229
|
-
generation: number;
|
|
4230
|
-
url: string;
|
|
4231
|
-
headers?: Record<string, string>;
|
|
4232
|
-
}
|
|
4233
|
-
/** Framework-independent processing. The native worker and replay tests run this exact engine. */
|
|
4234
|
-
declare class MarketDataEngine {
|
|
4235
|
-
private socket;
|
|
4236
|
-
private generation;
|
|
4237
|
-
private receivedAtMs;
|
|
4238
|
-
private revision;
|
|
4239
|
-
private deliveredClosed;
|
|
4240
|
-
private subscriptions;
|
|
4241
|
-
private builders;
|
|
4242
|
-
private dirty;
|
|
4243
|
-
private observer?;
|
|
4244
|
-
private timer?;
|
|
4245
|
-
private inFlight;
|
|
4246
|
-
private deliveryToken;
|
|
4247
|
-
private cancelDelivery?;
|
|
4248
|
-
private disposed;
|
|
4249
|
-
private history;
|
|
4250
|
-
private measurements;
|
|
4251
|
-
start(options: Omit<AggWebSocketOptions, "callbacks">, event: (event: EngineEvent) => void): void;
|
|
4252
|
-
observeViews(observer: (batch: MarketViewBatch) => Promise<void> | void): void;
|
|
4253
|
-
setSubscriptions(subscriptions: MarketSubscription[], generation: number): void;
|
|
4254
|
-
authenticate(token: string): void;
|
|
4255
|
-
resnapshot(ids: string[]): void;
|
|
4256
|
-
connect(): void;
|
|
4257
|
-
disconnect(): void;
|
|
4258
|
-
resume(): void;
|
|
4259
|
-
getMeasurements(): {
|
|
4260
|
-
activeSubscriptions: number;
|
|
4261
|
-
activeOutcomes: number;
|
|
4262
|
-
cachedBooks: number;
|
|
4263
|
-
builders: number;
|
|
4264
|
-
historyTasks: number;
|
|
4265
|
-
pendingOutcomes: number;
|
|
4266
|
-
inFlightDeliveries: number;
|
|
4267
|
-
retainedCandleOutcomes: number;
|
|
4268
|
-
socket: AggWebSocketDiagnostics | null;
|
|
4269
|
-
received: number;
|
|
4270
|
-
published: number;
|
|
4271
|
-
coalesced: number;
|
|
4272
|
-
maxPendingOutcomes: number;
|
|
4273
|
-
maxInFlight: number;
|
|
4274
|
-
};
|
|
4275
|
-
decodeHistory(payload: string): ChartBarsResponse;
|
|
4276
|
-
/** Fetch/decode on the processing side; newer range generations abort obsolete fetches. */
|
|
4277
|
-
loadHistoryRange(request: HistoryRangeRequest): Promise<ChartBarsResponse | null>;
|
|
4278
|
-
loadImmutableRange(key: string, generation: number, manifest: ChartHistoryManifest): Promise<ChartCandle[]>;
|
|
4279
|
-
cancelHistoryRange(key: string, generation?: number): void;
|
|
4280
|
-
dispose(): void;
|
|
4281
|
-
private builder;
|
|
4282
|
-
private mark;
|
|
4283
|
-
private schedule;
|
|
4284
|
-
private publish;
|
|
4285
|
-
}
|
|
4286
|
-
|
|
4287
|
-
interface AggWebSocketCallbacks {
|
|
4288
|
-
/** Local receipt clock, distinct from venue/source timestamps. */
|
|
4289
|
-
onFrameReceived?: (receivedAtMs: number) => void;
|
|
4290
|
-
/** Pre-accumulated live views from the optional processing engine. */
|
|
4291
|
-
onMarketView?: (view: MarketView) => void;
|
|
4292
|
-
/** Invoked with the venueMarketOutcomeId the snapshot belongs to. */
|
|
4293
|
-
onSnapshot?: (outcomeId: string, book: OrderbookState) => void;
|
|
4294
|
-
/** Invoked with the venueMarketOutcomeId the delta belongs to. */
|
|
4295
|
-
onDelta?: (outcomeId: string, book: OrderbookState) => void;
|
|
4296
|
-
onTrade?: (trade: WsTrade) => void;
|
|
4297
|
-
/** Every validated update, before optional view batching. Timestamps are seconds. */
|
|
4298
|
-
onBookTick?: (outcomeId: string, tick: {
|
|
4299
|
-
midpoint: number | null;
|
|
4300
|
-
timestamp: number;
|
|
4301
|
-
source: "snapshot" | "delta";
|
|
4302
|
-
}) => void;
|
|
4303
|
-
onHeartbeat?: (hb: WsHeartbeat) => void;
|
|
4304
|
-
onSubscribed?: (msg: WsSubscribed) => void;
|
|
4305
|
-
onUnsubscribed?: (msg: WsUnsubscribed) => void;
|
|
4306
|
-
onConnected?: (msg: WsConnected) => void;
|
|
4307
|
-
onAuthenticated?: (msg: WsAuthenticated) => void;
|
|
4308
|
-
onMarketResolved?: (msg: WsMarketResolved) => void;
|
|
4309
|
-
onError?: (msg: WsError) => void;
|
|
4310
|
-
onOrderSubmitted?: (msg: WsOrderSubmitted) => void;
|
|
4311
|
-
onBalanceUpdate?: (msg: WsBalanceUpdate) => void;
|
|
4312
|
-
onOrderEvent?: (msg: WsOrderEvent) => void;
|
|
4313
|
-
onRedeemEvent?: (msg: WsRedeemEvent) => void;
|
|
4314
|
-
onWithdrawalLifecycle?: (msg: WsWithdrawalLifecycleEvent) => void;
|
|
4315
|
-
onArbMarket?: (msg: WsArbMarketUpdate) => void;
|
|
4316
|
-
onArbFeed?: (batch: WsArbFeedBatch) => void;
|
|
4317
|
-
onDiagnostics?: DiagnosticCallback;
|
|
4318
|
-
onConnectionStateChange?: (connected: boolean) => void;
|
|
4319
|
-
}
|
|
4320
|
-
interface AggWebSocketDiagnostics {
|
|
4321
|
-
connected: boolean;
|
|
4322
|
-
transport: "direct" | "worker" | "disposed";
|
|
4323
|
-
orderbookOutcomeIds: string[];
|
|
4324
|
-
tradeOutcomeIds: string[];
|
|
4325
|
-
arbMarketIds: string[];
|
|
4326
|
-
arbFeedSubscribers: number;
|
|
4327
|
-
cachedBooks: number;
|
|
4328
|
-
cachedArb: number;
|
|
4329
|
-
resyncingBooks: number;
|
|
4330
|
-
pendingResnapshots: number;
|
|
4331
|
-
pendingHistoryRequests: number;
|
|
4332
|
-
workerAttached?: boolean;
|
|
4333
|
-
bridgeListeners?: number;
|
|
4334
|
-
host?: Record<string, unknown>;
|
|
4335
|
-
}
|
|
4336
|
-
interface AggWebSocketOptions {
|
|
4337
|
-
/** Full WebSocket URL including query params (appId). Token should NOT be in the URL. */
|
|
4338
|
-
url: string;
|
|
4339
|
-
callbacks?: AggWebSocketCallbacks;
|
|
4340
|
-
/** JWT to send via the authenticate message after connecting (avoids token in URL/logs). */
|
|
4341
|
-
initialToken?: string;
|
|
4342
|
-
/** Enable websocket debug logs. Default: false. */
|
|
4343
|
-
enableLogs?: boolean;
|
|
4344
|
-
/** Engine-only: read immutable books through getBook at presentation cadence. */
|
|
4345
|
-
deferBookViews?: boolean;
|
|
4346
|
-
}
|
|
4347
|
-
/**
|
|
4348
|
-
* Agg WebSocket client. Single WS connection with refcounted market subscriptions.
|
|
4349
|
-
*/
|
|
4350
|
-
declare class AggWebSocket {
|
|
4351
|
-
private ws;
|
|
4352
|
-
private readonly url;
|
|
4353
|
-
private callbacks;
|
|
4354
|
-
private readonly subs;
|
|
4355
|
-
private readonly pendingSubs;
|
|
4356
|
-
private readonly pendingTradeSubs;
|
|
4357
|
-
private readonly pendingResnapshots;
|
|
4358
|
-
private readonly pendingFlushSubs;
|
|
4359
|
-
private readonly pendingFlushUnsubs;
|
|
4360
|
-
private readonly pendingFlushTradeSubs;
|
|
4361
|
-
private readonly pendingFlushTradeUnsubs;
|
|
4362
|
-
private readonly pendingFlushArbSubs;
|
|
4363
|
-
private readonly pendingFlushArbUnsubs;
|
|
4364
|
-
private flushScheduled;
|
|
4365
|
-
private readonly arbSubs;
|
|
4366
|
-
private readonly arbFeedCbs;
|
|
4367
|
-
/** Latest arb market update per marketId (last-value-wins, loss-tolerant). */
|
|
4368
|
-
private readonly latestArb;
|
|
4369
|
-
private readonly books;
|
|
4370
|
-
private readonly deferBookViews;
|
|
4371
|
-
/** Markets currently resyncing (awaiting snapshot after seq gap / checksum mismatch). */
|
|
4372
|
-
private readonly resyncing;
|
|
4373
|
-
private connecting;
|
|
4374
|
-
private _connected;
|
|
4375
|
-
private reconnectAttempts;
|
|
4376
|
-
private reconnectTimer;
|
|
4377
|
-
private staleTimer;
|
|
4378
|
-
private lastMessageTime;
|
|
4379
|
-
private destroyed;
|
|
4380
|
-
private historyControllers;
|
|
4381
|
-
private hostDiagnostics?;
|
|
4382
|
-
private initialToken?;
|
|
4383
|
-
private readonly enableLogs;
|
|
4384
|
-
constructor(options: AggWebSocketOptions);
|
|
4385
|
-
get connected(): boolean;
|
|
4386
|
-
/** Decode dynamic authenticated REST bytes in the same processing environment as live data. */
|
|
4387
|
-
decodeHistory(payload: string): Promise<ChartBarsResponse>;
|
|
4388
|
-
/** Immutable history decoder. Browser adapters execute this inside their Worker. */
|
|
4389
|
-
loadHistory(manifest: ChartHistoryManifest, options?: {
|
|
4390
|
-
signal?: AbortSignal;
|
|
4391
|
-
}): Promise<ChartCandle[]>;
|
|
4392
|
-
/** Optional framework-independent host diagnostics, cleared on disposal. */
|
|
4393
|
-
setHostDiagnostics(provider?: () => Record<string, unknown>): void;
|
|
4394
|
-
/** On-demand ownership diagnostics; contains no credentials or user/account data. */
|
|
4395
|
-
getDiagnostics(): AggWebSocketDiagnostics;
|
|
4396
|
-
/** Get the current orderbook state for an outcome (or null if no snapshot received yet). */
|
|
4397
|
-
getBook(outcomeId: string): OrderbookState | null;
|
|
4398
|
-
/** Whether an outcome is currently resyncing (waiting for fresh snapshot). */
|
|
4399
|
-
isResyncing(outcomeId: string): boolean;
|
|
4400
|
-
/** Get the latest arb update for a market (or null if none received yet). */
|
|
4401
|
-
getArb(marketId: string): WsArbMarketUpdate | null;
|
|
4402
|
-
/**
|
|
4403
|
-
* Subscribe to per-market arb updates for a given marketId.
|
|
4404
|
-
* Ref-counted: multiple callers for the same marketId share one server subscription.
|
|
4405
|
-
* Returns an unsubscribe function.
|
|
4406
|
-
*/
|
|
4407
|
-
subscribeArb(marketId: string, cb: (m: WsArbMarketUpdate) => void): () => void;
|
|
4408
|
-
/**
|
|
4409
|
-
* Subscribe to the global arb-feed batches.
|
|
4410
|
-
* Only one server subscription is maintained regardless of how many callers.
|
|
4411
|
-
* Returns an unsubscribe function.
|
|
4412
|
-
*/
|
|
4413
|
-
subscribeArbFeed(cb: (b: WsArbFeedBatch) => void): () => void;
|
|
4414
|
-
/**
|
|
4415
|
-
* Subscribe to a feed by outcome ID.
|
|
4416
|
-
* @param outcomeId The venueMarketOutcomeId to subscribe to.
|
|
4417
|
-
* @param channel "orderbook" (default) or "trades".
|
|
4418
|
-
* Returns an unsubscribe function (ref-counted).
|
|
4419
|
-
*/
|
|
4420
|
-
subscribe(outcomeId: string, channel?: "orderbook" | "trades"): () => void;
|
|
4421
|
-
/**
|
|
4422
|
-
* Subscribe to an outcome's trade feed.
|
|
4423
|
-
* @deprecated Use `subscribe(outcomeId, "trades")` instead.
|
|
4424
|
-
* Returns an unsubscribe function.
|
|
4425
|
-
*/
|
|
4426
|
-
subscribeTrades(outcomeId: string): () => void;
|
|
4427
|
-
private _subscribeTrades;
|
|
4428
|
-
/** Send a JWT to authenticate (or re-authenticate) the connection. */
|
|
4429
|
-
authenticate(token: string): void;
|
|
4430
|
-
/** Request a fresh snapshot for one or more subscribed outcomes. */
|
|
4431
|
-
resnapshot(outcomeIdOrIds: string | string[]): void;
|
|
4432
|
-
/** Connect (idempotent). Called automatically on first subscribe. */
|
|
4433
|
-
connect(): void;
|
|
4434
|
-
/** Disconnect and clean up. Reusable — call connect() to reconnect. */
|
|
4435
|
-
disconnect(): void;
|
|
4436
|
-
/** Permanently destroy. Cannot reconnect after this. */
|
|
4437
|
-
destroy(): void;
|
|
4438
|
-
/** Update callbacks (e.g., after React re-render). */
|
|
4439
|
-
setCallbacks(callbacks: AggWebSocketCallbacks): void;
|
|
4440
|
-
private ensureConnected;
|
|
4441
|
-
private doConnect;
|
|
4442
|
-
private scheduleReconnect;
|
|
4443
|
-
private cancelReconnect;
|
|
4444
|
-
private resetStaleTimer;
|
|
4445
|
-
private cancelStaleTimer;
|
|
4446
|
-
private handleMessage;
|
|
4447
|
-
/**
|
|
4448
|
-
* Server confirmed the connection — gateway has validated our appId and is
|
|
4449
|
-
* ready to accept subscriptions. Now flush all pending subs.
|
|
4450
|
-
*/
|
|
4451
|
-
private handleConnected;
|
|
4452
|
-
private handleSnapshot;
|
|
4453
|
-
private handleDelta;
|
|
4454
|
-
private handleTrade;
|
|
4455
|
-
private handleHeartbeat;
|
|
4456
|
-
private handleMarketResolved;
|
|
4457
|
-
private handleOrderSubmitted;
|
|
4458
|
-
private handleBalanceUpdate;
|
|
4459
|
-
private handleRedeemEvent;
|
|
4460
|
-
private requestResnapshot;
|
|
4461
|
-
/**
|
|
4462
|
-
* Schedule a microtask that flushes queued subscribe/unsubscribe frames.
|
|
4463
|
-
* Coalesces multiple same-tick sub/unsub calls into at most one frame per
|
|
4464
|
-
* channel+action pair.
|
|
4465
|
-
*/
|
|
4466
|
-
private scheduleFlush;
|
|
4467
|
-
private flushPending;
|
|
4468
|
-
private sendSubscribe;
|
|
4469
|
-
private send;
|
|
4470
|
-
private activeOrderbookMarkets;
|
|
4471
|
-
private activeTradeMarkets;
|
|
4472
|
-
private activeArbMarkets;
|
|
4473
|
-
private emitDiagnostic;
|
|
4474
|
-
private summarizeTopLevels;
|
|
4475
|
-
private debugOrderbook;
|
|
4476
|
-
private isOrderbookDebugEnabled;
|
|
4477
|
-
}
|
|
4478
|
-
|
|
4479
|
-
export { type PaperTradingAppOptions as $, AggWebSocket as A, type ExecutionStatusQuery as B, type ChartBarsResponse as C, type ExecutionStatusResponse as D, type ExecutionOrdersQuery as E, type UserActivityQuery as F, type UserActivityItem as G, type LeaderboardRow as H, type LeaderboardSeriesQuery as I, type LeaderboardSeries as J, type ExecutionPositionsQuery as K, type LeaderboardQuery as L, MarketDataEngine as M, type ExecutionPositionGroup as N, type OrderbookState as O, type PaginatedResponse as P, type ManagedBalancesParams as Q, type UnifiedBalanceResponse as R, type SiweMessageParams as S, type TradeSplit as T, type UserProfile as U, Venue as V, type WsArbMarketUpdate as W, type UpsertVenueKey as X, type VenueKeySummary as Y, type VenueKeyStatus as Z, type CreatePaperTradingAccountParams as _, type AggWebSocketOptions as a, type WithdrawManagedResponse as a$, type PaperTradingAccount as a0, type PaperTradingAccountListParams as a1, type PaperTradingAccountsPage as a2, type SetPaperTradingBalanceParams as a3, type PaperTradingBalanceResponse as a4, type ResetPaperTradingAccountParams as a5, type PlacePaperTradingOrderParams as a6, type PaperTradingOrder as a7, type PaperTradingListParams as a8, type PaperTradingPositionsPage as a9, type SearchParams as aA, type SearchResponse as aB, type CorrelatedMarketsStatus as aC, type CorrelatedMarketSignalBatch as aD, type CorrelatedMarketQueryResult as aE, type CorrelatedMarketCascadeResponse as aF, type ResolveCorrelatedMarketsParams as aG, type ResolveCorrelatedMarketsResponse as aH, type ChartResolution as aI, type BatchOrderbooksResponse as aJ, type BatchMidpointsResponse as aK, type OutcomeOrderbookResponse as aL, type SmartRouteParams as aM, type SmartRouteResponse as aN, type ExecuteManagedParams as aO, type ExecuteManagedResponse as aP, type PlaceLimitOrderParams as aQ, type PlaceLimitOrderResponse as aR, type PlaceOrderParams as aS, type PlaceOrderResponse as aT, type RedeemRequest as aU, type RedeemResponse as aV, type BalanceRefillPolicy as aW, type CreateBalanceRefillPolicyParams as aX, type UpdateBalanceRefillPolicyParams as aY, type BalanceRefillAttempt as aZ, type WithdrawManagedParams as a_, type PaperTradingOrdersPage as aa, type PaperTradingPortfolio as ab, type CancelOrderSignature as ac, type CancelManagedExecutionResponse as ad, type CancelVenueOrderParams as ae, MatchStatus as af, MarketStatus as ag, type RecurrenceFilter as ah, type VenueEvent as ai, type EventBootstrapResponse as aj, type SportsLiveResponse as ak, type ListRecurringCryptoMarketsOptions as al, type RecurringCryptoMarketsResponse as am, type GetCryptoReferencePricesOptions as an, type CryptoReferencePricesResponse as ao, type Category as ap, type AppClientConfigResponse as aq, type VenueGeoPolicyResponse as ar, type RpcTokenResponse as as, type NewsFeedListResponse as at, type NewsFeedPageOptions as au, type NewsFeedArticleFeedResponse as av, type NewsFeedMarketFeedResponse as aw, type NewsFeedStatusResponse as ax, type NewsFeedMarketNewsParams as ay, type NewsFeedMarketNewsResponse as az, type ChartHistoryManifest as b, type DiagnosticEvent as b$, type WithdrawPreviewParams as b0, type WithdrawPreviewResponse as b1, type WithdrawalQuoteParams as b2, type WithdrawalQuoteResponse as b3, type SyncBalancesResponse as b4, type DepositAddressesResponse as b5, type GetPositionsParams as b6, type PositionGroup as b7, type RampQuoteRequest as b8, type RampQuote as b9, CONFIRMED_MATCH_STATUSES as bA, CandleBuilder as bB, type CandleInterval as bC, type CandleTail as bD, Chain as bE, type ChartBarsMeta as bF, type ChartVenueCandles as bG, type ComputeSplitsRequest as bH, type ComputeSplitsResponse as bI, type ComputeSplitsSelection as bJ, type CorrelatedMarketCascadeItem as bK, type CorrelatedMarketSide as bL, type CorrelatedMarketSignal as bM, type CorrelatedMarketSignalDirection as bN, type CreateApp as bO, type CryptoReferencePriceError as bP, type CryptoReferencePriceExternalMarketInput as bQ, type CryptoReferencePriceMarketInput as bR, type CryptoReferencePriceResult as bS, type CryptoReferencePriceSource as bT, type CryptoReferencePriceTarget as bU, type DepositAddressesPendingResponse as bV, type DepositAddressesReadyResponse as bW, type DepositAddressesSupportedChain as bX, type DepositAddressesToken as bY, type DepositStep as bZ, type DiagnosticCallback as b_, type RampSessionRequest as ba, type RampWidgetSession as bb, type Candle as bc, ACTIVE_VENUES as bd, type Account as be, AccountProvider as bf, AccountType as bg, type AggAuthDeliveryMode as bh, type AggAuthPrivyVerifyBody as bi, type AggAuthProviderType as bj, type AggAuthWalletVerifyBody as bk, type AggClientAuthOptions as bl, type AggSessionUser as bm, type AggregatedOrderbookLevel as bn, type AggregatedOrderbookResponse as bo, type App as bp, type AppTradingMode as bq, type AttributedOrderbook as br, type AttributedOrderbookLevel as bs, type AuthCodeResponse as bt, type AuthTokenResponse as bu, type AuthUser as bv, type BalanceCustody as bw, type BalanceRefillAttemptStatus as bx, type BalanceRefillPolicyStatus as by, type BookQuality as bz, type ChartCandle as c, type PersistedAuthSnapshot as c$, type ExecuteManagedRequest as c0, type ExecuteTradeRequest as c1, type ExecuteTradeResponse as c2, type ExecutionDagProgress as c3, type ExecutionDisplayGroupStatus as c4, type ExecutionDisplayStepKind as c5, type ExecutionMode as c6, type ExecutionOverallState as c7, type ExecutionStatusOrder as c8, type ExecutionStatusStep as c9, type NewsFeedLinkedMarket as cA, type NewsFeedMarketFeedArticle as cB, type NewsFeedMarketFeedItem as cC, type NewsFeedMarketNewsResult as cD, type NonceResponse as cE, type NovigExecutionMode as cF, OPTIONAL_SIGNATURE_TIMEOUT_MS as cG, type OrderListItem as cH, OrderStatus as cI, OrderType as cJ, type OrderbookBatchItemError as cK, type OrderbookBatchItemErrorCode as cL, type OrderbookBatchItemStatus as cM, type OrderbookHistoryPoint as cN, type OrderbookHistoryResponse as cO, type OrderbookLevel as cP, type OrderbookQuoteFill as cQ, type OrderbookQuoteParams as cR, type OrderbookQuoteResponse as cS, type OrderbookServiceUnavailableError as cT, type OrderbooksOnlyError as cU, type OutcomeMidpoint as cV, type OutcomeMidpointRow as cW, type PaperTradingBalanceAdjustment as cX, type PaperTradingLiquidityStatus as cY, type PaperTradingMarkSource as cZ, type PaperTradingPosition as c_, type GetBalanceQuery as ca, type GetBalanceResponse as cb, type GetHoldingsQuery as cc, type GetHoldingsResponse as cd, type GetOrdersParams as ce, type GetOrdersQuery as cf, type GetPositionsQuery as cg, type HelloResponse as ch, type HistoryRangeRequest as ci, INACTIVE_VENUES as cj, type LeaderboardMetric as ck, type LeaderboardSeriesPoint as cl, type LimitOrderTimeInForce as cm, type MarkSource as cn, type MarketPriceHistory as co, type MarketView as cp, type MarketViewBatch as cq, MatchType as cr, type MatchedMidpoint as cs, type MatchedMidpointOutcome as ct, type MatchedOrderbookMarket as cu, type MatchedVenueMarketOutcomeRef as cv, type MidpointItem as cw, type MidpointRow as cx, type NewsFeedArticleFeedItem as cy, type NewsFeedArticleWithSummary as cz, type AggWebSocketDiagnostics as d, type UserActivityUserOp as d$, type PositionRedeemStatus as d0, type PricePoint as d1, type PriceSource as d2, type PricesHistoryResponse as d3, type ProphetxExecutionMode as d4, RECURRENCE_CADENCES as d5, type RecurrenceCadence as d6, type RecurringCryptoComparisonPoint as d7, type RecurringCryptoComparisonPriceSource as d8, type RecurringCryptoDuration as d9, type SignatureRequest as dA, type SignatureRequestType as dB, type SignerFn as dC, type SimpleOrderbookLevel as dD, type SmartRouteAllocation as dE, type SmartRouteBridgeStep as dF, type SmartRouteFeeBreakdown as dG, type SmartRouteFill as dH, type SmartRouteSettlementLeg as dI, type SmartRouteSettlementPlan as dJ, type SmartRouteSetupCostLine as dK, type SmartRouteSide as dL, type SmartRouteStatus as dM, type SmartRouteVenueFill as dN, type SportsGameStatus as dO, type SportsLiveParticipant as dP, type SportsLiveState as dQ, TERMINAL_EXECUTION_STATES as dR, TimeInForce as dS, type TradeExecutorOrder as dT, type TradeStep as dU, type UserActivityBridge as dV, type UserActivityDeposit as dW, type UserActivityRedeem as dX, type UserActivityRedeemLeg as dY, type UserActivityTrade as dZ, type UserActivityType as d_, type RecurringCryptoDurationInput as da, type RecurringCryptoMarketMetrics as db, type RecurringCryptoOrderbookDepthLevel as dc, type RecurringCryptoOrderbookDepthSide as dd, type RecurringCryptoOutcome as de, type RecurringCryptoOutcomeOrderbookDepth as df, type RecurringCryptoPriceComparison as dg, type RecurringCryptoReferencePrice as dh, type RecurringCryptoResolution as di, type RecurringCryptoSourceConfidence as dj, type RecurringCryptoVenueMarket as dk, type RecurringCryptoWindowComparisons as dl, type RecurringCryptoWindowMarket as dm, type RedeemLegResult as dn, type RedeemLegStatus as dp, type RequestedOrderbookMarket as dq, type ResolvedCorrelatedMarketsResponse as dr, SELF_CUSTODY_FILL_TIMEOUT_MS as ds, SELF_CUSTODY_POLL_INTERVAL_MS as dt, type ServerWallet as du, type SettlementDiff as dv, type SettlementDifference as dw, type SettlementSource as dx, type SetupDepositAddressStep as dy, type SetupVenueKeyStep as dz, type WsArbFeedBatch as e, applyOrderbookDelta as e$, type UserActivityWithdrawal as e0, VENUES as e1, VENUE_CHAIN_IDS as e2, type ValidateBalanceOnClientStep as e3, type ValidateManagedParams as e4, type ValidateManagedRequest as e5, type ValidateManagedResponse as e6, type ValidateTradeRequest as e7, type ValidateTradeResponse as e8, type VenueEventListItem as e9, type WsAttributedLevel as eA, type WsAuthenticated as eB, type WsBalanceUpdate as eC, type WsCandleInterval as eD, type WsClientMessage as eE, type WsConnected as eF, type WsError as eG, type WsHeartbeat as eH, type WsMarkSource as eI, type WsMarketResolved as eJ, type WsOrderEvent as eK, type WsOrderEventType as eL, type WsOrderSubmitted as eM, type WsOrderbookDelta as eN, type WsOrderbookSnapshot as eO, type WsRedeemEvent as eP, type WsServerMessage as eQ, type WsSubscribed as eR, type WsTrade as eS, type WsUnsubscribed as eT, type WsVenueBook as eU, type WsVenueInfo as eV, type WsVenueLevel as eW, type WsWithdrawalLegStatus as eX, type WsWithdrawalLifecycleEvent as eY, type WsWithdrawalLifecycleLeg as eZ, type WsWithdrawalLifecycleStatus as e_, type VenueEventWithMarkets as ea, type VenueGeoPolicyEntry as eb, type VenueMarketListItem as ec, type VenueMarketRef as ed, type VenueOrderbookEntry as ee, type VenueOrderbookLevel as ef, type VenuePositionBalance as eg, type VenuePriceInfo as eh, type VenueSoloQuote as ei, type VerifyBody as ej, type VerifyResponse as ek, type WalletChainBalance as el, type WalletTokenBalance as em, type WithdrawManagedRequest as en, type WithdrawManagedSourceItem as eo, type WithdrawTokenSymbol as ep, type WithdrawalExpected as eq, type WithdrawalLeg as er, type WithdrawalLegStatus as es, type WithdrawalLegType as et, type WithdrawalLifecycleStatus as eu, type WithdrawalSource as ev, type WithdrawalSourceItem as ew, type WithdrawalSourceStatus as ex, type WithdrawalSourceTokenSymbol as ey, type WsArbFeedEntry as ez, type AggWebSocketCallbacks as f, computeChecksum as f0, getEffectiveDisabledVenues as f1, isVenueActive as f2, isVenueDataVisible as f3, isVenueInactive as f4, snapshotToOrderbook as f5, type VenueMarket as g, type VenueMarketOutcome as h, type Orderbook as i, TradeSide$1 as j, type AggClientOptions as k, type AggClientSessionInput as l, type AuthStatus as m, type SiwsMessageParams as n, type AggAuthVerifyBody as o, type AggAuthStartBody as p, type AggAuthStartResult as q, type AggLinkAccountBody as r, type AggLinkAccountResult as s, type AggLinkAccountWalletConfirmBody as t, type AggLinkAccountConfirmResult as u, type UpdateUserBody as v, type UserHolding as w, type OrderListQuery as x, type TradeExecutorOrderListResponse as y, type ExecutionOrderItem as z };
|