@dimcool/sdk 0.1.22 → 0.1.26
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 +63 -31
- package/dist/index.cjs +582 -21899
- package/dist/index.d.cts +119 -6
- package/dist/index.d.ts +119 -6
- package/dist/index.js +538 -21866
- package/package.json +4 -1
package/dist/index.d.cts
CHANGED
|
@@ -662,6 +662,52 @@ interface PaginatedNotificationsResponse {
|
|
|
662
662
|
limit: number;
|
|
663
663
|
unreadCount: number;
|
|
664
664
|
}
|
|
665
|
+
type TransactionJobStatus = 'PENDING' | 'PROCESSING' | 'CONFIRMING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
|
|
666
|
+
type TransactionJobType = 'GAME_PAYOUT_WINNER' | 'GAME_PAYOUT_DRAW' | 'PREDICTION_MARKET_PAYOUT' | 'PREDICTION_MARKET_REFUND' | 'PREDICTION_MARKET_BONUS' | 'REFERRAL_CLAIM' | 'LOBBY_DEPOSIT_REFUND' | 'ESCROW_SWEEP' | 'P2P_TRANSFER_CONFIRM' | 'LOBBY_DEPOSIT_CONFIRM';
|
|
667
|
+
interface TransactionJob {
|
|
668
|
+
id: string;
|
|
669
|
+
type: TransactionJobType;
|
|
670
|
+
status: TransactionJobStatus;
|
|
671
|
+
idempotencyKey: string;
|
|
672
|
+
recipientUserId: string;
|
|
673
|
+
amount: number;
|
|
674
|
+
mint: string;
|
|
675
|
+
gameHistoryId?: string | null;
|
|
676
|
+
contextType?: string | null;
|
|
677
|
+
contextId?: string | null;
|
|
678
|
+
bullmqJobId?: string | null;
|
|
679
|
+
attempts: number;
|
|
680
|
+
maxAttempts: number;
|
|
681
|
+
lastError?: string | null;
|
|
682
|
+
walletTransactionId?: string | null;
|
|
683
|
+
signature?: string | null;
|
|
684
|
+
payload: Record<string, unknown>;
|
|
685
|
+
scheduledFor?: string | null;
|
|
686
|
+
startedAt?: string | null;
|
|
687
|
+
completedAt?: string | null;
|
|
688
|
+
failedAt?: string | null;
|
|
689
|
+
createdAt: string;
|
|
690
|
+
updatedAt: string;
|
|
691
|
+
recipientUser?: {
|
|
692
|
+
id: string;
|
|
693
|
+
username?: string | null;
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
interface TransactionQueueStats {
|
|
697
|
+
pending: number;
|
|
698
|
+
processing: number;
|
|
699
|
+
confirming: number;
|
|
700
|
+
completed: number;
|
|
701
|
+
failed: number;
|
|
702
|
+
cancelled: number;
|
|
703
|
+
}
|
|
704
|
+
interface PaginatedTransactionJobs {
|
|
705
|
+
items: TransactionJob[];
|
|
706
|
+
total: number;
|
|
707
|
+
page: number;
|
|
708
|
+
limit: number;
|
|
709
|
+
totalPages: number;
|
|
710
|
+
}
|
|
665
711
|
interface Achievement {
|
|
666
712
|
id: string;
|
|
667
713
|
code: string;
|
|
@@ -699,11 +745,16 @@ interface WalletSigner {
|
|
|
699
745
|
*/
|
|
700
746
|
signMessage: (message: string) => Promise<Uint8Array | string>;
|
|
701
747
|
/**
|
|
702
|
-
* Sign a transaction
|
|
703
|
-
*
|
|
704
|
-
|
|
748
|
+
* Sign a transaction and return the signed transaction.
|
|
749
|
+
* Mutually exclusive with signAndSendTransaction — provide exactly one.
|
|
750
|
+
*/
|
|
751
|
+
signTransaction?: (transaction: Transaction) => Promise<Transaction>;
|
|
752
|
+
/**
|
|
753
|
+
* Sign and send a transaction in one step, returning the signature string.
|
|
754
|
+
* Used by embedded wallets that cannot return signed bytes without also sending.
|
|
755
|
+
* Mutually exclusive with signTransaction — provide exactly one.
|
|
705
756
|
*/
|
|
706
|
-
|
|
757
|
+
signAndSendTransaction?: (transaction: Transaction) => Promise<string>;
|
|
707
758
|
}
|
|
708
759
|
interface BalanceResponse {
|
|
709
760
|
sol: number;
|
|
@@ -867,12 +918,27 @@ declare class Wallet {
|
|
|
867
918
|
* @returns The signature
|
|
868
919
|
*/
|
|
869
920
|
signMessage(message: string): Promise<Uint8Array | string>;
|
|
921
|
+
/**
|
|
922
|
+
* Check whether the configured signer uses signAndSendTransaction (client-sent mode).
|
|
923
|
+
*/
|
|
924
|
+
isSignAndSendMode(): boolean;
|
|
870
925
|
/**
|
|
871
926
|
* Sign a transaction using the configured signer
|
|
872
927
|
* @param transaction - The transaction to sign
|
|
873
928
|
* @returns The signed transaction
|
|
874
929
|
*/
|
|
875
930
|
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
931
|
+
/**
|
|
932
|
+
* Sign and send a transaction using the configured signer (client-sent mode).
|
|
933
|
+
* @param transaction - The transaction to sign and send
|
|
934
|
+
* @returns The transaction signature
|
|
935
|
+
*/
|
|
936
|
+
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
937
|
+
/**
|
|
938
|
+
* Get QR code as a data URL for the current user's wallet address.
|
|
939
|
+
* Use as <img src={url} /> in the deposit / add-funds section.
|
|
940
|
+
*/
|
|
941
|
+
getMyWalletQrDataUrl(): Promise<string>;
|
|
876
942
|
/**
|
|
877
943
|
* Get SOL and USDC balances
|
|
878
944
|
*/
|
|
@@ -926,9 +992,14 @@ declare class Wallet {
|
|
|
926
992
|
* @returns Transaction signature and status
|
|
927
993
|
*/
|
|
928
994
|
submitTransfer(signedTransaction: string, senderAddress: string, recipientAddress: string, amount: number, token?: TransferToken, ataCreated?: boolean, recipientInput?: string): Promise<SubmitTransferResponse>;
|
|
995
|
+
/**
|
|
996
|
+
* Confirm a transfer that was already sent by the client (signAndSendTransaction path).
|
|
997
|
+
*/
|
|
998
|
+
confirmTransferSignature(signature: string, senderAddress: string, recipientAddress: string, amount: number, token?: TransferToken, ataCreated?: boolean, recipientInput?: string): Promise<SubmitTransferResponse>;
|
|
929
999
|
/**
|
|
930
1000
|
* Full transfer flow in one call: prepare -> sign -> submit
|
|
931
1001
|
* Recipient can be username, .sol domain, or Solana address (resolved by backend).
|
|
1002
|
+
* Automatically uses signAndSendTransaction or signTransaction based on signer capability.
|
|
932
1003
|
*/
|
|
933
1004
|
send(recipient: string, amount: number, token?: TransferToken): Promise<SendTransferResponse>;
|
|
934
1005
|
}
|
|
@@ -966,6 +1037,11 @@ declare class Admin {
|
|
|
966
1037
|
getAdminDailyStats(days?: number): Promise<AdminDailyStats>;
|
|
967
1038
|
getEscrowSweepPreview(): Promise<EscrowSweepPreview>;
|
|
968
1039
|
getEscrowSweeps(limit?: number): Promise<EscrowSweepRecord[]>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Get QR code as a data URL for a wallet address.
|
|
1042
|
+
* Used in the admin dashboard for sweep/feeps/escrow wallets to scan and add funds.
|
|
1043
|
+
*/
|
|
1044
|
+
getWalletQrDataUrl(address: string): Promise<string>;
|
|
969
1045
|
executeEscrowSweep(amountUsdcMinor: number, idempotencyKey?: string): Promise<EscrowSweepRecord>;
|
|
970
1046
|
banUser(userId: string, reason?: string): Promise<User>;
|
|
971
1047
|
unbanUser(userId: string): Promise<User>;
|
|
@@ -978,6 +1054,17 @@ declare class Admin {
|
|
|
978
1054
|
category?: CriticalIncidentCategory;
|
|
979
1055
|
}): Promise<PaginatedCriticalIncidents>;
|
|
980
1056
|
resolveCriticalIncident(id: string, resolutionNote?: string): Promise<CriticalIncident>;
|
|
1057
|
+
getTransactionQueueStats(): Promise<TransactionQueueStats>;
|
|
1058
|
+
getTransactionQueueJobs(input?: {
|
|
1059
|
+
status?: TransactionJobStatus;
|
|
1060
|
+
type?: TransactionJobType;
|
|
1061
|
+
userId?: string;
|
|
1062
|
+
page?: number;
|
|
1063
|
+
limit?: number;
|
|
1064
|
+
}): Promise<PaginatedTransactionJobs>;
|
|
1065
|
+
getTransactionQueueJob(id: string): Promise<TransactionJob>;
|
|
1066
|
+
retryTransactionQueueJob(id: string): Promise<TransactionJob>;
|
|
1067
|
+
cancelTransactionQueueJob(id: string): Promise<TransactionJob>;
|
|
981
1068
|
getPlatformFees(input?: {
|
|
982
1069
|
page?: number;
|
|
983
1070
|
limit?: number;
|
|
@@ -2030,10 +2117,16 @@ interface SubmitDepositResponse {
|
|
|
2030
2117
|
signature: string;
|
|
2031
2118
|
status: string;
|
|
2032
2119
|
}
|
|
2120
|
+
interface DepositForLobbyResponse {
|
|
2121
|
+
signature: string;
|
|
2122
|
+
status: string;
|
|
2123
|
+
canProceedToQueue: boolean;
|
|
2124
|
+
}
|
|
2033
2125
|
declare class Escrow {
|
|
2034
2126
|
private http;
|
|
2127
|
+
private wallet;
|
|
2035
2128
|
private logger?;
|
|
2036
|
-
constructor(http: IHttpClient, logger?: ILogger | undefined);
|
|
2129
|
+
constructor(http: IHttpClient, wallet: Wallet, logger?: ILogger | undefined);
|
|
2037
2130
|
/**
|
|
2038
2131
|
* Start the deposit flow for a lobby
|
|
2039
2132
|
* Transitions the lobby to 'preparing' state
|
|
@@ -2053,6 +2146,20 @@ declare class Escrow {
|
|
|
2053
2146
|
* Check the deposit status for all players in a lobby
|
|
2054
2147
|
*/
|
|
2055
2148
|
getDepositStatus(lobbyId: string): Promise<DepositStatusResponse>;
|
|
2149
|
+
/**
|
|
2150
|
+
* Confirm a deposit that was already sent by the client (signAndSendTransaction path).
|
|
2151
|
+
*/
|
|
2152
|
+
confirmDepositSignature(lobbyId: string, signature: string): Promise<{
|
|
2153
|
+
status: string;
|
|
2154
|
+
}>;
|
|
2155
|
+
/**
|
|
2156
|
+
* One-call lobby deposit: start deposits, prepare, sign, submit, and poll until
|
|
2157
|
+
* the current user's deposit is confirmed. Requires sdk.wallet.setSigner() to be set.
|
|
2158
|
+
* Returns when all required deposits are confirmed and the lobby can proceed to queue.
|
|
2159
|
+
*
|
|
2160
|
+
* Automatically uses signAndSendTransaction or signTransaction based on signer capability.
|
|
2161
|
+
*/
|
|
2162
|
+
depositForLobby(lobbyId: string): Promise<DepositForLobbyResponse>;
|
|
2056
2163
|
claimLobbyDepositRefund(lobbyId: string, depositSignature: string): Promise<{
|
|
2057
2164
|
signature: string;
|
|
2058
2165
|
status: string;
|
|
@@ -2642,9 +2749,11 @@ declare class StandaloneWsTransport extends BaseWsTransport {
|
|
|
2642
2749
|
private accessToken;
|
|
2643
2750
|
private reconnectAttempts;
|
|
2644
2751
|
private reconnectTimer;
|
|
2752
|
+
private periodicReconnectInterval;
|
|
2645
2753
|
private maxReconnectAttempts;
|
|
2646
2754
|
private reconnectDelay;
|
|
2647
2755
|
private reconnectDelayMax;
|
|
2756
|
+
private static readonly PERIODIC_RECONNECT_MS;
|
|
2648
2757
|
private wildcardHandlers;
|
|
2649
2758
|
private eventHandlers;
|
|
2650
2759
|
private registeredEvents;
|
|
@@ -2661,6 +2770,10 @@ declare class StandaloneWsTransport extends BaseWsTransport {
|
|
|
2661
2770
|
protected onLeaveRoom(roomName: string): void;
|
|
2662
2771
|
private ensureSocket;
|
|
2663
2772
|
private reconnectWithAuth;
|
|
2773
|
+
/** Clear socket reference so ensureSocket() can create a new connection. */
|
|
2774
|
+
private clearSocketForReconnect;
|
|
2775
|
+
private clearPeriodicReconnect;
|
|
2776
|
+
private startPeriodicReconnect;
|
|
2664
2777
|
private scheduleReconnect;
|
|
2665
2778
|
private getEventHandlers;
|
|
2666
2779
|
private unsubscribeEvent;
|
|
@@ -2717,4 +2830,4 @@ declare class HttpClient implements IHttpClient {
|
|
|
2717
2830
|
private payChallenge;
|
|
2718
2831
|
}
|
|
2719
2832
|
|
|
2720
|
-
export { type AcceptChallengeResponse, type Achievement, Activity, type ActivityFeedItem, type ActivityFeedItemType, type ActivityFeedResponse, type ActivityFeedUser, Admin, type AdminDailyStats, type AdminDailyStatsItem, type AdminGameHistory, type AdminGameHistoryFeeBreakdown, type AdminGameHistoryFeePlayer, type AdminGameHistoryPlayer, type AdminMarketDailyStats, type AdminMarketDailyStatsItem, type AdminMarketDetail, type AdminMarketStats, type AdminStats, type AdminWalletActivityItem, type AdminWalletActivityResponse, 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 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 IHttpClient, type ILogger, type IStorage, type InviteFriendRequest, type LeaderboardEntry, type LeaderboardQuery, type LeaderboardRange, type LeaderboardResponse, Leaderboards, type LivePlayer, type LivePlayersPage, Lobbies, type Lobby, 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, type NotificationEvent, type NotificationsStore, type NotificationsStoreState, type PaginatedCriticalIncidents, type PaginatedFriends, type PaginatedNotificationsResponse, type PaginatedPlatformFees, type PaginatedReports, type PaginatedSearchUsers, type PaginatedSessions, type PaginatedSupportTickets, 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, SOL_MINT, type SdkStore, type SdkUpgradeInfo, type SearchUser, type SendMessageRequest, type SendTipResponse, type SendTransferResponse, type Session, 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, Tips, 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, withRetry };
|
|
2833
|
+
export { type AcceptChallengeResponse, type Achievement, Activity, type ActivityFeedItem, type ActivityFeedItemType, type ActivityFeedResponse, type ActivityFeedUser, Admin, type AdminDailyStats, type AdminDailyStatsItem, type AdminGameHistory, type AdminGameHistoryFeeBreakdown, type AdminGameHistoryFeePlayer, type AdminGameHistoryPlayer, type AdminMarketDailyStats, type AdminMarketDailyStatsItem, type AdminMarketDetail, type AdminMarketStats, type AdminStats, type AdminWalletActivityItem, type AdminWalletActivityResponse, 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 IHttpClient, type ILogger, type IStorage, type InviteFriendRequest, type LeaderboardEntry, type LeaderboardQuery, type LeaderboardRange, type LeaderboardResponse, Leaderboards, type LivePlayer, type LivePlayersPage, Lobbies, type Lobby, 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, type NotificationEvent, type NotificationsStore, type NotificationsStoreState, type PaginatedCriticalIncidents, 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, SOL_MINT, type SdkStore, type SdkUpgradeInfo, type SearchUser, type SendMessageRequest, type SendTipResponse, type SendTransferResponse, type Session, 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, 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, withRetry };
|
package/dist/index.d.ts
CHANGED
|
@@ -662,6 +662,52 @@ interface PaginatedNotificationsResponse {
|
|
|
662
662
|
limit: number;
|
|
663
663
|
unreadCount: number;
|
|
664
664
|
}
|
|
665
|
+
type TransactionJobStatus = 'PENDING' | 'PROCESSING' | 'CONFIRMING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
|
|
666
|
+
type TransactionJobType = 'GAME_PAYOUT_WINNER' | 'GAME_PAYOUT_DRAW' | 'PREDICTION_MARKET_PAYOUT' | 'PREDICTION_MARKET_REFUND' | 'PREDICTION_MARKET_BONUS' | 'REFERRAL_CLAIM' | 'LOBBY_DEPOSIT_REFUND' | 'ESCROW_SWEEP' | 'P2P_TRANSFER_CONFIRM' | 'LOBBY_DEPOSIT_CONFIRM';
|
|
667
|
+
interface TransactionJob {
|
|
668
|
+
id: string;
|
|
669
|
+
type: TransactionJobType;
|
|
670
|
+
status: TransactionJobStatus;
|
|
671
|
+
idempotencyKey: string;
|
|
672
|
+
recipientUserId: string;
|
|
673
|
+
amount: number;
|
|
674
|
+
mint: string;
|
|
675
|
+
gameHistoryId?: string | null;
|
|
676
|
+
contextType?: string | null;
|
|
677
|
+
contextId?: string | null;
|
|
678
|
+
bullmqJobId?: string | null;
|
|
679
|
+
attempts: number;
|
|
680
|
+
maxAttempts: number;
|
|
681
|
+
lastError?: string | null;
|
|
682
|
+
walletTransactionId?: string | null;
|
|
683
|
+
signature?: string | null;
|
|
684
|
+
payload: Record<string, unknown>;
|
|
685
|
+
scheduledFor?: string | null;
|
|
686
|
+
startedAt?: string | null;
|
|
687
|
+
completedAt?: string | null;
|
|
688
|
+
failedAt?: string | null;
|
|
689
|
+
createdAt: string;
|
|
690
|
+
updatedAt: string;
|
|
691
|
+
recipientUser?: {
|
|
692
|
+
id: string;
|
|
693
|
+
username?: string | null;
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
interface TransactionQueueStats {
|
|
697
|
+
pending: number;
|
|
698
|
+
processing: number;
|
|
699
|
+
confirming: number;
|
|
700
|
+
completed: number;
|
|
701
|
+
failed: number;
|
|
702
|
+
cancelled: number;
|
|
703
|
+
}
|
|
704
|
+
interface PaginatedTransactionJobs {
|
|
705
|
+
items: TransactionJob[];
|
|
706
|
+
total: number;
|
|
707
|
+
page: number;
|
|
708
|
+
limit: number;
|
|
709
|
+
totalPages: number;
|
|
710
|
+
}
|
|
665
711
|
interface Achievement {
|
|
666
712
|
id: string;
|
|
667
713
|
code: string;
|
|
@@ -699,11 +745,16 @@ interface WalletSigner {
|
|
|
699
745
|
*/
|
|
700
746
|
signMessage: (message: string) => Promise<Uint8Array | string>;
|
|
701
747
|
/**
|
|
702
|
-
* Sign a transaction
|
|
703
|
-
*
|
|
704
|
-
|
|
748
|
+
* Sign a transaction and return the signed transaction.
|
|
749
|
+
* Mutually exclusive with signAndSendTransaction — provide exactly one.
|
|
750
|
+
*/
|
|
751
|
+
signTransaction?: (transaction: Transaction) => Promise<Transaction>;
|
|
752
|
+
/**
|
|
753
|
+
* Sign and send a transaction in one step, returning the signature string.
|
|
754
|
+
* Used by embedded wallets that cannot return signed bytes without also sending.
|
|
755
|
+
* Mutually exclusive with signTransaction — provide exactly one.
|
|
705
756
|
*/
|
|
706
|
-
|
|
757
|
+
signAndSendTransaction?: (transaction: Transaction) => Promise<string>;
|
|
707
758
|
}
|
|
708
759
|
interface BalanceResponse {
|
|
709
760
|
sol: number;
|
|
@@ -867,12 +918,27 @@ declare class Wallet {
|
|
|
867
918
|
* @returns The signature
|
|
868
919
|
*/
|
|
869
920
|
signMessage(message: string): Promise<Uint8Array | string>;
|
|
921
|
+
/**
|
|
922
|
+
* Check whether the configured signer uses signAndSendTransaction (client-sent mode).
|
|
923
|
+
*/
|
|
924
|
+
isSignAndSendMode(): boolean;
|
|
870
925
|
/**
|
|
871
926
|
* Sign a transaction using the configured signer
|
|
872
927
|
* @param transaction - The transaction to sign
|
|
873
928
|
* @returns The signed transaction
|
|
874
929
|
*/
|
|
875
930
|
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
931
|
+
/**
|
|
932
|
+
* Sign and send a transaction using the configured signer (client-sent mode).
|
|
933
|
+
* @param transaction - The transaction to sign and send
|
|
934
|
+
* @returns The transaction signature
|
|
935
|
+
*/
|
|
936
|
+
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
937
|
+
/**
|
|
938
|
+
* Get QR code as a data URL for the current user's wallet address.
|
|
939
|
+
* Use as <img src={url} /> in the deposit / add-funds section.
|
|
940
|
+
*/
|
|
941
|
+
getMyWalletQrDataUrl(): Promise<string>;
|
|
876
942
|
/**
|
|
877
943
|
* Get SOL and USDC balances
|
|
878
944
|
*/
|
|
@@ -926,9 +992,14 @@ declare class Wallet {
|
|
|
926
992
|
* @returns Transaction signature and status
|
|
927
993
|
*/
|
|
928
994
|
submitTransfer(signedTransaction: string, senderAddress: string, recipientAddress: string, amount: number, token?: TransferToken, ataCreated?: boolean, recipientInput?: string): Promise<SubmitTransferResponse>;
|
|
995
|
+
/**
|
|
996
|
+
* Confirm a transfer that was already sent by the client (signAndSendTransaction path).
|
|
997
|
+
*/
|
|
998
|
+
confirmTransferSignature(signature: string, senderAddress: string, recipientAddress: string, amount: number, token?: TransferToken, ataCreated?: boolean, recipientInput?: string): Promise<SubmitTransferResponse>;
|
|
929
999
|
/**
|
|
930
1000
|
* Full transfer flow in one call: prepare -> sign -> submit
|
|
931
1001
|
* Recipient can be username, .sol domain, or Solana address (resolved by backend).
|
|
1002
|
+
* Automatically uses signAndSendTransaction or signTransaction based on signer capability.
|
|
932
1003
|
*/
|
|
933
1004
|
send(recipient: string, amount: number, token?: TransferToken): Promise<SendTransferResponse>;
|
|
934
1005
|
}
|
|
@@ -966,6 +1037,11 @@ declare class Admin {
|
|
|
966
1037
|
getAdminDailyStats(days?: number): Promise<AdminDailyStats>;
|
|
967
1038
|
getEscrowSweepPreview(): Promise<EscrowSweepPreview>;
|
|
968
1039
|
getEscrowSweeps(limit?: number): Promise<EscrowSweepRecord[]>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Get QR code as a data URL for a wallet address.
|
|
1042
|
+
* Used in the admin dashboard for sweep/feeps/escrow wallets to scan and add funds.
|
|
1043
|
+
*/
|
|
1044
|
+
getWalletQrDataUrl(address: string): Promise<string>;
|
|
969
1045
|
executeEscrowSweep(amountUsdcMinor: number, idempotencyKey?: string): Promise<EscrowSweepRecord>;
|
|
970
1046
|
banUser(userId: string, reason?: string): Promise<User>;
|
|
971
1047
|
unbanUser(userId: string): Promise<User>;
|
|
@@ -978,6 +1054,17 @@ declare class Admin {
|
|
|
978
1054
|
category?: CriticalIncidentCategory;
|
|
979
1055
|
}): Promise<PaginatedCriticalIncidents>;
|
|
980
1056
|
resolveCriticalIncident(id: string, resolutionNote?: string): Promise<CriticalIncident>;
|
|
1057
|
+
getTransactionQueueStats(): Promise<TransactionQueueStats>;
|
|
1058
|
+
getTransactionQueueJobs(input?: {
|
|
1059
|
+
status?: TransactionJobStatus;
|
|
1060
|
+
type?: TransactionJobType;
|
|
1061
|
+
userId?: string;
|
|
1062
|
+
page?: number;
|
|
1063
|
+
limit?: number;
|
|
1064
|
+
}): Promise<PaginatedTransactionJobs>;
|
|
1065
|
+
getTransactionQueueJob(id: string): Promise<TransactionJob>;
|
|
1066
|
+
retryTransactionQueueJob(id: string): Promise<TransactionJob>;
|
|
1067
|
+
cancelTransactionQueueJob(id: string): Promise<TransactionJob>;
|
|
981
1068
|
getPlatformFees(input?: {
|
|
982
1069
|
page?: number;
|
|
983
1070
|
limit?: number;
|
|
@@ -2030,10 +2117,16 @@ interface SubmitDepositResponse {
|
|
|
2030
2117
|
signature: string;
|
|
2031
2118
|
status: string;
|
|
2032
2119
|
}
|
|
2120
|
+
interface DepositForLobbyResponse {
|
|
2121
|
+
signature: string;
|
|
2122
|
+
status: string;
|
|
2123
|
+
canProceedToQueue: boolean;
|
|
2124
|
+
}
|
|
2033
2125
|
declare class Escrow {
|
|
2034
2126
|
private http;
|
|
2127
|
+
private wallet;
|
|
2035
2128
|
private logger?;
|
|
2036
|
-
constructor(http: IHttpClient, logger?: ILogger | undefined);
|
|
2129
|
+
constructor(http: IHttpClient, wallet: Wallet, logger?: ILogger | undefined);
|
|
2037
2130
|
/**
|
|
2038
2131
|
* Start the deposit flow for a lobby
|
|
2039
2132
|
* Transitions the lobby to 'preparing' state
|
|
@@ -2053,6 +2146,20 @@ declare class Escrow {
|
|
|
2053
2146
|
* Check the deposit status for all players in a lobby
|
|
2054
2147
|
*/
|
|
2055
2148
|
getDepositStatus(lobbyId: string): Promise<DepositStatusResponse>;
|
|
2149
|
+
/**
|
|
2150
|
+
* Confirm a deposit that was already sent by the client (signAndSendTransaction path).
|
|
2151
|
+
*/
|
|
2152
|
+
confirmDepositSignature(lobbyId: string, signature: string): Promise<{
|
|
2153
|
+
status: string;
|
|
2154
|
+
}>;
|
|
2155
|
+
/**
|
|
2156
|
+
* One-call lobby deposit: start deposits, prepare, sign, submit, and poll until
|
|
2157
|
+
* the current user's deposit is confirmed. Requires sdk.wallet.setSigner() to be set.
|
|
2158
|
+
* Returns when all required deposits are confirmed and the lobby can proceed to queue.
|
|
2159
|
+
*
|
|
2160
|
+
* Automatically uses signAndSendTransaction or signTransaction based on signer capability.
|
|
2161
|
+
*/
|
|
2162
|
+
depositForLobby(lobbyId: string): Promise<DepositForLobbyResponse>;
|
|
2056
2163
|
claimLobbyDepositRefund(lobbyId: string, depositSignature: string): Promise<{
|
|
2057
2164
|
signature: string;
|
|
2058
2165
|
status: string;
|
|
@@ -2642,9 +2749,11 @@ declare class StandaloneWsTransport extends BaseWsTransport {
|
|
|
2642
2749
|
private accessToken;
|
|
2643
2750
|
private reconnectAttempts;
|
|
2644
2751
|
private reconnectTimer;
|
|
2752
|
+
private periodicReconnectInterval;
|
|
2645
2753
|
private maxReconnectAttempts;
|
|
2646
2754
|
private reconnectDelay;
|
|
2647
2755
|
private reconnectDelayMax;
|
|
2756
|
+
private static readonly PERIODIC_RECONNECT_MS;
|
|
2648
2757
|
private wildcardHandlers;
|
|
2649
2758
|
private eventHandlers;
|
|
2650
2759
|
private registeredEvents;
|
|
@@ -2661,6 +2770,10 @@ declare class StandaloneWsTransport extends BaseWsTransport {
|
|
|
2661
2770
|
protected onLeaveRoom(roomName: string): void;
|
|
2662
2771
|
private ensureSocket;
|
|
2663
2772
|
private reconnectWithAuth;
|
|
2773
|
+
/** Clear socket reference so ensureSocket() can create a new connection. */
|
|
2774
|
+
private clearSocketForReconnect;
|
|
2775
|
+
private clearPeriodicReconnect;
|
|
2776
|
+
private startPeriodicReconnect;
|
|
2664
2777
|
private scheduleReconnect;
|
|
2665
2778
|
private getEventHandlers;
|
|
2666
2779
|
private unsubscribeEvent;
|
|
@@ -2717,4 +2830,4 @@ declare class HttpClient implements IHttpClient {
|
|
|
2717
2830
|
private payChallenge;
|
|
2718
2831
|
}
|
|
2719
2832
|
|
|
2720
|
-
export { type AcceptChallengeResponse, type Achievement, Activity, type ActivityFeedItem, type ActivityFeedItemType, type ActivityFeedResponse, type ActivityFeedUser, Admin, type AdminDailyStats, type AdminDailyStatsItem, type AdminGameHistory, type AdminGameHistoryFeeBreakdown, type AdminGameHistoryFeePlayer, type AdminGameHistoryPlayer, type AdminMarketDailyStats, type AdminMarketDailyStatsItem, type AdminMarketDetail, type AdminMarketStats, type AdminStats, type AdminWalletActivityItem, type AdminWalletActivityResponse, 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 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 IHttpClient, type ILogger, type IStorage, type InviteFriendRequest, type LeaderboardEntry, type LeaderboardQuery, type LeaderboardRange, type LeaderboardResponse, Leaderboards, type LivePlayer, type LivePlayersPage, Lobbies, type Lobby, 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, type NotificationEvent, type NotificationsStore, type NotificationsStoreState, type PaginatedCriticalIncidents, type PaginatedFriends, type PaginatedNotificationsResponse, type PaginatedPlatformFees, type PaginatedReports, type PaginatedSearchUsers, type PaginatedSessions, type PaginatedSupportTickets, 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, SOL_MINT, type SdkStore, type SdkUpgradeInfo, type SearchUser, type SendMessageRequest, type SendTipResponse, type SendTransferResponse, type Session, 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, Tips, 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, withRetry };
|
|
2833
|
+
export { type AcceptChallengeResponse, type Achievement, Activity, type ActivityFeedItem, type ActivityFeedItemType, type ActivityFeedResponse, type ActivityFeedUser, Admin, type AdminDailyStats, type AdminDailyStatsItem, type AdminGameHistory, type AdminGameHistoryFeeBreakdown, type AdminGameHistoryFeePlayer, type AdminGameHistoryPlayer, type AdminMarketDailyStats, type AdminMarketDailyStatsItem, type AdminMarketDetail, type AdminMarketStats, type AdminStats, type AdminWalletActivityItem, type AdminWalletActivityResponse, 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 IHttpClient, type ILogger, type IStorage, type InviteFriendRequest, type LeaderboardEntry, type LeaderboardQuery, type LeaderboardRange, type LeaderboardResponse, Leaderboards, type LivePlayer, type LivePlayersPage, Lobbies, type Lobby, 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, type NotificationEvent, type NotificationsStore, type NotificationsStoreState, type PaginatedCriticalIncidents, 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, SOL_MINT, type SdkStore, type SdkUpgradeInfo, type SearchUser, type SendMessageRequest, type SendTipResponse, type SendTransferResponse, type Session, 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, 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, withRetry };
|