@taphubhq/sdk-core 0.15.3 → 0.16.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/dist/index.d.mts CHANGED
@@ -233,97 +233,6 @@ declare class BidModule {
233
233
  }): Promise<Bid[]>;
234
234
  }
235
235
 
236
- interface Game {
237
- id: string;
238
- pair: string;
239
- status: string;
240
- config: GameConfig;
241
- /** ISO-8601 string passthrough from the server. */
242
- createdAt: string | null;
243
- }
244
- interface GameConfig {
245
- gridConfig: GridConfig;
246
- constraints: Constraints;
247
- acceptableBids: number[];
248
- minBidAmount: number;
249
- maxBidAmount: number;
250
- }
251
- interface GridConfig {
252
- cellSizeTime: number;
253
- cellSizeValue: number;
254
- candleSize: number;
255
- baseline: number;
256
- baselineTime: number;
257
- }
258
- interface Constraints {
259
- minBetTime: number;
260
- maxBetTime: number;
261
- slippage: number;
262
- priceMinRange: number;
263
- priceMaxRange: number;
264
- coefMults: number[];
265
- maxCoef: number;
266
- }
267
- interface GamePairInfo {
268
- /** game_pairs.id — catalog identifier for this pair within a gameplay. */
269
- id: string;
270
- /** Trading pair symbol, e.g. "BTC/USD". */
271
- pair: string;
272
- /** ID of the gameplay this pair belongs to. Use as `gameplaySlug` in game.get(). */
273
- gameplayId: string;
274
- /** Human-readable gameplay name. */
275
- gameplayName: string;
276
- /** Price feed source, e.g. "binance". */
277
- source: string;
278
- /**
279
- * agency_game_pairs.id — the runtime game ID for this agency.
280
- * Present only when the caller is authenticated with a valid JWT.
281
- * Use directly as `gameId` in MQTT topic `game/{gameId}/candle`.
282
- * Null when called without authentication.
283
- */
284
- gameId: string | null;
285
- }
286
- interface Candle {
287
- /** Unix epoch SECONDS (not ms). Multiply by 1000 for JS Date. */
288
- time: number;
289
- o: number;
290
- h: number;
291
- l: number;
292
- c: number;
293
- volatility: number;
294
- coefMults: number[];
295
- }
296
-
297
- interface GameModuleDeps {
298
- graphql: GraphQLTransport;
299
- }
300
- declare class GameModule {
301
- #private;
302
- constructor(deps: GameModuleDeps);
303
- get(pair: string, opts?: {
304
- gameplaySlug?: string;
305
- signal?: AbortSignal;
306
- }): Promise<Game>;
307
- /**
308
- * Returns available game pairs, optionally filtered by gameplay.
309
- *
310
- * When called with a valid JWT (authenticated builder), each entry includes
311
- * `gameId` — use it directly as the MQTT topic `game/{gameId}/candle`.
312
- *
313
- * @example
314
- * const pairs = await client.game.availableGamePairs({ gameplayId: 'taptrading' });
315
- * const game = await client.game.get(pairs[0].pair, { gameplaySlug: pairs[0].gameplayId });
316
- * const ch = client.realtime?.subscribe(pairs[0].gameId ?? game.id, userId);
317
- */
318
- availableGamePairs(opts?: {
319
- gameplayId?: string;
320
- signal?: AbortSignal;
321
- }): Promise<GamePairInfo[]>;
322
- chartHistory(gameId: string, limit?: number, opts?: {
323
- signal?: AbortSignal;
324
- }): Promise<Candle[]>;
325
- }
326
-
327
236
  type LeaderboardPeriod = 'weekly' | 'all_time';
328
237
  type LeaderboardSortBy = 'gain' | 'wagered';
329
238
  interface LeaderboardEntry {
@@ -427,6 +336,97 @@ declare class LocaleModule {
427
336
  }): Promise<LocaleRefreshResult>;
428
337
  }
429
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
+
430
430
  interface MqttWireCandle {
431
431
  type: 'new' | 'update';
432
432
  time: number;
@@ -891,8 +891,8 @@ declare class TaphubClient {
891
891
  user: UserModule;
892
892
  /** @readonly Auth module — reassignment has no effect at runtime. */
893
893
  auth: AuthModule;
894
- /** @readonly Game module — reassignment has no effect at runtime. */
895
- game: GameModule;
894
+ /** @readonly Pair module — reassignment has no effect at runtime. */
895
+ pair: PairModule;
896
896
  /** @readonly Bid module — reassignment has no effect at runtime. */
897
897
  bid: BidModule;
898
898
  /** @readonly Leaderboard module — reassignment has no effect at runtime. */
@@ -988,4 +988,4 @@ declare function adaptiveSimpson(f: (x: number) => number, a: number, b: number,
988
988
  declare function calculateProbWin(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
989
989
  declare function calculateProbWin_v2(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
990
990
 
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, 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
@@ -233,97 +233,6 @@ declare class BidModule {
233
233
  }): Promise<Bid[]>;
234
234
  }
235
235
 
236
- interface Game {
237
- id: string;
238
- pair: string;
239
- status: string;
240
- config: GameConfig;
241
- /** ISO-8601 string passthrough from the server. */
242
- createdAt: string | null;
243
- }
244
- interface GameConfig {
245
- gridConfig: GridConfig;
246
- constraints: Constraints;
247
- acceptableBids: number[];
248
- minBidAmount: number;
249
- maxBidAmount: number;
250
- }
251
- interface GridConfig {
252
- cellSizeTime: number;
253
- cellSizeValue: number;
254
- candleSize: number;
255
- baseline: number;
256
- baselineTime: number;
257
- }
258
- interface Constraints {
259
- minBetTime: number;
260
- maxBetTime: number;
261
- slippage: number;
262
- priceMinRange: number;
263
- priceMaxRange: number;
264
- coefMults: number[];
265
- maxCoef: number;
266
- }
267
- interface GamePairInfo {
268
- /** game_pairs.id — catalog identifier for this pair within a gameplay. */
269
- id: string;
270
- /** Trading pair symbol, e.g. "BTC/USD". */
271
- pair: string;
272
- /** ID of the gameplay this pair belongs to. Use as `gameplaySlug` in game.get(). */
273
- gameplayId: string;
274
- /** Human-readable gameplay name. */
275
- gameplayName: string;
276
- /** Price feed source, e.g. "binance". */
277
- source: string;
278
- /**
279
- * agency_game_pairs.id — the runtime game ID for this agency.
280
- * Present only when the caller is authenticated with a valid JWT.
281
- * Use directly as `gameId` in MQTT topic `game/{gameId}/candle`.
282
- * Null when called without authentication.
283
- */
284
- gameId: string | null;
285
- }
286
- interface Candle {
287
- /** Unix epoch SECONDS (not ms). Multiply by 1000 for JS Date. */
288
- time: number;
289
- o: number;
290
- h: number;
291
- l: number;
292
- c: number;
293
- volatility: number;
294
- coefMults: number[];
295
- }
296
-
297
- interface GameModuleDeps {
298
- graphql: GraphQLTransport;
299
- }
300
- declare class GameModule {
301
- #private;
302
- constructor(deps: GameModuleDeps);
303
- get(pair: string, opts?: {
304
- gameplaySlug?: string;
305
- signal?: AbortSignal;
306
- }): Promise<Game>;
307
- /**
308
- * Returns available game pairs, optionally filtered by gameplay.
309
- *
310
- * When called with a valid JWT (authenticated builder), each entry includes
311
- * `gameId` — use it directly as the MQTT topic `game/{gameId}/candle`.
312
- *
313
- * @example
314
- * const pairs = await client.game.availableGamePairs({ gameplayId: 'taptrading' });
315
- * const game = await client.game.get(pairs[0].pair, { gameplaySlug: pairs[0].gameplayId });
316
- * const ch = client.realtime?.subscribe(pairs[0].gameId ?? game.id, userId);
317
- */
318
- availableGamePairs(opts?: {
319
- gameplayId?: string;
320
- signal?: AbortSignal;
321
- }): Promise<GamePairInfo[]>;
322
- chartHistory(gameId: string, limit?: number, opts?: {
323
- signal?: AbortSignal;
324
- }): Promise<Candle[]>;
325
- }
326
-
327
236
  type LeaderboardPeriod = 'weekly' | 'all_time';
328
237
  type LeaderboardSortBy = 'gain' | 'wagered';
329
238
  interface LeaderboardEntry {
@@ -427,6 +336,97 @@ declare class LocaleModule {
427
336
  }): Promise<LocaleRefreshResult>;
428
337
  }
429
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
+
430
430
  interface MqttWireCandle {
431
431
  type: 'new' | 'update';
432
432
  time: number;
@@ -891,8 +891,8 @@ declare class TaphubClient {
891
891
  user: UserModule;
892
892
  /** @readonly Auth module — reassignment has no effect at runtime. */
893
893
  auth: AuthModule;
894
- /** @readonly Game module — reassignment has no effect at runtime. */
895
- game: GameModule;
894
+ /** @readonly Pair module — reassignment has no effect at runtime. */
895
+ pair: PairModule;
896
896
  /** @readonly Bid module — reassignment has no effect at runtime. */
897
897
  bid: BidModule;
898
898
  /** @readonly Leaderboard module — reassignment has no effect at runtime. */
@@ -988,4 +988,4 @@ declare function adaptiveSimpson(f: (x: number) => number, a: number, b: number,
988
988
  declare function calculateProbWin(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
989
989
  declare function calculateProbWin_v2(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
990
990
 
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, 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 };