@agg-build/sdk 4.36.0 → 4.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -24
- package/dist/{agg-websocket-BVu_Tnr3.mjs → agg-websocket-C9ELOadG.mjs} +324 -68
- package/dist/agg-websocket-C9ELOadG.mjs.map +1 -0
- package/dist/{agg-websocket-Dmrc-5lm.d.ts → agg-websocket-CY3PRo3_.d.mts} +109 -8
- package/dist/agg-websocket-CY3PRo3_.d.mts.map +1 -0
- package/dist/{agg-websocket-Dmrc-5lm.d.mts → agg-websocket-CY3PRo3_.d.ts} +109 -8
- package/dist/agg-websocket-CY3PRo3_.d.ts.map +1 -0
- package/dist/{agg-websocket-CsWEgt18.js → agg-websocket-Cq4E0T0f.js} +323 -67
- package/dist/browser.d.mts +1 -1
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +2 -1
- package/dist/browser.mjs +2 -1
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +47 -8
- package/dist/index.mjs +45 -9
- package/dist/index.mjs.map +1 -1
- package/dist/market-data.d.mts +1 -1
- package/dist/market-data.d.ts +1 -1
- package/dist/market-data.js +2 -1
- package/dist/market-data.mjs +2 -1
- package/dist/market-data.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/agg-websocket-BVu_Tnr3.mjs.map +0 -1
- package/dist/agg-websocket-Dmrc-5lm.d.mts.map +0 -1
- package/dist/agg-websocket-Dmrc-5lm.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as loadImmutableHistory, c as orderbookCrc32, i as snapshotToOrderbook, l as projectedOrderbookChecksum, n as applyOrderbookDelta, r as computeChecksum, s as readChartHistoryText, t as AggWebSocket } from "./agg-websocket-
|
|
1
|
+
import { a as loadImmutableHistory, c as orderbookCrc32, i as snapshotToOrderbook, l as projectedOrderbookChecksum, n as applyOrderbookDelta, r as computeChecksum, s as readChartHistoryText, t as AggWebSocket } from "./agg-websocket-C9ELOadG.mjs";
|
|
2
2
|
import { t as CandleBuilder } from "./candle-builder-BNewIe9K.mjs";
|
|
3
3
|
//#region ../common/src/enums/venue.ts
|
|
4
4
|
/** Use these constants instead of hardcoding "kalshi" or "polymarket". */
|
|
@@ -16,6 +16,7 @@ let Venue = /* @__PURE__ */ function(Venue) {
|
|
|
16
16
|
Venue["novig"] = "novig";
|
|
17
17
|
Venue["prophetx"] = "prophetx";
|
|
18
18
|
Venue["betdex"] = "betdex";
|
|
19
|
+
Venue["lighter"] = "lighter";
|
|
19
20
|
return Venue;
|
|
20
21
|
}({});
|
|
21
22
|
/** Single source of truth for venue identifiers. */
|
|
@@ -32,9 +33,12 @@ const VENUES = [
|
|
|
32
33
|
"hyperliquid",
|
|
33
34
|
"novig",
|
|
34
35
|
"prophetx",
|
|
35
|
-
"betdex"
|
|
36
|
+
"betdex",
|
|
37
|
+
"lighter"
|
|
36
38
|
];
|
|
37
|
-
/** Canonical destination chain for venues with on-chain funding or settlement.
|
|
39
|
+
/** Canonical destination chain for venues with on-chain funding or settlement.
|
|
40
|
+
* Lighter is absent: signing chain 304 and Relay funding chain 3586256 are
|
|
41
|
+
* different identities, so one map entry would pick the wrong rail. */
|
|
38
42
|
const VENUE_CHAIN_IDS = {
|
|
39
43
|
["kalshi"]: 792703809,
|
|
40
44
|
["polymarket"]: 137,
|
|
@@ -68,7 +72,8 @@ const ACTIVE_VENUES = [
|
|
|
68
72
|
"hyperliquid",
|
|
69
73
|
"novig",
|
|
70
74
|
"prophetx",
|
|
71
|
-
"betdex"
|
|
75
|
+
"betdex",
|
|
76
|
+
"lighter"
|
|
72
77
|
];
|
|
73
78
|
/**
|
|
74
79
|
* Venues excluded from new user-facing activity. BETDEX is active at the
|
|
@@ -96,7 +101,8 @@ const DEFAULT_DISABLED_VENUES = [
|
|
|
96
101
|
"tiprun",
|
|
97
102
|
"novig",
|
|
98
103
|
"prophetx",
|
|
99
|
-
"betdex"
|
|
104
|
+
"betdex",
|
|
105
|
+
"lighter"
|
|
100
106
|
];
|
|
101
107
|
const ACTIVE_VENUE_SET = new Set(ACTIVE_VENUES);
|
|
102
108
|
const INACTIVE_VENUE_SET = new Set(INACTIVE_VENUES);
|
|
@@ -676,6 +682,7 @@ const VENUE_SORT_ORDER = [
|
|
|
676
682
|
"predict",
|
|
677
683
|
"prophetx",
|
|
678
684
|
"betdex",
|
|
685
|
+
"lighter",
|
|
679
686
|
"kalshi",
|
|
680
687
|
"limitless",
|
|
681
688
|
"myriad",
|
|
@@ -1597,6 +1604,8 @@ var AggClient = class {
|
|
|
1597
1604
|
this.signer = options.signer;
|
|
1598
1605
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
1599
1606
|
this.wsUrl = options.wsUrl;
|
|
1607
|
+
this.orderbookUrl = options.orderbookUrl;
|
|
1608
|
+
this.orderbookLatency = options.orderbookLatency;
|
|
1600
1609
|
this.preferImmutableHistory = options.preferImmutableHistory ?? false;
|
|
1601
1610
|
this.webSocketFactory = options.webSocketFactory;
|
|
1602
1611
|
this.authOptions = options.auth;
|
|
@@ -2851,14 +2860,20 @@ var AggClient = class {
|
|
|
2851
2860
|
* browser Origin check). Never in a browser: browsers cannot set handshake
|
|
2852
2861
|
* headers, and keys must not ship there.
|
|
2853
2862
|
*/
|
|
2863
|
+
withAppId(raw) {
|
|
2864
|
+
const url = new URL(raw);
|
|
2865
|
+
if (this._appId) url.searchParams.set("appId", this._appId);
|
|
2866
|
+
return url.toString();
|
|
2867
|
+
}
|
|
2854
2868
|
webSocketOptions(webSocketImpl) {
|
|
2855
2869
|
if (!this.wsUrl) throw new Error("AggClient WebSockets require wsUrl to be set in client options");
|
|
2856
|
-
const url = new URL(this.wsUrl);
|
|
2857
|
-
if (this._appId) url.searchParams.set("appId", this._appId);
|
|
2858
2870
|
const isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
2859
2871
|
const headers = this.apiKey && !isBrowser ? { "x-app-api-key": this.apiKey } : void 0;
|
|
2872
|
+
const orderbookUrl = this.orderbookUrl ? this.withAppId(this.orderbookUrl) : void 0;
|
|
2860
2873
|
return {
|
|
2861
|
-
url:
|
|
2874
|
+
url: this.withAppId(this.wsUrl),
|
|
2875
|
+
...orderbookUrl ? { orderbookUrl } : {},
|
|
2876
|
+
...this.orderbookLatency ? { orderbookLatency: this.orderbookLatency } : {},
|
|
2862
2877
|
...headers ? { headers } : {},
|
|
2863
2878
|
...webSocketImpl ? { webSocketImpl } : {}
|
|
2864
2879
|
};
|
|
@@ -2876,6 +2891,8 @@ var AggClient = class {
|
|
|
2876
2891
|
if (this.apiKey) watchdogHeaders["x-app-api-key"] = this.apiKey;
|
|
2877
2892
|
const socket = createSocket({
|
|
2878
2893
|
...this.webSocketOptions(options?.webSocketImpl),
|
|
2894
|
+
...options?.orderbookUrl ? { orderbookUrl: this.withAppId(options.orderbookUrl) } : {},
|
|
2895
|
+
...options?.orderbookLatency ? { orderbookLatency: options.orderbookLatency } : {},
|
|
2879
2896
|
callbacks,
|
|
2880
2897
|
initialToken: this.accessToken,
|
|
2881
2898
|
enableLogs: options?.enableLogs ?? false,
|
|
@@ -3550,11 +3567,30 @@ async function prepareHostedVenueRoute(client, options) {
|
|
|
3550
3567
|
return quote;
|
|
3551
3568
|
}
|
|
3552
3569
|
//#endregion
|
|
3570
|
+
//#region src/lighter-netting.ts
|
|
3571
|
+
/**
|
|
3572
|
+
* Lighter native netting. A sell may close current exposure and then open
|
|
3573
|
+
* the opposite side, including market and immediate-or-cancel orders.
|
|
3574
|
+
* Reduce-only stays 0. This is not a close-only guarantee.
|
|
3575
|
+
*/
|
|
3576
|
+
const NATIVE_NETTING_SELLS_MAY_OPEN_OPPOSITE_EXPOSURE = true;
|
|
3577
|
+
const LIGHTER_REDUCE_ONLY = 0;
|
|
3578
|
+
const LIGHTER_ORDER_DISCLOSURE_TEXT = "A sell can close current exposure and then open the opposite side. Opposite exposure can follow a sell, including market and immediate-or-cancel orders. Lighter does not offer a close-only guarantee.";
|
|
3579
|
+
function lighterOrderDisclosure() {
|
|
3580
|
+
return {
|
|
3581
|
+
nativeNetting: true,
|
|
3582
|
+
sellsMayOpenOppositeExposure: true,
|
|
3583
|
+
closeOnly: false,
|
|
3584
|
+
reduceOnly: 0,
|
|
3585
|
+
text: LIGHTER_ORDER_DISCLOSURE_TEXT
|
|
3586
|
+
};
|
|
3587
|
+
}
|
|
3588
|
+
//#endregion
|
|
3553
3589
|
//#region src/index.ts
|
|
3554
3590
|
function createAggClient(options) {
|
|
3555
3591
|
return new AggClient(options);
|
|
3556
3592
|
}
|
|
3557
3593
|
//#endregion
|
|
3558
|
-
export { ACTIVE_VENUES, AccountProvider, AccountType, AggApiError, AggClient, AggWebSocket, CATALOG_DEFAULT_OVERLAP_MS, CONFIRMED_MATCH_STATUSES, CandleBuilder, Chain, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, IMAGE_SIZES, INACTIVE_VENUES, ImageSize, LIMIT_PRICE_RAW_SCALE, MarketStatus, MatchStatus, MatchType, OPTIONAL_FEE_SIGNATURE_TIMEOUT_MS, OPTIONAL_SIGNATURE_TIMEOUT_MS, OrderStatus, OrderType, RECURRENCE_CADENCES, RETINA_IMAGE_SIZES, SELF_CUSTODY_FILL_TIMEOUT_MS, SELF_CUSTODY_POLL_INTERVAL_MS, TERMINAL_EXECUTION_STATES, TimeInForce, TradeSide, TurnstileChallengeError, VENUES, VENUE_CHAIN_IDS, Venue, adjustLimitPriceRawToTick, aggregateMidpoint, applyOrderbookDelta, areOrdersFilled, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isCatalogResyncRequired, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isOptionalFeeRequest, isOrderSignatureStep, isPolymarketOrderSignatureStep, isPostFillFeeRequest, isSameWalletAddress, isVenueActive, isVenueDataVisible, isVenueInactive, loadImmutableHistory, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, orderSignatureRound, orderbookCrc32, parse, parseEmail, parseEmailStrict, prepareHostedVenueFunding, prepareHostedVenueRoute, projectedOrderbookChecksum, retinaImageUrl, safeParse, signatureTimeoutMs, snapshotToOrderbook, sortVenues, toChecksumAddress, userSignerAddresses, withTimeout };
|
|
3594
|
+
export { ACTIVE_VENUES, AccountProvider, AccountType, AggApiError, AggClient, AggWebSocket, CATALOG_DEFAULT_OVERLAP_MS, CONFIRMED_MATCH_STATUSES, CandleBuilder, Chain, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, IMAGE_SIZES, INACTIVE_VENUES, ImageSize, LIGHTER_REDUCE_ONLY, LIMIT_PRICE_RAW_SCALE, MarketStatus, MatchStatus, MatchType, NATIVE_NETTING_SELLS_MAY_OPEN_OPPOSITE_EXPOSURE, OPTIONAL_FEE_SIGNATURE_TIMEOUT_MS, OPTIONAL_SIGNATURE_TIMEOUT_MS, OrderStatus, OrderType, RECURRENCE_CADENCES, RETINA_IMAGE_SIZES, SELF_CUSTODY_FILL_TIMEOUT_MS, SELF_CUSTODY_POLL_INTERVAL_MS, TERMINAL_EXECUTION_STATES, TimeInForce, TradeSide, TurnstileChallengeError, VENUES, VENUE_CHAIN_IDS, Venue, adjustLimitPriceRawToTick, aggregateMidpoint, applyOrderbookDelta, areOrdersFilled, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isCatalogResyncRequired, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isOptionalFeeRequest, isOrderSignatureStep, isPolymarketOrderSignatureStep, isPostFillFeeRequest, isSameWalletAddress, isVenueActive, isVenueDataVisible, isVenueInactive, lighterOrderDisclosure, loadImmutableHistory, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, orderSignatureRound, orderbookCrc32, parse, parseEmail, parseEmailStrict, prepareHostedVenueFunding, prepareHostedVenueRoute, projectedOrderbookChecksum, retinaImageUrl, safeParse, signatureTimeoutMs, snapshotToOrderbook, sortVenues, toChecksumAddress, userSignerAddresses, withTimeout };
|
|
3559
3595
|
|
|
3560
3596
|
//# sourceMappingURL=index.mjs.map
|