@stxapp/stx-typescript 0.8.0 → 0.9.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +42 -0
- package/dist/{chunk-L2DEU7R6.cjs → chunk-33AQCUGM.cjs} +53 -27
- package/dist/chunk-33AQCUGM.cjs.map +1 -0
- package/dist/{chunk-H7XZDE2U.js → chunk-4CSBA2YV.js} +53 -27
- package/dist/chunk-4CSBA2YV.js.map +1 -0
- package/dist/{client-E5Lg6k8d.d.cts → client-CNkaTuhG.d.cts} +121 -40
- package/dist/{client-E5Lg6k8d.d.ts → client-CNkaTuhG.d.ts} +121 -40
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/oauth.cjs +374 -39
- package/dist/oauth.cjs.map +1 -1
- package/dist/oauth.d.cts +156 -11
- package/dist/oauth.d.ts +156 -11
- package/dist/oauth.js +349 -14
- package/dist/oauth.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-H7XZDE2U.js.map +0 -1
- package/dist/chunk-L2DEU7R6.cjs.map +0 -1
|
@@ -252,10 +252,49 @@ interface EventPlayers {
|
|
|
252
252
|
stats: EventStat[];
|
|
253
253
|
[key: string]: unknown;
|
|
254
254
|
}
|
|
255
|
-
/** One
|
|
256
|
-
interface
|
|
257
|
-
/** The
|
|
258
|
-
|
|
255
|
+
/** One stat an event type offers, in `STX.marketTypes()`. */
|
|
256
|
+
interface MarketTypeEventType {
|
|
257
|
+
/** The sport, e.g. `"Football"`. */
|
|
258
|
+
sport: string;
|
|
259
|
+
/** The stats on offer, sorted by `stat`. */
|
|
260
|
+
stats: EventStat[];
|
|
261
|
+
[key: string]: unknown;
|
|
262
|
+
}
|
|
263
|
+
/** One field a market entry takes besides `rule`. */
|
|
264
|
+
interface MarketTypeField {
|
|
265
|
+
/** Its JSON type, e.g. `"string"`. */
|
|
266
|
+
type: string;
|
|
267
|
+
/** What it takes. */
|
|
268
|
+
description: string;
|
|
269
|
+
[key: string]: unknown;
|
|
270
|
+
}
|
|
271
|
+
/** A market type `STX.createMarkets()` can create. */
|
|
272
|
+
interface CreatableMarketType {
|
|
273
|
+
partner_create: true;
|
|
274
|
+
/** The fields an entry takes besides `rule`, by wire name. */
|
|
275
|
+
fields: Record<string, MarketTypeField>;
|
|
276
|
+
/** The event types it runs on, keyed by event type, e.g. `"NFL"`. */
|
|
277
|
+
event_types: Record<string, MarketTypeEventType>;
|
|
278
|
+
[key: string]: unknown;
|
|
279
|
+
}
|
|
280
|
+
/** A market type STX lists but an app cannot create. */
|
|
281
|
+
interface ListedMarketType {
|
|
282
|
+
partner_create: false;
|
|
283
|
+
/** The event types it runs on. */
|
|
284
|
+
event_types: string[];
|
|
285
|
+
[key: string]: unknown;
|
|
286
|
+
}
|
|
287
|
+
/** One market type. `partner_create` says whether `STX.createMarkets()` takes it. */
|
|
288
|
+
type MarketType = CreatableMarketType | ListedMarketType;
|
|
289
|
+
/** `GET /api/v1/types`: the market types, keyed by rule. */
|
|
290
|
+
type MarketTypes = {
|
|
291
|
+
player_stat_line: CreatableMarketType;
|
|
292
|
+
} & {
|
|
293
|
+
[rule: string]: MarketType;
|
|
294
|
+
};
|
|
295
|
+
/** A player stat line: over/under one player's stat in one event. */
|
|
296
|
+
interface PlayerStatLineMarket {
|
|
297
|
+
rule: "player_stat_line";
|
|
259
298
|
/** From `eventPlayers()`. */
|
|
260
299
|
playerId: string;
|
|
261
300
|
/** One of the event's stats, e.g. `Stats.Basketball.POINTS`. */
|
|
@@ -266,41 +305,59 @@ interface NewMarketInput {
|
|
|
266
305
|
* are rejected with `invalid_line`.
|
|
267
306
|
*/
|
|
268
307
|
line: number;
|
|
269
|
-
/** `"ou"` (over/under), the only type today and the default. */
|
|
270
|
-
propType?: "ou";
|
|
271
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* One market to create. `rule` names the market type and decides the other
|
|
311
|
+
* fields; `STX.marketTypes()` lists the rules an app can create. Player stat
|
|
312
|
+
* lines are the only one today.
|
|
313
|
+
*/
|
|
314
|
+
type NewMarket = PlayerStatLineMarket;
|
|
315
|
+
/** A rule `STX.createMarkets()` takes. */
|
|
316
|
+
type MarketRule = NewMarket["rule"];
|
|
272
317
|
/** Why a market was not created. */
|
|
273
|
-
type MarketRejectionReason = "invalid_market" | "
|
|
274
|
-
/**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
prop_type?: string;
|
|
279
|
-
line?: number;
|
|
280
|
-
[key: string]: unknown;
|
|
281
|
-
}
|
|
282
|
-
/** The outcome for one requested market, in request order. */
|
|
318
|
+
type MarketRejectionReason = "invalid_market" | "unsupported_rule" | "unsupported_stat" | "invalid_line" | "unknown_player" | "event_not_open" | "not_created" | (string & {});
|
|
319
|
+
/**
|
|
320
|
+
* The outcome for one requested market. `index` is the market's position in
|
|
321
|
+
* the list given to `createMarkets()`.
|
|
322
|
+
*/
|
|
283
323
|
type CreateMarketResult = {
|
|
324
|
+
index: number;
|
|
284
325
|
status: "created";
|
|
285
326
|
market_id: string;
|
|
286
|
-
|
|
327
|
+
reason: null;
|
|
328
|
+
[key: string]: unknown;
|
|
287
329
|
} | {
|
|
330
|
+
index: number;
|
|
288
331
|
status: "exists";
|
|
289
332
|
market_id: string;
|
|
290
|
-
|
|
333
|
+
reason: null;
|
|
334
|
+
[key: string]: unknown;
|
|
335
|
+
} | {
|
|
336
|
+
index: number;
|
|
337
|
+
status: "valid";
|
|
338
|
+
market_id: null;
|
|
339
|
+
reason: null;
|
|
340
|
+
[key: string]: unknown;
|
|
291
341
|
} | {
|
|
342
|
+
index: number;
|
|
292
343
|
status: "rejected";
|
|
344
|
+
market_id: null;
|
|
293
345
|
reason: MarketRejectionReason;
|
|
294
|
-
|
|
346
|
+
[key: string]: unknown;
|
|
295
347
|
};
|
|
296
348
|
/** Options for `STX.createMarkets()`. */
|
|
297
349
|
interface CreateMarketsOptions {
|
|
298
350
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
351
|
+
* Run every check and create nothing. A market that would be created comes
|
|
352
|
+
* back `valid`; one that is already listed comes back `exists`.
|
|
353
|
+
*/
|
|
354
|
+
dryRun?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Check each player stat line against the event's players and stats, and
|
|
357
|
+
* the line rule, before sending. Failing markets come back `rejected`
|
|
358
|
+
* without a request; the rest are sent with the event's own stat key. The
|
|
359
|
+
* exchange checks every market either way. Reads `eventPlayers()`, so the
|
|
360
|
+
* token also needs the `events` scope.
|
|
304
361
|
*/
|
|
305
362
|
validate?: boolean;
|
|
306
363
|
}
|
|
@@ -2758,6 +2815,17 @@ declare const OPERATIONS: {
|
|
|
2758
2815
|
readonly isList: false;
|
|
2759
2816
|
readonly paginated: false;
|
|
2760
2817
|
};
|
|
2818
|
+
readonly types_get: {
|
|
2819
|
+
readonly method: "GET";
|
|
2820
|
+
readonly path: "/api/v1/types";
|
|
2821
|
+
readonly query: readonly [];
|
|
2822
|
+
readonly pathParams: readonly [];
|
|
2823
|
+
readonly hasBody: false;
|
|
2824
|
+
readonly responseKey: "";
|
|
2825
|
+
readonly model: "";
|
|
2826
|
+
readonly isList: false;
|
|
2827
|
+
readonly paginated: false;
|
|
2828
|
+
};
|
|
2761
2829
|
};
|
|
2762
2830
|
type OperationId = keyof typeof OPERATIONS;
|
|
2763
2831
|
|
|
@@ -3003,8 +3071,8 @@ declare class ApiKeyCredentials implements AuthProvider {
|
|
|
3003
3071
|
toString(): string;
|
|
3004
3072
|
}
|
|
3005
3073
|
|
|
3006
|
-
declare const VERSION = "0.
|
|
3007
|
-
declare const USER_AGENT = "stx-typescript/0.
|
|
3074
|
+
declare const VERSION = "0.9.0-alpha.1";
|
|
3075
|
+
declare const USER_AGENT = "stx-typescript/0.9.0-alpha.1";
|
|
3008
3076
|
/**
|
|
3009
3077
|
* `Symbol.asyncDispose` where the runtime has it (Node 20+, Bun), so
|
|
3010
3078
|
* `await using client = new STX()` works there; a registered stand-in on
|
|
@@ -3251,7 +3319,9 @@ interface STXWebSocketOptions extends Pick<STXOptions, "environment" | "region"
|
|
|
3251
3319
|
* Called when the socket gives up because its credentials are dead: an OAuth
|
|
3252
3320
|
* grant was revoked (`STXGrantRevokedException`), or the tokens are gone. The
|
|
3253
3321
|
* socket is closed by then; `ws.error` holds the same exception. Send the
|
|
3254
|
-
* member back through consent.
|
|
3322
|
+
* member back through consent. It is also called with
|
|
3323
|
+
* `STXAccountPendingException` while the member's STX account is still being
|
|
3324
|
+
* verified: their tokens are kept, so connect again once they are verified.
|
|
3255
3325
|
*/
|
|
3256
3326
|
onAuthError?: (err: STXException) => void;
|
|
3257
3327
|
/** Milliseconds to wait for a join or push reply. Default 10000. */
|
|
@@ -3689,21 +3759,32 @@ declare class STX {
|
|
|
3689
3759
|
event_id?: string | null;
|
|
3690
3760
|
}): Promise<EventStat[]>;
|
|
3691
3761
|
/**
|
|
3692
|
-
* `
|
|
3693
|
-
*
|
|
3694
|
-
* `
|
|
3762
|
+
* `GET /api/v1/types`: the market types, keyed by rule. One with
|
|
3763
|
+
* `partner_create: true` can be created with `createMarkets()`, and lists
|
|
3764
|
+
* the `fields` an entry takes and, per event type, the `stats` on offer. It
|
|
3765
|
+
* changes only when STX adds a rule or a stat, so read it once and keep it.
|
|
3766
|
+
* Needs an OAuth app token with `events`, or an API key.
|
|
3767
|
+
*/
|
|
3768
|
+
marketTypes(): Promise<MarketTypes>;
|
|
3769
|
+
/**
|
|
3770
|
+
* `POST /api/v1/markets`: create markets on a scheduled event, up to
|
|
3771
|
+
* `MAX_MARKETS_PER_REQUEST` per call. Each market names its `rule` and the
|
|
3772
|
+
* fields that rule takes. Needs an OAuth app token with `markets.write`,
|
|
3773
|
+
* which STX grants, from an address on the client's IP allow-list (it
|
|
3774
|
+
* applies to every call that client makes).
|
|
3695
3775
|
*
|
|
3696
|
-
* Returns one result per market, in order
|
|
3697
|
-
* `
|
|
3698
|
-
*
|
|
3699
|
-
*
|
|
3700
|
-
*
|
|
3776
|
+
* Returns one result per market, in the order given, each with its `index`:
|
|
3777
|
+
* `created` or `exists` (both with `market_id`), `valid` (a `dryRun` market
|
|
3778
|
+
* that would be created), or `rejected` with a `reason`. A rejected market
|
|
3779
|
+
* is a result, not an error, and resending is safe: a market that is
|
|
3780
|
+
* already listed comes back `exists`. A refused request throws (`403`
|
|
3781
|
+
* without `markets.write`, `404` unknown event, `422` event not open).
|
|
3701
3782
|
*
|
|
3702
|
-
*
|
|
3703
|
-
*
|
|
3704
|
-
*
|
|
3783
|
+
* `dryRun` runs every check and creates nothing. More than
|
|
3784
|
+
* `MAX_MARKETS_PER_REQUEST` markets throws `TypeError` before any request.
|
|
3785
|
+
* `validate` also needs the `events` scope.
|
|
3705
3786
|
*/
|
|
3706
|
-
createMarkets(eventId: string, markets: readonly
|
|
3787
|
+
createMarkets(eventId: string, markets: readonly NewMarket[], opts?: CreateMarketsOptions): Promise<CreateMarketResult[]>;
|
|
3707
3788
|
/** `GET /api/v1/orders`: one page of your orders, newest first. */
|
|
3708
3789
|
orders(query?: OrdersQuery): Promise<Page<Order>>;
|
|
3709
3790
|
/** Every order matching the filters, following the cursor. */
|
|
@@ -3826,4 +3907,4 @@ declare class STX {
|
|
|
3826
3907
|
websocket(opts?: Omit<STXWebSocketOptions, "rest">): STXWebSocket;
|
|
3827
3908
|
}
|
|
3828
3909
|
|
|
3829
|
-
export { type
|
|
3910
|
+
export { type MarketTypes as $, type AcceptTermsOptions as A, type Balance as B, type Cancellation as C, type GeoLocationProvider as D, Environment as E, type FeeTransaction as F, type GeoCheckResult as G, type GeoOption as H, type GeoRejection as I, HOSTS as J, KEY_HEADER as K, type KnownStat as L, type Leaderboard as M, type LeaderboardEntry as N, type LeaderboardStanding as O, type ListedMarketType as P, type Logger as Q, MAX_MARKETS_PER_REQUEST as R, type Market as S, type MarketFilter as T, type MarketRejectionReason as U, type MarketRule as V, type MarketStat as W, type MarketStatsQuery as X, type MarketType as Y, type MarketTypeEventType as Z, type MarketTypeField as _, type AccountChange as a, baseUrlFor as a$, type MarketsQuery as a0, type Me as a1, type MessageHandler as a2, NO_RETRY as a3, type NewMarket as a4, type NewOrder as a5, type NewOrderInput as a6, OPERATIONS as a7, type Operation as a8, type OperationId as a9, STXForbiddenException as aA, STXGeoLocationException as aB, STXInsufficientScopeException as aC, STXInvalidTokenException as aD, STXNotFoundException as aE, type STXOptions as aF, STXRateLimitException as aG, STXRejectedException as aH, STXServerException as aI, STXTimeoutException as aJ, STXTransportException as aK, STXValidationException as aL, STXWebSocket as aM, type STXWebSocketOptions as aN, type Settlement as aO, type SettlementsQuery as aP, type Signer as aQ, type Stat as aR, type StatDetail as aS, Stats as aT, type StrList as aU, TERMINAL_ORDER_STATUSES as aV, TIMESTAMP_HEADER as aW, type Transaction as aX, USER_AGENT as aY, VERSION as aZ, type WebSocketAuthContext as a_, type Order as aa, type OrderOptions as ab, type OrdersQuery as ac, Page as ad, type PageQuery as ae, type PaymentTransaction as af, type PlayerStatLineMarket as ag, type Position as ah, type PrivateKeyInput as ai, type ProfileUpdate as aj, type RecentTrade as ak, ReconnectPolicy as al, type ReconnectPolicyOptions as am, Region as an, type ResponseEvent as ao, RetryPolicy as ap, type RetryPolicyOptions as aq, SIGNATURE_HEADER as ar, SNAPSHOT_EVENTS as as, STX as at, STXAPIException as au, STXAuthenticationException as av, STXChannelException as aw, STXConfigException as ax, type STXEnvironment as ay, STXException as az, type AccountChangeKind as b, buildMessage as b0, environmentNamed as b1, errorForStatus as b2, geoRejection as b3, handshakePath as b4, isValidLine as b5, loadPrivateKey as b6, models as b7, orderBody as b8, requestPath as b9, resolveHost as ba, signerFromPrivateKey as bb, socketUrlFor as bc, type AccountState as c, AccountView as d, type AccountViewOptions as e, ApiKeyCredentials as f, type AuthProvider as g, type AuthRequest as h, type BatchOrderResult as i, type BookLevel as j, Channel as k, ChannelMessage as l, type CreatableMarketType as m, type CreateMarketResult as n, type CreateMarketsOptions as o, Environments as p, type Error$1 as q, type Event as r, type EventPlayer as s, type EventPlayers as t, type EventStat as u, type EventTeam as v, type EventsQuery as w, type FetchLike as x, type Fill as y, type FillsQuery as z };
|
|
@@ -252,10 +252,49 @@ interface EventPlayers {
|
|
|
252
252
|
stats: EventStat[];
|
|
253
253
|
[key: string]: unknown;
|
|
254
254
|
}
|
|
255
|
-
/** One
|
|
256
|
-
interface
|
|
257
|
-
/** The
|
|
258
|
-
|
|
255
|
+
/** One stat an event type offers, in `STX.marketTypes()`. */
|
|
256
|
+
interface MarketTypeEventType {
|
|
257
|
+
/** The sport, e.g. `"Football"`. */
|
|
258
|
+
sport: string;
|
|
259
|
+
/** The stats on offer, sorted by `stat`. */
|
|
260
|
+
stats: EventStat[];
|
|
261
|
+
[key: string]: unknown;
|
|
262
|
+
}
|
|
263
|
+
/** One field a market entry takes besides `rule`. */
|
|
264
|
+
interface MarketTypeField {
|
|
265
|
+
/** Its JSON type, e.g. `"string"`. */
|
|
266
|
+
type: string;
|
|
267
|
+
/** What it takes. */
|
|
268
|
+
description: string;
|
|
269
|
+
[key: string]: unknown;
|
|
270
|
+
}
|
|
271
|
+
/** A market type `STX.createMarkets()` can create. */
|
|
272
|
+
interface CreatableMarketType {
|
|
273
|
+
partner_create: true;
|
|
274
|
+
/** The fields an entry takes besides `rule`, by wire name. */
|
|
275
|
+
fields: Record<string, MarketTypeField>;
|
|
276
|
+
/** The event types it runs on, keyed by event type, e.g. `"NFL"`. */
|
|
277
|
+
event_types: Record<string, MarketTypeEventType>;
|
|
278
|
+
[key: string]: unknown;
|
|
279
|
+
}
|
|
280
|
+
/** A market type STX lists but an app cannot create. */
|
|
281
|
+
interface ListedMarketType {
|
|
282
|
+
partner_create: false;
|
|
283
|
+
/** The event types it runs on. */
|
|
284
|
+
event_types: string[];
|
|
285
|
+
[key: string]: unknown;
|
|
286
|
+
}
|
|
287
|
+
/** One market type. `partner_create` says whether `STX.createMarkets()` takes it. */
|
|
288
|
+
type MarketType = CreatableMarketType | ListedMarketType;
|
|
289
|
+
/** `GET /api/v1/types`: the market types, keyed by rule. */
|
|
290
|
+
type MarketTypes = {
|
|
291
|
+
player_stat_line: CreatableMarketType;
|
|
292
|
+
} & {
|
|
293
|
+
[rule: string]: MarketType;
|
|
294
|
+
};
|
|
295
|
+
/** A player stat line: over/under one player's stat in one event. */
|
|
296
|
+
interface PlayerStatLineMarket {
|
|
297
|
+
rule: "player_stat_line";
|
|
259
298
|
/** From `eventPlayers()`. */
|
|
260
299
|
playerId: string;
|
|
261
300
|
/** One of the event's stats, e.g. `Stats.Basketball.POINTS`. */
|
|
@@ -266,41 +305,59 @@ interface NewMarketInput {
|
|
|
266
305
|
* are rejected with `invalid_line`.
|
|
267
306
|
*/
|
|
268
307
|
line: number;
|
|
269
|
-
/** `"ou"` (over/under), the only type today and the default. */
|
|
270
|
-
propType?: "ou";
|
|
271
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* One market to create. `rule` names the market type and decides the other
|
|
311
|
+
* fields; `STX.marketTypes()` lists the rules an app can create. Player stat
|
|
312
|
+
* lines are the only one today.
|
|
313
|
+
*/
|
|
314
|
+
type NewMarket = PlayerStatLineMarket;
|
|
315
|
+
/** A rule `STX.createMarkets()` takes. */
|
|
316
|
+
type MarketRule = NewMarket["rule"];
|
|
272
317
|
/** Why a market was not created. */
|
|
273
|
-
type MarketRejectionReason = "invalid_market" | "
|
|
274
|
-
/**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
prop_type?: string;
|
|
279
|
-
line?: number;
|
|
280
|
-
[key: string]: unknown;
|
|
281
|
-
}
|
|
282
|
-
/** The outcome for one requested market, in request order. */
|
|
318
|
+
type MarketRejectionReason = "invalid_market" | "unsupported_rule" | "unsupported_stat" | "invalid_line" | "unknown_player" | "event_not_open" | "not_created" | (string & {});
|
|
319
|
+
/**
|
|
320
|
+
* The outcome for one requested market. `index` is the market's position in
|
|
321
|
+
* the list given to `createMarkets()`.
|
|
322
|
+
*/
|
|
283
323
|
type CreateMarketResult = {
|
|
324
|
+
index: number;
|
|
284
325
|
status: "created";
|
|
285
326
|
market_id: string;
|
|
286
|
-
|
|
327
|
+
reason: null;
|
|
328
|
+
[key: string]: unknown;
|
|
287
329
|
} | {
|
|
330
|
+
index: number;
|
|
288
331
|
status: "exists";
|
|
289
332
|
market_id: string;
|
|
290
|
-
|
|
333
|
+
reason: null;
|
|
334
|
+
[key: string]: unknown;
|
|
335
|
+
} | {
|
|
336
|
+
index: number;
|
|
337
|
+
status: "valid";
|
|
338
|
+
market_id: null;
|
|
339
|
+
reason: null;
|
|
340
|
+
[key: string]: unknown;
|
|
291
341
|
} | {
|
|
342
|
+
index: number;
|
|
292
343
|
status: "rejected";
|
|
344
|
+
market_id: null;
|
|
293
345
|
reason: MarketRejectionReason;
|
|
294
|
-
|
|
346
|
+
[key: string]: unknown;
|
|
295
347
|
};
|
|
296
348
|
/** Options for `STX.createMarkets()`. */
|
|
297
349
|
interface CreateMarketsOptions {
|
|
298
350
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
351
|
+
* Run every check and create nothing. A market that would be created comes
|
|
352
|
+
* back `valid`; one that is already listed comes back `exists`.
|
|
353
|
+
*/
|
|
354
|
+
dryRun?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Check each player stat line against the event's players and stats, and
|
|
357
|
+
* the line rule, before sending. Failing markets come back `rejected`
|
|
358
|
+
* without a request; the rest are sent with the event's own stat key. The
|
|
359
|
+
* exchange checks every market either way. Reads `eventPlayers()`, so the
|
|
360
|
+
* token also needs the `events` scope.
|
|
304
361
|
*/
|
|
305
362
|
validate?: boolean;
|
|
306
363
|
}
|
|
@@ -2758,6 +2815,17 @@ declare const OPERATIONS: {
|
|
|
2758
2815
|
readonly isList: false;
|
|
2759
2816
|
readonly paginated: false;
|
|
2760
2817
|
};
|
|
2818
|
+
readonly types_get: {
|
|
2819
|
+
readonly method: "GET";
|
|
2820
|
+
readonly path: "/api/v1/types";
|
|
2821
|
+
readonly query: readonly [];
|
|
2822
|
+
readonly pathParams: readonly [];
|
|
2823
|
+
readonly hasBody: false;
|
|
2824
|
+
readonly responseKey: "";
|
|
2825
|
+
readonly model: "";
|
|
2826
|
+
readonly isList: false;
|
|
2827
|
+
readonly paginated: false;
|
|
2828
|
+
};
|
|
2761
2829
|
};
|
|
2762
2830
|
type OperationId = keyof typeof OPERATIONS;
|
|
2763
2831
|
|
|
@@ -3003,8 +3071,8 @@ declare class ApiKeyCredentials implements AuthProvider {
|
|
|
3003
3071
|
toString(): string;
|
|
3004
3072
|
}
|
|
3005
3073
|
|
|
3006
|
-
declare const VERSION = "0.
|
|
3007
|
-
declare const USER_AGENT = "stx-typescript/0.
|
|
3074
|
+
declare const VERSION = "0.9.0-alpha.1";
|
|
3075
|
+
declare const USER_AGENT = "stx-typescript/0.9.0-alpha.1";
|
|
3008
3076
|
/**
|
|
3009
3077
|
* `Symbol.asyncDispose` where the runtime has it (Node 20+, Bun), so
|
|
3010
3078
|
* `await using client = new STX()` works there; a registered stand-in on
|
|
@@ -3251,7 +3319,9 @@ interface STXWebSocketOptions extends Pick<STXOptions, "environment" | "region"
|
|
|
3251
3319
|
* Called when the socket gives up because its credentials are dead: an OAuth
|
|
3252
3320
|
* grant was revoked (`STXGrantRevokedException`), or the tokens are gone. The
|
|
3253
3321
|
* socket is closed by then; `ws.error` holds the same exception. Send the
|
|
3254
|
-
* member back through consent.
|
|
3322
|
+
* member back through consent. It is also called with
|
|
3323
|
+
* `STXAccountPendingException` while the member's STX account is still being
|
|
3324
|
+
* verified: their tokens are kept, so connect again once they are verified.
|
|
3255
3325
|
*/
|
|
3256
3326
|
onAuthError?: (err: STXException) => void;
|
|
3257
3327
|
/** Milliseconds to wait for a join or push reply. Default 10000. */
|
|
@@ -3689,21 +3759,32 @@ declare class STX {
|
|
|
3689
3759
|
event_id?: string | null;
|
|
3690
3760
|
}): Promise<EventStat[]>;
|
|
3691
3761
|
/**
|
|
3692
|
-
* `
|
|
3693
|
-
*
|
|
3694
|
-
* `
|
|
3762
|
+
* `GET /api/v1/types`: the market types, keyed by rule. One with
|
|
3763
|
+
* `partner_create: true` can be created with `createMarkets()`, and lists
|
|
3764
|
+
* the `fields` an entry takes and, per event type, the `stats` on offer. It
|
|
3765
|
+
* changes only when STX adds a rule or a stat, so read it once and keep it.
|
|
3766
|
+
* Needs an OAuth app token with `events`, or an API key.
|
|
3767
|
+
*/
|
|
3768
|
+
marketTypes(): Promise<MarketTypes>;
|
|
3769
|
+
/**
|
|
3770
|
+
* `POST /api/v1/markets`: create markets on a scheduled event, up to
|
|
3771
|
+
* `MAX_MARKETS_PER_REQUEST` per call. Each market names its `rule` and the
|
|
3772
|
+
* fields that rule takes. Needs an OAuth app token with `markets.write`,
|
|
3773
|
+
* which STX grants, from an address on the client's IP allow-list (it
|
|
3774
|
+
* applies to every call that client makes).
|
|
3695
3775
|
*
|
|
3696
|
-
* Returns one result per market, in order
|
|
3697
|
-
* `
|
|
3698
|
-
*
|
|
3699
|
-
*
|
|
3700
|
-
*
|
|
3776
|
+
* Returns one result per market, in the order given, each with its `index`:
|
|
3777
|
+
* `created` or `exists` (both with `market_id`), `valid` (a `dryRun` market
|
|
3778
|
+
* that would be created), or `rejected` with a `reason`. A rejected market
|
|
3779
|
+
* is a result, not an error, and resending is safe: a market that is
|
|
3780
|
+
* already listed comes back `exists`. A refused request throws (`403`
|
|
3781
|
+
* without `markets.write`, `404` unknown event, `422` event not open).
|
|
3701
3782
|
*
|
|
3702
|
-
*
|
|
3703
|
-
*
|
|
3704
|
-
*
|
|
3783
|
+
* `dryRun` runs every check and creates nothing. More than
|
|
3784
|
+
* `MAX_MARKETS_PER_REQUEST` markets throws `TypeError` before any request.
|
|
3785
|
+
* `validate` also needs the `events` scope.
|
|
3705
3786
|
*/
|
|
3706
|
-
createMarkets(eventId: string, markets: readonly
|
|
3787
|
+
createMarkets(eventId: string, markets: readonly NewMarket[], opts?: CreateMarketsOptions): Promise<CreateMarketResult[]>;
|
|
3707
3788
|
/** `GET /api/v1/orders`: one page of your orders, newest first. */
|
|
3708
3789
|
orders(query?: OrdersQuery): Promise<Page<Order>>;
|
|
3709
3790
|
/** Every order matching the filters, following the cursor. */
|
|
@@ -3826,4 +3907,4 @@ declare class STX {
|
|
|
3826
3907
|
websocket(opts?: Omit<STXWebSocketOptions, "rest">): STXWebSocket;
|
|
3827
3908
|
}
|
|
3828
3909
|
|
|
3829
|
-
export { type
|
|
3910
|
+
export { type MarketTypes as $, type AcceptTermsOptions as A, type Balance as B, type Cancellation as C, type GeoLocationProvider as D, Environment as E, type FeeTransaction as F, type GeoCheckResult as G, type GeoOption as H, type GeoRejection as I, HOSTS as J, KEY_HEADER as K, type KnownStat as L, type Leaderboard as M, type LeaderboardEntry as N, type LeaderboardStanding as O, type ListedMarketType as P, type Logger as Q, MAX_MARKETS_PER_REQUEST as R, type Market as S, type MarketFilter as T, type MarketRejectionReason as U, type MarketRule as V, type MarketStat as W, type MarketStatsQuery as X, type MarketType as Y, type MarketTypeEventType as Z, type MarketTypeField as _, type AccountChange as a, baseUrlFor as a$, type MarketsQuery as a0, type Me as a1, type MessageHandler as a2, NO_RETRY as a3, type NewMarket as a4, type NewOrder as a5, type NewOrderInput as a6, OPERATIONS as a7, type Operation as a8, type OperationId as a9, STXForbiddenException as aA, STXGeoLocationException as aB, STXInsufficientScopeException as aC, STXInvalidTokenException as aD, STXNotFoundException as aE, type STXOptions as aF, STXRateLimitException as aG, STXRejectedException as aH, STXServerException as aI, STXTimeoutException as aJ, STXTransportException as aK, STXValidationException as aL, STXWebSocket as aM, type STXWebSocketOptions as aN, type Settlement as aO, type SettlementsQuery as aP, type Signer as aQ, type Stat as aR, type StatDetail as aS, Stats as aT, type StrList as aU, TERMINAL_ORDER_STATUSES as aV, TIMESTAMP_HEADER as aW, type Transaction as aX, USER_AGENT as aY, VERSION as aZ, type WebSocketAuthContext as a_, type Order as aa, type OrderOptions as ab, type OrdersQuery as ac, Page as ad, type PageQuery as ae, type PaymentTransaction as af, type PlayerStatLineMarket as ag, type Position as ah, type PrivateKeyInput as ai, type ProfileUpdate as aj, type RecentTrade as ak, ReconnectPolicy as al, type ReconnectPolicyOptions as am, Region as an, type ResponseEvent as ao, RetryPolicy as ap, type RetryPolicyOptions as aq, SIGNATURE_HEADER as ar, SNAPSHOT_EVENTS as as, STX as at, STXAPIException as au, STXAuthenticationException as av, STXChannelException as aw, STXConfigException as ax, type STXEnvironment as ay, STXException as az, type AccountChangeKind as b, buildMessage as b0, environmentNamed as b1, errorForStatus as b2, geoRejection as b3, handshakePath as b4, isValidLine as b5, loadPrivateKey as b6, models as b7, orderBody as b8, requestPath as b9, resolveHost as ba, signerFromPrivateKey as bb, socketUrlFor as bc, type AccountState as c, AccountView as d, type AccountViewOptions as e, ApiKeyCredentials as f, type AuthProvider as g, type AuthRequest as h, type BatchOrderResult as i, type BookLevel as j, Channel as k, ChannelMessage as l, type CreatableMarketType as m, type CreateMarketResult as n, type CreateMarketsOptions as o, Environments as p, type Error$1 as q, type Event as r, type EventPlayer as s, type EventPlayers as t, type EventStat as u, type EventTeam as v, type EventsQuery as w, type FetchLike as x, type Fill as y, type FillsQuery as z };
|
package/dist/index.cjs
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunk33AQCUGMcjs = require('./chunk-33AQCUGM.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
@@ -123,5 +123,5 @@ var _chunkL2DEU7R6cjs = require('./chunk-L2DEU7R6.cjs');
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
|
|
126
|
-
exports.AccountView =
|
|
126
|
+
exports.AccountView = _chunk33AQCUGMcjs.AccountView; exports.ApiKeyCredentials = _chunk33AQCUGMcjs.ApiKeyCredentials; exports.Channel = _chunk33AQCUGMcjs.Channel; exports.ChannelMessage = _chunk33AQCUGMcjs.ChannelMessage; exports.Environment = _chunk33AQCUGMcjs.Environment; exports.Environments = _chunk33AQCUGMcjs.Environments; exports.HOSTS = _chunk33AQCUGMcjs.HOSTS; exports.KEY_HEADER = _chunk33AQCUGMcjs.KEY_HEADER; exports.MAX_MARKETS_PER_REQUEST = _chunk33AQCUGMcjs.MAX_MARKETS_PER_REQUEST; exports.NO_RETRY = _chunk33AQCUGMcjs.NO_RETRY; exports.OPERATIONS = _chunk33AQCUGMcjs.OPERATIONS; exports.Page = _chunk33AQCUGMcjs.Page; exports.ReconnectPolicy = _chunk33AQCUGMcjs.ReconnectPolicy; exports.Region = _chunk33AQCUGMcjs.Region; exports.RetryPolicy = _chunk33AQCUGMcjs.RetryPolicy; exports.SIGNATURE_HEADER = _chunk33AQCUGMcjs.SIGNATURE_HEADER; exports.SNAPSHOT_EVENTS = _chunk33AQCUGMcjs.SNAPSHOT_EVENTS; exports.STX = _chunk33AQCUGMcjs.STX; exports.STXAPIException = _chunk33AQCUGMcjs.STXAPIException; exports.STXAuthenticationException = _chunk33AQCUGMcjs.STXAuthenticationException; exports.STXChannelException = _chunk33AQCUGMcjs.STXChannelException; exports.STXConfigException = _chunk33AQCUGMcjs.STXConfigException; exports.STXException = _chunk33AQCUGMcjs.STXException; exports.STXForbiddenException = _chunk33AQCUGMcjs.STXForbiddenException; exports.STXGeoLocationException = _chunk33AQCUGMcjs.STXGeoLocationException; exports.STXInsufficientScopeException = _chunk33AQCUGMcjs.STXInsufficientScopeException; exports.STXInvalidTokenException = _chunk33AQCUGMcjs.STXInvalidTokenException; exports.STXNotFoundException = _chunk33AQCUGMcjs.STXNotFoundException; exports.STXRateLimitException = _chunk33AQCUGMcjs.STXRateLimitException; exports.STXRejectedException = _chunk33AQCUGMcjs.STXRejectedException; exports.STXServerException = _chunk33AQCUGMcjs.STXServerException; exports.STXTimeoutException = _chunk33AQCUGMcjs.STXTimeoutException; exports.STXTransportException = _chunk33AQCUGMcjs.STXTransportException; exports.STXValidationException = _chunk33AQCUGMcjs.STXValidationException; exports.STXWebSocket = _chunk33AQCUGMcjs.STXWebSocket; exports.Stats = _chunk33AQCUGMcjs.Stats; exports.TERMINAL_ORDER_STATUSES = _chunk33AQCUGMcjs.TERMINAL_ORDER_STATUSES; exports.TIMESTAMP_HEADER = _chunk33AQCUGMcjs.TIMESTAMP_HEADER; exports.USER_AGENT = _chunk33AQCUGMcjs.USER_AGENT; exports.VERSION = _chunk33AQCUGMcjs.VERSION; exports.baseUrlFor = _chunk33AQCUGMcjs.baseUrlFor; exports.buildMessage = _chunk33AQCUGMcjs.buildMessage; exports.centsToDollars = _chunk33AQCUGMcjs.centsToDollars; exports.convertBook = _chunk33AQCUGMcjs.convertBook; exports.convertMarketChannelPayload = _chunk33AQCUGMcjs.convertMarketChannelPayload; exports.convertMarketPayload = _chunk33AQCUGMcjs.convertMarketPayload; exports.convertMarketsFrame = _chunk33AQCUGMcjs.convertMarketsFrame; exports.environmentNamed = _chunk33AQCUGMcjs.environmentNamed; exports.errorForStatus = _chunk33AQCUGMcjs.errorForStatus; exports.geoRejection = _chunk33AQCUGMcjs.geoRejection; exports.handshakePath = _chunk33AQCUGMcjs.handshakePath; exports.isValidLine = _chunk33AQCUGMcjs.isValidLine; exports.loadPrivateKey = _chunk33AQCUGMcjs.loadPrivateKey; exports.orderBody = _chunk33AQCUGMcjs.orderBody; exports.requestPath = _chunk33AQCUGMcjs.requestPath; exports.resolveHost = _chunk33AQCUGMcjs.resolveHost; exports.resolveSettings = _chunk33AQCUGMcjs.resolveSettings; exports.signerFromPrivateKey = _chunk33AQCUGMcjs.signerFromPrivateKey; exports.socketUrlFor = _chunk33AQCUGMcjs.socketUrlFor; exports.toDollarString = _chunk33AQCUGMcjs.toDollarString; exports.toQuantity = _chunk33AQCUGMcjs.toQuantity;
|
|
127
127
|
//# 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, m as
|
|
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, m as CreatableMarketType, n as CreateMarketResult, o as CreateMarketsOptions, E as Environment, p as Environments, q as Error, r as Event, s as EventPlayer, t as EventPlayers, u as EventStat, v as EventTeam, w as EventsQuery, F as FeeTransaction, x as FetchLike, y as Fill, z as FillsQuery, G as GeoCheckResult, D as GeoLocationProvider, H as GeoOption, I as GeoRejection, J as HOSTS, K as KEY_HEADER, L as KnownStat, M as Leaderboard, N as LeaderboardEntry, O as LeaderboardStanding, P as ListedMarketType, Q as Logger, R as MAX_MARKETS_PER_REQUEST, S as Market, T as MarketFilter, U as MarketRejectionReason, V as MarketRule, W as MarketStat, X as MarketStatsQuery, Y as MarketType, Z as MarketTypeEventType, _ as MarketTypeField, $ as MarketTypes, a0 as MarketsQuery, a1 as Me, a2 as MessageHandler, a3 as NO_RETRY, a4 as NewMarket, a5 as NewOrder, a6 as NewOrderInput, a7 as OPERATIONS, a8 as Operation, a9 as OperationId, aa as Order, ab as OrderOptions, ac as OrdersQuery, ad as Page, ae as PageQuery, af as PaymentTransaction, ag as PlayerStatLineMarket, ah as Position, ai as PrivateKeyInput, aj as ProfileUpdate, ak as RecentTrade, al as ReconnectPolicy, am as ReconnectPolicyOptions, an as Region, ao as ResponseEvent, ap as RetryPolicy, aq as RetryPolicyOptions, ar as SIGNATURE_HEADER, as as SNAPSHOT_EVENTS, at as STX, au as STXAPIException, av as STXAuthenticationException, aw as STXChannelException, ax as STXConfigException, ay as STXEnvironment, az as STXException, aA as STXForbiddenException, aB as STXGeoLocationException, aC as STXInsufficientScopeException, aD as STXInvalidTokenException, aE as STXNotFoundException, aF as STXOptions, aG as STXRateLimitException, aH as STXRejectedException, aI as STXServerException, aJ as STXTimeoutException, aK as STXTransportException, aL as STXValidationException, aM as STXWebSocket, aN as STXWebSocketOptions, aO as Settlement, aP as SettlementsQuery, aQ as Signer, aR as Stat, aS as StatDetail, aT as Stats, aU as StrList, aV as TERMINAL_ORDER_STATUSES, aW as TIMESTAMP_HEADER, aX as Transaction, aY as USER_AGENT, aZ as VERSION, a_ as WebSocketAuthContext, a$ as baseUrlFor, b0 as buildMessage, b1 as environmentNamed, b2 as errorForStatus, b3 as geoRejection, b4 as handshakePath, b5 as isValidLine, b6 as loadPrivateKey, b7 as models, b8 as orderBody, b9 as requestPath, ba as resolveHost, bb as signerFromPrivateKey, bc as socketUrlFor } from './client-CNkaTuhG.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, m as
|
|
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, m as CreatableMarketType, n as CreateMarketResult, o as CreateMarketsOptions, E as Environment, p as Environments, q as Error, r as Event, s as EventPlayer, t as EventPlayers, u as EventStat, v as EventTeam, w as EventsQuery, F as FeeTransaction, x as FetchLike, y as Fill, z as FillsQuery, G as GeoCheckResult, D as GeoLocationProvider, H as GeoOption, I as GeoRejection, J as HOSTS, K as KEY_HEADER, L as KnownStat, M as Leaderboard, N as LeaderboardEntry, O as LeaderboardStanding, P as ListedMarketType, Q as Logger, R as MAX_MARKETS_PER_REQUEST, S as Market, T as MarketFilter, U as MarketRejectionReason, V as MarketRule, W as MarketStat, X as MarketStatsQuery, Y as MarketType, Z as MarketTypeEventType, _ as MarketTypeField, $ as MarketTypes, a0 as MarketsQuery, a1 as Me, a2 as MessageHandler, a3 as NO_RETRY, a4 as NewMarket, a5 as NewOrder, a6 as NewOrderInput, a7 as OPERATIONS, a8 as Operation, a9 as OperationId, aa as Order, ab as OrderOptions, ac as OrdersQuery, ad as Page, ae as PageQuery, af as PaymentTransaction, ag as PlayerStatLineMarket, ah as Position, ai as PrivateKeyInput, aj as ProfileUpdate, ak as RecentTrade, al as ReconnectPolicy, am as ReconnectPolicyOptions, an as Region, ao as ResponseEvent, ap as RetryPolicy, aq as RetryPolicyOptions, ar as SIGNATURE_HEADER, as as SNAPSHOT_EVENTS, at as STX, au as STXAPIException, av as STXAuthenticationException, aw as STXChannelException, ax as STXConfigException, ay as STXEnvironment, az as STXException, aA as STXForbiddenException, aB as STXGeoLocationException, aC as STXInsufficientScopeException, aD as STXInvalidTokenException, aE as STXNotFoundException, aF as STXOptions, aG as STXRateLimitException, aH as STXRejectedException, aI as STXServerException, aJ as STXTimeoutException, aK as STXTransportException, aL as STXValidationException, aM as STXWebSocket, aN as STXWebSocketOptions, aO as Settlement, aP as SettlementsQuery, aQ as Signer, aR as Stat, aS as StatDetail, aT as Stats, aU as StrList, aV as TERMINAL_ORDER_STATUSES, aW as TIMESTAMP_HEADER, aX as Transaction, aY as USER_AGENT, aZ as VERSION, a_ as WebSocketAuthContext, a$ as baseUrlFor, b0 as buildMessage, b1 as environmentNamed, b2 as errorForStatus, b3 as geoRejection, b4 as handshakePath, b5 as isValidLine, b6 as loadPrivateKey, b7 as models, b8 as orderBody, b9 as requestPath, ba as resolveHost, bb as signerFromPrivateKey, bc as socketUrlFor } from './client-CNkaTuhG.js';
|
|
2
2
|
import 'node:crypto';
|
|
3
3
|
|
|
4
4
|
/** The fully resolved configuration the clients consume. */
|