@taphubhq/sdk-core 0.15.2 → 0.16.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.
package/dist/index.d.mts CHANGED
@@ -222,7 +222,10 @@ declare class BidModule {
222
222
  signal?: AbortSignal;
223
223
  }): Promise<CancelBidResult>;
224
224
  listBids(opts?: {
225
+ /** @deprecated Use `statuses` instead. Folded into a one-element `statuses` list. */
225
226
  status?: BidStatus;
227
+ /** Include-semantics: return only bids whose status is in this list. */
228
+ statuses?: BidStatus[];
226
229
  limit?: number;
227
230
  offset?: number;
228
231
  gameId?: string;
@@ -230,97 +233,6 @@ declare class BidModule {
230
233
  }): Promise<Bid[]>;
231
234
  }
232
235
 
233
- interface Game {
234
- id: string;
235
- pair: string;
236
- status: string;
237
- config: GameConfig;
238
- /** ISO-8601 string passthrough from the server. */
239
- createdAt: string | null;
240
- }
241
- interface GameConfig {
242
- gridConfig: GridConfig;
243
- constraints: Constraints;
244
- acceptableBids: number[];
245
- minBidAmount: number;
246
- maxBidAmount: number;
247
- }
248
- interface GridConfig {
249
- cellSizeTime: number;
250
- cellSizeValue: number;
251
- candleSize: number;
252
- baseline: number;
253
- baselineTime: number;
254
- }
255
- interface Constraints {
256
- minBetTime: number;
257
- maxBetTime: number;
258
- slippage: number;
259
- priceMinRange: number;
260
- priceMaxRange: number;
261
- coefMults: number[];
262
- maxCoef: number;
263
- }
264
- interface GamePairInfo {
265
- /** game_pairs.id — catalog identifier for this pair within a gameplay. */
266
- id: string;
267
- /** Trading pair symbol, e.g. "BTC/USD". */
268
- pair: string;
269
- /** ID of the gameplay this pair belongs to. Use as `gameplaySlug` in game.get(). */
270
- gameplayId: string;
271
- /** Human-readable gameplay name. */
272
- gameplayName: string;
273
- /** Price feed source, e.g. "binance". */
274
- source: string;
275
- /**
276
- * agency_game_pairs.id — the runtime game ID for this agency.
277
- * Present only when the caller is authenticated with a valid JWT.
278
- * Use directly as `gameId` in MQTT topic `game/{gameId}/candle`.
279
- * Null when called without authentication.
280
- */
281
- gameId: string | null;
282
- }
283
- interface Candle {
284
- /** Unix epoch SECONDS (not ms). Multiply by 1000 for JS Date. */
285
- time: number;
286
- o: number;
287
- h: number;
288
- l: number;
289
- c: number;
290
- volatility: number;
291
- coefMults: number[];
292
- }
293
-
294
- interface GameModuleDeps {
295
- graphql: GraphQLTransport;
296
- }
297
- declare class GameModule {
298
- #private;
299
- constructor(deps: GameModuleDeps);
300
- get(pair: string, opts?: {
301
- gameplaySlug?: string;
302
- signal?: AbortSignal;
303
- }): Promise<Game>;
304
- /**
305
- * Returns available game pairs, optionally filtered by gameplay.
306
- *
307
- * When called with a valid JWT (authenticated builder), each entry includes
308
- * `gameId` — use it directly as the MQTT topic `game/{gameId}/candle`.
309
- *
310
- * @example
311
- * const pairs = await client.game.availableGamePairs({ gameplayId: 'taptrading' });
312
- * const game = await client.game.get(pairs[0].pair, { gameplaySlug: pairs[0].gameplayId });
313
- * const ch = client.realtime?.subscribe(pairs[0].gameId ?? game.id, userId);
314
- */
315
- availableGamePairs(opts?: {
316
- gameplayId?: string;
317
- signal?: AbortSignal;
318
- }): Promise<GamePairInfo[]>;
319
- chartHistory(gameId: string, limit?: number, opts?: {
320
- signal?: AbortSignal;
321
- }): Promise<Candle[]>;
322
- }
323
-
324
236
  type LeaderboardPeriod = 'weekly' | 'all_time';
325
237
  type LeaderboardSortBy = 'gain' | 'wagered';
326
238
  interface LeaderboardEntry {
@@ -424,6 +336,97 @@ declare class LocaleModule {
424
336
  }): Promise<LocaleRefreshResult>;
425
337
  }
426
338
 
339
+ interface Pair {
340
+ id: string;
341
+ pair: string;
342
+ status: string;
343
+ config: GameConfig;
344
+ /** ISO-8601 string passthrough from the server. */
345
+ createdAt: string | null;
346
+ }
347
+ interface GameConfig {
348
+ gridConfig: GridConfig;
349
+ constraints: Constraints;
350
+ acceptableBids: number[];
351
+ minBidAmount: number;
352
+ maxBidAmount: number;
353
+ }
354
+ interface GridConfig {
355
+ cellSizeTime: number;
356
+ cellSizeValue: number;
357
+ candleSize: number;
358
+ baseline: number;
359
+ baselineTime: number;
360
+ }
361
+ interface Constraints {
362
+ minBetTime: number;
363
+ maxBetTime: number;
364
+ slippage: number;
365
+ priceMinRange: number;
366
+ priceMaxRange: number;
367
+ coefMults: number[];
368
+ maxCoef: number;
369
+ }
370
+ interface PairInfo {
371
+ /** game_pairs.id — catalog identifier for this pair within a gameplay. */
372
+ id: string;
373
+ /** Trading pair symbol, e.g. "BTC/USD". */
374
+ pair: string;
375
+ /** ID of the gameplay this pair belongs to. Use as `gameplaySlug` in game.get(). */
376
+ gameplayId: string;
377
+ /** Human-readable gameplay name. */
378
+ gameplayName: string;
379
+ /** Price feed source, e.g. "binance". */
380
+ source: string;
381
+ /**
382
+ * agency_game_pairs.id — the runtime game ID for this agency.
383
+ * Present only when the caller is authenticated with a valid JWT.
384
+ * Use directly as `gameId` in MQTT topic `game/{gameId}/candle`.
385
+ * Null when called without authentication.
386
+ */
387
+ agencyPairId: string | null;
388
+ }
389
+ interface Candle {
390
+ /** Unix epoch SECONDS (not ms). Multiply by 1000 for JS Date. */
391
+ time: number;
392
+ o: number;
393
+ h: number;
394
+ l: number;
395
+ c: number;
396
+ volatility: number;
397
+ coefMults: number[];
398
+ }
399
+
400
+ interface PairModuleDeps {
401
+ graphql: GraphQLTransport;
402
+ }
403
+ declare class PairModule {
404
+ #private;
405
+ constructor(deps: PairModuleDeps);
406
+ get(pair: string, opts?: {
407
+ gameplaySlug?: string;
408
+ signal?: AbortSignal;
409
+ }): Promise<Pair>;
410
+ /**
411
+ * Returns available game pairs, optionally filtered by gameplay.
412
+ *
413
+ * When called with a valid JWT (authenticated builder), each entry includes
414
+ * `gameId` — use it directly as the MQTT topic `game/{gameId}/candle`.
415
+ *
416
+ * @example
417
+ * const pairs = await client.pair.availableGamePairs({ gameplayId: 'taptrading' });
418
+ * const game = await client.pair.get(pairs[0].pair, { gameplaySlug: pairs[0].gameplayId });
419
+ * const ch = client.realtime?.subscribe(pairs[0].agencyPairId ?? game.id, userId);
420
+ */
421
+ availableGamePairs(opts?: {
422
+ gameplayId?: string;
423
+ signal?: AbortSignal;
424
+ }): Promise<PairInfo[]>;
425
+ chartHistory(agencyPairId: string, limit?: number, opts?: {
426
+ signal?: AbortSignal;
427
+ }): Promise<Candle[]>;
428
+ }
429
+
427
430
  interface MqttWireCandle {
428
431
  type: 'new' | 'update';
429
432
  time: number;
@@ -888,8 +891,8 @@ declare class TaphubClient {
888
891
  user: UserModule;
889
892
  /** @readonly Auth module — reassignment has no effect at runtime. */
890
893
  auth: AuthModule;
891
- /** @readonly Game module — reassignment has no effect at runtime. */
892
- game: GameModule;
894
+ /** @readonly Pair module — reassignment has no effect at runtime. */
895
+ pair: PairModule;
893
896
  /** @readonly Bid module — reassignment has no effect at runtime. */
894
897
  bid: BidModule;
895
898
  /** @readonly Leaderboard module — reassignment has no effect at runtime. */
@@ -985,4 +988,4 @@ declare function adaptiveSimpson(f: (x: number) => number, a: number, b: number,
985
988
  declare function calculateProbWin(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
986
989
  declare function calculateProbWin_v2(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
987
990
 
988
- export { type AgencyPairFilter, AgencyPairModule, type AgencyPairStats, type AgencyPairStatus, AuthModule, type BackendHealth, type Bid, BidModule, type BidStatus, type CancelBidResult, type Candle, type Constraints, type Currency, type Game, GameChannel, type GameConfig, GameModule, type GamePairInfo, type GridConfig, type LeaderboardEntry, LeaderboardModule, type LeaderboardPeriod, type LeaderboardSortBy, LocaleModule, type LocaleRefreshResult, type LocaleResponse, type LocaleTranslations, type LoginResult, type Me, type MqttAcceptedBid, type MqttAgencyPairStatsEvent, type MqttBalanceEvent, type MqttBidAcceptedEvent, type MqttBidLostEvent, type MqttBidWonEvent, type MqttCandleEvent, type MqttConfigEvent, type MqttIdealConfigEvent, type MqttWalletBalanceEvent, type NetworkLevel, type NetworkQuality, NetworkQualityMonitor, type PlaceBidInput, RealtimeModule, type Sample, type SampleReason, type SignalSource, TaphubAuthError, TaphubClient, type TaphubClientConfig, TaphubError, TaphubEventBus, type TaphubEventMap, TaphubNetworkError, TaphubServerError, TaphubSlippageError, TaphubStorage, type TaphubStorageAdapter, TaphubValidationError, type User, UserModule, type UserPnL, type UserPnLPeriod, type Wallet as UserWallet, type Wallet$1 as Wallet, type WalletBalanceReason, WalletChannel, adaptiveSimpson, autoDetectStorage, calculateProbWin, calculateProbWin_v2, errorFunction, isCancelled, isLoss, isPending, isTerminal, isWin, normalCDF, normalPDF };
991
+ export { type AgencyPairFilter, AgencyPairModule, type AgencyPairStats, type AgencyPairStatus, AuthModule, type BackendHealth, type Bid, BidModule, type BidStatus, type CancelBidResult, type Candle, type Constraints, type Currency, GameChannel, type GameConfig, type GridConfig, type LeaderboardEntry, LeaderboardModule, type LeaderboardPeriod, type LeaderboardSortBy, LocaleModule, type LocaleRefreshResult, type LocaleResponse, type LocaleTranslations, type LoginResult, type Me, type MqttAcceptedBid, type MqttAgencyPairStatsEvent, type MqttBalanceEvent, type MqttBidAcceptedEvent, type MqttBidLostEvent, type MqttBidWonEvent, type MqttCandleEvent, type MqttConfigEvent, type MqttIdealConfigEvent, type MqttWalletBalanceEvent, type NetworkLevel, type NetworkQuality, NetworkQualityMonitor, type Pair, type PairInfo, PairModule, type PlaceBidInput, RealtimeModule, type Sample, type SampleReason, type SignalSource, TaphubAuthError, TaphubClient, type TaphubClientConfig, TaphubError, TaphubEventBus, type TaphubEventMap, TaphubNetworkError, TaphubServerError, TaphubSlippageError, TaphubStorage, type TaphubStorageAdapter, TaphubValidationError, type User, UserModule, type UserPnL, type UserPnLPeriod, type Wallet as UserWallet, type Wallet$1 as Wallet, type WalletBalanceReason, WalletChannel, adaptiveSimpson, autoDetectStorage, calculateProbWin, calculateProbWin_v2, errorFunction, isCancelled, isLoss, isPending, isTerminal, isWin, normalCDF, normalPDF };
package/dist/index.d.ts CHANGED
@@ -222,7 +222,10 @@ declare class BidModule {
222
222
  signal?: AbortSignal;
223
223
  }): Promise<CancelBidResult>;
224
224
  listBids(opts?: {
225
+ /** @deprecated Use `statuses` instead. Folded into a one-element `statuses` list. */
225
226
  status?: BidStatus;
227
+ /** Include-semantics: return only bids whose status is in this list. */
228
+ statuses?: BidStatus[];
226
229
  limit?: number;
227
230
  offset?: number;
228
231
  gameId?: string;
@@ -230,97 +233,6 @@ declare class BidModule {
230
233
  }): Promise<Bid[]>;
231
234
  }
232
235
 
233
- interface Game {
234
- id: string;
235
- pair: string;
236
- status: string;
237
- config: GameConfig;
238
- /** ISO-8601 string passthrough from the server. */
239
- createdAt: string | null;
240
- }
241
- interface GameConfig {
242
- gridConfig: GridConfig;
243
- constraints: Constraints;
244
- acceptableBids: number[];
245
- minBidAmount: number;
246
- maxBidAmount: number;
247
- }
248
- interface GridConfig {
249
- cellSizeTime: number;
250
- cellSizeValue: number;
251
- candleSize: number;
252
- baseline: number;
253
- baselineTime: number;
254
- }
255
- interface Constraints {
256
- minBetTime: number;
257
- maxBetTime: number;
258
- slippage: number;
259
- priceMinRange: number;
260
- priceMaxRange: number;
261
- coefMults: number[];
262
- maxCoef: number;
263
- }
264
- interface GamePairInfo {
265
- /** game_pairs.id — catalog identifier for this pair within a gameplay. */
266
- id: string;
267
- /** Trading pair symbol, e.g. "BTC/USD". */
268
- pair: string;
269
- /** ID of the gameplay this pair belongs to. Use as `gameplaySlug` in game.get(). */
270
- gameplayId: string;
271
- /** Human-readable gameplay name. */
272
- gameplayName: string;
273
- /** Price feed source, e.g. "binance". */
274
- source: string;
275
- /**
276
- * agency_game_pairs.id — the runtime game ID for this agency.
277
- * Present only when the caller is authenticated with a valid JWT.
278
- * Use directly as `gameId` in MQTT topic `game/{gameId}/candle`.
279
- * Null when called without authentication.
280
- */
281
- gameId: string | null;
282
- }
283
- interface Candle {
284
- /** Unix epoch SECONDS (not ms). Multiply by 1000 for JS Date. */
285
- time: number;
286
- o: number;
287
- h: number;
288
- l: number;
289
- c: number;
290
- volatility: number;
291
- coefMults: number[];
292
- }
293
-
294
- interface GameModuleDeps {
295
- graphql: GraphQLTransport;
296
- }
297
- declare class GameModule {
298
- #private;
299
- constructor(deps: GameModuleDeps);
300
- get(pair: string, opts?: {
301
- gameplaySlug?: string;
302
- signal?: AbortSignal;
303
- }): Promise<Game>;
304
- /**
305
- * Returns available game pairs, optionally filtered by gameplay.
306
- *
307
- * When called with a valid JWT (authenticated builder), each entry includes
308
- * `gameId` — use it directly as the MQTT topic `game/{gameId}/candle`.
309
- *
310
- * @example
311
- * const pairs = await client.game.availableGamePairs({ gameplayId: 'taptrading' });
312
- * const game = await client.game.get(pairs[0].pair, { gameplaySlug: pairs[0].gameplayId });
313
- * const ch = client.realtime?.subscribe(pairs[0].gameId ?? game.id, userId);
314
- */
315
- availableGamePairs(opts?: {
316
- gameplayId?: string;
317
- signal?: AbortSignal;
318
- }): Promise<GamePairInfo[]>;
319
- chartHistory(gameId: string, limit?: number, opts?: {
320
- signal?: AbortSignal;
321
- }): Promise<Candle[]>;
322
- }
323
-
324
236
  type LeaderboardPeriod = 'weekly' | 'all_time';
325
237
  type LeaderboardSortBy = 'gain' | 'wagered';
326
238
  interface LeaderboardEntry {
@@ -424,6 +336,97 @@ declare class LocaleModule {
424
336
  }): Promise<LocaleRefreshResult>;
425
337
  }
426
338
 
339
+ interface Pair {
340
+ id: string;
341
+ pair: string;
342
+ status: string;
343
+ config: GameConfig;
344
+ /** ISO-8601 string passthrough from the server. */
345
+ createdAt: string | null;
346
+ }
347
+ interface GameConfig {
348
+ gridConfig: GridConfig;
349
+ constraints: Constraints;
350
+ acceptableBids: number[];
351
+ minBidAmount: number;
352
+ maxBidAmount: number;
353
+ }
354
+ interface GridConfig {
355
+ cellSizeTime: number;
356
+ cellSizeValue: number;
357
+ candleSize: number;
358
+ baseline: number;
359
+ baselineTime: number;
360
+ }
361
+ interface Constraints {
362
+ minBetTime: number;
363
+ maxBetTime: number;
364
+ slippage: number;
365
+ priceMinRange: number;
366
+ priceMaxRange: number;
367
+ coefMults: number[];
368
+ maxCoef: number;
369
+ }
370
+ interface PairInfo {
371
+ /** game_pairs.id — catalog identifier for this pair within a gameplay. */
372
+ id: string;
373
+ /** Trading pair symbol, e.g. "BTC/USD". */
374
+ pair: string;
375
+ /** ID of the gameplay this pair belongs to. Use as `gameplaySlug` in game.get(). */
376
+ gameplayId: string;
377
+ /** Human-readable gameplay name. */
378
+ gameplayName: string;
379
+ /** Price feed source, e.g. "binance". */
380
+ source: string;
381
+ /**
382
+ * agency_game_pairs.id — the runtime game ID for this agency.
383
+ * Present only when the caller is authenticated with a valid JWT.
384
+ * Use directly as `gameId` in MQTT topic `game/{gameId}/candle`.
385
+ * Null when called without authentication.
386
+ */
387
+ agencyPairId: string | null;
388
+ }
389
+ interface Candle {
390
+ /** Unix epoch SECONDS (not ms). Multiply by 1000 for JS Date. */
391
+ time: number;
392
+ o: number;
393
+ h: number;
394
+ l: number;
395
+ c: number;
396
+ volatility: number;
397
+ coefMults: number[];
398
+ }
399
+
400
+ interface PairModuleDeps {
401
+ graphql: GraphQLTransport;
402
+ }
403
+ declare class PairModule {
404
+ #private;
405
+ constructor(deps: PairModuleDeps);
406
+ get(pair: string, opts?: {
407
+ gameplaySlug?: string;
408
+ signal?: AbortSignal;
409
+ }): Promise<Pair>;
410
+ /**
411
+ * Returns available game pairs, optionally filtered by gameplay.
412
+ *
413
+ * When called with a valid JWT (authenticated builder), each entry includes
414
+ * `gameId` — use it directly as the MQTT topic `game/{gameId}/candle`.
415
+ *
416
+ * @example
417
+ * const pairs = await client.pair.availableGamePairs({ gameplayId: 'taptrading' });
418
+ * const game = await client.pair.get(pairs[0].pair, { gameplaySlug: pairs[0].gameplayId });
419
+ * const ch = client.realtime?.subscribe(pairs[0].agencyPairId ?? game.id, userId);
420
+ */
421
+ availableGamePairs(opts?: {
422
+ gameplayId?: string;
423
+ signal?: AbortSignal;
424
+ }): Promise<PairInfo[]>;
425
+ chartHistory(agencyPairId: string, limit?: number, opts?: {
426
+ signal?: AbortSignal;
427
+ }): Promise<Candle[]>;
428
+ }
429
+
427
430
  interface MqttWireCandle {
428
431
  type: 'new' | 'update';
429
432
  time: number;
@@ -888,8 +891,8 @@ declare class TaphubClient {
888
891
  user: UserModule;
889
892
  /** @readonly Auth module — reassignment has no effect at runtime. */
890
893
  auth: AuthModule;
891
- /** @readonly Game module — reassignment has no effect at runtime. */
892
- game: GameModule;
894
+ /** @readonly Pair module — reassignment has no effect at runtime. */
895
+ pair: PairModule;
893
896
  /** @readonly Bid module — reassignment has no effect at runtime. */
894
897
  bid: BidModule;
895
898
  /** @readonly Leaderboard module — reassignment has no effect at runtime. */
@@ -985,4 +988,4 @@ declare function adaptiveSimpson(f: (x: number) => number, a: number, b: number,
985
988
  declare function calculateProbWin(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
986
989
  declare function calculateProbWin_v2(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
987
990
 
988
- export { type AgencyPairFilter, AgencyPairModule, type AgencyPairStats, type AgencyPairStatus, AuthModule, type BackendHealth, type Bid, BidModule, type BidStatus, type CancelBidResult, type Candle, type Constraints, type Currency, type Game, GameChannel, type GameConfig, GameModule, type GamePairInfo, type GridConfig, type LeaderboardEntry, LeaderboardModule, type LeaderboardPeriod, type LeaderboardSortBy, LocaleModule, type LocaleRefreshResult, type LocaleResponse, type LocaleTranslations, type LoginResult, type Me, type MqttAcceptedBid, type MqttAgencyPairStatsEvent, type MqttBalanceEvent, type MqttBidAcceptedEvent, type MqttBidLostEvent, type MqttBidWonEvent, type MqttCandleEvent, type MqttConfigEvent, type MqttIdealConfigEvent, type MqttWalletBalanceEvent, type NetworkLevel, type NetworkQuality, NetworkQualityMonitor, type PlaceBidInput, RealtimeModule, type Sample, type SampleReason, type SignalSource, TaphubAuthError, TaphubClient, type TaphubClientConfig, TaphubError, TaphubEventBus, type TaphubEventMap, TaphubNetworkError, TaphubServerError, TaphubSlippageError, TaphubStorage, type TaphubStorageAdapter, TaphubValidationError, type User, UserModule, type UserPnL, type UserPnLPeriod, type Wallet as UserWallet, type Wallet$1 as Wallet, type WalletBalanceReason, WalletChannel, adaptiveSimpson, autoDetectStorage, calculateProbWin, calculateProbWin_v2, errorFunction, isCancelled, isLoss, isPending, isTerminal, isWin, normalCDF, normalPDF };
991
+ export { type AgencyPairFilter, AgencyPairModule, type AgencyPairStats, type AgencyPairStatus, AuthModule, type BackendHealth, type Bid, BidModule, type BidStatus, type CancelBidResult, type Candle, type Constraints, type Currency, GameChannel, type GameConfig, type GridConfig, type LeaderboardEntry, LeaderboardModule, type LeaderboardPeriod, type LeaderboardSortBy, LocaleModule, type LocaleRefreshResult, type LocaleResponse, type LocaleTranslations, type LoginResult, type Me, type MqttAcceptedBid, type MqttAgencyPairStatsEvent, type MqttBalanceEvent, type MqttBidAcceptedEvent, type MqttBidLostEvent, type MqttBidWonEvent, type MqttCandleEvent, type MqttConfigEvent, type MqttIdealConfigEvent, type MqttWalletBalanceEvent, type NetworkLevel, type NetworkQuality, NetworkQualityMonitor, type Pair, type PairInfo, PairModule, type PlaceBidInput, RealtimeModule, type Sample, type SampleReason, type SignalSource, TaphubAuthError, TaphubClient, type TaphubClientConfig, TaphubError, TaphubEventBus, type TaphubEventMap, TaphubNetworkError, TaphubServerError, TaphubSlippageError, TaphubStorage, type TaphubStorageAdapter, TaphubValidationError, type User, UserModule, type UserPnL, type UserPnLPeriod, type Wallet as UserWallet, type Wallet$1 as Wallet, type WalletBalanceReason, WalletChannel, adaptiveSimpson, autoDetectStorage, calculateProbWin, calculateProbWin_v2, errorFunction, isCancelled, isLoss, isPending, isTerminal, isWin, normalCDF, normalPDF };