@dimcool/sdk 0.1.30 → 0.1.32
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/README.md +55 -45
- package/dist/index.cjs +229 -50
- package/dist/index.d.cts +62 -20
- package/dist/index.d.ts +62 -20
- package/dist/index.js +229 -50
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { NimGameState, NimGameAction } from '@dimcool/nim';
|
|
|
5
5
|
import { DotsAndBoxesGameState, DotsAndBoxesGameAction } from '@dimcool/dots-and-boxes';
|
|
6
6
|
import { TicTacToeGameState, TicTacToeGameAction } from '@dimcool/tic-tac-toe';
|
|
7
7
|
import { Connect4GameState, Connect4GameAction } from '@dimcool/connect-four';
|
|
8
|
-
export { MICRO_UNITS, formatMoneyMinor, toMajor } from '@dimcool/utils';
|
|
8
|
+
export { MICRO_UNITS, SOL_MINT, formatMoneyMinor, toMajor } from '@dimcool/utils';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Interface for HTTP client implementations.
|
|
@@ -929,7 +929,7 @@ declare const TRANSFER_FEE_MINOR = 10000;
|
|
|
929
929
|
declare const MIN_TRANSFER_AMOUNT = 50000;
|
|
930
930
|
declare const MIN_SOL_TRANSFER_AMOUNT = 1000000;
|
|
931
931
|
declare const SOL_DECIMALS = 9;
|
|
932
|
-
|
|
932
|
+
|
|
933
933
|
declare const ESTIMATED_SOL_FEE_LAMPORTS = 10000;
|
|
934
934
|
interface PrepareTransferRequest {
|
|
935
935
|
senderAddress: string;
|
|
@@ -1121,6 +1121,11 @@ declare class Admin {
|
|
|
1121
1121
|
private http;
|
|
1122
1122
|
private logger?;
|
|
1123
1123
|
constructor(http: IHttpClient, logger?: ILogger | undefined);
|
|
1124
|
+
getInternalBots(): Promise<(User & {
|
|
1125
|
+
sol: number;
|
|
1126
|
+
usdc: number;
|
|
1127
|
+
publicKey: string;
|
|
1128
|
+
})[]>;
|
|
1124
1129
|
getUserById(id: string): Promise<User>;
|
|
1125
1130
|
getUserBalance(userId: string): Promise<{
|
|
1126
1131
|
sol: number;
|
|
@@ -1434,12 +1439,55 @@ declare function createGameStore(transport: WsTransport): GameStore;
|
|
|
1434
1439
|
type GameActionsStoreState = {
|
|
1435
1440
|
statesByGameId: Record<string, GameStateResponse>;
|
|
1436
1441
|
};
|
|
1442
|
+
interface ChessClockTimes {
|
|
1443
|
+
whiteTimeMs: number;
|
|
1444
|
+
blackTimeMs: number;
|
|
1445
|
+
}
|
|
1446
|
+
interface ChessCapturedPieces {
|
|
1447
|
+
capturedByWhite: string[];
|
|
1448
|
+
capturedByBlack: string[];
|
|
1449
|
+
}
|
|
1450
|
+
interface TicTacToeClockTimes {
|
|
1451
|
+
xTimeMs: number;
|
|
1452
|
+
oTimeMs: number;
|
|
1453
|
+
}
|
|
1454
|
+
interface Connect4ClockTimes {
|
|
1455
|
+
redTimeMs: number;
|
|
1456
|
+
yellowTimeMs: number;
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Common lifecycle fields extracted from any game state.
|
|
1460
|
+
* Used by useGameLifecycle to avoid casting the raw union type.
|
|
1461
|
+
*/
|
|
1462
|
+
interface GameLifecycleState {
|
|
1463
|
+
status: string;
|
|
1464
|
+
winnerId: string | null;
|
|
1465
|
+
betAmount: number;
|
|
1466
|
+
wonAmount: number | null;
|
|
1467
|
+
totalPotMinor: number | undefined;
|
|
1468
|
+
currentPlayerId: string | null;
|
|
1469
|
+
}
|
|
1470
|
+
/**
|
|
1471
|
+
* Pure selector — extracts lifecycle fields from any game state variant.
|
|
1472
|
+
* Accepts a single GameStateResponse so callers can use it after selecting
|
|
1473
|
+
* the stable store entry via useSdkSelector, avoiding new-object-per-call issues.
|
|
1474
|
+
*/
|
|
1475
|
+
declare function selectGameLifecycleState(gameState: GameStateResponse | null | undefined): GameLifecycleState | null;
|
|
1437
1476
|
type GameActionsStore = {
|
|
1438
1477
|
store: SdkStore<GameActionsStoreState>;
|
|
1439
1478
|
setBaseState: (gameId: string, state: GameStateResponse) => void;
|
|
1440
1479
|
clearState: (gameId: string) => void;
|
|
1441
1480
|
applyWsEvent: (event: WsEvent) => void;
|
|
1442
1481
|
joinGame: (gameId: string) => () => void;
|
|
1482
|
+
getCountdownDigit: (gameId: string, nowMs: number) => number | null;
|
|
1483
|
+
/** Live chess clock — deducts elapsed time since turnStartedAt. */
|
|
1484
|
+
getChessClockTimes: (gameId: string, nowMs: number) => ChessClockTimes | null;
|
|
1485
|
+
/** Captured pieces derived from the current FEN position. */
|
|
1486
|
+
getChessCapturedPieces: (gameId: string) => ChessCapturedPieces | null;
|
|
1487
|
+
/** Live TTT clock — deducts elapsed from the current player's mark (X or O). */
|
|
1488
|
+
getTicTacToeClockTimes: (gameId: string, nowMs: number) => TicTacToeClockTimes | null;
|
|
1489
|
+
/** Live Connect Four clock — deducts elapsed from the current player's color. */
|
|
1490
|
+
getConnect4ClockTimes: (gameId: string, nowMs: number) => Connect4ClockTimes | null;
|
|
1443
1491
|
};
|
|
1444
1492
|
declare function createGameActionsStore(transport: WsTransport): GameActionsStore;
|
|
1445
1493
|
|
|
@@ -1743,7 +1791,7 @@ type LobbyDepositUpdatedPayload = {
|
|
|
1743
1791
|
status: 'confirmed' | 'failed' | 'refunded' | 'refund_failed';
|
|
1744
1792
|
allConfirmed: boolean;
|
|
1745
1793
|
};
|
|
1746
|
-
type
|
|
1794
|
+
type WsEventBase = {
|
|
1747
1795
|
event: 'lobby:created';
|
|
1748
1796
|
payload: Lobby;
|
|
1749
1797
|
} | {
|
|
@@ -1941,6 +1989,9 @@ type WsEvent = {
|
|
|
1941
1989
|
event: 'notification';
|
|
1942
1990
|
payload: unknown;
|
|
1943
1991
|
};
|
|
1992
|
+
type WsEvent = WsEventBase & {
|
|
1993
|
+
_serverTs?: number;
|
|
1994
|
+
};
|
|
1944
1995
|
|
|
1945
1996
|
type LobbyMatchedEvent = {
|
|
1946
1997
|
gameId: string;
|
|
@@ -2043,6 +2094,13 @@ declare class Lobbies {
|
|
|
2043
2094
|
constructor(http: IHttpClient, logger?: ILogger | undefined);
|
|
2044
2095
|
/** Called by SDK after the store is created so mutations can update state directly. */
|
|
2045
2096
|
setLobbyStore(store: LobbyStore): void;
|
|
2097
|
+
/**
|
|
2098
|
+
* Create a new game lobby.
|
|
2099
|
+
*
|
|
2100
|
+
* **Important:** Creating a lobby automatically closes and refunds any
|
|
2101
|
+
* existing open or queued lobby for this user. You do not need to manually
|
|
2102
|
+
* leave or cancel a previous lobby before calling this.
|
|
2103
|
+
*/
|
|
2046
2104
|
createLobby(gameType: string, betAmount?: MoneyMinor): Promise<Lobby>;
|
|
2047
2105
|
getLobby(lobbyId: string): Promise<Lobby>;
|
|
2048
2106
|
inviteFriend(lobbyId: string, friendId: string): Promise<{
|
|
@@ -2070,22 +2128,6 @@ declare class Lobbies {
|
|
|
2070
2128
|
deleteLobby(lobbyId: string): Promise<{
|
|
2071
2129
|
message: string;
|
|
2072
2130
|
}>;
|
|
2073
|
-
/**
|
|
2074
|
-
* Play again: Create a new lobby and prepare deposit in one flow.
|
|
2075
|
-
* Returns the lobby and unsigned transaction that needs to be signed.
|
|
2076
|
-
* @param gameType - The game type to play again
|
|
2077
|
-
* @param betAmount - The bet amount (same as previous game)
|
|
2078
|
-
* @param escrow - The escrow service instance (from sdk.escrow)
|
|
2079
|
-
*/
|
|
2080
|
-
playAgain(gameType: string, betAmount: MoneyMinor, escrow: {
|
|
2081
|
-
prepareAndStartDeposit: (id: string) => Promise<{
|
|
2082
|
-
transaction: string;
|
|
2083
|
-
message: string;
|
|
2084
|
-
}>;
|
|
2085
|
-
}): Promise<{
|
|
2086
|
-
lobby: Lobby;
|
|
2087
|
-
unsignedTransaction: string;
|
|
2088
|
-
}>;
|
|
2089
2131
|
}
|
|
2090
2132
|
|
|
2091
2133
|
/** A player currently in an active game; used for "Live now" and "Who to watch" UI. */
|
|
@@ -3006,4 +3048,4 @@ declare class HttpClient implements IHttpClient {
|
|
|
3006
3048
|
private payChallenge;
|
|
3007
3049
|
}
|
|
3008
3050
|
|
|
3009
|
-
export { type AcceptChallengeResponse, type Achievement, Activity, type ActivityFeedItem, type ActivityFeedItemType, type ActivityFeedResponse, type ActivityFeedUser, Admin, type AdminDailyStats, type AdminDailyStatsItem, type AdminFeatureFlag, type AdminGameHistory, type AdminGameHistoryFeeBreakdown, type AdminGameHistoryFeePlayer, type AdminGameHistoryPlayer, type AdminMarketDailyStats, type AdminMarketDailyStatsItem, type AdminMarketDetail, type AdminMarketStats, type AdminStats, type AdminWalletActivityItem, type AdminWalletActivityResponse, type AnalyticsUserData, type ApiError, type AppNotification, type AppNotificationType, type ApplyReferralCodeResponse, type BalanceResponse, type BetOption, type BroadcastTipRequest, BrowserLocalStorage, Challenges, Chat, type ChatContext, type ChatContextType, type ChatMessage, type ChatMessageReply, type ChatMessageType, type ChatReaction, type ChatReadBy, type ChatState, type ChatStore, type ChatStoreState, type ClaimReferralRewardsResponse, type CreateChallengeRequest, type CreateChallengeResponse, type CreateLobbyRequest, type CreateTicketData, type CriticalIncident, type CriticalIncidentCategory, type CriticalIncidentImpactType, type CriticalIncidentSeverity, type CriticalIncidentStatus, type CriticalIncidentSummary, type CurrentGame, Daily, type DailyParticipant, type DailyRoom, type DailyToken, type DepositForLobbyResponse, type DepositStatus, type DepositStatusResponse, type DmThread, type DmThreadsStore, type DmThreadsStoreState, type DonateToGameResponse, ESTIMATED_SOL_FEE_LAMPORTS, Escrow, type EscrowSweepPreview, type EscrowSweepRecord, type FaucetResponse, type FeatureFlag, type FriendRequestItem, type FriendsStore, type FriendsStoreState, type FriendshipStatus, type Game, type GameActionsStore, type GameActionsStoreState, type GameHistoryItem, type GameMetrics, type GamePlayer, type GameStateResponse, type GameStore, type GameStoreState, type GameType, Games, type GenerateHandshakeResponse, type GetTicketsOptions, HttpClient, type IAnalyticsClient, type IHttpClient, type ILogger, type IStorage, type ImageUploadPayload, type InviteFriendRequest, type LeaderboardEntry, type LeaderboardQuery, type LeaderboardRange, type LeaderboardResponse, Leaderboards, type LivePlayer, type LivePlayersPage, Lobbies, type Lobby, type LobbyDepositUpdatedPayload, type LobbyMatchedEvent, type LobbyPlayer, type LobbyStore, type LobbyStoreState, type LogLevel, type LoginResponse, MIN_SOL_TRANSFER_AMOUNT, MIN_TRANSFER_AMOUNT, type MarketBuyResult, type MarketPosition, type MarketSellResult, type MarketState, Markets, type MoneyMinor, NodeStorage, NoopAnalyticsClient, type NotificationEvent, type NotificationsStore, type NotificationsStoreState, type PaginatedCriticalIncidents, type PaginatedFriendRequests, type PaginatedFriends, type PaginatedNotificationsResponse, type PaginatedPlatformFees, type PaginatedReports, type PaginatedSearchUsers, type PaginatedSessions, type PaginatedSupportTickets, type PaginatedTransactionJobs, type PaginatedUsers, type PaymentRequiredChallenge, type PlatformFeeItem, type PrepareDepositResponse, type PrepareTipRequest, type PrepareTipResponse, type PrepareTransferRequest, type PrepareTransferResponse, type PublicUser, type QueueStats, type RedeemResult, type ReferralRewardItem, type ReferralRewardStatus, type ReferralRewardsResponse, type ReferralSummary, type ReferralTreeItem, type ReferralTreeResponse, Referrals, type Report, type ReportCount, type ReportStatus, type ReportUser, Reports, type RetryOptions, SDK, type SDKConfig, SDK_VERSION, SOL_DECIMALS,
|
|
3051
|
+
export { type AcceptChallengeResponse, type Achievement, Activity, type ActivityFeedItem, type ActivityFeedItemType, type ActivityFeedResponse, type ActivityFeedUser, Admin, type AdminDailyStats, type AdminDailyStatsItem, type AdminFeatureFlag, type AdminGameHistory, type AdminGameHistoryFeeBreakdown, type AdminGameHistoryFeePlayer, type AdminGameHistoryPlayer, type AdminMarketDailyStats, type AdminMarketDailyStatsItem, type AdminMarketDetail, type AdminMarketStats, type AdminStats, type AdminWalletActivityItem, type AdminWalletActivityResponse, type AnalyticsUserData, type ApiError, type AppNotification, type AppNotificationType, type ApplyReferralCodeResponse, type BalanceResponse, type BetOption, type BroadcastTipRequest, BrowserLocalStorage, Challenges, Chat, type ChatContext, type ChatContextType, type ChatMessage, type ChatMessageReply, type ChatMessageType, type ChatReaction, type ChatReadBy, type ChatState, type ChatStore, type ChatStoreState, type ChessCapturedPieces, type ChessClockTimes, type ClaimReferralRewardsResponse, type Connect4ClockTimes, type CreateChallengeRequest, type CreateChallengeResponse, type CreateLobbyRequest, type CreateTicketData, type CriticalIncident, type CriticalIncidentCategory, type CriticalIncidentImpactType, type CriticalIncidentSeverity, type CriticalIncidentStatus, type CriticalIncidentSummary, type CurrentGame, Daily, type DailyParticipant, type DailyRoom, type DailyToken, type DepositForLobbyResponse, type DepositStatus, type DepositStatusResponse, type DmThread, type DmThreadsStore, type DmThreadsStoreState, type DonateToGameResponse, ESTIMATED_SOL_FEE_LAMPORTS, Escrow, type EscrowSweepPreview, type EscrowSweepRecord, type FaucetResponse, type FeatureFlag, type FriendRequestItem, type FriendsStore, type FriendsStoreState, type FriendshipStatus, type Game, type GameActionsStore, type GameActionsStoreState, type GameHistoryItem, type GameLifecycleState, type GameMetrics, type GamePlayer, type GameStateResponse, type GameStore, type GameStoreState, type GameType, Games, type GenerateHandshakeResponse, type GetTicketsOptions, HttpClient, type IAnalyticsClient, type IHttpClient, type ILogger, type IStorage, type ImageUploadPayload, type InviteFriendRequest, type LeaderboardEntry, type LeaderboardQuery, type LeaderboardRange, type LeaderboardResponse, Leaderboards, type LivePlayer, type LivePlayersPage, Lobbies, type Lobby, type LobbyDepositUpdatedPayload, type LobbyMatchedEvent, type LobbyPlayer, type LobbyStore, type LobbyStoreState, type LogLevel, type LoginResponse, MIN_SOL_TRANSFER_AMOUNT, MIN_TRANSFER_AMOUNT, type MarketBuyResult, type MarketPosition, type MarketSellResult, type MarketState, Markets, type MoneyMinor, NodeStorage, NoopAnalyticsClient, type NotificationEvent, type NotificationsStore, type NotificationsStoreState, type PaginatedCriticalIncidents, type PaginatedFriendRequests, type PaginatedFriends, type PaginatedNotificationsResponse, type PaginatedPlatformFees, type PaginatedReports, type PaginatedSearchUsers, type PaginatedSessions, type PaginatedSupportTickets, type PaginatedTransactionJobs, type PaginatedUsers, type PaymentRequiredChallenge, type PlatformFeeItem, type PrepareDepositResponse, type PrepareTipRequest, type PrepareTipResponse, type PrepareTransferRequest, type PrepareTransferResponse, type PublicUser, type QueueStats, type RedeemResult, type ReferralRewardItem, type ReferralRewardStatus, type ReferralRewardsResponse, type ReferralSummary, type ReferralTreeItem, type ReferralTreeResponse, Referrals, type Report, type ReportCount, type ReportStatus, type ReportUser, Reports, type RetryOptions, SDK, type SDKConfig, SDK_VERSION, SOL_DECIMALS, type SdkStore, type SdkUpgradeInfo, type SearchUser, type SendMessageRequest, type SendTipResponse, type SendTransferResponse, type Session, type SessionStats, SharedWorkerTransport, Spectate, type SpectatorMetrics, type SpectatorMetricsByUser, StandaloneWsTransport, type SubmitDepositResponse, type SubmitTransferRequest, type SubmitTransferResponse, Support, type SupportMessage, type SupportMessageSenderRole, type SupportTicket, type SupportTicketCategory, type SupportTicketPriority, type SupportTicketStatus, type SupportTicketUser, type SystemMessageType, TOKEN_KEY, TRANSFER_FEE_MINOR, type TicTacToeClockTimes, Tips, type TransactionJob, type TransactionJobStatus, type TransactionJobType, type TransactionQueueStats, type TransferToken, type TypingUser, type UpdateTicketData, type User, type UserAchievement, type UserActivity, type UserActivityStatus, type UserStats, type UsernameAvailabilityResponse, Users, type ValidAction, Wallet, type WalletActivityCounterpartyType, type WalletActivityDirection, type WalletActivityItem, type WalletActivityKind, type WalletActivityResponse, type WalletActivityStatus, type WalletClaimAction, type WalletMeta, type WalletResponse, type WalletSigner, type WsEvent, WsEventBus, type WsEventName, type WsTransport, type ConnectionState as WsTransportState, createChatStore, createDmThreadsStore, createFriendsStore, createGameActionsStore, createGameStore, createLobbyStore, createLogger, createNotificationsStore, createSdkStore, isRetryableError, logger, selectGameLifecycleState, withRetry };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { NimGameState, NimGameAction } from '@dimcool/nim';
|
|
|
5
5
|
import { DotsAndBoxesGameState, DotsAndBoxesGameAction } from '@dimcool/dots-and-boxes';
|
|
6
6
|
import { TicTacToeGameState, TicTacToeGameAction } from '@dimcool/tic-tac-toe';
|
|
7
7
|
import { Connect4GameState, Connect4GameAction } from '@dimcool/connect-four';
|
|
8
|
-
export { MICRO_UNITS, formatMoneyMinor, toMajor } from '@dimcool/utils';
|
|
8
|
+
export { MICRO_UNITS, SOL_MINT, formatMoneyMinor, toMajor } from '@dimcool/utils';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Interface for HTTP client implementations.
|
|
@@ -929,7 +929,7 @@ declare const TRANSFER_FEE_MINOR = 10000;
|
|
|
929
929
|
declare const MIN_TRANSFER_AMOUNT = 50000;
|
|
930
930
|
declare const MIN_SOL_TRANSFER_AMOUNT = 1000000;
|
|
931
931
|
declare const SOL_DECIMALS = 9;
|
|
932
|
-
|
|
932
|
+
|
|
933
933
|
declare const ESTIMATED_SOL_FEE_LAMPORTS = 10000;
|
|
934
934
|
interface PrepareTransferRequest {
|
|
935
935
|
senderAddress: string;
|
|
@@ -1121,6 +1121,11 @@ declare class Admin {
|
|
|
1121
1121
|
private http;
|
|
1122
1122
|
private logger?;
|
|
1123
1123
|
constructor(http: IHttpClient, logger?: ILogger | undefined);
|
|
1124
|
+
getInternalBots(): Promise<(User & {
|
|
1125
|
+
sol: number;
|
|
1126
|
+
usdc: number;
|
|
1127
|
+
publicKey: string;
|
|
1128
|
+
})[]>;
|
|
1124
1129
|
getUserById(id: string): Promise<User>;
|
|
1125
1130
|
getUserBalance(userId: string): Promise<{
|
|
1126
1131
|
sol: number;
|
|
@@ -1434,12 +1439,55 @@ declare function createGameStore(transport: WsTransport): GameStore;
|
|
|
1434
1439
|
type GameActionsStoreState = {
|
|
1435
1440
|
statesByGameId: Record<string, GameStateResponse>;
|
|
1436
1441
|
};
|
|
1442
|
+
interface ChessClockTimes {
|
|
1443
|
+
whiteTimeMs: number;
|
|
1444
|
+
blackTimeMs: number;
|
|
1445
|
+
}
|
|
1446
|
+
interface ChessCapturedPieces {
|
|
1447
|
+
capturedByWhite: string[];
|
|
1448
|
+
capturedByBlack: string[];
|
|
1449
|
+
}
|
|
1450
|
+
interface TicTacToeClockTimes {
|
|
1451
|
+
xTimeMs: number;
|
|
1452
|
+
oTimeMs: number;
|
|
1453
|
+
}
|
|
1454
|
+
interface Connect4ClockTimes {
|
|
1455
|
+
redTimeMs: number;
|
|
1456
|
+
yellowTimeMs: number;
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Common lifecycle fields extracted from any game state.
|
|
1460
|
+
* Used by useGameLifecycle to avoid casting the raw union type.
|
|
1461
|
+
*/
|
|
1462
|
+
interface GameLifecycleState {
|
|
1463
|
+
status: string;
|
|
1464
|
+
winnerId: string | null;
|
|
1465
|
+
betAmount: number;
|
|
1466
|
+
wonAmount: number | null;
|
|
1467
|
+
totalPotMinor: number | undefined;
|
|
1468
|
+
currentPlayerId: string | null;
|
|
1469
|
+
}
|
|
1470
|
+
/**
|
|
1471
|
+
* Pure selector — extracts lifecycle fields from any game state variant.
|
|
1472
|
+
* Accepts a single GameStateResponse so callers can use it after selecting
|
|
1473
|
+
* the stable store entry via useSdkSelector, avoiding new-object-per-call issues.
|
|
1474
|
+
*/
|
|
1475
|
+
declare function selectGameLifecycleState(gameState: GameStateResponse | null | undefined): GameLifecycleState | null;
|
|
1437
1476
|
type GameActionsStore = {
|
|
1438
1477
|
store: SdkStore<GameActionsStoreState>;
|
|
1439
1478
|
setBaseState: (gameId: string, state: GameStateResponse) => void;
|
|
1440
1479
|
clearState: (gameId: string) => void;
|
|
1441
1480
|
applyWsEvent: (event: WsEvent) => void;
|
|
1442
1481
|
joinGame: (gameId: string) => () => void;
|
|
1482
|
+
getCountdownDigit: (gameId: string, nowMs: number) => number | null;
|
|
1483
|
+
/** Live chess clock — deducts elapsed time since turnStartedAt. */
|
|
1484
|
+
getChessClockTimes: (gameId: string, nowMs: number) => ChessClockTimes | null;
|
|
1485
|
+
/** Captured pieces derived from the current FEN position. */
|
|
1486
|
+
getChessCapturedPieces: (gameId: string) => ChessCapturedPieces | null;
|
|
1487
|
+
/** Live TTT clock — deducts elapsed from the current player's mark (X or O). */
|
|
1488
|
+
getTicTacToeClockTimes: (gameId: string, nowMs: number) => TicTacToeClockTimes | null;
|
|
1489
|
+
/** Live Connect Four clock — deducts elapsed from the current player's color. */
|
|
1490
|
+
getConnect4ClockTimes: (gameId: string, nowMs: number) => Connect4ClockTimes | null;
|
|
1443
1491
|
};
|
|
1444
1492
|
declare function createGameActionsStore(transport: WsTransport): GameActionsStore;
|
|
1445
1493
|
|
|
@@ -1743,7 +1791,7 @@ type LobbyDepositUpdatedPayload = {
|
|
|
1743
1791
|
status: 'confirmed' | 'failed' | 'refunded' | 'refund_failed';
|
|
1744
1792
|
allConfirmed: boolean;
|
|
1745
1793
|
};
|
|
1746
|
-
type
|
|
1794
|
+
type WsEventBase = {
|
|
1747
1795
|
event: 'lobby:created';
|
|
1748
1796
|
payload: Lobby;
|
|
1749
1797
|
} | {
|
|
@@ -1941,6 +1989,9 @@ type WsEvent = {
|
|
|
1941
1989
|
event: 'notification';
|
|
1942
1990
|
payload: unknown;
|
|
1943
1991
|
};
|
|
1992
|
+
type WsEvent = WsEventBase & {
|
|
1993
|
+
_serverTs?: number;
|
|
1994
|
+
};
|
|
1944
1995
|
|
|
1945
1996
|
type LobbyMatchedEvent = {
|
|
1946
1997
|
gameId: string;
|
|
@@ -2043,6 +2094,13 @@ declare class Lobbies {
|
|
|
2043
2094
|
constructor(http: IHttpClient, logger?: ILogger | undefined);
|
|
2044
2095
|
/** Called by SDK after the store is created so mutations can update state directly. */
|
|
2045
2096
|
setLobbyStore(store: LobbyStore): void;
|
|
2097
|
+
/**
|
|
2098
|
+
* Create a new game lobby.
|
|
2099
|
+
*
|
|
2100
|
+
* **Important:** Creating a lobby automatically closes and refunds any
|
|
2101
|
+
* existing open or queued lobby for this user. You do not need to manually
|
|
2102
|
+
* leave or cancel a previous lobby before calling this.
|
|
2103
|
+
*/
|
|
2046
2104
|
createLobby(gameType: string, betAmount?: MoneyMinor): Promise<Lobby>;
|
|
2047
2105
|
getLobby(lobbyId: string): Promise<Lobby>;
|
|
2048
2106
|
inviteFriend(lobbyId: string, friendId: string): Promise<{
|
|
@@ -2070,22 +2128,6 @@ declare class Lobbies {
|
|
|
2070
2128
|
deleteLobby(lobbyId: string): Promise<{
|
|
2071
2129
|
message: string;
|
|
2072
2130
|
}>;
|
|
2073
|
-
/**
|
|
2074
|
-
* Play again: Create a new lobby and prepare deposit in one flow.
|
|
2075
|
-
* Returns the lobby and unsigned transaction that needs to be signed.
|
|
2076
|
-
* @param gameType - The game type to play again
|
|
2077
|
-
* @param betAmount - The bet amount (same as previous game)
|
|
2078
|
-
* @param escrow - The escrow service instance (from sdk.escrow)
|
|
2079
|
-
*/
|
|
2080
|
-
playAgain(gameType: string, betAmount: MoneyMinor, escrow: {
|
|
2081
|
-
prepareAndStartDeposit: (id: string) => Promise<{
|
|
2082
|
-
transaction: string;
|
|
2083
|
-
message: string;
|
|
2084
|
-
}>;
|
|
2085
|
-
}): Promise<{
|
|
2086
|
-
lobby: Lobby;
|
|
2087
|
-
unsignedTransaction: string;
|
|
2088
|
-
}>;
|
|
2089
2131
|
}
|
|
2090
2132
|
|
|
2091
2133
|
/** A player currently in an active game; used for "Live now" and "Who to watch" UI. */
|
|
@@ -3006,4 +3048,4 @@ declare class HttpClient implements IHttpClient {
|
|
|
3006
3048
|
private payChallenge;
|
|
3007
3049
|
}
|
|
3008
3050
|
|
|
3009
|
-
export { type AcceptChallengeResponse, type Achievement, Activity, type ActivityFeedItem, type ActivityFeedItemType, type ActivityFeedResponse, type ActivityFeedUser, Admin, type AdminDailyStats, type AdminDailyStatsItem, type AdminFeatureFlag, type AdminGameHistory, type AdminGameHistoryFeeBreakdown, type AdminGameHistoryFeePlayer, type AdminGameHistoryPlayer, type AdminMarketDailyStats, type AdminMarketDailyStatsItem, type AdminMarketDetail, type AdminMarketStats, type AdminStats, type AdminWalletActivityItem, type AdminWalletActivityResponse, type AnalyticsUserData, type ApiError, type AppNotification, type AppNotificationType, type ApplyReferralCodeResponse, type BalanceResponse, type BetOption, type BroadcastTipRequest, BrowserLocalStorage, Challenges, Chat, type ChatContext, type ChatContextType, type ChatMessage, type ChatMessageReply, type ChatMessageType, type ChatReaction, type ChatReadBy, type ChatState, type ChatStore, type ChatStoreState, type ClaimReferralRewardsResponse, type CreateChallengeRequest, type CreateChallengeResponse, type CreateLobbyRequest, type CreateTicketData, type CriticalIncident, type CriticalIncidentCategory, type CriticalIncidentImpactType, type CriticalIncidentSeverity, type CriticalIncidentStatus, type CriticalIncidentSummary, type CurrentGame, Daily, type DailyParticipant, type DailyRoom, type DailyToken, type DepositForLobbyResponse, type DepositStatus, type DepositStatusResponse, type DmThread, type DmThreadsStore, type DmThreadsStoreState, type DonateToGameResponse, ESTIMATED_SOL_FEE_LAMPORTS, Escrow, type EscrowSweepPreview, type EscrowSweepRecord, type FaucetResponse, type FeatureFlag, type FriendRequestItem, type FriendsStore, type FriendsStoreState, type FriendshipStatus, type Game, type GameActionsStore, type GameActionsStoreState, type GameHistoryItem, type GameMetrics, type GamePlayer, type GameStateResponse, type GameStore, type GameStoreState, type GameType, Games, type GenerateHandshakeResponse, type GetTicketsOptions, HttpClient, type IAnalyticsClient, type IHttpClient, type ILogger, type IStorage, type ImageUploadPayload, type InviteFriendRequest, type LeaderboardEntry, type LeaderboardQuery, type LeaderboardRange, type LeaderboardResponse, Leaderboards, type LivePlayer, type LivePlayersPage, Lobbies, type Lobby, type LobbyDepositUpdatedPayload, type LobbyMatchedEvent, type LobbyPlayer, type LobbyStore, type LobbyStoreState, type LogLevel, type LoginResponse, MIN_SOL_TRANSFER_AMOUNT, MIN_TRANSFER_AMOUNT, type MarketBuyResult, type MarketPosition, type MarketSellResult, type MarketState, Markets, type MoneyMinor, NodeStorage, NoopAnalyticsClient, type NotificationEvent, type NotificationsStore, type NotificationsStoreState, type PaginatedCriticalIncidents, type PaginatedFriendRequests, type PaginatedFriends, type PaginatedNotificationsResponse, type PaginatedPlatformFees, type PaginatedReports, type PaginatedSearchUsers, type PaginatedSessions, type PaginatedSupportTickets, type PaginatedTransactionJobs, type PaginatedUsers, type PaymentRequiredChallenge, type PlatformFeeItem, type PrepareDepositResponse, type PrepareTipRequest, type PrepareTipResponse, type PrepareTransferRequest, type PrepareTransferResponse, type PublicUser, type QueueStats, type RedeemResult, type ReferralRewardItem, type ReferralRewardStatus, type ReferralRewardsResponse, type ReferralSummary, type ReferralTreeItem, type ReferralTreeResponse, Referrals, type Report, type ReportCount, type ReportStatus, type ReportUser, Reports, type RetryOptions, SDK, type SDKConfig, SDK_VERSION, SOL_DECIMALS,
|
|
3051
|
+
export { type AcceptChallengeResponse, type Achievement, Activity, type ActivityFeedItem, type ActivityFeedItemType, type ActivityFeedResponse, type ActivityFeedUser, Admin, type AdminDailyStats, type AdminDailyStatsItem, type AdminFeatureFlag, type AdminGameHistory, type AdminGameHistoryFeeBreakdown, type AdminGameHistoryFeePlayer, type AdminGameHistoryPlayer, type AdminMarketDailyStats, type AdminMarketDailyStatsItem, type AdminMarketDetail, type AdminMarketStats, type AdminStats, type AdminWalletActivityItem, type AdminWalletActivityResponse, type AnalyticsUserData, type ApiError, type AppNotification, type AppNotificationType, type ApplyReferralCodeResponse, type BalanceResponse, type BetOption, type BroadcastTipRequest, BrowserLocalStorage, Challenges, Chat, type ChatContext, type ChatContextType, type ChatMessage, type ChatMessageReply, type ChatMessageType, type ChatReaction, type ChatReadBy, type ChatState, type ChatStore, type ChatStoreState, type ChessCapturedPieces, type ChessClockTimes, type ClaimReferralRewardsResponse, type Connect4ClockTimes, type CreateChallengeRequest, type CreateChallengeResponse, type CreateLobbyRequest, type CreateTicketData, type CriticalIncident, type CriticalIncidentCategory, type CriticalIncidentImpactType, type CriticalIncidentSeverity, type CriticalIncidentStatus, type CriticalIncidentSummary, type CurrentGame, Daily, type DailyParticipant, type DailyRoom, type DailyToken, type DepositForLobbyResponse, type DepositStatus, type DepositStatusResponse, type DmThread, type DmThreadsStore, type DmThreadsStoreState, type DonateToGameResponse, ESTIMATED_SOL_FEE_LAMPORTS, Escrow, type EscrowSweepPreview, type EscrowSweepRecord, type FaucetResponse, type FeatureFlag, type FriendRequestItem, type FriendsStore, type FriendsStoreState, type FriendshipStatus, type Game, type GameActionsStore, type GameActionsStoreState, type GameHistoryItem, type GameLifecycleState, type GameMetrics, type GamePlayer, type GameStateResponse, type GameStore, type GameStoreState, type GameType, Games, type GenerateHandshakeResponse, type GetTicketsOptions, HttpClient, type IAnalyticsClient, type IHttpClient, type ILogger, type IStorage, type ImageUploadPayload, type InviteFriendRequest, type LeaderboardEntry, type LeaderboardQuery, type LeaderboardRange, type LeaderboardResponse, Leaderboards, type LivePlayer, type LivePlayersPage, Lobbies, type Lobby, type LobbyDepositUpdatedPayload, type LobbyMatchedEvent, type LobbyPlayer, type LobbyStore, type LobbyStoreState, type LogLevel, type LoginResponse, MIN_SOL_TRANSFER_AMOUNT, MIN_TRANSFER_AMOUNT, type MarketBuyResult, type MarketPosition, type MarketSellResult, type MarketState, Markets, type MoneyMinor, NodeStorage, NoopAnalyticsClient, type NotificationEvent, type NotificationsStore, type NotificationsStoreState, type PaginatedCriticalIncidents, type PaginatedFriendRequests, type PaginatedFriends, type PaginatedNotificationsResponse, type PaginatedPlatformFees, type PaginatedReports, type PaginatedSearchUsers, type PaginatedSessions, type PaginatedSupportTickets, type PaginatedTransactionJobs, type PaginatedUsers, type PaymentRequiredChallenge, type PlatformFeeItem, type PrepareDepositResponse, type PrepareTipRequest, type PrepareTipResponse, type PrepareTransferRequest, type PrepareTransferResponse, type PublicUser, type QueueStats, type RedeemResult, type ReferralRewardItem, type ReferralRewardStatus, type ReferralRewardsResponse, type ReferralSummary, type ReferralTreeItem, type ReferralTreeResponse, Referrals, type Report, type ReportCount, type ReportStatus, type ReportUser, Reports, type RetryOptions, SDK, type SDKConfig, SDK_VERSION, SOL_DECIMALS, type SdkStore, type SdkUpgradeInfo, type SearchUser, type SendMessageRequest, type SendTipResponse, type SendTransferResponse, type Session, type SessionStats, SharedWorkerTransport, Spectate, type SpectatorMetrics, type SpectatorMetricsByUser, StandaloneWsTransport, type SubmitDepositResponse, type SubmitTransferRequest, type SubmitTransferResponse, Support, type SupportMessage, type SupportMessageSenderRole, type SupportTicket, type SupportTicketCategory, type SupportTicketPriority, type SupportTicketStatus, type SupportTicketUser, type SystemMessageType, TOKEN_KEY, TRANSFER_FEE_MINOR, type TicTacToeClockTimes, Tips, type TransactionJob, type TransactionJobStatus, type TransactionJobType, type TransactionQueueStats, type TransferToken, type TypingUser, type UpdateTicketData, type User, type UserAchievement, type UserActivity, type UserActivityStatus, type UserStats, type UsernameAvailabilityResponse, Users, type ValidAction, Wallet, type WalletActivityCounterpartyType, type WalletActivityDirection, type WalletActivityItem, type WalletActivityKind, type WalletActivityResponse, type WalletActivityStatus, type WalletClaimAction, type WalletMeta, type WalletResponse, type WalletSigner, type WsEvent, WsEventBus, type WsEventName, type WsTransport, type ConnectionState as WsTransportState, createChatStore, createDmThreadsStore, createFriendsStore, createGameActionsStore, createGameStore, createLobbyStore, createLogger, createNotificationsStore, createSdkStore, isRetryableError, logger, selectGameLifecycleState, withRetry };
|