@stxapp/stx-typescript 0.6.0 → 0.6.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.
@@ -100,14 +100,14 @@ declare function environmentNamed(name: string): STXEnvironment;
100
100
  /** Hostname for a (region, env) pair, or `STXConfigException`. */
101
101
  declare function resolveHost(region: string | null | undefined, env: string | null | undefined): string;
102
102
  /**
103
- * The REST base URL (scheme and authority, no path).
103
+ * The API base URL (scheme and authority, no path).
104
104
  *
105
105
  * `host` may be a bare hostname (`demo.stxapp.io`, `localhost:4000`), which
106
106
  * gets `https://`, or a URL (`http://localhost:4000`) whose scheme is kept.
107
107
  * Any path on the URL is ignored: the API lives at `/api/v1` on every host.
108
108
  */
109
109
  declare function baseUrlFor(region: string | null | undefined, env: string | null | undefined, host: string | null | undefined): string;
110
- /** The WebSocket URL for a REST base URL: https maps to wss, http to ws. */
110
+ /** The WebSocket URL for an API base URL: https maps to wss, http to ws. */
111
111
  declare function socketUrlFor(baseUrl: string): string;
112
112
 
113
113
  /** Why the exchange's geo-fencing refused a request. */
@@ -2556,8 +2556,8 @@ declare class ApiKeyCredentials implements AuthProvider {
2556
2556
  toString(): string;
2557
2557
  }
2558
2558
 
2559
- declare const VERSION = "0.6.0";
2560
- declare const USER_AGENT = "stx-typescript/0.6.0";
2559
+ declare const VERSION = "0.6.1";
2560
+ declare const USER_AGENT = "stx-typescript/0.6.1";
2561
2561
  /**
2562
2562
  * `Symbol.asyncDispose` where the runtime has it (Node 20+, Bun), so
2563
2563
  * `await using client = new STX()` works there; a registered stand-in on
@@ -2798,7 +2798,7 @@ interface STXWebSocketOptions extends Pick<STXOptions, "environment" | "region"
2798
2798
  /** Reconnect after a drop. Default true. */
2799
2799
  reconnect?: boolean;
2800
2800
  reconnectPolicy?: ReconnectPolicy;
2801
- /** Called after every successful reconnect and rejoin: the moment to reconcile from REST. */
2801
+ /** Called after every successful reconnect and rejoin: the moment to read open orders and anything else you loaded with `STX` again. */
2802
2802
  onReconnect?: () => void | Promise<void>;
2803
2803
  /**
2804
2804
  * Called when the socket gives up because its credentials are dead: an OAuth
@@ -2814,8 +2814,8 @@ interface STXWebSocketOptions extends Pick<STXOptions, "environment" | "region"
2814
2814
  logger?: Logger;
2815
2815
  }
2816
2816
  /**
2817
- * Phoenix-channels client for the documented STX topics. Build it from a REST
2818
- * client, which supplies the host, the key and your user id:
2817
+ * Phoenix-channels client for the documented STX topics. Build it from an
2818
+ * `STX` client, which supplies the host, the key and your user id:
2819
2819
  *
2820
2820
  * const client = new STX({ profile: "ontario" });
2821
2821
  * const ws = await client.websocket().connect();
@@ -3021,8 +3021,8 @@ interface STXOptions {
3021
3021
  /** A section of ~/.stx/credentials to read. */
3022
3022
  profile?: string | null;
3023
3023
  /**
3024
- * Set false only for a local server. Honoured by the WebSocket; for REST,
3025
- * pass a `fetch` whose dispatcher skips verification (Node's global fetch
3024
+ * Set false only for a local server. Honoured by the WebSocket; for HTTP
3025
+ * requests, pass a `fetch` whose dispatcher skips verification (Node's global fetch
3026
3026
  * has no per-call switch).
3027
3027
  */
3028
3028
  verifyTls?: boolean | null;
@@ -3177,7 +3177,7 @@ interface AcceptTermsOptions {
3177
3177
  /** The JSON body for one new order. Fields left undefined are omitted. */
3178
3178
  declare function orderBody(marketId: string, action: string, orderType: string, opts: Omit<OrderOptions, "geoLocation">): Record<string, unknown>;
3179
3179
  /**
3180
- * The STX REST client. Configuration comes from the options, then
3180
+ * The STX client. Configuration comes from the options, then
3181
3181
  * environment variables, then a profile in ~/.stx/credentials:
3182
3182
  *
3183
3183
  * const client = new STX({ profile: "ontario-production" });
@@ -100,14 +100,14 @@ declare function environmentNamed(name: string): STXEnvironment;
100
100
  /** Hostname for a (region, env) pair, or `STXConfigException`. */
101
101
  declare function resolveHost(region: string | null | undefined, env: string | null | undefined): string;
102
102
  /**
103
- * The REST base URL (scheme and authority, no path).
103
+ * The API base URL (scheme and authority, no path).
104
104
  *
105
105
  * `host` may be a bare hostname (`demo.stxapp.io`, `localhost:4000`), which
106
106
  * gets `https://`, or a URL (`http://localhost:4000`) whose scheme is kept.
107
107
  * Any path on the URL is ignored: the API lives at `/api/v1` on every host.
108
108
  */
109
109
  declare function baseUrlFor(region: string | null | undefined, env: string | null | undefined, host: string | null | undefined): string;
110
- /** The WebSocket URL for a REST base URL: https maps to wss, http to ws. */
110
+ /** The WebSocket URL for an API base URL: https maps to wss, http to ws. */
111
111
  declare function socketUrlFor(baseUrl: string): string;
112
112
 
113
113
  /** Why the exchange's geo-fencing refused a request. */
@@ -2556,8 +2556,8 @@ declare class ApiKeyCredentials implements AuthProvider {
2556
2556
  toString(): string;
2557
2557
  }
2558
2558
 
2559
- declare const VERSION = "0.6.0";
2560
- declare const USER_AGENT = "stx-typescript/0.6.0";
2559
+ declare const VERSION = "0.6.1";
2560
+ declare const USER_AGENT = "stx-typescript/0.6.1";
2561
2561
  /**
2562
2562
  * `Symbol.asyncDispose` where the runtime has it (Node 20+, Bun), so
2563
2563
  * `await using client = new STX()` works there; a registered stand-in on
@@ -2798,7 +2798,7 @@ interface STXWebSocketOptions extends Pick<STXOptions, "environment" | "region"
2798
2798
  /** Reconnect after a drop. Default true. */
2799
2799
  reconnect?: boolean;
2800
2800
  reconnectPolicy?: ReconnectPolicy;
2801
- /** Called after every successful reconnect and rejoin: the moment to reconcile from REST. */
2801
+ /** Called after every successful reconnect and rejoin: the moment to read open orders and anything else you loaded with `STX` again. */
2802
2802
  onReconnect?: () => void | Promise<void>;
2803
2803
  /**
2804
2804
  * Called when the socket gives up because its credentials are dead: an OAuth
@@ -2814,8 +2814,8 @@ interface STXWebSocketOptions extends Pick<STXOptions, "environment" | "region"
2814
2814
  logger?: Logger;
2815
2815
  }
2816
2816
  /**
2817
- * Phoenix-channels client for the documented STX topics. Build it from a REST
2818
- * client, which supplies the host, the key and your user id:
2817
+ * Phoenix-channels client for the documented STX topics. Build it from an
2818
+ * `STX` client, which supplies the host, the key and your user id:
2819
2819
  *
2820
2820
  * const client = new STX({ profile: "ontario" });
2821
2821
  * const ws = await client.websocket().connect();
@@ -3021,8 +3021,8 @@ interface STXOptions {
3021
3021
  /** A section of ~/.stx/credentials to read. */
3022
3022
  profile?: string | null;
3023
3023
  /**
3024
- * Set false only for a local server. Honoured by the WebSocket; for REST,
3025
- * pass a `fetch` whose dispatcher skips verification (Node's global fetch
3024
+ * Set false only for a local server. Honoured by the WebSocket; for HTTP
3025
+ * requests, pass a `fetch` whose dispatcher skips verification (Node's global fetch
3026
3026
  * has no per-call switch).
3027
3027
  */
3028
3028
  verifyTls?: boolean | null;
@@ -3177,7 +3177,7 @@ interface AcceptTermsOptions {
3177
3177
  /** The JSON body for one new order. Fields left undefined are omitted. */
3178
3178
  declare function orderBody(marketId: string, action: string, orderType: string, opts: Omit<OrderOptions, "geoLocation">): Record<string, unknown>;
3179
3179
  /**
3180
- * The STX REST client. Configuration comes from the options, then
3180
+ * The STX client. Configuration comes from the options, then
3181
3181
  * environment variables, then a profile in ~/.stx/credentials:
3182
3182
  *
3183
3183
  * const client = new STX({ profile: "ontario-production" });
package/dist/index.cjs CHANGED
@@ -57,7 +57,7 @@
57
57
 
58
58
 
59
59
 
60
- var _chunkR664LTIBcjs = require('./chunk-R664LTIB.cjs');
60
+ var _chunk7O5ZGZQIcjs = require('./chunk-7O5ZGZQI.cjs');
61
61
 
62
62
 
63
63
 
@@ -117,5 +117,5 @@ var _chunkR664LTIBcjs = require('./chunk-R664LTIB.cjs');
117
117
 
118
118
 
119
119
 
120
- exports.AccountView = _chunkR664LTIBcjs.AccountView; exports.ApiKeyCredentials = _chunkR664LTIBcjs.ApiKeyCredentials; exports.Channel = _chunkR664LTIBcjs.Channel; exports.ChannelMessage = _chunkR664LTIBcjs.ChannelMessage; exports.Environment = _chunkR664LTIBcjs.Environment; exports.Environments = _chunkR664LTIBcjs.Environments; exports.HOSTS = _chunkR664LTIBcjs.HOSTS; exports.KEY_HEADER = _chunkR664LTIBcjs.KEY_HEADER; exports.NO_RETRY = _chunkR664LTIBcjs.NO_RETRY; exports.OPERATIONS = _chunkR664LTIBcjs.OPERATIONS; exports.Page = _chunkR664LTIBcjs.Page; exports.ReconnectPolicy = _chunkR664LTIBcjs.ReconnectPolicy; exports.Region = _chunkR664LTIBcjs.Region; exports.RetryPolicy = _chunkR664LTIBcjs.RetryPolicy; exports.SIGNATURE_HEADER = _chunkR664LTIBcjs.SIGNATURE_HEADER; exports.SNAPSHOT_EVENTS = _chunkR664LTIBcjs.SNAPSHOT_EVENTS; exports.STX = _chunkR664LTIBcjs.STX; exports.STXAPIException = _chunkR664LTIBcjs.STXAPIException; exports.STXAuthenticationException = _chunkR664LTIBcjs.STXAuthenticationException; exports.STXChannelException = _chunkR664LTIBcjs.STXChannelException; exports.STXConfigException = _chunkR664LTIBcjs.STXConfigException; exports.STXException = _chunkR664LTIBcjs.STXException; exports.STXForbiddenException = _chunkR664LTIBcjs.STXForbiddenException; exports.STXGeoLocationException = _chunkR664LTIBcjs.STXGeoLocationException; exports.STXInsufficientScopeException = _chunkR664LTIBcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunkR664LTIBcjs.STXInvalidTokenException; exports.STXNotFoundException = _chunkR664LTIBcjs.STXNotFoundException; exports.STXRateLimitException = _chunkR664LTIBcjs.STXRateLimitException; exports.STXRejectedException = _chunkR664LTIBcjs.STXRejectedException; exports.STXServerException = _chunkR664LTIBcjs.STXServerException; exports.STXTimeoutException = _chunkR664LTIBcjs.STXTimeoutException; exports.STXTransportException = _chunkR664LTIBcjs.STXTransportException; exports.STXValidationException = _chunkR664LTIBcjs.STXValidationException; exports.STXWebSocket = _chunkR664LTIBcjs.STXWebSocket; exports.TERMINAL_ORDER_STATUSES = _chunkR664LTIBcjs.TERMINAL_ORDER_STATUSES; exports.TIMESTAMP_HEADER = _chunkR664LTIBcjs.TIMESTAMP_HEADER; exports.USER_AGENT = _chunkR664LTIBcjs.USER_AGENT; exports.VERSION = _chunkR664LTIBcjs.VERSION; exports.baseUrlFor = _chunkR664LTIBcjs.baseUrlFor; exports.buildMessage = _chunkR664LTIBcjs.buildMessage; exports.centsToDollars = _chunkR664LTIBcjs.centsToDollars; exports.convertBook = _chunkR664LTIBcjs.convertBook; exports.convertMarketChannelPayload = _chunkR664LTIBcjs.convertMarketChannelPayload; exports.convertMarketPayload = _chunkR664LTIBcjs.convertMarketPayload; exports.convertMarketsFrame = _chunkR664LTIBcjs.convertMarketsFrame; exports.environmentNamed = _chunkR664LTIBcjs.environmentNamed; exports.errorForStatus = _chunkR664LTIBcjs.errorForStatus; exports.geoRejection = _chunkR664LTIBcjs.geoRejection; exports.handshakePath = _chunkR664LTIBcjs.handshakePath; exports.loadPrivateKey = _chunkR664LTIBcjs.loadPrivateKey; exports.orderBody = _chunkR664LTIBcjs.orderBody; exports.requestPath = _chunkR664LTIBcjs.requestPath; exports.resolveHost = _chunkR664LTIBcjs.resolveHost; exports.resolveSettings = _chunkR664LTIBcjs.resolveSettings; exports.signerFromPrivateKey = _chunkR664LTIBcjs.signerFromPrivateKey; exports.socketUrlFor = _chunkR664LTIBcjs.socketUrlFor; exports.toDollarString = _chunkR664LTIBcjs.toDollarString; exports.toQuantity = _chunkR664LTIBcjs.toQuantity;
120
+ exports.AccountView = _chunk7O5ZGZQIcjs.AccountView; exports.ApiKeyCredentials = _chunk7O5ZGZQIcjs.ApiKeyCredentials; exports.Channel = _chunk7O5ZGZQIcjs.Channel; exports.ChannelMessage = _chunk7O5ZGZQIcjs.ChannelMessage; exports.Environment = _chunk7O5ZGZQIcjs.Environment; exports.Environments = _chunk7O5ZGZQIcjs.Environments; exports.HOSTS = _chunk7O5ZGZQIcjs.HOSTS; exports.KEY_HEADER = _chunk7O5ZGZQIcjs.KEY_HEADER; exports.NO_RETRY = _chunk7O5ZGZQIcjs.NO_RETRY; exports.OPERATIONS = _chunk7O5ZGZQIcjs.OPERATIONS; exports.Page = _chunk7O5ZGZQIcjs.Page; exports.ReconnectPolicy = _chunk7O5ZGZQIcjs.ReconnectPolicy; exports.Region = _chunk7O5ZGZQIcjs.Region; exports.RetryPolicy = _chunk7O5ZGZQIcjs.RetryPolicy; exports.SIGNATURE_HEADER = _chunk7O5ZGZQIcjs.SIGNATURE_HEADER; exports.SNAPSHOT_EVENTS = _chunk7O5ZGZQIcjs.SNAPSHOT_EVENTS; exports.STX = _chunk7O5ZGZQIcjs.STX; exports.STXAPIException = _chunk7O5ZGZQIcjs.STXAPIException; exports.STXAuthenticationException = _chunk7O5ZGZQIcjs.STXAuthenticationException; exports.STXChannelException = _chunk7O5ZGZQIcjs.STXChannelException; exports.STXConfigException = _chunk7O5ZGZQIcjs.STXConfigException; exports.STXException = _chunk7O5ZGZQIcjs.STXException; exports.STXForbiddenException = _chunk7O5ZGZQIcjs.STXForbiddenException; exports.STXGeoLocationException = _chunk7O5ZGZQIcjs.STXGeoLocationException; exports.STXInsufficientScopeException = _chunk7O5ZGZQIcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunk7O5ZGZQIcjs.STXInvalidTokenException; exports.STXNotFoundException = _chunk7O5ZGZQIcjs.STXNotFoundException; exports.STXRateLimitException = _chunk7O5ZGZQIcjs.STXRateLimitException; exports.STXRejectedException = _chunk7O5ZGZQIcjs.STXRejectedException; exports.STXServerException = _chunk7O5ZGZQIcjs.STXServerException; exports.STXTimeoutException = _chunk7O5ZGZQIcjs.STXTimeoutException; exports.STXTransportException = _chunk7O5ZGZQIcjs.STXTransportException; exports.STXValidationException = _chunk7O5ZGZQIcjs.STXValidationException; exports.STXWebSocket = _chunk7O5ZGZQIcjs.STXWebSocket; exports.TERMINAL_ORDER_STATUSES = _chunk7O5ZGZQIcjs.TERMINAL_ORDER_STATUSES; exports.TIMESTAMP_HEADER = _chunk7O5ZGZQIcjs.TIMESTAMP_HEADER; exports.USER_AGENT = _chunk7O5ZGZQIcjs.USER_AGENT; exports.VERSION = _chunk7O5ZGZQIcjs.VERSION; exports.baseUrlFor = _chunk7O5ZGZQIcjs.baseUrlFor; exports.buildMessage = _chunk7O5ZGZQIcjs.buildMessage; exports.centsToDollars = _chunk7O5ZGZQIcjs.centsToDollars; exports.convertBook = _chunk7O5ZGZQIcjs.convertBook; exports.convertMarketChannelPayload = _chunk7O5ZGZQIcjs.convertMarketChannelPayload; exports.convertMarketPayload = _chunk7O5ZGZQIcjs.convertMarketPayload; exports.convertMarketsFrame = _chunk7O5ZGZQIcjs.convertMarketsFrame; exports.environmentNamed = _chunk7O5ZGZQIcjs.environmentNamed; exports.errorForStatus = _chunk7O5ZGZQIcjs.errorForStatus; exports.geoRejection = _chunk7O5ZGZQIcjs.geoRejection; exports.handshakePath = _chunk7O5ZGZQIcjs.handshakePath; exports.loadPrivateKey = _chunk7O5ZGZQIcjs.loadPrivateKey; exports.orderBody = _chunk7O5ZGZQIcjs.orderBody; exports.requestPath = _chunk7O5ZGZQIcjs.requestPath; exports.resolveHost = _chunk7O5ZGZQIcjs.resolveHost; exports.resolveSettings = _chunk7O5ZGZQIcjs.resolveSettings; exports.signerFromPrivateKey = _chunk7O5ZGZQIcjs.signerFromPrivateKey; exports.socketUrlFor = _chunk7O5ZGZQIcjs.socketUrlFor; exports.toDollarString = _chunk7O5ZGZQIcjs.toDollarString; exports.toQuantity = _chunk7O5ZGZQIcjs.toQuantity;
121
121
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AcceptTermsOptions, a as AccountChange, b as AccountChangeKind, c as AccountState, d as AccountView, e as AccountViewOptions, f as ApiKeyCredentials, g as AuthProvider, h as AuthRequest, B as Balance, i as BatchOrderResult, j as BookLevel, C as Cancellation, k as Channel, l as ChannelMessage, E as Environment, m as Environments, n as Error, o as Event, p as EventsQuery, F as FeeTransaction, q as FetchLike, r as Fill, s as FillsQuery, G as GeoCheckResult, t as GeoLocationProvider, u as GeoOption, v as GeoRejection, H as HOSTS, K as KEY_HEADER, L as Logger, M as Market, w as MarketFilter, x as MarketStat, y as MarketStatsQuery, z as MarketsQuery, D as Me, I as MessageHandler, N as NO_RETRY, J as NewOrder, O as NewOrderInput, P as OPERATIONS, Q as Operation, R as OperationId, S as Order, T as OrderOptions, U as OrdersQuery, V as Page, W as PageQuery, X as PaymentTransaction, Y as Position, Z as PrivateKeyInput, _ as RecentTrade, $ as ReconnectPolicy, a0 as ReconnectPolicyOptions, a1 as Region, a2 as ResponseEvent, a3 as RetryPolicy, a4 as RetryPolicyOptions, a5 as SIGNATURE_HEADER, a6 as SNAPSHOT_EVENTS, a7 as STX, a8 as STXAPIException, a9 as STXAuthenticationException, aa as STXChannelException, ab as STXConfigException, ac as STXEnvironment, ad as STXException, ae as STXForbiddenException, af as STXGeoLocationException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException, ai as STXNotFoundException, aj as STXOptions, ak as STXRateLimitException, al as STXRejectedException, am as STXServerException, an as STXTimeoutException, ao as STXTransportException, ap as STXValidationException, aq as STXWebSocket, ar as STXWebSocketOptions, as as Settlement, at as SettlementsQuery, au as Signer, av as StatDetail, aw as StrList, ax as TERMINAL_ORDER_STATUSES, ay as TIMESTAMP_HEADER, az as Transaction, aA as USER_AGENT, aB as VERSION, aC as WebSocketAuthContext, aD as baseUrlFor, aE as buildMessage, aF as environmentNamed, aG as errorForStatus, aH as geoRejection, aI as handshakePath, aJ as loadPrivateKey, aK as models, aL as orderBody, aM as requestPath, aN as resolveHost, aO as signerFromPrivateKey, aP as socketUrlFor } from './client-5n7RRquU.cjs';
1
+ export { A as AcceptTermsOptions, a as AccountChange, b as AccountChangeKind, c as AccountState, d as AccountView, e as AccountViewOptions, f as ApiKeyCredentials, g as AuthProvider, h as AuthRequest, B as Balance, i as BatchOrderResult, j as BookLevel, C as Cancellation, k as Channel, l as ChannelMessage, E as Environment, m as Environments, n as Error, o as Event, p as EventsQuery, F as FeeTransaction, q as FetchLike, r as Fill, s as FillsQuery, G as GeoCheckResult, t as GeoLocationProvider, u as GeoOption, v as GeoRejection, H as HOSTS, K as KEY_HEADER, L as Logger, M as Market, w as MarketFilter, x as MarketStat, y as MarketStatsQuery, z as MarketsQuery, D as Me, I as MessageHandler, N as NO_RETRY, J as NewOrder, O as NewOrderInput, P as OPERATIONS, Q as Operation, R as OperationId, S as Order, T as OrderOptions, U as OrdersQuery, V as Page, W as PageQuery, X as PaymentTransaction, Y as Position, Z as PrivateKeyInput, _ as RecentTrade, $ as ReconnectPolicy, a0 as ReconnectPolicyOptions, a1 as Region, a2 as ResponseEvent, a3 as RetryPolicy, a4 as RetryPolicyOptions, a5 as SIGNATURE_HEADER, a6 as SNAPSHOT_EVENTS, a7 as STX, a8 as STXAPIException, a9 as STXAuthenticationException, aa as STXChannelException, ab as STXConfigException, ac as STXEnvironment, ad as STXException, ae as STXForbiddenException, af as STXGeoLocationException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException, ai as STXNotFoundException, aj as STXOptions, ak as STXRateLimitException, al as STXRejectedException, am as STXServerException, an as STXTimeoutException, ao as STXTransportException, ap as STXValidationException, aq as STXWebSocket, ar as STXWebSocketOptions, as as Settlement, at as SettlementsQuery, au as Signer, av as StatDetail, aw as StrList, ax as TERMINAL_ORDER_STATUSES, ay as TIMESTAMP_HEADER, az as Transaction, aA as USER_AGENT, aB as VERSION, aC as WebSocketAuthContext, aD as baseUrlFor, aE as buildMessage, aF as environmentNamed, aG as errorForStatus, aH as geoRejection, aI as handshakePath, aJ as loadPrivateKey, aK as models, aL as orderBody, aM as requestPath, aN as resolveHost, aO as signerFromPrivateKey, aP as socketUrlFor } from './client-wriBXPDx.cjs';
2
2
  import 'node:crypto';
3
3
 
4
4
  /** The fully resolved configuration the clients consume. */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AcceptTermsOptions, a as AccountChange, b as AccountChangeKind, c as AccountState, d as AccountView, e as AccountViewOptions, f as ApiKeyCredentials, g as AuthProvider, h as AuthRequest, B as Balance, i as BatchOrderResult, j as BookLevel, C as Cancellation, k as Channel, l as ChannelMessage, E as Environment, m as Environments, n as Error, o as Event, p as EventsQuery, F as FeeTransaction, q as FetchLike, r as Fill, s as FillsQuery, G as GeoCheckResult, t as GeoLocationProvider, u as GeoOption, v as GeoRejection, H as HOSTS, K as KEY_HEADER, L as Logger, M as Market, w as MarketFilter, x as MarketStat, y as MarketStatsQuery, z as MarketsQuery, D as Me, I as MessageHandler, N as NO_RETRY, J as NewOrder, O as NewOrderInput, P as OPERATIONS, Q as Operation, R as OperationId, S as Order, T as OrderOptions, U as OrdersQuery, V as Page, W as PageQuery, X as PaymentTransaction, Y as Position, Z as PrivateKeyInput, _ as RecentTrade, $ as ReconnectPolicy, a0 as ReconnectPolicyOptions, a1 as Region, a2 as ResponseEvent, a3 as RetryPolicy, a4 as RetryPolicyOptions, a5 as SIGNATURE_HEADER, a6 as SNAPSHOT_EVENTS, a7 as STX, a8 as STXAPIException, a9 as STXAuthenticationException, aa as STXChannelException, ab as STXConfigException, ac as STXEnvironment, ad as STXException, ae as STXForbiddenException, af as STXGeoLocationException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException, ai as STXNotFoundException, aj as STXOptions, ak as STXRateLimitException, al as STXRejectedException, am as STXServerException, an as STXTimeoutException, ao as STXTransportException, ap as STXValidationException, aq as STXWebSocket, ar as STXWebSocketOptions, as as Settlement, at as SettlementsQuery, au as Signer, av as StatDetail, aw as StrList, ax as TERMINAL_ORDER_STATUSES, ay as TIMESTAMP_HEADER, az as Transaction, aA as USER_AGENT, aB as VERSION, aC as WebSocketAuthContext, aD as baseUrlFor, aE as buildMessage, aF as environmentNamed, aG as errorForStatus, aH as geoRejection, aI as handshakePath, aJ as loadPrivateKey, aK as models, aL as orderBody, aM as requestPath, aN as resolveHost, aO as signerFromPrivateKey, aP as socketUrlFor } from './client-5n7RRquU.js';
1
+ export { A as AcceptTermsOptions, a as AccountChange, b as AccountChangeKind, c as AccountState, d as AccountView, e as AccountViewOptions, f as ApiKeyCredentials, g as AuthProvider, h as AuthRequest, B as Balance, i as BatchOrderResult, j as BookLevel, C as Cancellation, k as Channel, l as ChannelMessage, E as Environment, m as Environments, n as Error, o as Event, p as EventsQuery, F as FeeTransaction, q as FetchLike, r as Fill, s as FillsQuery, G as GeoCheckResult, t as GeoLocationProvider, u as GeoOption, v as GeoRejection, H as HOSTS, K as KEY_HEADER, L as Logger, M as Market, w as MarketFilter, x as MarketStat, y as MarketStatsQuery, z as MarketsQuery, D as Me, I as MessageHandler, N as NO_RETRY, J as NewOrder, O as NewOrderInput, P as OPERATIONS, Q as Operation, R as OperationId, S as Order, T as OrderOptions, U as OrdersQuery, V as Page, W as PageQuery, X as PaymentTransaction, Y as Position, Z as PrivateKeyInput, _ as RecentTrade, $ as ReconnectPolicy, a0 as ReconnectPolicyOptions, a1 as Region, a2 as ResponseEvent, a3 as RetryPolicy, a4 as RetryPolicyOptions, a5 as SIGNATURE_HEADER, a6 as SNAPSHOT_EVENTS, a7 as STX, a8 as STXAPIException, a9 as STXAuthenticationException, aa as STXChannelException, ab as STXConfigException, ac as STXEnvironment, ad as STXException, ae as STXForbiddenException, af as STXGeoLocationException, ag as STXInsufficientScopeException, ah as STXInvalidTokenException, ai as STXNotFoundException, aj as STXOptions, ak as STXRateLimitException, al as STXRejectedException, am as STXServerException, an as STXTimeoutException, ao as STXTransportException, ap as STXValidationException, aq as STXWebSocket, ar as STXWebSocketOptions, as as Settlement, at as SettlementsQuery, au as Signer, av as StatDetail, aw as StrList, ax as TERMINAL_ORDER_STATUSES, ay as TIMESTAMP_HEADER, az as Transaction, aA as USER_AGENT, aB as VERSION, aC as WebSocketAuthContext, aD as baseUrlFor, aE as buildMessage, aF as environmentNamed, aG as errorForStatus, aH as geoRejection, aI as handshakePath, aJ as loadPrivateKey, aK as models, aL as orderBody, aM as requestPath, aN as resolveHost, aO as signerFromPrivateKey, aP as socketUrlFor } from './client-wriBXPDx.js';
2
2
  import 'node:crypto';
3
3
 
4
4
  /** The fully resolved configuration the clients consume. */
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ import {
57
57
  socketUrlFor,
58
58
  toDollarString,
59
59
  toQuantity
60
- } from "./chunk-U3KT3I43.js";
60
+ } from "./chunk-P7ZEHWKM.js";
61
61
  export {
62
62
  AccountView,
63
63
  ApiKeyCredentials,
package/dist/oauth.cjs CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkR664LTIBcjs = require('./chunk-R664LTIB.cjs');
10
+ var _chunk7O5ZGZQIcjs = require('./chunk-7O5ZGZQI.cjs');
11
11
 
12
12
  // src/oauth/endpoints.ts
13
13
  var DEFAULT_ENDPOINTS = {
@@ -24,12 +24,12 @@ var WELL_KNOWN = {
24
24
  function resolveOAuthConfig(input) {
25
25
  const env = _nullishCoalesce(_optionalChain([globalThis, 'access', _ => _.process, 'optionalAccess', _2 => _2.env]), () => ( {}));
26
26
  const host = _nullishCoalesce(_nullishCoalesce(input.baseUrl, () => ( env.STX_HOST)), () => ( env.STX_BASE_URL));
27
- if (!host) throw new (0, _chunkR664LTIBcjs.STXConfigException)("An OAuth base URL is required. Pass { baseUrl } or set STX_HOST.");
27
+ if (!host) throw new (0, _chunk7O5ZGZQIcjs.STXConfigException)("An OAuth base URL is required. Pass { baseUrl } or set STX_HOST.");
28
28
  const fetchImpl = _nullishCoalesce(input.fetch, () => ( globalThis.fetch));
29
29
  if (typeof fetchImpl !== "function") {
30
- throw new (0, _chunkR664LTIBcjs.STXConfigException)("No fetch implementation available. Use Node 18+, or pass { fetch }.");
30
+ throw new (0, _chunk7O5ZGZQIcjs.STXConfigException)("No fetch implementation available. Use Node 18+, or pass { fetch }.");
31
31
  }
32
- return { baseUrl: _chunkR664LTIBcjs.baseUrlFor.call(void 0, null, null, host), fetch: fetchImpl };
32
+ return { baseUrl: _chunk7O5ZGZQIcjs.baseUrlFor.call(void 0, null, null, host), fetch: fetchImpl };
33
33
  }
34
34
  function joinUrl(baseUrl, path) {
35
35
  if (/^https?:\/\//i.test(path)) return path;
@@ -37,7 +37,7 @@ function joinUrl(baseUrl, path) {
37
37
  }
38
38
 
39
39
  // src/oauth/errors.ts
40
- var STXOAuthException = class extends _chunkR664LTIBcjs.STXAuthenticationException {
40
+ var STXOAuthException = class extends _chunk7O5ZGZQIcjs.STXAuthenticationException {
41
41
  /** The RFC error code: `invalid_client`, `invalid_grant`, `invalid_scope`, ... */
42
42
 
43
43
 
@@ -56,7 +56,7 @@ var STXOAuthException = class extends _chunkR664LTIBcjs.STXAuthenticationExcepti
56
56
  this.retryAfter = retryAfter;
57
57
  }
58
58
  };
59
- var STXGrantRevokedException = class extends _chunkR664LTIBcjs.STXAuthenticationException {
59
+ var STXGrantRevokedException = class extends _chunk7O5ZGZQIcjs.STXAuthenticationException {
60
60
  constructor(message = "OAuth grant revoked: the member must re-authorize.") {
61
61
  super(message, { statusCode: 400 });
62
62
  }
@@ -141,7 +141,7 @@ function rfcError(text) {
141
141
  }
142
142
  }
143
143
  function httpError(status, text, path) {
144
- return new (0, _chunkR664LTIBcjs.STXAPIException)(`HTTP ${status} from ${path}: ${text.slice(0, 500)}`, {
144
+ return new (0, _chunk7O5ZGZQIcjs.STXAPIException)(`HTTP ${status} from ${path}: ${text.slice(0, 500)}`, {
145
145
  statusCode: status,
146
146
  body: text,
147
147
  path
@@ -290,7 +290,7 @@ var OAuthClient = (_class = class _OAuthClient {
290
290
  */
291
291
  async beginAuthorization(pending, params = {}) {
292
292
  const redirectUri = _nullishCoalesce(params.redirectUri, () => ( this.redirectUri));
293
- if (!redirectUri) throw new (0, _chunkR664LTIBcjs.STXConfigException)("redirectUri is required to build an authorize URL.");
293
+ if (!redirectUri) throw new (0, _chunk7O5ZGZQIcjs.STXConfigException)("redirectUri is required to build an authorize URL.");
294
294
  const auth = await this.authorizationUrl({ ...params, redirectUri });
295
295
  await pending.put(auth.state, {
296
296
  codeVerifier: auth.codeVerifier,
@@ -332,7 +332,7 @@ var OAuthClient = (_class = class _OAuthClient {
332
332
  let memberKey;
333
333
  if (opts.store) {
334
334
  memberKey = typeof opts.memberKey === "function" ? opts.memberKey(entry.data) : opts.memberKey;
335
- if (!memberKey) throw new (0, _chunkR664LTIBcjs.STXConfigException)("Pass memberKey along with store.");
335
+ if (!memberKey) throw new (0, _chunk7O5ZGZQIcjs.STXConfigException)("Pass memberKey along with store.");
336
336
  await opts.store.set(memberKey, tokenSetToStored(tokens));
337
337
  }
338
338
  return { tokens, scopes: parseScopes(tokens.scope), data: entry.data, memberKey };
@@ -341,7 +341,7 @@ var OAuthClient = (_class = class _OAuthClient {
341
341
  buildAuthorizeUrl(params) {
342
342
  const redirectUri = _nullishCoalesce(params.redirectUri, () => ( this.redirectUri));
343
343
  if (!redirectUri) {
344
- throw new (0, _chunkR664LTIBcjs.STXConfigException)("redirectUri is required to build an authorize URL.");
344
+ throw new (0, _chunk7O5ZGZQIcjs.STXConfigException)("redirectUri is required to build an authorize URL.");
345
345
  }
346
346
  const url = new URL(joinUrl(this.baseUrl, this.endpoints.authorize));
347
347
  const search = {
@@ -363,7 +363,7 @@ var OAuthClient = (_class = class _OAuthClient {
363
363
  exchangeCode(args) {
364
364
  const redirectUri = _nullishCoalesce(args.redirectUri, () => ( this.redirectUri));
365
365
  if (!redirectUri) {
366
- throw new (0, _chunkR664LTIBcjs.STXConfigException)("redirectUri is required to exchange a code.");
366
+ throw new (0, _chunk7O5ZGZQIcjs.STXConfigException)("redirectUri is required to exchange a code.");
367
367
  }
368
368
  return this.postToken(
369
369
  new URLSearchParams({
@@ -404,7 +404,7 @@ var OAuthClient = (_class = class _OAuthClient {
404
404
  */
405
405
  clientCredentials(scope) {
406
406
  if (this.isPublic) {
407
- throw new (0, _chunkR664LTIBcjs.STXConfigException)(
407
+ throw new (0, _chunk7O5ZGZQIcjs.STXConfigException)(
408
408
  "client_credentials needs a client secret; a public client cannot mint an app token."
409
409
  );
410
410
  }
@@ -415,7 +415,7 @@ var OAuthClient = (_class = class _OAuthClient {
415
415
  }
416
416
  /**
417
417
  * A cached `client_credentials` token that re-mints itself before expiry.
418
- * The same scope returns the same provider, so every REST client and socket
418
+ * The same scope returns the same provider, so every `STX` client and socket
419
419
  * built from this OAuth client shares one token.
420
420
  */
421
421
  appToken(scope) {
@@ -493,14 +493,14 @@ var OAuthClient = (_class = class _OAuthClient {
493
493
  }
494
494
  /**
495
495
  * An adapter authenticated as the APP (client_credentials): the public
496
- * catalog over REST and the public market feeds over the socket. Re-mints
496
+ * catalog (`markets()`, `events()`) and the public market channels. Re-mints
497
497
  * before expiry, once on a 401, and fresh on every socket (re)connect.
498
498
  */
499
499
  app(scope) {
500
500
  return new OAuthAppAuth(this.appToken(scope));
501
501
  }
502
502
  /**
503
- * An `STX` REST client acting for one member, over `session(store,
503
+ * An `STX` client acting for one member, over `session(store,
504
504
  * memberKey)`: every `/api/v1` method (balance, positions, fills, orders,
505
505
  * place and cancel) with the Bearer token attached, refreshed before expiry
506
506
  * and on a 401, and `client.websocket()` for the member's channels over the
@@ -508,7 +508,7 @@ var OAuthClient = (_class = class _OAuthClient {
508
508
  */
509
509
  memberClient(store, memberKey, opts = {}) {
510
510
  const { session, ...rest } = opts;
511
- return new (0, _chunkR664LTIBcjs.STX)({
511
+ return new (0, _chunk7O5ZGZQIcjs.STX)({
512
512
  ...rest,
513
513
  host: this.baseUrl,
514
514
  fetch: _nullishCoalesce(rest.fetch, () => ( this.fetch)),
@@ -516,12 +516,12 @@ var OAuthClient = (_class = class _OAuthClient {
516
516
  });
517
517
  }
518
518
  /**
519
- * An `STX` REST client acting as the app (client_credentials): the public
519
+ * An `STX` client acting as the app (client_credentials): the public
520
520
  * catalog (`markets()`, `events()`) and, through `websocket()`, the public
521
521
  * market channels. Scope defaults to every app scope the client may hold.
522
522
  */
523
523
  appClient(scope, opts = {}) {
524
- return new (0, _chunkR664LTIBcjs.STX)({ ...opts, host: this.baseUrl, fetch: _nullishCoalesce(opts.fetch, () => ( this.fetch)), auth: this.app(scope) });
524
+ return new (0, _chunk7O5ZGZQIcjs.STX)({ ...opts, host: this.baseUrl, fetch: _nullishCoalesce(opts.fetch, () => ( this.fetch)), auth: this.app(scope) });
525
525
  }
526
526
  /** @internal The in-flight refresh map for one store; see `OAuthSessionAuth`. */
527
527
  _refreshesFor(store) {
@@ -697,7 +697,7 @@ var OAuthSessionAuth = (_class4 = class {
697
697
  async tokens() {
698
698
  let tokens = await this.load();
699
699
  if (!tokens) {
700
- throw new (0, _chunkR664LTIBcjs.STXConfigException)(`No tokens stored for member "${this.memberKey}". Complete the OAuth flow first.`);
700
+ throw new (0, _chunk7O5ZGZQIcjs.STXConfigException)(`No tokens stored for member "${this.memberKey}". Complete the OAuth flow first.`);
701
701
  }
702
702
  if (tokens.refreshToken && tokens.expiresAt !== void 0 && tokens.expiresAt - Date.now() <= this.skewMs) {
703
703
  const refreshed = await this.refresh(tokens.refreshToken);
@@ -879,7 +879,7 @@ async function fetchWellKnown(baseUrl, path, opts) {
879
879
  }
880
880
  }
881
881
  function httpError2(status, text, path) {
882
- return new (0, _chunkR664LTIBcjs.STXAPIException)(`HTTP ${status} from ${path}: ${text.slice(0, 500)}`, {
882
+ return new (0, _chunk7O5ZGZQIcjs.STXAPIException)(`HTTP ${status} from ${path}: ${text.slice(0, 500)}`, {
883
883
  statusCode: status,
884
884
  body: text,
885
885
  path
@@ -963,5 +963,5 @@ var MemoryPendingAuthorizationStore = (_class7 = class {constructor() { _class7.
963
963
 
964
964
 
965
965
 
966
- exports.ALL_APP_SCOPES = ALL_APP_SCOPES; exports.ALL_MEMBER_SCOPES = ALL_MEMBER_SCOPES; exports.AppScopes = AppScopes; exports.AppTokenProvider = AppTokenProvider; exports.DEFAULT_ENDPOINTS = DEFAULT_ENDPOINTS; exports.LEGACY_SCOPES = LEGACY_SCOPES; exports.MemberScopes = MemberScopes; exports.MemoryPendingAuthorizationStore = MemoryPendingAuthorizationStore; exports.MemoryTokenStore = MemoryTokenStore; exports.OAuthAppAuth = OAuthAppAuth; exports.OAuthBearerAuth = OAuthBearerAuth; exports.OAuthClient = OAuthClient; exports.OAuthSessionAuth = OAuthSessionAuth; exports.STXAuthenticationException = _chunkR664LTIBcjs.STXAuthenticationException; exports.STXForbiddenException = _chunkR664LTIBcjs.STXForbiddenException; exports.STXGrantRevokedException = STXGrantRevokedException; exports.STXInsufficientScopeException = _chunkR664LTIBcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunkR664LTIBcjs.STXInvalidTokenException; exports.STXOAuthException = STXOAuthException; exports.Scopes = Scopes; exports.WELL_KNOWN = WELL_KNOWN; exports.base64url = base64url; exports.canonicalScope = canonicalScope; exports.codeChallengeS256 = codeChallengeS256; exports.createPkce = createPkce; exports.discoverMetadata = discoverMetadata; exports.discoverProtectedResource = discoverProtectedResource; exports.formatScopes = formatScopes; exports.generateCodeVerifier = generateCodeVerifier; exports.generateState = generateState; exports.isAppScope = isAppScope; exports.isMemberScope = isMemberScope; exports.joinUrl = joinUrl; exports.parseScopes = parseScopes; exports.parseTokenResponse = parseTokenResponse; exports.readCallback = readCallback; exports.registerClient = registerClient; exports.rfcError = rfcError; exports.tokenSetToStored = tokenSetToStored;
966
+ exports.ALL_APP_SCOPES = ALL_APP_SCOPES; exports.ALL_MEMBER_SCOPES = ALL_MEMBER_SCOPES; exports.AppScopes = AppScopes; exports.AppTokenProvider = AppTokenProvider; exports.DEFAULT_ENDPOINTS = DEFAULT_ENDPOINTS; exports.LEGACY_SCOPES = LEGACY_SCOPES; exports.MemberScopes = MemberScopes; exports.MemoryPendingAuthorizationStore = MemoryPendingAuthorizationStore; exports.MemoryTokenStore = MemoryTokenStore; exports.OAuthAppAuth = OAuthAppAuth; exports.OAuthBearerAuth = OAuthBearerAuth; exports.OAuthClient = OAuthClient; exports.OAuthSessionAuth = OAuthSessionAuth; exports.STXAuthenticationException = _chunk7O5ZGZQIcjs.STXAuthenticationException; exports.STXForbiddenException = _chunk7O5ZGZQIcjs.STXForbiddenException; exports.STXGrantRevokedException = STXGrantRevokedException; exports.STXInsufficientScopeException = _chunk7O5ZGZQIcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunk7O5ZGZQIcjs.STXInvalidTokenException; exports.STXOAuthException = STXOAuthException; exports.Scopes = Scopes; exports.WELL_KNOWN = WELL_KNOWN; exports.base64url = base64url; exports.canonicalScope = canonicalScope; exports.codeChallengeS256 = codeChallengeS256; exports.createPkce = createPkce; exports.discoverMetadata = discoverMetadata; exports.discoverProtectedResource = discoverProtectedResource; exports.formatScopes = formatScopes; exports.generateCodeVerifier = generateCodeVerifier; exports.generateState = generateState; exports.isAppScope = isAppScope; exports.isMemberScope = isMemberScope; exports.joinUrl = joinUrl; exports.parseScopes = parseScopes; exports.parseTokenResponse = parseTokenResponse; exports.readCallback = readCallback; exports.registerClient = registerClient; exports.rfcError = rfcError; exports.tokenSetToStored = tokenSetToStored;
967
967
  //# sourceMappingURL=oauth.cjs.map