@stxapp/stx-typescript 0.10.0 → 0.11.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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;// src/exceptions.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;// src/exceptions.ts
2
2
  var STXException = class extends Error {
3
3
 
4
4
 
@@ -43,15 +43,46 @@ var STXTermsRequiredException = class extends STXForbiddenException {
43
43
  };
44
44
  var STXIPNotAllowedException = class extends STXForbiddenException {
45
45
  };
46
+ var STXBlockedException = class extends STXForbiddenException {
47
+
48
+
49
+ constructor(message, opts = {}) {
50
+ super(message, opts);
51
+ this.reason = _nullishCoalesce(opts.reason, () => ( "blocked"));
52
+ this.reference = opts.reference;
53
+ }
54
+ };
55
+ var STXRestrictedJurisdictionException = class extends STXBlockedException {
56
+ };
57
+ var STXUnusualNetworkException = class extends STXBlockedException {
58
+ };
46
59
  var STXNotFoundException = class extends STXAPIException {
47
60
  };
48
61
  var STXRejectedException = class extends STXAPIException {
49
62
  };
63
+ var STXFillModeNotAllowedException = class extends STXRejectedException {
64
+
65
+ constructor(message, opts) {
66
+ super(message, opts);
67
+ this.fillMode = opts.fillMode;
68
+ }
69
+ };
70
+ var STXPostOnlyWouldMatchException = class extends STXRejectedException {
71
+
72
+
73
+ constructor(message, opts) {
74
+ super(message, opts);
75
+ this.reason = opts.reason;
76
+ this.order = opts.order;
77
+ }
78
+ };
50
79
  var STXRateLimitException = class extends STXAPIException {
51
80
 
81
+
52
82
  constructor(message, opts = {}) {
53
83
  super(message, opts);
54
84
  this.retryAfter = opts.retryAfter;
85
+ this.reference = opts.reference;
55
86
  }
56
87
  };
57
88
  var STXServerException = class extends STXAPIException {
@@ -92,21 +123,27 @@ var FEATURE_PHRASES = {
92
123
  event_players: "Event players are",
93
124
  leaderboard: "The leaderboard is",
94
125
  loyalty: "The loyalty program is",
95
- combos: "Combos are"
126
+ combos: "Combos are",
127
+ "orders.post_only": "Post-only orders are",
128
+ "orders.fill_or_kill": "Fill-or-kill orders are"
96
129
  };
97
- function notAvailableMessage(feature, host) {
130
+ function notAvailableMessage(feature, host, apiVersion) {
98
131
  const phrase = feature.startsWith("scope:") ? `The ${feature.slice("scope:".length)} scope is` : _nullishCoalesce(FEATURE_PHRASES[feature], () => ( `${feature} is`));
99
- return `${phrase} not available on ${host} yet.`;
132
+ const where = apiVersion ? `${host} (version ${apiVersion})` : host;
133
+ return `${phrase} not available on ${where} yet.`;
100
134
  }
101
135
  var STXNotAvailableException = class _STXNotAvailableException extends STXAPIException {
102
136
  /** The feature id, e.g. `"combos"`. */
103
137
 
104
138
  /** The exchange host that lacks it, e.g. `"demo.stxapp.ca"`. */
105
139
 
140
+ /** The exchange build, e.g. `"3.4.24"`, when known. */
141
+
106
142
  constructor(feature, host, opts = {}) {
107
- super(_nullishCoalesce(opts.message, () => ( notAvailableMessage(feature, host))), opts);
143
+ super(_nullishCoalesce(opts.message, () => ( notAvailableMessage(feature, host, opts.apiVersion))), opts);
108
144
  this.feature = feature;
109
145
  this.host = host;
146
+ this.apiVersion = _nullishCoalesce(opts.apiVersion, () => ( void 0));
110
147
  markNotAvailable(this);
111
148
  }
112
149
  // `this` is the class on the right of `instanceof`: a subclass keeps the
@@ -172,6 +209,18 @@ function errorForStatus(statusCode, body, opts) {
172
209
  message = `HTTP ${statusCode}`;
173
210
  }
174
211
  const base = { statusCode, body, method: opts.method, path: opts.path };
212
+ const edge = edgeBlock(statusCode, body, opts.stxError, opts.cfId);
213
+ if (edge) {
214
+ if (statusCode === 429) {
215
+ return new STXRateLimitException(edge.message, {
216
+ ...base,
217
+ retryAfter: parseRetryAfter(opts.retryAfter),
218
+ reference: edge.reference
219
+ });
220
+ }
221
+ const cls = edge.reason === "restricted_jurisdiction" ? STXRestrictedJurisdictionException : edge.reason === "unusual_network" ? STXUnusualNetworkException : STXBlockedException;
222
+ return new cls(edge.message, { ...base, reason: edge.reason, reference: edge.reference });
223
+ }
175
224
  switch (statusCode) {
176
225
  case 400:
177
226
  return new STXValidationException(message, base);
@@ -206,10 +255,36 @@ function errorForStatus(statusCode, body, opts) {
206
255
  return statusCode >= 500 ? new STXServerException(message, base) : new STXAPIException(message, base);
207
256
  }
208
257
  }
258
+ var NO_USER_AGENT_HINT = "Request blocked (HTTP 403) before it reached the exchange. Every request needs a User-Agent header; if you replaced or removed the SDK's, set one that names your application. If it persists, contact STX support.";
259
+ var EDGE_REASONS = {
260
+ 403: ["restricted_jurisdiction", "unusual_network"],
261
+ 429: ["rate_limited"]
262
+ };
263
+ var REFERENCE_PLACEHOLDER = "x-amz-cf-id response header";
264
+ function edgeBlock(status, body, stxError, cfId) {
265
+ const reasons = EDGE_REASONS[status];
266
+ if (!reasons || stxError) return void 0;
267
+ let reference = cfId || void 0;
268
+ if (body && typeof body === "object") {
269
+ const fields = body;
270
+ if (typeof fields.error !== "string" || !reasons.includes(fields.error)) return void 0;
271
+ if (reference === void 0 && typeof fields.reference === "string" && fields.reference) {
272
+ reference = fields.reference === REFERENCE_PLACEHOLDER ? void 0 : fields.reference;
273
+ }
274
+ return {
275
+ reason: fields.error,
276
+ message: typeof fields.message === "string" && fields.message ? fields.message : fields.error,
277
+ reference
278
+ };
279
+ }
280
+ return status === 403 ? { reason: "blocked", message: NO_USER_AGENT_HINT, reference } : void 0;
281
+ }
209
282
  function parseRetryAfter(value) {
210
283
  if (value === null || value === void 0 || value.trim() === "") return void 0;
211
284
  const n = Number(value);
212
- return Number.isFinite(n) ? Math.max(0, n) : void 0;
285
+ if (Number.isFinite(n)) return Math.max(0, n);
286
+ const at = Date.parse(value);
287
+ return Number.isNaN(at) ? void 0 : Math.max(0, (at - Date.now()) / 1e3);
213
288
  }
214
289
  function bearerError(header) {
215
290
  if (!header || !/^\s*Bearer\b/i.test(header)) return void 0;
@@ -236,8 +311,22 @@ var FEATURES = [
236
311
  "event_players",
237
312
  "leaderboard",
238
313
  "loyalty",
239
- "combos"
314
+ "combos",
315
+ "orders.post_only",
316
+ "orders.fill_or_kill"
240
317
  ];
318
+ var API_FEATURES = {
319
+ "orders.post_only": "order_post_only",
320
+ "orders.fill_or_kill": "order_fill_or_kill"
321
+ };
322
+ function apiVersionFrom(body) {
323
+ const version = _optionalChain([body, 'optionalAccess', _5 => _5.api_version]);
324
+ const features = _optionalChain([body, 'optionalAccess', _6 => _6.features]);
325
+ return {
326
+ apiVersion: typeof version === "string" ? version : null,
327
+ features: Array.isArray(features) ? features.filter((f) => typeof f === "string") : null
328
+ };
329
+ }
241
330
  var MEMBER_SCOPES = [
242
331
  "profile.read",
243
332
  "balance.read",
@@ -326,7 +415,9 @@ async function discoverCapabilities(probes) {
326
415
  swallow(probes.signedGet("/api/v1/portfolio/loyalty?limit=1")),
327
416
  swallow(probes.joinReason(`rfq:${NOBODY}`))
328
417
  ]);
329
- const apiVersion = _optionalChain([json, 'call', _5 => _5(version), 'optionalAccess', _6 => _6.api_version]);
418
+ const info = version ? apiVersionFrom(version.status === 200 ? json(version) : null) : null;
419
+ const apiVersion = _optionalChain([info, 'optionalAccess', _7 => _7.apiVersion]);
420
+ const listed = (name) => version === null ? null : version.status === 200 || version.status === 404 || version.status === 403 && json(version) === null ? !!_optionalChain([info, 'optionalAccess', _8 => _8.features, 'optionalAccess', _9 => _9.includes, 'call', _10 => _10(name)]) : null;
330
421
  const meta = oauthMetadataFrom(discovery);
331
422
  const scopes = meta ? strings(meta.scopes_supported) : [];
332
423
  const grants = meta ? strings(meta.grant_types_supported) : [];
@@ -348,7 +439,9 @@ async function discoverCapabilities(probes) {
348
439
  leaderboard: board === null ? null : board.status >= 200 && board.status < 300 ? true : board.status === 404 ? false : null,
349
440
  // Switched off answers 404 ("Loyalty program is not enabled").
350
441
  loyalty: loyalty === null ? null : loyalty.status >= 200 && loyalty.status < 300 ? true : loyalty.status === 404 ? false : null,
351
- combos: combos === null ? null : combos !== "unmatched topic"
442
+ combos: combos === null ? null : combos !== "unmatched topic",
443
+ "orders.post_only": listed(API_FEATURES["orders.post_only"]),
444
+ "orders.fill_or_kill": listed(API_FEATURES["orders.fill_or_kill"])
352
445
  };
353
446
  return new Capabilities({
354
447
  host: probes.host,
@@ -481,7 +574,7 @@ var OPERATIONS = {
481
574
  account_market_stats_get: {
482
575
  method: "GET",
483
576
  path: "/api/v1/account/market_stats",
484
- query: ["market_ids", "event_ids", "exclude_zero_settlements", "from_time", "to_time", "sports", "competitions", "limit", "cursor"],
577
+ query: ["market_ids", "event_ids", "exclude_zero_settlements", "unsettled_only", "from_time", "to_time", "sports", "competitions", "limit", "cursor"],
485
578
  pathParams: [],
486
579
  hasBody: false,
487
580
  responseKey: "market_stats",
@@ -917,6 +1010,9 @@ var RetryPolicy = class {
917
1010
  shouldRetry(exc, attempt, idempotent) {
918
1011
  if (attempt >= this.maxAttempts) return false;
919
1012
  if (!this.retryableExceptions.some((cls) => exc instanceof cls)) return false;
1013
+ if (exc instanceof STXRateLimitException && exc.retryAfter !== void 0 && exc.retryAfter * 1e3 > this.maxBackoffMs) {
1014
+ return false;
1015
+ }
920
1016
  return idempotent || exc instanceof STXRateLimitException;
921
1017
  }
922
1018
  /** Milliseconds to wait after attempt `attempt` (1-based) failed. */
@@ -1004,7 +1100,7 @@ function readProfile(profileName, path) {
1004
1100
  }
1005
1101
  function processEnv() {
1006
1102
  const p = globalThis.process;
1007
- return _nullishCoalesce(_optionalChain([p, 'optionalAccess', _7 => _7.env]), () => ( {}));
1103
+ return _nullishCoalesce(_optionalChain([p, 'optionalAccess', _11 => _11.env]), () => ( {}));
1008
1104
  }
1009
1105
  function resolveSettings(input = {}) {
1010
1106
  const environ = _nullishCoalesce(input.environ, () => ( processEnv()));
@@ -1178,7 +1274,7 @@ function credentialsFromSettings(keyId, privateKey, signer) {
1178
1274
  }
1179
1275
 
1180
1276
  // src/version.ts
1181
- var VERSION = "0.10.0";
1277
+ var VERSION = "0.11.0";
1182
1278
  var USER_AGENT = `stx-typescript/${VERSION}`;
1183
1279
  var ASYNC_DISPOSE = _nullishCoalesce(Symbol.asyncDispose, () => ( /* @__PURE__ */ Symbol.for("Symbol.asyncDispose")));
1184
1280
 
@@ -1310,7 +1406,7 @@ var AccountView = (_class3 = class {
1310
1406
  case "all_orders":
1311
1407
  this.seeds.orders = (_nullishCoalesce(this.seeds.orders, () => ( 0))) + 1;
1312
1408
  this.#orders.clear();
1313
- for (const o of _nullishCoalesce(_optionalChain([payload, 'optionalAccess', _8 => _8.orders]), () => ( []))) this.#upsertOrder(o);
1409
+ for (const o of _nullishCoalesce(_optionalChain([payload, 'optionalAccess', _12 => _12.orders]), () => ( []))) this.#upsertOrder(o);
1314
1410
  return change("orders", true);
1315
1411
  case "new_open_order":
1316
1412
  this.#upsertOrder(payload);
@@ -1318,7 +1414,7 @@ var AccountView = (_class3 = class {
1318
1414
  case "all_trades":
1319
1415
  this.seeds.fills = (_nullishCoalesce(this.seeds.fills, () => ( 0))) + 1;
1320
1416
  this.#fills.clear();
1321
- for (const t of _nullishCoalesce(_optionalChain([payload, 'optionalAccess', _9 => _9.trades]), () => ( []))) this.#upsertFill(t);
1417
+ for (const t of _nullishCoalesce(_optionalChain([payload, 'optionalAccess', _13 => _13.trades]), () => ( []))) this.#upsertFill(t);
1322
1418
  return change("fills", true);
1323
1419
  case "trade":
1324
1420
  this.#upsertFill(payload);
@@ -1326,22 +1422,22 @@ var AccountView = (_class3 = class {
1326
1422
  case "all_positions":
1327
1423
  this.seeds.positions = (_nullishCoalesce(this.seeds.positions, () => ( 0))) + 1;
1328
1424
  this.#positions.clear();
1329
- for (const p of _nullishCoalesce(_optionalChain([payload, 'optionalAccess', _10 => _10.positions]), () => ( []))) this.#upsertPosition(p);
1425
+ for (const p of _nullishCoalesce(_optionalChain([payload, 'optionalAccess', _14 => _14.positions]), () => ( []))) this.#upsertPosition(p);
1330
1426
  return change("positions", true);
1331
1427
  case "updated_positions":
1332
- for (const p of _nullishCoalesce(_optionalChain([payload, 'optionalAccess', _11 => _11.positions]), () => ( []))) this.#upsertPosition(p);
1428
+ for (const p of _nullishCoalesce(_optionalChain([payload, 'optionalAccess', _15 => _15.positions]), () => ( []))) this.#upsertPosition(p);
1333
1429
  return change("positions", false);
1334
1430
  default:
1335
1431
  return void 0;
1336
1432
  }
1337
1433
  }
1338
1434
  #upsertOrder(order) {
1339
- if (!_optionalChain([order, 'optionalAccess', _12 => _12.id])) return;
1435
+ if (!_optionalChain([order, 'optionalAccess', _16 => _16.id])) return;
1340
1436
  if (TERMINAL_ORDER_STATUSES.has(String(order.status))) this.#orders.delete(order.id);
1341
1437
  else this.#orders.set(order.id, order);
1342
1438
  }
1343
1439
  #upsertFill(fill) {
1344
- if (!_optionalChain([fill, 'optionalAccess', _13 => _13.id])) return;
1440
+ if (!_optionalChain([fill, 'optionalAccess', _17 => _17.id])) return;
1345
1441
  this.#fills.delete(fill.id);
1346
1442
  this.#fills.set(fill.id, fill);
1347
1443
  if (this.#fills.size > this.#maxFills) {
@@ -1350,7 +1446,7 @@ var AccountView = (_class3 = class {
1350
1446
  }
1351
1447
  }
1352
1448
  #upsertPosition(position) {
1353
- const key = _nullishCoalesce(_optionalChain([position, 'optionalAccess', _14 => _14.market_id]), () => ( _optionalChain([position, 'optionalAccess', _15 => _15.id])));
1449
+ const key = _nullishCoalesce(_optionalChain([position, 'optionalAccess', _18 => _18.market_id]), () => ( _optionalChain([position, 'optionalAccess', _19 => _19.id])));
1354
1450
  if (!key) return;
1355
1451
  if (!this.#keepFlat && isZero(position.position)) this.#positions.delete(key);
1356
1452
  else this.#positions.set(key, position);
@@ -1789,7 +1885,7 @@ function buildRequest(operationId, args = {}) {
1789
1885
  const op = OPERATIONS[operationId];
1790
1886
  let path = op.path;
1791
1887
  for (const name of op.pathParams) {
1792
- const value = _optionalChain([args, 'access', _16 => _16.pathParams, 'optionalAccess', _17 => _17[name]]);
1888
+ const value = _optionalChain([args, 'access', _20 => _20.pathParams, 'optionalAccess', _21 => _21[name]]);
1793
1889
  if (!value) throw new TypeError(`${name} is required`);
1794
1890
  path = path.replace(`{${name}}`, quote(String(value)));
1795
1891
  }
@@ -1828,7 +1924,9 @@ function decodeResponse(request, status, text, headers = {}) {
1828
1924
  method: request.method,
1829
1925
  path: request.path,
1830
1926
  retryAfter: headers.retryAfter,
1831
- wwwAuthenticate: headers.wwwAuthenticate
1927
+ wwwAuthenticate: headers.wwwAuthenticate,
1928
+ stxError: headers.stxError,
1929
+ cfId: headers.cfId
1832
1930
  });
1833
1931
  }
1834
1932
  function splitPage(operationId, body) {
@@ -1843,10 +1941,14 @@ function toBatchOrderResult(raw) {
1843
1941
  const obj = raw && typeof raw === "object" ? raw : {};
1844
1942
  const order = _nullishCoalesce(obj.order, () => ( null));
1845
1943
  const errors = Array.isArray(obj.errors) ? obj.errors : null;
1846
- return { ...obj, order, errors, ok: order !== null && !_optionalChain([errors, 'optionalAccess', _18 => _18.length]) };
1944
+ return { ...obj, order, errors, ok: order !== null && !_optionalChain([errors, 'optionalAccess', _22 => _22.length]) };
1847
1945
  }
1848
1946
 
1849
1947
  // src/client.ts
1948
+ var FILL_MODES = ["normal", "post_only", "fill_or_kill"];
1949
+ var NOT_ENABLED = /fill_mode (post_only|fill_or_kill) is not enabled|The (post_only|fill_or_kill) fill mode is not enabled/;
1950
+ var NOT_ACCEPTED = /does not accept the (post_only|fill_or_kill) fill mode/;
1951
+ var MATCH_WITH_SELF = "would match with your other order";
1850
1952
  var NEW_ORDER_FIELDS = {
1851
1953
  marketId: "market_id",
1852
1954
  action: "action",
@@ -1857,7 +1959,8 @@ var NEW_ORDER_FIELDS = {
1857
1959
  expiration: "expiration",
1858
1960
  expirationTime: "expiration_time",
1859
1961
  cancelOnDisconnect: "cancel_on_disconnect",
1860
- deviceId: "device_id"
1962
+ deviceId: "device_id",
1963
+ fillMode: "fill_mode"
1861
1964
  };
1862
1965
  function amount(name, value, required) {
1863
1966
  if (value === void 0 || value === null) {
@@ -1872,6 +1975,13 @@ function amount(name, value, required) {
1872
1975
  return value;
1873
1976
  }
1874
1977
  function orderBody(marketId, action, orderType, opts) {
1978
+ const mode = opts.fillMode;
1979
+ if (mode !== void 0 && mode !== null && !FILL_MODES.includes(mode)) {
1980
+ throw new TypeError(`fillMode must be one of ${JSON.stringify(FILL_MODES)}, got ${JSON.stringify(mode)}`);
1981
+ }
1982
+ if ((mode === "post_only" || mode === "fill_or_kill") && orderType !== "limit") {
1983
+ throw new TypeError(`fillMode "${mode}" is for limit orders only`);
1984
+ }
1875
1985
  const body = {
1876
1986
  market_id: marketId,
1877
1987
  action,
@@ -1884,7 +1994,8 @@ function orderBody(marketId, action, orderType, opts) {
1884
1994
  expiration: opts.expiration,
1885
1995
  expiration_time: opts.expirationTime,
1886
1996
  cancel_on_disconnect: opts.cancelOnDisconnect,
1887
- device_id: opts.deviceId
1997
+ device_id: opts.deviceId,
1998
+ fill_mode: mode === "normal" ? void 0 : mode
1888
1999
  };
1889
2000
  for (const [k, v] of Object.entries(optional)) if (v !== void 0 && v !== null) body[k] = v;
1890
2001
  return body;
@@ -1935,6 +2046,7 @@ var STX = (_class4 = class _STX {
1935
2046
  #fetch;
1936
2047
  #me;
1937
2048
  #capabilities;
2049
+ #apiVersion;
1938
2050
  /** Test hook: how retries wait. */
1939
2051
  __init5() {this._sleep = sleep}
1940
2052
  constructor(opts = {}) {;_class4.prototype.__init5.call(this);
@@ -1985,7 +2097,7 @@ var STX = (_class4 = class _STX {
1985
2097
  this.#fetch = fetchImpl;
1986
2098
  }
1987
2099
  toString() {
1988
- return `STX(baseUrl=${JSON.stringify(this.baseUrl)}, keyId=${JSON.stringify(_nullishCoalesce(_optionalChain([this, 'access', _19 => _19.credentials, 'optionalAccess', _20 => _20.keyId]), () => ( null)))})`;
2100
+ return `STX(baseUrl=${JSON.stringify(this.baseUrl)}, keyId=${JSON.stringify(_nullishCoalesce(_optionalChain([this, 'access', _23 => _23.credentials, 'optionalAccess', _24 => _24.keyId]), () => ( null)))})`;
1989
2101
  }
1990
2102
  /** The exchange host, e.g. `"demo.stxapp.io"`: the name `STXNotAvailableException` and `capabilities()` report. */
1991
2103
  get host() {
@@ -2038,6 +2150,89 @@ var STX = (_class4 = class _STX {
2038
2150
  clearTimeout(timer);
2039
2151
  }
2040
2152
  }
2153
+ // GET /api_version, cached on the client. A 404 is an answer (no feature
2154
+ // list), and so is a bare 403 from the edge (not JSON, no x-stx-error), which
2155
+ // some exchanges send for this path while serving the API. Any other failure
2156
+ // throws, so an outage or a block with a reason is never read as "absent".
2157
+ #apiVersionInfo() {
2158
+ if (!this.#apiVersion) {
2159
+ const run = this.#fetchApiVersion();
2160
+ this.#apiVersion = run;
2161
+ run.catch(() => {
2162
+ if (this.#apiVersion === run) this.#apiVersion = void 0;
2163
+ });
2164
+ }
2165
+ return this.#apiVersion;
2166
+ }
2167
+ async #fetchApiVersion() {
2168
+ const request = {
2169
+ operationId: "api_version",
2170
+ method: "GET",
2171
+ path: "/api_version",
2172
+ body: void 0,
2173
+ idempotent: true
2174
+ };
2175
+ const controller = new AbortController();
2176
+ const timer = setTimeout(() => controller.abort(), this.timeoutMs);
2177
+ let res;
2178
+ let text;
2179
+ try {
2180
+ res = await this.#fetch(this.baseUrl + request.path, {
2181
+ method: "GET",
2182
+ headers: { "User-Agent": USER_AGENT, Accept: "application/json" },
2183
+ signal: controller.signal
2184
+ });
2185
+ text = await res.text();
2186
+ } catch (err) {
2187
+ throw new STXTransportException(`GET /api_version failed: ${_nullishCoalesce(_optionalChain([err, 'optionalAccess', _25 => _25.message]), () => ( String(err)))}`, {
2188
+ method: "GET",
2189
+ path: request.path,
2190
+ cause: err
2191
+ });
2192
+ } finally {
2193
+ clearTimeout(timer);
2194
+ }
2195
+ if (res.status === 404 || res.status === 403 && !res.headers.get("x-stx-error") && isEdgeBlock(403, text)) {
2196
+ return { apiVersion: null, features: null };
2197
+ }
2198
+ return apiVersionFrom(
2199
+ decodeResponse(request, res.status, text, {
2200
+ retryAfter: res.headers.get("Retry-After"),
2201
+ stxError: res.headers.get("x-stx-error"),
2202
+ cfId: res.headers.get("x-amz-cf-id")
2203
+ })
2204
+ );
2205
+ }
2206
+ // Older builds ignore a fill_mode they do not know and would place a normal
2207
+ // order, so nothing is sent unless the exchange lists the mode.
2208
+ async #requireFillModes(modes) {
2209
+ for (const mode of [...new Set(modes)].sort()) {
2210
+ const feature = `orders.${mode}`;
2211
+ const info = await this.#apiVersionInfo();
2212
+ if (!_optionalChain([info, 'access', _26 => _26.features, 'optionalAccess', _27 => _27.includes, 'call', _28 => _28(API_FEATURES[feature])])) {
2213
+ throw new STXNotAvailableException(feature, this.host, { apiVersion: info.apiVersion });
2214
+ }
2215
+ }
2216
+ }
2217
+ // A typed error for the exchange's refusals of a fill mode, else undefined.
2218
+ async #fillModeError(err, mode) {
2219
+ if (!(err instanceof STXValidationException || err instanceof STXRejectedException)) return void 0;
2220
+ const base = { statusCode: err.statusCode, body: err.body, method: err.method, path: err.path, cause: err };
2221
+ const off = NOT_ENABLED.exec(err.message);
2222
+ if (off) {
2223
+ const cached = this.#apiVersion;
2224
+ this.#apiVersion = void 0;
2225
+ const apiVersion = cached ? await _asyncOptionalChain([(await cached.catch(() => null)), 'optionalAccess', async _29 => _29.apiVersion]) : void 0;
2226
+ return new STXNotAvailableException(`orders.${_nullishCoalesce(off[1], () => ( off[2]))}`, this.host, { ...base, apiVersion });
2227
+ }
2228
+ if (!(err instanceof STXRejectedException)) return void 0;
2229
+ const notAccepted = NOT_ACCEPTED.exec(err.message);
2230
+ if (notAccepted) return new STXFillModeNotAllowedException(err.message, { ...base, fillMode: notAccepted[1] });
2231
+ if (mode === "post_only" && err.message.includes(MATCH_WITH_SELF)) {
2232
+ return new STXPostOnlyWouldMatchException(err.message, { ...base, reason: "match_with_self" });
2233
+ }
2234
+ return void 0;
2235
+ }
2041
2236
  async #joinReason(topic) {
2042
2237
  if (!this.auth) return null;
2043
2238
  const ws = this.websocket({ reconnect: false, joinTimeoutMs: 8e3 });
@@ -2088,7 +2283,7 @@ var STX = (_class4 = class _STX {
2088
2283
  status,
2089
2284
  attempt,
2090
2285
  durationMs: Date.now() - started,
2091
- authKind: _optionalChain([this, 'access', _21 => _21.auth, 'optionalAccess', _22 => _22.kind]),
2286
+ authKind: _optionalChain([this, 'access', _30 => _30.auth, 'optionalAccess', _31 => _31.kind]),
2092
2287
  requestBody: request.body,
2093
2288
  responseBody
2094
2289
  });
@@ -2120,7 +2315,7 @@ var STX = (_class4 = class _STX {
2120
2315
  });
2121
2316
  }
2122
2317
  throw new STXTransportException(
2123
- `${request.method} ${request.path} failed: ${_nullishCoalesce(_optionalChain([err, 'optionalAccess', _23 => _23.message]), () => ( String(err)))}`,
2318
+ `${request.method} ${request.path} failed: ${_nullishCoalesce(_optionalChain([err, 'optionalAccess', _32 => _32.message]), () => ( String(err)))}`,
2124
2319
  { method: request.method, path: request.path, cause: err }
2125
2320
  );
2126
2321
  } finally {
@@ -2129,7 +2324,9 @@ var STX = (_class4 = class _STX {
2129
2324
  this.#report(request, response.status, attempt, started, text);
2130
2325
  return decodeResponse(request, response.status, text, {
2131
2326
  retryAfter: response.headers.get("Retry-After"),
2132
- wwwAuthenticate: response.headers.get("WWW-Authenticate")
2327
+ wwwAuthenticate: response.headers.get("WWW-Authenticate"),
2328
+ stxError: response.headers.get("x-stx-error"),
2329
+ cfId: response.headers.get("x-amz-cf-id")
2133
2330
  });
2134
2331
  }
2135
2332
  async #send(request) {
@@ -2142,7 +2339,7 @@ var STX = (_class4 = class _STX {
2142
2339
  return await this.#sendOnce(request, sent);
2143
2340
  } catch (err) {
2144
2341
  if (!(err instanceof STXException)) throw err;
2145
- if (err.statusCode === 401 && !reauthenticated && _optionalChain([this, 'access', _24 => _24.auth, 'optionalAccess', _25 => _25.onUnauthorized])) {
2342
+ if (err.statusCode === 401 && !reauthenticated && _optionalChain([this, 'access', _33 => _33.auth, 'optionalAccess', _34 => _34.onUnauthorized])) {
2146
2343
  reauthenticated = true;
2147
2344
  if (await this.auth.onUnauthorized()) continue;
2148
2345
  }
@@ -2157,7 +2354,7 @@ var STX = (_class4 = class _STX {
2157
2354
  return await this.#send(buildRequest(operationId, args));
2158
2355
  } catch (err) {
2159
2356
  const feature = GATED_OPERATIONS[operationId];
2160
- const off = feature !== void 0 && err instanceof STXNotFoundException && SWITCHED_OFF[feature] !== void 0 && _optionalChain([err, 'access', _26 => _26.body, 'optionalAccess', _27 => _27.error]) === SWITCHED_OFF[feature];
2357
+ const off = feature !== void 0 && err instanceof STXNotFoundException && SWITCHED_OFF[feature] !== void 0 && _optionalChain([err, 'access', _35 => _35.body, 'optionalAccess', _36 => _36.error]) === SWITCHED_OFF[feature];
2161
2358
  if (feature && (isMissingRoute(err) || off)) {
2162
2359
  throw new STXNotAvailableException(feature, this.host, {
2163
2360
  statusCode: err.statusCode,
@@ -2210,7 +2407,7 @@ var STX = (_class4 = class _STX {
2210
2407
  * `user_id`.
2211
2408
  */
2212
2409
  async userId() {
2213
- if (_optionalChain([this, 'access', _28 => _28.#me, 'optionalAccess', _29 => _29.user_id])) return this.#me.user_id;
2410
+ if (_optionalChain([this, 'access', _37 => _37.#me, 'optionalAccess', _38 => _38.user_id])) return this.#me.user_id;
2214
2411
  try {
2215
2412
  await this.me();
2216
2413
  } catch (err) {
@@ -2221,7 +2418,7 @@ var STX = (_class4 = class _STX {
2221
2418
  if (!balance.user_id) throw err;
2222
2419
  this.#me = { ..._nullishCoalesce(this.#me, () => ( {})), user_id: balance.user_id };
2223
2420
  }
2224
- if (!_optionalChain([this, 'access', _30 => _30.#me, 'optionalAccess', _31 => _31.user_id])) throw new STXException("GET /api/v1/me returned no user_id");
2421
+ if (!_optionalChain([this, 'access', _39 => _39.#me, 'optionalAccess', _40 => _40.user_id])) throw new STXException("GET /api/v1/me returned no user_id");
2225
2422
  return this.#me.user_id;
2226
2423
  }
2227
2424
  // ------------------------------------------------------------------
@@ -2388,6 +2585,17 @@ var STX = (_class4 = class _STX {
2388
2585
  * are decimal strings, e.g. `{ price: "0.58", quantity: "100" }`. Numbers are
2389
2586
  * refused client-side.
2390
2587
  *
2588
+ * `fillMode` (limit orders only) is `"normal"` (the default), `"post_only"`
2589
+ * or `"fill_or_kill"`. A post-only order that would match on arrival is not
2590
+ * placed: this throws `STXPostOnlyWouldMatchException`. A fill-or-kill order
2591
+ * comes back `accepted` (or `delayed` in play); follow it on the `orders`
2592
+ * channel or with `order()` to see it `filled` or `cancelled`.
2593
+ *
2594
+ * Before sending either mode, the client checks once that the exchange offers
2595
+ * it (`GET /api_version`, cached) and throws `STXNotAvailableException`
2596
+ * (`orders.post_only`, `orders.fill_or_kill`) without sending the order when
2597
+ * it does not. A combination market throws `STXFillModeNotAllowedException`.
2598
+ *
2391
2599
  * The exchange validates the order: a bad price step or a fractional
2392
2600
  * quantity throws `STXValidationException` (400) or `STXRejectedException`
2393
2601
  * (422) with the API's message. An order from outside the region is also
@@ -2398,16 +2606,44 @@ var STX = (_class4 = class _STX {
2398
2606
  */
2399
2607
  async placeOrder(marketId, action, orderType, opts) {
2400
2608
  const body = orderBody(marketId, action, orderType, _nullishCoalesce(opts, () => ( {})));
2401
- return this.#one("orders_post", { body });
2609
+ const mode = body.fill_mode;
2610
+ if (mode === void 0) return this.#one("orders_post", { body });
2611
+ await this.#requireFillModes([mode]);
2612
+ let order;
2613
+ try {
2614
+ order = await this.#one("orders_post", { body });
2615
+ } catch (err) {
2616
+ throw await _asyncNullishCoalesce(await this.#fillModeError(err, mode), async () => ( err));
2617
+ }
2618
+ if (mode === "post_only" && order.status === "cancelled" && order.cancellation_reason === "auto_matching") {
2619
+ throw new STXPostOnlyWouldMatchException(
2620
+ "The post-only order would have matched on arrival, so it was cancelled.",
2621
+ { reason: "auto_matching", order, statusCode: 200, method: "POST", path: OPERATIONS.orders_post.path }
2622
+ );
2623
+ }
2624
+ return order;
2402
2625
  }
2403
2626
  /**
2404
2627
  * `POST /api/v1/orders/batched`: place several orders in one call. Returns
2405
2628
  * one result per order, in order; a rejected order has `errors` instead of
2406
- * `order` and does not stop the others.
2629
+ * `order` and does not stop the others. A post-only order that would have
2630
+ * matched comes back as its order, `cancelled` with `cancellation_reason`
2631
+ * `auto_matching`.
2632
+ *
2633
+ * When any order has a `fillMode` other than `"normal"`, the exchange is
2634
+ * checked first as in `placeOrder()`, and `STXNotAvailableException` is
2635
+ * thrown with nothing sent.
2407
2636
  */
2408
2637
  async placeOrders(orders) {
2409
2638
  const body = { orders: orders.map(normalizeOrder) };
2410
- const raw = await this.#list("orders_batched_post", { body });
2639
+ const modes = body.orders.map((o) => o.fill_mode).filter((m) => typeof m === "string");
2640
+ if (modes.length) await this.#requireFillModes(modes);
2641
+ let raw;
2642
+ try {
2643
+ raw = await this.#list("orders_batched_post", { body });
2644
+ } catch (err) {
2645
+ throw await _asyncNullishCoalesce((modes.length ? await this.#fillModeError(err, void 0) : void 0), async () => ( err));
2646
+ }
2411
2647
  return raw.map(toBatchOrderResult);
2412
2648
  }
2413
2649
  /**
@@ -2466,6 +2702,7 @@ var STX = (_class4 = class _STX {
2466
2702
  market_ids: ids(q.marketIds),
2467
2703
  event_ids: ids(q.eventIds),
2468
2704
  exclude_zero_settlements: q.excludeZeroSettlements,
2705
+ unsettled_only: q.unsettledOnly,
2469
2706
  from_time: q.fromTime,
2470
2707
  to_time: q.toTime,
2471
2708
  sports: ids(q.sports),
@@ -2898,7 +3135,7 @@ var Channel = (_class5 = class {
2898
3135
  _startPinger() {
2899
3136
  this._stopPinger();
2900
3137
  let interval = this.pingIntervalMs;
2901
- const granted = _optionalChain([this, 'access', _32 => _32.reply, 'optionalAccess', _33 => _33.ping_timeout]);
3138
+ const granted = _optionalChain([this, 'access', _41 => _41.reply, 'optionalAccess', _42 => _42.ping_timeout]);
2902
3139
  if (typeof granted === "number" && this.joinPayload.cancel_on_disconnect) {
2903
3140
  const cod = granted / 3;
2904
3141
  interval = interval === null ? cod : Math.min(interval, cod);
@@ -2912,7 +3149,7 @@ var Channel = (_class5 = class {
2912
3149
  (err) => this.#ws.logger.warn(`${this.topic} ping failed: ${err.message}`)
2913
3150
  );
2914
3151
  }, every);
2915
- _optionalChain([this, 'access', _34 => _34.#pingTimer, 'access', _35 => _35.unref, 'optionalCall', _36 => _36()]);
3152
+ _optionalChain([this, 'access', _43 => _43.#pingTimer, 'access', _44 => _44.unref, 'optionalCall', _45 => _45()]);
2916
3153
  }
2917
3154
  }
2918
3155
  /** @internal */
@@ -3124,7 +3361,7 @@ var STXWebSocket = (_class6 = class {
3124
3361
  */
3125
3362
  async marketUpdates(opts = {}) {
3126
3363
  const channel = await this.join("market_updates", {}, opts.onMessage);
3127
- if (_optionalChain([opts, 'access', _37 => _37.watch, 'optionalAccess', _38 => _38.length])) await channel.watch(opts.watch);
3364
+ if (_optionalChain([opts, 'access', _46 => _46.watch, 'optionalAccess', _47 => _47.length])) await channel.watch(opts.watch);
3128
3365
  return channel;
3129
3366
  }
3130
3367
  /**
@@ -3373,12 +3610,12 @@ var STXWebSocket = (_class6 = class {
3373
3610
  if (!(err instanceof STXTransportException)) return false;
3374
3611
  if (err.statusCode !== 401 && err.statusCode !== 403) return false;
3375
3612
  const auth = this.rest.auth;
3376
- if (!_optionalChain([auth, 'optionalAccess', _39 => _39.onUnauthorized])) return false;
3613
+ if (!_optionalChain([auth, 'optionalAccess', _48 => _48.onUnauthorized])) return false;
3377
3614
  return auth.onUnauthorized();
3378
3615
  }
3379
3616
  async #open(reconnect = false) {
3380
3617
  const headers = { "User-Agent": USER_AGENT };
3381
- if (_optionalChain([this, 'access', _40 => _40.rest, 'access', _41 => _41.auth, 'optionalAccess', _42 => _42.websocketHeaders])) Object.assign(headers, await this.rest.auth.websocketHeaders({ reconnect }));
3618
+ if (_optionalChain([this, 'access', _49 => _49.rest, 'access', _50 => _50.auth, 'optionalAccess', _51 => _51.websocketHeaders])) Object.assign(headers, await this.rest.auth.websocketHeaders({ reconnect }));
3382
3619
  const conn = new (0, _ws2.default)(this.url, {
3383
3620
  headers,
3384
3621
  rejectUnauthorized: this.rest.verifyTls,
@@ -3394,7 +3631,7 @@ var STXWebSocket = (_class6 = class {
3394
3631
  conn.on("error", () => {
3395
3632
  });
3396
3633
  conn.terminate();
3397
- const reason = _optionalChain([res, 'access', _43 => _43.headers, 'optionalAccess', _44 => _44["x-stx-error"]]);
3634
+ const reason = _optionalChain([res, 'access', _52 => _52.headers, 'optionalAccess', _53 => _53["x-stx-error"]]);
3398
3635
  reject(
3399
3636
  new STXTransportException(
3400
3637
  `Could not open ${this.url}: HTTP ${res.statusCode}${reason ? ` (${String(reason)})` : ""}`,
@@ -3509,7 +3746,7 @@ var STXWebSocket = (_class6 = class {
3509
3746
  if (!channel.joined) {
3510
3747
  channel._endedJoin = { joinRef: String(joinRef), event };
3511
3748
  const pending = this.#pending.get(String(joinRef));
3512
- if (_optionalChain([pending, 'optionalAccess', _45 => _45.event]) === "phx_join") pending.reject(joinInterrupted(channel, event));
3749
+ if (_optionalChain([pending, 'optionalAccess', _54 => _54.event]) === "phx_join") pending.reject(joinInterrupted(channel, event));
3513
3750
  if (event === "phx_close" && channel.name === "market") this.#finishMarket(channel);
3514
3751
  return;
3515
3752
  }
@@ -3562,7 +3799,7 @@ var STXWebSocket = (_class6 = class {
3562
3799
  } catch (err) {
3563
3800
  this.logger.error(`rejoin ${channel.topic} failed: ${err.message}`);
3564
3801
  const reply = err instanceof STXChannelException ? err.reply : void 0;
3565
- if (_optionalChain([reply, 'optionalAccess', _46 => _46.reason]) === "unauthorized" || _optionalChain([reply, 'optionalAccess', _47 => _47.reason]) === COMBOS_UNAVAILABLE_REASON && COMBO_CHANNELS.has(channel.name)) {
3802
+ if (_optionalChain([reply, 'optionalAccess', _55 => _55.reason]) === "unauthorized" || _optionalChain([reply, 'optionalAccess', _56 => _56.reason]) === COMBOS_UNAVAILABLE_REASON && COMBO_CHANNELS.has(channel.name)) {
3566
3803
  channel._close();
3567
3804
  return;
3568
3805
  }
@@ -3576,7 +3813,7 @@ var STXWebSocket = (_class6 = class {
3576
3813
  if (!this.connected) return;
3577
3814
  if (this.#pendingHeartbeat !== null) {
3578
3815
  this.logger.warn("heartbeat unanswered; reconnecting");
3579
- _optionalChain([this, 'access', _48 => _48.#conn, 'optionalAccess', _49 => _49.terminate, 'call', _50 => _50()]);
3816
+ _optionalChain([this, 'access', _57 => _57.#conn, 'optionalAccess', _58 => _58.terminate, 'call', _59 => _59()]);
3580
3817
  return;
3581
3818
  }
3582
3819
  const ref = this.#nextRef();
@@ -3584,7 +3821,7 @@ var STXWebSocket = (_class6 = class {
3584
3821
  try {
3585
3822
  this.#send([null, ref, PHOENIX_TOPIC, "heartbeat", {}]);
3586
3823
  } catch (e13) {
3587
- _optionalChain([this, 'access', _51 => _51.#conn, 'optionalAccess', _52 => _52.terminate, 'call', _53 => _53()]);
3824
+ _optionalChain([this, 'access', _60 => _60.#conn, 'optionalAccess', _61 => _61.terminate, 'call', _62 => _62()]);
3588
3825
  }
3589
3826
  }, this.heartbeatIntervalMs);
3590
3827
  }
@@ -3671,7 +3908,7 @@ var STXWebSocket = (_class6 = class {
3671
3908
  this.error = err;
3672
3909
  this.#shutdownAfterDrop();
3673
3910
  try {
3674
- _optionalChain([this, 'access', _54 => _54.onAuthError, 'optionalCall', _55 => _55(err)]);
3911
+ _optionalChain([this, 'access', _63 => _63.onAuthError, 'optionalCall', _64 => _64(err)]);
3675
3912
  } catch (hookErr) {
3676
3913
  this.logger.error("onAuthError threw", hookErr);
3677
3914
  }
@@ -3772,5 +4009,10 @@ function dropUndefined(payload) {
3772
4009
 
3773
4010
 
3774
4011
 
3775
- exports.STXException = STXException; exports.STXConfigException = STXConfigException; exports.STXAPIException = STXAPIException; exports.STXValidationException = STXValidationException; exports.STXAuthenticationException = STXAuthenticationException; exports.STXForbiddenException = STXForbiddenException; exports.STXInvalidTokenException = STXInvalidTokenException; exports.STXInsufficientScopeException = STXInsufficientScopeException; exports.STXTermsRequiredException = STXTermsRequiredException; exports.STXIPNotAllowedException = STXIPNotAllowedException; exports.STXNotFoundException = STXNotFoundException; exports.STXRejectedException = STXRejectedException; exports.STXRateLimitException = STXRateLimitException; exports.STXServerException = STXServerException; exports.STXTransportException = STXTransportException; exports.STXChannelException = STXChannelException; exports.STXTimeoutException = STXTimeoutException; exports.notAvailableMessage = notAvailableMessage; exports.STXNotAvailableException = STXNotAvailableException; exports.STXCombosUnavailableException = STXCombosUnavailableException; exports.isEdgeBlock = isEdgeBlock; exports.STXComboRefusedException = STXComboRefusedException; exports.STXComboPriceMovedException = STXComboPriceMovedException; exports.errorForStatus = errorForStatus; exports.FEATURES = FEATURES; exports.Capabilities = Capabilities; exports.Region = Region; exports.Environment = Environment; exports.Environments = Environments; exports.HOSTS = HOSTS; exports.environmentNamed = environmentNamed; exports.resolveHost = resolveHost; exports.baseUrlFor = baseUrlFor; exports.socketUrlFor = socketUrlFor; exports.OPERATIONS = OPERATIONS; exports.Stats = Stats; exports.MAX_MARKETS_PER_REQUEST = MAX_MARKETS_PER_REQUEST; exports.isValidLine = isValidLine; exports.Page = Page; exports.RetryPolicy = RetryPolicy; exports.NO_RETRY = NO_RETRY; exports.resolveSettings = resolveSettings; exports.KEY_HEADER = KEY_HEADER; exports.TIMESTAMP_HEADER = TIMESTAMP_HEADER; exports.SIGNATURE_HEADER = SIGNATURE_HEADER; exports.buildMessage = buildMessage; exports.requestPath = requestPath; exports.handshakePath = handshakePath; exports.loadPrivateKey = loadPrivateKey; exports.signerFromPrivateKey = signerFromPrivateKey; exports.ApiKeyCredentials = ApiKeyCredentials; exports.VERSION = VERSION; exports.USER_AGENT = USER_AGENT; exports.TERMINAL_ORDER_STATUSES = TERMINAL_ORDER_STATUSES; exports.AccountView = AccountView; exports.ComboPlayer = ComboPlayer; exports.ComboMaker = ComboMaker; exports.centsToDollars = centsToDollars; exports.toDollarString = toDollarString; exports.toQuantity = toQuantity; exports.convertMarketPayload = convertMarketPayload; exports.convertMarketsFrame = convertMarketsFrame; exports.convertBook = convertBook; exports.convertMarketChannelPayload = convertMarketChannelPayload; exports.SNAPSHOT_EVENTS = SNAPSHOT_EVENTS; exports.ChannelMessage = ChannelMessage; exports.ReconnectPolicy = ReconnectPolicy; exports.Channel = Channel; exports.STXWebSocket = STXWebSocket; exports.orderBody = orderBody; exports.STX = STX;
3776
- //# sourceMappingURL=chunk-42OCIF3G.cjs.map
4012
+
4013
+
4014
+
4015
+
4016
+
4017
+ exports.STXException = STXException; exports.STXConfigException = STXConfigException; exports.STXAPIException = STXAPIException; exports.STXValidationException = STXValidationException; exports.STXAuthenticationException = STXAuthenticationException; exports.STXForbiddenException = STXForbiddenException; exports.STXInvalidTokenException = STXInvalidTokenException; exports.STXInsufficientScopeException = STXInsufficientScopeException; exports.STXTermsRequiredException = STXTermsRequiredException; exports.STXIPNotAllowedException = STXIPNotAllowedException; exports.STXBlockedException = STXBlockedException; exports.STXRestrictedJurisdictionException = STXRestrictedJurisdictionException; exports.STXUnusualNetworkException = STXUnusualNetworkException; exports.STXNotFoundException = STXNotFoundException; exports.STXRejectedException = STXRejectedException; exports.STXFillModeNotAllowedException = STXFillModeNotAllowedException; exports.STXPostOnlyWouldMatchException = STXPostOnlyWouldMatchException; exports.STXRateLimitException = STXRateLimitException; exports.STXServerException = STXServerException; exports.STXTransportException = STXTransportException; exports.STXChannelException = STXChannelException; exports.STXTimeoutException = STXTimeoutException; exports.notAvailableMessage = notAvailableMessage; exports.STXNotAvailableException = STXNotAvailableException; exports.STXCombosUnavailableException = STXCombosUnavailableException; exports.isEdgeBlock = isEdgeBlock; exports.STXComboRefusedException = STXComboRefusedException; exports.STXComboPriceMovedException = STXComboPriceMovedException; exports.errorForStatus = errorForStatus; exports.FEATURES = FEATURES; exports.Capabilities = Capabilities; exports.Region = Region; exports.Environment = Environment; exports.Environments = Environments; exports.HOSTS = HOSTS; exports.environmentNamed = environmentNamed; exports.resolveHost = resolveHost; exports.baseUrlFor = baseUrlFor; exports.socketUrlFor = socketUrlFor; exports.OPERATIONS = OPERATIONS; exports.Stats = Stats; exports.MAX_MARKETS_PER_REQUEST = MAX_MARKETS_PER_REQUEST; exports.isValidLine = isValidLine; exports.Page = Page; exports.RetryPolicy = RetryPolicy; exports.NO_RETRY = NO_RETRY; exports.resolveSettings = resolveSettings; exports.KEY_HEADER = KEY_HEADER; exports.TIMESTAMP_HEADER = TIMESTAMP_HEADER; exports.SIGNATURE_HEADER = SIGNATURE_HEADER; exports.buildMessage = buildMessage; exports.requestPath = requestPath; exports.handshakePath = handshakePath; exports.loadPrivateKey = loadPrivateKey; exports.signerFromPrivateKey = signerFromPrivateKey; exports.ApiKeyCredentials = ApiKeyCredentials; exports.VERSION = VERSION; exports.USER_AGENT = USER_AGENT; exports.TERMINAL_ORDER_STATUSES = TERMINAL_ORDER_STATUSES; exports.AccountView = AccountView; exports.ComboPlayer = ComboPlayer; exports.ComboMaker = ComboMaker; exports.centsToDollars = centsToDollars; exports.toDollarString = toDollarString; exports.toQuantity = toQuantity; exports.convertMarketPayload = convertMarketPayload; exports.convertMarketsFrame = convertMarketsFrame; exports.convertBook = convertBook; exports.convertMarketChannelPayload = convertMarketChannelPayload; exports.SNAPSHOT_EVENTS = SNAPSHOT_EVENTS; exports.ChannelMessage = ChannelMessage; exports.ReconnectPolicy = ReconnectPolicy; exports.Channel = Channel; exports.STXWebSocket = STXWebSocket; exports.orderBody = orderBody; exports.STX = STX;
4018
+ //# sourceMappingURL=chunk-BSX65XEA.cjs.map