@stxapp/stx-typescript 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.2 (2026-10-15)
4
+
5
+ - `createMarkets()` sends each market in the form the exchange takes, `{ rule: "player_stat_line", player_id, stat, line }`. Markets sent by 0.8.0 and 0.8.1 came back `rejected` with `invalid_market`.
6
+ - `createMarkets(eventId, markets, { dryRun: true })` runs every check on STX and creates nothing; a market that would be created comes back `valid`.
7
+ - Each result carries `index` (its position in the list you passed), `market_id`, `reason` (`null` unless rejected) and `market`, the market as you requested it. Rejection reasons follow the exchange: `invalid_market`, `unsupported_rule`, `unsupported_stat`, `invalid_line`, `unknown_player`, `event_not_open` and `not_created`.
8
+ - `propType` is no longer sent; a player stat line is always over/under.
9
+
10
+ ## 0.8.1 (2026-10-12)
11
+
12
+ - Combos (preview: available on US demo; may change before general availability). `ws.comboPlayer()` requests quotes on a combination, cashes one out, accepts, cancels and reads a request; `ws.comboMaker()` receives requests, quotes and withdraws quotes. Events and replies are typed (`ComboPlayerEvent`, `ComboMakerEvent` and the reply types), with `waitFor()`, `next()` and `for await`.
13
+ - `STXCombosUnavailableException` when an environment does not offer combos, `STXComboRefusedException` with the exchange's reason in `code` (and `detail` for `player_refused`), and `STXComboPriceMovedException` with the live best quote.
14
+
3
15
  ## 0.8.0 (2026-10-06)
4
16
 
5
17
  - Create player-prop markets as an app with the `markets.write` scope: `eventPlayers()`, `statsFor()` and `createMarkets()`, with `Stats` constants by sport and an opt-in `validate` check. Lines must be positive and end in `.5`; up to 25 markets per call.
@@ -114,6 +114,26 @@ var STXChannelException = class extends STXException {
114
114
  };
115
115
  var STXTimeoutException = class extends STXChannelException {
116
116
  };
117
+ var STXCombosUnavailableException = class extends STXChannelException {
118
+ };
119
+ var STXComboRefusedException = class extends STXChannelException {
120
+ command;
121
+ code;
122
+ detail;
123
+ constructor(message, opts) {
124
+ super(message, opts);
125
+ this.command = opts.command;
126
+ this.code = opts.code;
127
+ this.detail = opts.detail;
128
+ }
129
+ };
130
+ var STXComboPriceMovedException = class extends STXComboRefusedException {
131
+ best;
132
+ constructor(message, opts) {
133
+ super(message, opts);
134
+ this.best = opts.best;
135
+ }
136
+ };
117
137
  function errorForStatus(statusCode, body, opts) {
118
138
  let message;
119
139
  if (body && typeof body === "object" && typeof body.error === "string") {
@@ -630,17 +650,22 @@ function isValidLine(line) {
630
650
  return typeof line === "number" && Number.isFinite(line) && line > 0 && line * 2 % 2 === 1;
631
651
  }
632
652
  function marketEntry(m) {
633
- return {
634
- stat_detail: { player_id: m.playerId, stat: m.stat, prop_type: m.propType ?? "ou", line: m.line }
635
- };
653
+ return { rule: m.rule ?? "player_stat_line", player_id: m.playerId, stat: m.stat, line: m.line };
636
654
  }
637
- function toCreateMarketResult(raw) {
638
- const market = raw.market ?? raw.stat_detail ?? {};
639
- return { ...raw, market };
655
+ function toCreateMarketResult(raw, m, index) {
656
+ const market = marketEntry(m);
657
+ switch (raw.status) {
658
+ case "created":
659
+ case "exists":
660
+ return { index, status: raw.status, market_id: String(raw.market_id), reason: null, market };
661
+ case "valid":
662
+ return { index, status: "valid", market_id: null, reason: null, market };
663
+ default:
664
+ return rejected(m, index, raw.reason ?? "not_created");
665
+ }
640
666
  }
641
- function rejected(m, reason) {
642
- const market = marketEntry(m).stat_detail;
643
- return { status: "rejected", reason, market };
667
+ function rejected(m, index, reason) {
668
+ return { index, status: "rejected", market_id: null, reason, market: marketEntry(m) };
644
669
  }
645
670
  function checkMarket(m, players) {
646
671
  if (!isValidLine(m.line)) return { reason: "invalid_line" };
@@ -961,7 +986,7 @@ function credentialsFromSettings(keyId, privateKey, signer) {
961
986
  }
962
987
 
963
988
  // src/version.ts
964
- var VERSION = "0.8.0";
989
+ var VERSION = "0.8.2";
965
990
  var USER_AGENT = `stx-typescript/${VERSION}`;
966
991
  var ASYNC_DISPOSE = Symbol.asyncDispose ?? /* @__PURE__ */ Symbol.for("Symbol.asyncDispose");
967
992
 
@@ -1148,6 +1173,293 @@ var AccountView = class {
1148
1173
  }
1149
1174
  };
1150
1175
 
1176
+ // src/combos.ts
1177
+ var COMBO_PLAYER_CHANNEL = "rfq";
1178
+ var COMBO_MAKER_CHANNEL = "combo_quote";
1179
+ var UNAVAILABLE_REASON = "unmatched topic";
1180
+ var ACCEPT_TIMEOUT_MS = 35e3;
1181
+ var HISTORY_SIZE = 1e3;
1182
+ var PLAYER_EVENTS = /* @__PURE__ */ new Set(["best_quote", "placed", "negotiation_closed"]);
1183
+ var MAKER_EVENTS = /* @__PURE__ */ new Set([
1184
+ "rfq_opened",
1185
+ "rfq_closed",
1186
+ "quote_accepted",
1187
+ "placed",
1188
+ "negotiation_closed"
1189
+ ]);
1190
+ function comboRefusal(command, topic, response) {
1191
+ const reply = response && typeof response === "object" ? response : {};
1192
+ const reason = typeof reply.reason === "string" ? reply.reason : void 0;
1193
+ if (reason === UNAVAILABLE_REASON) {
1194
+ return new STXCombosUnavailableException("Combos are not available on this environment.", {
1195
+ topic,
1196
+ reply: response
1197
+ });
1198
+ }
1199
+ if (reason === void 0) {
1200
+ return new STXComboRefusedException(`${command} on ${topic} failed: ${JSON.stringify(response)}`, {
1201
+ topic,
1202
+ reply: response,
1203
+ command,
1204
+ code: ""
1205
+ });
1206
+ }
1207
+ let code = reason;
1208
+ let detail;
1209
+ if (reason.startsWith("player_refused:")) {
1210
+ code = "player_refused";
1211
+ detail = reason.slice("player_refused:".length);
1212
+ }
1213
+ const message = `${command} on ${topic} refused: ${reason}`;
1214
+ if (code === "price_moved") {
1215
+ return new STXComboPriceMovedException(message, {
1216
+ topic,
1217
+ reply: response,
1218
+ command,
1219
+ code,
1220
+ best: {
1221
+ quote_id: reply.quote_id ?? null,
1222
+ amount: reply.amount ?? null,
1223
+ expires_at: reply.expires_at ?? null
1224
+ }
1225
+ });
1226
+ }
1227
+ return new STXComboRefusedException(message, { topic, reply: response, command, code, detail });
1228
+ }
1229
+ function comboJoinError(err) {
1230
+ if (err instanceof STXChannelException && !(err instanceof STXCombosUnavailableException) && err.reply !== void 0) {
1231
+ if (err.constructor !== STXChannelException) return err;
1232
+ return comboRefusal("phx_join", err.topic, err.reply);
1233
+ }
1234
+ return err;
1235
+ }
1236
+ async function comboJoinPayload(geo) {
1237
+ const packet = await resolveGeoLocation(geo);
1238
+ return packet === void 0 ? {} : { geo_location: packet };
1239
+ }
1240
+ function money(name, value) {
1241
+ if (typeof value !== "string") {
1242
+ throw new TypeError(`${name} must be a decimal string such as "250.00", got ${typeof value}`);
1243
+ }
1244
+ return value;
1245
+ }
1246
+ var ComboSession = class {
1247
+ /** The underlying channel. Its `reply` is the latest join reply. */
1248
+ channel;
1249
+ #onEvent;
1250
+ #history = [];
1251
+ #waiters = [];
1252
+ #events;
1253
+ /** @internal */
1254
+ constructor(channel, events, onEvent) {
1255
+ this.channel = channel;
1256
+ this.#events = events;
1257
+ this.#onEvent = onEvent;
1258
+ }
1259
+ /** Your account's pseudonym for counterparties, from the join reply. */
1260
+ get externalId() {
1261
+ return this.channel.reply.external_id ?? "";
1262
+ }
1263
+ /** When the geolocation packet this join used expires (ISO 8601), or null. Rejoin before it. */
1264
+ get nextGeolocationAt() {
1265
+ return this.channel.reply.next_geolocation_at ?? null;
1266
+ }
1267
+ /** @internal */
1268
+ _typed(msg) {
1269
+ if (!this.#events.has(msg.event) || !msg.payload || typeof msg.payload !== "object") return void 0;
1270
+ return { event: msg.event, payload: msg.payload };
1271
+ }
1272
+ /** @internal Called for every message on the channel, before it is queued. */
1273
+ async _receive(msg) {
1274
+ const event = this._typed(msg);
1275
+ if (!event) return;
1276
+ this.#history.push(event);
1277
+ if (this.#history.length > HISTORY_SIZE) this.#history.shift();
1278
+ for (const w of [...this.#waiters]) {
1279
+ if (w.match(event)) {
1280
+ this.#waiters = this.#waiters.filter((x) => x !== w);
1281
+ w.resolve(event);
1282
+ }
1283
+ }
1284
+ if (this.#onEvent) await this.#onEvent(event);
1285
+ }
1286
+ /** The events received so far (the latest 1000), oldest first. */
1287
+ get events() {
1288
+ return [...this.#history];
1289
+ }
1290
+ /**
1291
+ * The next event, in arrival order. Rejects with `STXTimeoutException` when
1292
+ * none arrives within `timeoutMs`, and with `STXChannelException` once the
1293
+ * channel is closed. Use either this or `for await`, not both.
1294
+ */
1295
+ async next(timeoutMs) {
1296
+ for (; ; ) {
1297
+ const event = this._typed(await this.channel.next(timeoutMs));
1298
+ if (event) return event;
1299
+ }
1300
+ }
1301
+ async *[Symbol.asyncIterator]() {
1302
+ for await (const msg of this.channel) {
1303
+ const event = this._typed(msg);
1304
+ if (event) yield event;
1305
+ }
1306
+ }
1307
+ /**
1308
+ * Resolve with the first event named `event` (or one of several) for
1309
+ * `rfqId`, looking first at events already received. Unlike `next()`, it
1310
+ * takes nothing from the queue. Rejects with `STXTimeoutException` after
1311
+ * `timeoutMs` (default 10000).
1312
+ *
1313
+ * @param event An event name, or several.
1314
+ * @param opts.rfqId Only events for this request.
1315
+ * @param opts.quoteId Only events for this quote (maker events).
1316
+ * @param opts.timeoutMs Milliseconds to wait. Default 10000.
1317
+ */
1318
+ waitFor(event, opts = {}) {
1319
+ const names = typeof event === "string" ? [event] : event;
1320
+ const match = (e) => names.includes(e.event) && (opts.rfqId === void 0 || e.payload.rfq_id === opts.rfqId) && (opts.quoteId === void 0 || e.payload.quote_id === opts.quoteId);
1321
+ const seen = this.#history.find(match);
1322
+ if (seen) return Promise.resolve(seen);
1323
+ const timeoutMs = opts.timeoutMs ?? 1e4;
1324
+ return new Promise((resolve, reject) => {
1325
+ const waiter = {
1326
+ match,
1327
+ resolve: (e) => {
1328
+ clearTimeout(timer);
1329
+ resolve(e);
1330
+ }
1331
+ };
1332
+ const timer = setTimeout(() => {
1333
+ this.#waiters = this.#waiters.filter((w) => w !== waiter);
1334
+ reject(
1335
+ new STXTimeoutException(`No ${names.join(" or ")} on ${this.channel.topic} within ${timeoutMs} ms`, {
1336
+ topic: this.channel.topic
1337
+ })
1338
+ );
1339
+ }, timeoutMs);
1340
+ this.#waiters.push(waiter);
1341
+ });
1342
+ }
1343
+ /** Leave the topic. Requests opened and quotes placed on this channel end, as on any close. */
1344
+ leave() {
1345
+ return this.channel.leave();
1346
+ }
1347
+ /** @internal Send a command and map a refusal to the combo exceptions. */
1348
+ async _command(command, payload, timeoutMs) {
1349
+ try {
1350
+ return await this.channel.push(command, payload, timeoutMs);
1351
+ } catch (err) {
1352
+ if (err instanceof STXChannelException && err.constructor === STXChannelException && err.reply !== void 0) {
1353
+ throw comboRefusal(command, this.channel.topic, err.reply);
1354
+ }
1355
+ throw err;
1356
+ }
1357
+ }
1358
+ };
1359
+ var ComboPlayer = class extends ComboSession {
1360
+ /** @internal */
1361
+ constructor(channel, onEvent) {
1362
+ super(channel, PLAYER_EVENTS, onEvent);
1363
+ }
1364
+ /**
1365
+ * `request_quote`: ask makers to quote on these legs for a stake. `amount`
1366
+ * is the stake as a decimal string in whole cents, e.g. `"250.00"`. Makers
1367
+ * quote what you win; quotes arrive as `best_quote` events.
1368
+ *
1369
+ * @param legs Two or more `open` markets and the outcome the combination needs of each.
1370
+ * @param amount The stake in dollars, e.g. `"250.00"`.
1371
+ */
1372
+ requestQuote(legs, amount2) {
1373
+ return this._command("request_quote", {
1374
+ legs: legs.map((leg) => ({ market_id: leg.marketId, outcome: leg.outcome })),
1375
+ amount: money("amount", amount2)
1376
+ });
1377
+ }
1378
+ /**
1379
+ * `cash_out`: ask makers to quote for what you hold of a combination, by the
1380
+ * `market_id` from `placed`. The exchange sets the size.
1381
+ *
1382
+ * @param marketId The combination's market id.
1383
+ */
1384
+ cashOut(marketId) {
1385
+ return this._command("cash_out", { market_id: marketId });
1386
+ }
1387
+ /**
1388
+ * `accept`: bind the request at `amount` or more, normally the amount
1389
+ * `best_quote` showed. The best live quote binds whoever made it, so the
1390
+ * placement can be better than `amount`. Waits up to 35 s.
1391
+ *
1392
+ * Throws `STXComboPriceMovedException` (with the live `best`) when nothing
1393
+ * at least as good is live; the request stays open and you can accept again.
1394
+ * The reply says what was placed; fills arrive on `fills`.
1395
+ *
1396
+ * @param rfqId The request.
1397
+ * @param quoteId The quote you saw, normally from `best_quote`.
1398
+ * @param amount The least amount you take, e.g. `"1750.00"`.
1399
+ */
1400
+ accept(rfqId, quoteId, amount2) {
1401
+ return this._command(
1402
+ "accept",
1403
+ { rfq_id: rfqId, quote_id: quoteId, amount: money("amount", amount2) },
1404
+ ACCEPT_TIMEOUT_MS
1405
+ );
1406
+ }
1407
+ /**
1408
+ * `cancel`: end the request and drop every quote on it.
1409
+ *
1410
+ * @param rfqId The request.
1411
+ */
1412
+ cancel(rfqId) {
1413
+ return this._command("cancel", { rfq_id: rfqId });
1414
+ }
1415
+ /**
1416
+ * `snapshot`: the request now, with the live best quote. Not delayed like `best_quote` events.
1417
+ *
1418
+ * @param rfqId The request.
1419
+ */
1420
+ snapshot(rfqId) {
1421
+ return this._command("snapshot", { rfq_id: rfqId });
1422
+ }
1423
+ };
1424
+ var ComboMaker = class extends ComboSession {
1425
+ /** @internal */
1426
+ constructor(channel, onEvent) {
1427
+ super(channel, MAKER_EVENTS, onEvent);
1428
+ }
1429
+ /**
1430
+ * `quote`: offer `amount` on a request. On a buy it is what the player wins;
1431
+ * on a cash out, what you pay for the whole size. Price it against the
1432
+ * request's `max_price` and `tick_size`. `expiresInMs` (a positive integer)
1433
+ * counts from receipt; the quote ends no later than its request.
1434
+ * `clientOrderId` (at most 255 bytes) is copied onto your order if it binds.
1435
+ *
1436
+ * @param rfqId The request, from `rfq_opened`.
1437
+ * @param amount In dollars, e.g. `"1750.00"`.
1438
+ * @param expiresInMs How long the quote stands, in milliseconds.
1439
+ * @param opts.clientOrderId Copied onto your order if the quote binds.
1440
+ */
1441
+ quote(rfqId, amount2, expiresInMs, opts = {}) {
1442
+ const payload = {
1443
+ rfq_id: rfqId,
1444
+ amount: money("amount", amount2),
1445
+ expires_in_ms: expiresInMs
1446
+ };
1447
+ if (opts.clientOrderId !== void 0) payload.client_order_id = opts.clientOrderId;
1448
+ return this._command("quote", payload);
1449
+ }
1450
+ /**
1451
+ * `withdraw_quote`: remove one of your quotes.
1452
+ *
1453
+ * @param rfqId The request.
1454
+ * @param quoteId Your quote, from the `quote()` reply.
1455
+ */
1456
+ withdrawQuote(rfqId, quoteId) {
1457
+ return this._command("withdraw_quote", { rfq_id: rfqId, quote_id: quoteId });
1458
+ }
1459
+ };
1460
+ var COMBO_CHANNELS = /* @__PURE__ */ new Set([COMBO_PLAYER_CHANNEL, COMBO_MAKER_CHANNEL]);
1461
+ var COMBOS_UNAVAILABLE_REASON = UNAVAILABLE_REASON;
1462
+
1151
1463
  // src/money.ts
1152
1464
  var PRICE_FIELDS = ["price", "last_traded_price", "max_price"];
1153
1465
  var QUANTITY_FIELDS = ["total_volume", "volume_24h", "open_interest"];
@@ -1708,14 +2020,17 @@ var STX = class _STX {
1708
2020
  * `markets.write`, which STX grants, from the client's IP allow-list.
1709
2021
  *
1710
2022
  * Returns one result per market, in order: `created` or `exists` (both with
1711
- * `market_id`), or `rejected` with a `reason`. A rejected market is a
2023
+ * `market_id`), `valid` with `dryRun`, or `rejected` with a `reason`. Each
2024
+ * result's `index` is its position in `markets`, and `market` is that market
2025
+ * as requested. A rejected market is a
1712
2026
  * result, not an error, and resending is safe: a market that is already
1713
2027
  * listed comes back `exists`. A refused request throws (`403` without
1714
2028
  * `markets.write`, `404` unknown event, `422` event not open).
1715
2029
  *
1716
2030
  * Each `line` must be a positive number ending in `.5`, e.g. `18.5`. More
1717
2031
  * than `MAX_MARKETS_PER_REQUEST` markets throws `TypeError` before any
1718
- * request. `validate` also needs the `events` scope.
2032
+ * request. `dryRun` runs every check and creates nothing. `validate` also
2033
+ * needs the `events` scope.
1719
2034
  */
1720
2035
  async createMarkets(eventId, markets, opts = {}) {
1721
2036
  if (markets.length < 1 || markets.length > MAX_MARKETS_PER_REQUEST) {
@@ -1728,19 +2043,20 @@ var STX = class _STX {
1728
2043
  send = send.flatMap(({ m, i }) => {
1729
2044
  const checked = checkMarket(m, players);
1730
2045
  if ("market" in checked) return [{ m: checked.market, i }];
1731
- results[i] = rejected(m, checked.reason);
2046
+ results[i] = rejected(m, i, checked.reason);
1732
2047
  return [];
1733
2048
  });
1734
2049
  }
1735
2050
  if (send.length) {
1736
2051
  const body = { event_id: eventId, markets: send.map(({ m }) => marketEntry(m)) };
2052
+ if (opts.dryRun) body.dry_run = true;
1737
2053
  const raw = await this.#one("markets_post", { body });
1738
2054
  (raw.markets ?? []).forEach((r, k) => {
1739
- const slot = send[k];
1740
- if (slot) results[slot.i] = toCreateMarketResult(r);
2055
+ const slot = send[typeof r.index === "number" ? r.index : k];
2056
+ if (slot) results[slot.i] = toCreateMarketResult(r, slot.m, slot.i);
1741
2057
  });
1742
2058
  }
1743
- return results.map((r, i) => r ?? rejected(markets[i], "not_created"));
2059
+ return results.map((r, i) => r ?? rejected(markets[i], i, "not_created"));
1744
2060
  }
1745
2061
  // ------------------------------------------------------------------
1746
2062
  // Orders
@@ -2102,6 +2418,8 @@ var Channel = class {
2102
2418
  joinRef = null;
2103
2419
  joined = false;
2104
2420
  closed = false;
2421
+ /** @internal Runs before every (re)join, e.g. to refresh a geolocation packet in `joinPayload`. */
2422
+ _beforeJoin;
2105
2423
  #ws;
2106
2424
  #queue;
2107
2425
  #snapshotWaiters = [];
@@ -2557,6 +2875,63 @@ var STXWebSocket = class {
2557
2875
  return this.#joinAccount("user_info", {}, opts.onMessage);
2558
2876
  }
2559
2877
  // ------------------------------------------------------------------
2878
+ // Combos
2879
+ // ------------------------------------------------------------------
2880
+ /**
2881
+ * Join `rfq:{user_id}` and return a `ComboPlayer`: request quotes on a
2882
+ * combination, cash one out, accept, cancel and read a request.
2883
+ *
2884
+ * Available on US demo.
2885
+ * Where combos are not available, rejects with
2886
+ * `STXCombosUnavailableException`. Other join refusals (a read-only key, an
2887
+ * account that may not trade) reject with `STXComboRefusedException`.
2888
+ */
2889
+ async comboPlayer(opts = {}) {
2890
+ let player;
2891
+ const early = [];
2892
+ const channel = await this.#joinCombo(COMBO_PLAYER_CHANNEL, opts, async (msg) => {
2893
+ if (player) await player._receive(msg);
2894
+ else early.push(msg);
2895
+ });
2896
+ player = new ComboPlayer(channel, opts.onEvent);
2897
+ for (const msg of early) await player._receive(msg);
2898
+ return player;
2899
+ }
2900
+ /**
2901
+ * Join `combo_quote:{user_id}` and return a `ComboMaker`: receive every
2902
+ * request opened from now on (`rfq_opened`), quote and withdraw quotes.
2903
+ *
2904
+ * Available on US demo.
2905
+ * Where combos are not available, rejects with
2906
+ * `STXCombosUnavailableException`.
2907
+ */
2908
+ async comboMaker(opts = {}) {
2909
+ let maker;
2910
+ const early = [];
2911
+ const channel = await this.#joinCombo(COMBO_MAKER_CHANNEL, opts, async (msg) => {
2912
+ if (maker) await maker._receive(msg);
2913
+ else early.push(msg);
2914
+ });
2915
+ maker = new ComboMaker(channel, opts.onEvent);
2916
+ for (const msg of early) await maker._receive(msg);
2917
+ return maker;
2918
+ }
2919
+ async #joinCombo(name, opts, onMessage) {
2920
+ let channel;
2921
+ try {
2922
+ channel = await this.#joinAccount(name, await comboJoinPayload(opts.geoLocation), onMessage);
2923
+ } catch (err) {
2924
+ throw comboJoinError(err);
2925
+ }
2926
+ if (typeof opts.geoLocation === "function") {
2927
+ const geo = opts.geoLocation;
2928
+ channel._beforeJoin = async () => {
2929
+ channel.joinPayload = await comboJoinPayload(geo);
2930
+ };
2931
+ }
2932
+ return channel;
2933
+ }
2934
+ // ------------------------------------------------------------------
2560
2935
  // Generic join
2561
2936
  // ------------------------------------------------------------------
2562
2937
  /**
@@ -2594,6 +2969,7 @@ var STXWebSocket = class {
2594
2969
  const ref = this.#nextRef();
2595
2970
  channel.joinRef = ref;
2596
2971
  channel._resetForRejoin();
2972
+ if (channel._beforeJoin) await channel._beforeJoin();
2597
2973
  const reply = await this._request(channel.topic, "phx_join", channel.joinPayload, ref, void 0, ref);
2598
2974
  channel.reply = reply && typeof reply === "object" && !Array.isArray(reply) ? reply : { response: reply };
2599
2975
  if (channel.name === "market") channel.reply = convertMarketChannelPayload(channel.reply);
@@ -2800,7 +3176,7 @@ var STXWebSocket = class {
2800
3176
  } catch (err) {
2801
3177
  this.logger.error(`rejoin ${channel.topic} failed: ${err.message}`);
2802
3178
  const reply = err instanceof STXChannelException ? err.reply : void 0;
2803
- if (reply?.reason === "unauthorized") {
3179
+ if (reply?.reason === "unauthorized" || reply?.reason === COMBOS_UNAVAILABLE_REASON && COMBO_CHANNELS.has(channel.name)) {
2804
3180
  channel._close();
2805
3181
  return;
2806
3182
  }
@@ -2941,6 +3317,9 @@ export {
2941
3317
  STXTransportException,
2942
3318
  STXChannelException,
2943
3319
  STXTimeoutException,
3320
+ STXCombosUnavailableException,
3321
+ STXComboRefusedException,
3322
+ STXComboPriceMovedException,
2944
3323
  errorForStatus,
2945
3324
  Environments,
2946
3325
  HOSTS,
@@ -2969,6 +3348,8 @@ export {
2969
3348
  USER_AGENT,
2970
3349
  TERMINAL_ORDER_STATUSES,
2971
3350
  AccountView,
3351
+ ComboPlayer,
3352
+ ComboMaker,
2972
3353
  centsToDollars,
2973
3354
  toDollarString,
2974
3355
  toQuantity,
@@ -2984,4 +3365,4 @@ export {
2984
3365
  orderBody,
2985
3366
  STX
2986
3367
  };
2987
- //# sourceMappingURL=chunk-H7XZDE2U.js.map
3368
+ //# sourceMappingURL=chunk-BDKOZ6S2.js.map