@agg-build/sdk 1.3.0 → 2.1.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/{chunk-AXBFBHS2.mjs → chunk-WNQUEZJF.mjs} +13 -0
- package/dist/index.d.mts +622 -5
- package/dist/index.d.ts +622 -5
- package/dist/index.js +364 -6
- package/dist/index.mjs +351 -7
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20,6 +20,18 @@ var __spreadValues = (a, b) => {
|
|
|
20
20
|
return a;
|
|
21
21
|
};
|
|
22
22
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
23
35
|
var __export = (target, all) => {
|
|
24
36
|
for (var name in all)
|
|
25
37
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -70,6 +82,9 @@ __export(index_exports, {
|
|
|
70
82
|
MatchStatus: () => MatchStatus,
|
|
71
83
|
MatchType: () => MatchType,
|
|
72
84
|
OrderStatus: () => OrderStatus,
|
|
85
|
+
OrderType: () => OrderType,
|
|
86
|
+
RECURRENCE_CADENCES: () => RECURRENCE_CADENCES,
|
|
87
|
+
TimeInForce: () => TimeInForce,
|
|
73
88
|
TradeSide: () => TradeSide,
|
|
74
89
|
TurnstileChallengeError: () => TurnstileChallengeError,
|
|
75
90
|
VENUES: () => VENUES,
|
|
@@ -193,8 +208,14 @@ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
|
193
208
|
OrderStatus2["pending_bridge"] = "pending_bridge";
|
|
194
209
|
OrderStatus2["submitting"] = "submitting";
|
|
195
210
|
OrderStatus2["submitted"] = "submitted";
|
|
211
|
+
OrderStatus2["open"] = "open";
|
|
212
|
+
OrderStatus2["partially_filled_open"] = "partially_filled_open";
|
|
213
|
+
OrderStatus2["cancel_pending"] = "cancel_pending";
|
|
196
214
|
OrderStatus2["filled"] = "filled";
|
|
197
215
|
OrderStatus2["partial_fill"] = "partial_fill";
|
|
216
|
+
OrderStatus2["failed"] = "failed";
|
|
217
|
+
OrderStatus2["expired"] = "expired";
|
|
218
|
+
OrderStatus2["cancelled"] = "cancelled";
|
|
198
219
|
return OrderStatus2;
|
|
199
220
|
})(OrderStatus || {});
|
|
200
221
|
var TradeSide = /* @__PURE__ */ ((TradeSide2) => {
|
|
@@ -202,6 +223,20 @@ var TradeSide = /* @__PURE__ */ ((TradeSide2) => {
|
|
|
202
223
|
TradeSide2["Sell"] = "sell";
|
|
203
224
|
return TradeSide2;
|
|
204
225
|
})(TradeSide || {});
|
|
226
|
+
var OrderType = /* @__PURE__ */ ((OrderType2) => {
|
|
227
|
+
OrderType2["Market"] = "market";
|
|
228
|
+
OrderType2["Limit"] = "limit";
|
|
229
|
+
return OrderType2;
|
|
230
|
+
})(OrderType || {});
|
|
231
|
+
var TimeInForce = /* @__PURE__ */ ((TimeInForce2) => {
|
|
232
|
+
TimeInForce2["GTC"] = "GTC";
|
|
233
|
+
TimeInForce2["GTD"] = "GTD";
|
|
234
|
+
TimeInForce2["FOK"] = "FOK";
|
|
235
|
+
TimeInForce2["FAK"] = "FAK";
|
|
236
|
+
TimeInForce2["IOC"] = "IOC";
|
|
237
|
+
TimeInForce2["ALO"] = "ALO";
|
|
238
|
+
return TimeInForce2;
|
|
239
|
+
})(TimeInForce || {});
|
|
205
240
|
|
|
206
241
|
// ../common/src/utils/format-market-display.ts
|
|
207
242
|
function formatOutcomeLabel(venue, outcome, _market) {
|
|
@@ -1557,6 +1592,8 @@ var AggWebSocket = class {
|
|
|
1557
1592
|
|
|
1558
1593
|
// src/client.ts
|
|
1559
1594
|
var COOKIE_REFRESH_DELIVERY = "cookie-refresh";
|
|
1595
|
+
var DEFAULT_MIDPOINT_IDS_PER_REQUEST = 75;
|
|
1596
|
+
var MAX_MIDPOINT_IDS_PER_REQUEST = 200;
|
|
1560
1597
|
var isUserProfile = (user) => {
|
|
1561
1598
|
return "accounts" in user && "wallets" in user && "avatarUrl" in user;
|
|
1562
1599
|
};
|
|
@@ -1590,6 +1627,17 @@ var normalizeSessionUser = (user, currentUser) => {
|
|
|
1590
1627
|
walletAddress: null
|
|
1591
1628
|
});
|
|
1592
1629
|
};
|
|
1630
|
+
var resolveMidpointIdsPerRequest = (value) => {
|
|
1631
|
+
if (value == null || !Number.isFinite(value)) return DEFAULT_MIDPOINT_IDS_PER_REQUEST;
|
|
1632
|
+
return Math.min(MAX_MIDPOINT_IDS_PER_REQUEST, Math.max(1, Math.floor(value)));
|
|
1633
|
+
};
|
|
1634
|
+
var chunkArray = (items, size) => {
|
|
1635
|
+
const chunks = [];
|
|
1636
|
+
for (let index = 0; index < items.length; index += size) {
|
|
1637
|
+
chunks.push(items.slice(index, index + size));
|
|
1638
|
+
}
|
|
1639
|
+
return chunks;
|
|
1640
|
+
};
|
|
1593
1641
|
var mapChartResolution = (resolution) => {
|
|
1594
1642
|
switch (resolution) {
|
|
1595
1643
|
case void 0:
|
|
@@ -1634,6 +1682,27 @@ var AggClient = class {
|
|
|
1634
1682
|
this.restoreSession();
|
|
1635
1683
|
this.initAuthChannel();
|
|
1636
1684
|
}
|
|
1685
|
+
resolvePaperTradingAppId(appId) {
|
|
1686
|
+
const resolvedAppId = appId != null ? appId : this.appId;
|
|
1687
|
+
if (!resolvedAppId) {
|
|
1688
|
+
throw new Error(
|
|
1689
|
+
"Paper trading account methods require appId in client options or method options"
|
|
1690
|
+
);
|
|
1691
|
+
}
|
|
1692
|
+
return encodeURIComponent(resolvedAppId);
|
|
1693
|
+
}
|
|
1694
|
+
paperTradingAccountsPath(appId) {
|
|
1695
|
+
return `/apps/${this.resolvePaperTradingAppId(appId)}/paper-trading/accounts`;
|
|
1696
|
+
}
|
|
1697
|
+
paperTradingAccountPath(accountId, appId) {
|
|
1698
|
+
return `${this.paperTradingAccountsPath(appId)}/${encodeURIComponent(accountId)}`;
|
|
1699
|
+
}
|
|
1700
|
+
paperTradingListQuery(params = {}) {
|
|
1701
|
+
const query = {};
|
|
1702
|
+
if (params.limit != null) query.limit = String(params.limit);
|
|
1703
|
+
if (params.cursor) query.cursor = params.cursor;
|
|
1704
|
+
return Object.keys(query).length ? query : void 0;
|
|
1705
|
+
}
|
|
1637
1706
|
withAuthPayload(payload) {
|
|
1638
1707
|
var _a, _b, _c;
|
|
1639
1708
|
if (typeof payload.earlyAccessCode === "string" && payload.earlyAccessCode.trim().length > 0) {
|
|
@@ -2263,6 +2332,100 @@ Issued At: ${issuedAt}`;
|
|
|
2263
2332
|
});
|
|
2264
2333
|
});
|
|
2265
2334
|
}
|
|
2335
|
+
/** Create a server-managed paper trading account for an app. Requires adminKey or apiKey. */
|
|
2336
|
+
createPaperTradingAccount(params, options) {
|
|
2337
|
+
return __async(this, null, function* () {
|
|
2338
|
+
return this.request(this.paperTradingAccountsPath(options == null ? void 0 : options.appId), {
|
|
2339
|
+
method: "POST",
|
|
2340
|
+
body: JSON.stringify(params)
|
|
2341
|
+
});
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
/** List server-managed paper trading accounts for an app. Requires adminKey or apiKey. */
|
|
2345
|
+
listPaperTradingAccounts() {
|
|
2346
|
+
return __async(this, arguments, function* (params = {}) {
|
|
2347
|
+
const _a = params, { appId } = _a, listParams = __objRest(_a, ["appId"]);
|
|
2348
|
+
return this.request(this.paperTradingAccountsPath(appId), {
|
|
2349
|
+
query: this.paperTradingListQuery(listParams)
|
|
2350
|
+
});
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2353
|
+
/** Fetch a server-managed paper trading account. Requires adminKey or apiKey. */
|
|
2354
|
+
getPaperTradingAccount(accountId, options) {
|
|
2355
|
+
return __async(this, null, function* () {
|
|
2356
|
+
return this.request(
|
|
2357
|
+
this.paperTradingAccountPath(accountId, options == null ? void 0 : options.appId)
|
|
2358
|
+
);
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2361
|
+
/** Set a paper trading account cash balance. Requires adminKey or apiKey. */
|
|
2362
|
+
setPaperTradingBalance(accountId, params, options) {
|
|
2363
|
+
return __async(this, null, function* () {
|
|
2364
|
+
return this.request(
|
|
2365
|
+
`${this.paperTradingAccountPath(accountId, options == null ? void 0 : options.appId)}/balance`,
|
|
2366
|
+
{
|
|
2367
|
+
method: "PATCH",
|
|
2368
|
+
body: JSON.stringify(params)
|
|
2369
|
+
}
|
|
2370
|
+
);
|
|
2371
|
+
});
|
|
2372
|
+
}
|
|
2373
|
+
/** Clear positions and reset cash for a paper trading account. Requires adminKey or apiKey. */
|
|
2374
|
+
resetPaperTradingAccount(_0) {
|
|
2375
|
+
return __async(this, arguments, function* (accountId, params = {}, options) {
|
|
2376
|
+
return this.request(
|
|
2377
|
+
`${this.paperTradingAccountPath(accountId, options == null ? void 0 : options.appId)}/reset`,
|
|
2378
|
+
{
|
|
2379
|
+
method: "POST",
|
|
2380
|
+
body: JSON.stringify(params)
|
|
2381
|
+
}
|
|
2382
|
+
);
|
|
2383
|
+
});
|
|
2384
|
+
}
|
|
2385
|
+
/** Place a direct simulated order in a paper trading account. Requires adminKey or apiKey. */
|
|
2386
|
+
placePaperTradingOrder(accountId, params, options) {
|
|
2387
|
+
return __async(this, null, function* () {
|
|
2388
|
+
return this.request(
|
|
2389
|
+
`${this.paperTradingAccountPath(accountId, options == null ? void 0 : options.appId)}/orders`,
|
|
2390
|
+
{
|
|
2391
|
+
method: "POST",
|
|
2392
|
+
body: JSON.stringify(params)
|
|
2393
|
+
}
|
|
2394
|
+
);
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2397
|
+
/** List positions for a server-managed paper trading account. Requires adminKey or apiKey. */
|
|
2398
|
+
listPaperTradingPositions(_0) {
|
|
2399
|
+
return __async(this, arguments, function* (accountId, params = {}) {
|
|
2400
|
+
const _a = params, { appId } = _a, listParams = __objRest(_a, ["appId"]);
|
|
2401
|
+
return this.request(
|
|
2402
|
+
`${this.paperTradingAccountPath(accountId, appId)}/positions`,
|
|
2403
|
+
{
|
|
2404
|
+
query: this.paperTradingListQuery(listParams)
|
|
2405
|
+
}
|
|
2406
|
+
);
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
/** List orders for a server-managed paper trading account. Requires adminKey or apiKey. */
|
|
2410
|
+
listPaperTradingOrders(_0) {
|
|
2411
|
+
return __async(this, arguments, function* (accountId, params = {}) {
|
|
2412
|
+
const _a = params, { appId } = _a, listParams = __objRest(_a, ["appId"]);
|
|
2413
|
+
return this.request(
|
|
2414
|
+
`${this.paperTradingAccountPath(accountId, appId)}/orders`,
|
|
2415
|
+
{
|
|
2416
|
+
query: this.paperTradingListQuery(listParams)
|
|
2417
|
+
}
|
|
2418
|
+
);
|
|
2419
|
+
});
|
|
2420
|
+
}
|
|
2421
|
+
/** Fetch account-level paper trading equity, P&L, and marked positions. Requires adminKey or apiKey. */
|
|
2422
|
+
getPaperTradingPortfolio(accountId, options) {
|
|
2423
|
+
return __async(this, null, function* () {
|
|
2424
|
+
return this.request(
|
|
2425
|
+
`${this.paperTradingAccountPath(accountId, options == null ? void 0 : options.appId)}/portfolio`
|
|
2426
|
+
);
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2266
2429
|
/** Cancel a pending managed execution by order id. */
|
|
2267
2430
|
cancelManagedOrder(orderId, options) {
|
|
2268
2431
|
return __async(this, null, function* () {
|
|
@@ -2310,6 +2473,92 @@ Issued At: ${issuedAt}`;
|
|
|
2310
2473
|
});
|
|
2311
2474
|
});
|
|
2312
2475
|
}
|
|
2476
|
+
/** List deterministic recurring crypto window markets across venues. Requires appId or admin auth. */
|
|
2477
|
+
listRecurringCryptoMarkets(options) {
|
|
2478
|
+
return __async(this, null, function* () {
|
|
2479
|
+
const query = {};
|
|
2480
|
+
if ((options == null ? void 0 : options.assets) && options.assets.length > 0) query.assets = options.assets;
|
|
2481
|
+
if ((options == null ? void 0 : options.durations) && options.durations.length > 0) query.durations = options.durations;
|
|
2482
|
+
if (options == null ? void 0 : options.interval) query.interval = options.interval;
|
|
2483
|
+
if (options == null ? void 0 : options.window) query.window = options.window;
|
|
2484
|
+
if ((options == null ? void 0 : options.venues) && options.venues.length > 0) query.venues = options.venues;
|
|
2485
|
+
if ((options == null ? void 0 : options.status) && options.status.length > 0) query.status = options.status;
|
|
2486
|
+
if (options == null ? void 0 : options.windowStartFrom) query.windowStartFrom = options.windowStartFrom;
|
|
2487
|
+
if (options == null ? void 0 : options.windowStartTo) query.windowStartTo = options.windowStartTo;
|
|
2488
|
+
if (options == null ? void 0 : options.cursor) query.cursor = options.cursor;
|
|
2489
|
+
if ((options == null ? void 0 : options.limit) != null) query.limit = String(options.limit);
|
|
2490
|
+
if ((options == null ? void 0 : options.includeOrderbookPrices) != null) {
|
|
2491
|
+
query.includeOrderbookPrices = String(options.includeOrderbookPrices);
|
|
2492
|
+
}
|
|
2493
|
+
if ((options == null ? void 0 : options.includeReferencePrices) != null) {
|
|
2494
|
+
query.includeReferencePrices = String(options.includeReferencePrices);
|
|
2495
|
+
}
|
|
2496
|
+
if ((options == null ? void 0 : options.includeDirectVenueMarkets) != null) {
|
|
2497
|
+
query.includeDirectVenueMarkets = String(options.includeDirectVenueMarkets);
|
|
2498
|
+
}
|
|
2499
|
+
return this.request("/crypto/recurring-markets", {
|
|
2500
|
+
query: Object.keys(query).length > 0 ? query : void 0,
|
|
2501
|
+
signal: options == null ? void 0 : options.signal
|
|
2502
|
+
});
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
/** Poll fresh reference prices for recurring crypto markets. Requires appId or admin auth. */
|
|
2506
|
+
getCryptoReferencePrices(options) {
|
|
2507
|
+
return __async(this, null, function* () {
|
|
2508
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2509
|
+
const targets = [
|
|
2510
|
+
...(_a = options.targets) != null ? _a : [],
|
|
2511
|
+
...((_b = options.venueMarketIds) != null ? _b : []).map((venueMarketId) => ({
|
|
2512
|
+
type: "venueMarket",
|
|
2513
|
+
venueMarketId
|
|
2514
|
+
})),
|
|
2515
|
+
...((_c = options.venueEventIds) != null ? _c : []).map((venueEventId) => ({
|
|
2516
|
+
type: "venueEvent",
|
|
2517
|
+
venueEventId
|
|
2518
|
+
})),
|
|
2519
|
+
...((_d = options.externalMarkets) != null ? _d : []).map((market) => ({
|
|
2520
|
+
type: "externalVenueMarket",
|
|
2521
|
+
venue: market.venue,
|
|
2522
|
+
externalMarketId: market.externalMarketId
|
|
2523
|
+
})),
|
|
2524
|
+
...((_e = options.markets) != null ? _e : []).map((market) => {
|
|
2525
|
+
var _a2;
|
|
2526
|
+
return {
|
|
2527
|
+
type: "market",
|
|
2528
|
+
venue: market.venue,
|
|
2529
|
+
venueEventId: market.venueEventId,
|
|
2530
|
+
venueMarketId: market.venueMarketId,
|
|
2531
|
+
externalEventId: market.externalEventId,
|
|
2532
|
+
externalMarketId: market.externalMarketId,
|
|
2533
|
+
asset: market.asset,
|
|
2534
|
+
quoteAsset: (_a2 = market.quoteAsset) != null ? _a2 : "USD",
|
|
2535
|
+
resolution: market.resolution
|
|
2536
|
+
};
|
|
2537
|
+
}),
|
|
2538
|
+
...((_f = options.windowMarkets) != null ? _f : []).flatMap(
|
|
2539
|
+
(windowMarket) => windowMarket.markets.map((market) => ({
|
|
2540
|
+
type: "market",
|
|
2541
|
+
venue: market.venue,
|
|
2542
|
+
venueEventId: market.venueEventId,
|
|
2543
|
+
venueMarketId: market.venueMarketId,
|
|
2544
|
+
externalEventId: market.externalEventId,
|
|
2545
|
+
externalMarketId: market.externalMarketId,
|
|
2546
|
+
asset: windowMarket.asset,
|
|
2547
|
+
quoteAsset: windowMarket.quoteAsset,
|
|
2548
|
+
resolution: market.resolution
|
|
2549
|
+
}))
|
|
2550
|
+
)
|
|
2551
|
+
];
|
|
2552
|
+
if (targets.length === 0) {
|
|
2553
|
+
throw new Error("getCryptoReferencePrices requires at least one target");
|
|
2554
|
+
}
|
|
2555
|
+
return this.request("/crypto/reference-prices", {
|
|
2556
|
+
method: "POST",
|
|
2557
|
+
body: JSON.stringify({ targets }),
|
|
2558
|
+
signal: options.signal
|
|
2559
|
+
});
|
|
2560
|
+
});
|
|
2561
|
+
}
|
|
2313
2562
|
/** List venue markets with optional filters. Requires appId or admin auth. Supports cursor-based pagination. */
|
|
2314
2563
|
getVenueMarkets(options) {
|
|
2315
2564
|
return __async(this, null, function* () {
|
|
@@ -2349,6 +2598,61 @@ Issued At: ${issuedAt}`;
|
|
|
2349
2598
|
return this.request("/app/config", init);
|
|
2350
2599
|
});
|
|
2351
2600
|
}
|
|
2601
|
+
buildNewsFeedQuery(options) {
|
|
2602
|
+
const query = {};
|
|
2603
|
+
if (options == null ? void 0 : options.cursor) query.cursor = options.cursor;
|
|
2604
|
+
if (options == null ? void 0 : options.since) query.since = options.since;
|
|
2605
|
+
if (options == null ? void 0 : options.before) query.before = options.before;
|
|
2606
|
+
if ((options == null ? void 0 : options.limit) != null) query.limit = String(options.limit);
|
|
2607
|
+
return Object.keys(query).length > 0 ? query : void 0;
|
|
2608
|
+
}
|
|
2609
|
+
/** List available market news feeds and item counts. */
|
|
2610
|
+
getNewsFeeds(options) {
|
|
2611
|
+
return __async(this, null, function* () {
|
|
2612
|
+
return this.request("/news-feed", {
|
|
2613
|
+
signal: options == null ? void 0 : options.signal
|
|
2614
|
+
});
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
/** Get the article-centric market news feed for a category. */
|
|
2618
|
+
getNewsFeed(category, options) {
|
|
2619
|
+
return __async(this, null, function* () {
|
|
2620
|
+
return this.request(`/news-feed/${encodeURIComponent(category)}`, {
|
|
2621
|
+
query: this.buildNewsFeedQuery(options),
|
|
2622
|
+
signal: options == null ? void 0 : options.signal
|
|
2623
|
+
});
|
|
2624
|
+
});
|
|
2625
|
+
}
|
|
2626
|
+
/** Get the market-centric market news feed for a category. */
|
|
2627
|
+
getNewsFeedMarkets(category, options) {
|
|
2628
|
+
return __async(this, null, function* () {
|
|
2629
|
+
return this.request(
|
|
2630
|
+
`/news-feed/${encodeURIComponent(category)}/markets`,
|
|
2631
|
+
{
|
|
2632
|
+
query: this.buildNewsFeedQuery(options),
|
|
2633
|
+
signal: options == null ? void 0 : options.signal
|
|
2634
|
+
}
|
|
2635
|
+
);
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
/** Get news feed coverage and per-category counts. */
|
|
2639
|
+
getNewsFeedStatus(options) {
|
|
2640
|
+
return __async(this, null, function* () {
|
|
2641
|
+
return this.request("/news-feed/status", {
|
|
2642
|
+
signal: options == null ? void 0 : options.signal
|
|
2643
|
+
});
|
|
2644
|
+
});
|
|
2645
|
+
}
|
|
2646
|
+
/** Search recent news for specific markets and return market impact summaries. */
|
|
2647
|
+
getMarketNews(params, options) {
|
|
2648
|
+
return __async(this, null, function* () {
|
|
2649
|
+
return this.request("/news-feed/market-news", {
|
|
2650
|
+
method: "POST",
|
|
2651
|
+
body: JSON.stringify(params),
|
|
2652
|
+
signal: options == null ? void 0 : options.signal
|
|
2653
|
+
});
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2352
2656
|
/**
|
|
2353
2657
|
* Search events or markets by query string. Supports cursor-based pagination.
|
|
2354
2658
|
*
|
|
@@ -2460,14 +2764,27 @@ Issued At: ${issuedAt}`;
|
|
|
2460
2764
|
}
|
|
2461
2765
|
getMidpoints(paramsOrVenueMarketIds, options) {
|
|
2462
2766
|
return __async(this, null, function* () {
|
|
2767
|
+
var _a;
|
|
2463
2768
|
const venueMarketIds = Array.isArray(paramsOrVenueMarketIds) ? paramsOrVenueMarketIds : paramsOrVenueMarketIds.venueMarketIds;
|
|
2464
2769
|
const bestPrice = !Array.isArray(paramsOrVenueMarketIds) ? paramsOrVenueMarketIds.bestPrice : options == null ? void 0 : options.bestPrice;
|
|
2465
|
-
const
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2770
|
+
const maxMidpointIdsPerRequest = resolveMidpointIdsPerRequest(
|
|
2771
|
+
(_a = options == null ? void 0 : options.maxMidpointIdsPerRequest) != null ? _a : Array.isArray(paramsOrVenueMarketIds) ? void 0 : paramsOrVenueMarketIds.maxMidpointIdsPerRequest
|
|
2772
|
+
);
|
|
2773
|
+
const requestBatch = (batchVenueMarketIds) => {
|
|
2774
|
+
const query = { venueMarketIds: batchVenueMarketIds };
|
|
2775
|
+
if (bestPrice) query.bestPrice = "true";
|
|
2776
|
+
return this.request("/midpoints", {
|
|
2777
|
+
query,
|
|
2778
|
+
signal: options == null ? void 0 : options.signal
|
|
2779
|
+
});
|
|
2780
|
+
};
|
|
2781
|
+
if (venueMarketIds.length <= maxMidpointIdsPerRequest) {
|
|
2782
|
+
return requestBatch(venueMarketIds);
|
|
2783
|
+
}
|
|
2784
|
+
const responses = yield Promise.all(
|
|
2785
|
+
chunkArray(venueMarketIds, maxMidpointIdsPerRequest).map((batch) => requestBatch(batch))
|
|
2786
|
+
);
|
|
2787
|
+
return { data: responses.flatMap((response) => response.data) };
|
|
2471
2788
|
});
|
|
2472
2789
|
}
|
|
2473
2790
|
/** Get a single outcome-level orderbook from the engine. */
|
|
@@ -2571,6 +2888,19 @@ Issued At: ${issuedAt}`;
|
|
|
2571
2888
|
});
|
|
2572
2889
|
});
|
|
2573
2890
|
}
|
|
2891
|
+
/**
|
|
2892
|
+
* Preview a withdrawal — real fee + receive estimate without creating one.
|
|
2893
|
+
* Optional: `withdrawManaged` does NOT require a prior preview, so partners
|
|
2894
|
+
* integrating against the SDK can ignore this entirely.
|
|
2895
|
+
*/
|
|
2896
|
+
withdrawPreview(params) {
|
|
2897
|
+
return __async(this, null, function* () {
|
|
2898
|
+
return this.request("/execution/withdraw/preview", {
|
|
2899
|
+
method: "POST",
|
|
2900
|
+
body: JSON.stringify(params)
|
|
2901
|
+
});
|
|
2902
|
+
});
|
|
2903
|
+
}
|
|
2574
2904
|
/**
|
|
2575
2905
|
* Read the current persisted state of a withdrawal. Used as a backfill for
|
|
2576
2906
|
* the WS lifecycle channel: the client polls this on hook mount and on WS
|
|
@@ -2603,6 +2933,19 @@ Issued At: ${issuedAt}`;
|
|
|
2603
2933
|
return this.request("/execution/deposit-addresses");
|
|
2604
2934
|
});
|
|
2605
2935
|
}
|
|
2936
|
+
/**
|
|
2937
|
+
* Internal: record that a deposit tx was initiated via the in-app
|
|
2938
|
+
* connected-wallet flow, so the activity feed can label it correctly.
|
|
2939
|
+
* Best-effort — callers should not block the UX on this.
|
|
2940
|
+
*/
|
|
2941
|
+
recordDepositIntent(body) {
|
|
2942
|
+
return __async(this, null, function* () {
|
|
2943
|
+
yield this.request(
|
|
2944
|
+
"/execution/deposit-intent",
|
|
2945
|
+
this.buildAuthRequestInit({ method: "POST", body: JSON.stringify(body) })
|
|
2946
|
+
);
|
|
2947
|
+
});
|
|
2948
|
+
}
|
|
2606
2949
|
/** Get open positions grouped by matched market with per-venue breakdown. */
|
|
2607
2950
|
getPositions(params) {
|
|
2608
2951
|
return __async(this, null, function* () {
|
|
@@ -2649,6 +2992,18 @@ Issued At: ${issuedAt}`;
|
|
|
2649
2992
|
// src/best-split.ts
|
|
2650
2993
|
var computeBestSplitsByAmount2 = computeBestSplitsByAmount;
|
|
2651
2994
|
|
|
2995
|
+
// src/types.ts
|
|
2996
|
+
var RECURRENCE_CADENCES = [
|
|
2997
|
+
"PT5M",
|
|
2998
|
+
"PT10M",
|
|
2999
|
+
"PT15M",
|
|
3000
|
+
"PT1H",
|
|
3001
|
+
"P1D",
|
|
3002
|
+
"P1W",
|
|
3003
|
+
"P1M",
|
|
3004
|
+
"P1Y"
|
|
3005
|
+
];
|
|
3006
|
+
|
|
2652
3007
|
// src/errors.ts
|
|
2653
3008
|
var TurnstileChallengeError = class extends Error {
|
|
2654
3009
|
constructor(siteKey) {
|
|
@@ -2861,6 +3216,9 @@ function createAggClient(options) {
|
|
|
2861
3216
|
MatchStatus,
|
|
2862
3217
|
MatchType,
|
|
2863
3218
|
OrderStatus,
|
|
3219
|
+
OrderType,
|
|
3220
|
+
RECURRENCE_CADENCES,
|
|
3221
|
+
TimeInForce,
|
|
2864
3222
|
TradeSide,
|
|
2865
3223
|
TurnstileChallengeError,
|
|
2866
3224
|
VENUES,
|