@dubsdotapp/expo 0.5.31 → 0.5.33
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 +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +110 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +109 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +25 -0
- package/src/hooks/useJoinGame.ts +3 -0
- package/src/index.ts +2 -0
- package/src/types.ts +16 -0
- package/src/ui/game/JoinGameSheet.tsx +77 -4
package/dist/index.d.mts
CHANGED
|
@@ -131,11 +131,25 @@ interface JoinGameParams {
|
|
|
131
131
|
gameId: string;
|
|
132
132
|
teamChoice: 'home' | 'away' | 'draw';
|
|
133
133
|
amount: number;
|
|
134
|
+
/**
|
|
135
|
+
* When true, spend one of the user's active 0.01 SOL streak credits
|
|
136
|
+
* instead of paying buy-in from the player's own wallet. The SDK
|
|
137
|
+
* picks the oldest credit (FIFO). The treasury covers buy-in + tx
|
|
138
|
+
* fee; the player only signs to consent. No-op if the user has no
|
|
139
|
+
* active credits — call useCredits() to check before enabling.
|
|
140
|
+
*/
|
|
141
|
+
useCredit?: boolean;
|
|
134
142
|
}
|
|
135
143
|
interface JoinGameResult {
|
|
136
144
|
gameId: string;
|
|
137
145
|
transaction: string;
|
|
138
146
|
gameAddress: string;
|
|
147
|
+
/**
|
|
148
|
+
* Set when this join was sponsored. The mutation hook echoes this
|
|
149
|
+
* back to confirmGame so the server can mark the credit as used.
|
|
150
|
+
*/
|
|
151
|
+
promoCode?: string;
|
|
152
|
+
sponsorWallet?: string;
|
|
139
153
|
}
|
|
140
154
|
interface ConfirmGameParams {
|
|
141
155
|
gameId: string;
|
|
@@ -145,6 +159,8 @@ interface ConfirmGameParams {
|
|
|
145
159
|
wagerAmount?: number;
|
|
146
160
|
role?: 'creator' | 'joiner';
|
|
147
161
|
gameAddress?: string;
|
|
162
|
+
/** Echoed back from a sponsored joinGame so the server marks the credit as used. */
|
|
163
|
+
promoCode?: string;
|
|
148
164
|
}
|
|
149
165
|
interface ConfirmGameResult {
|
|
150
166
|
gameId: string;
|
|
@@ -1490,6 +1506,24 @@ declare function useEnterJackpot(): {
|
|
|
1490
1506
|
reset: () => void;
|
|
1491
1507
|
};
|
|
1492
1508
|
|
|
1509
|
+
interface UseCreditsResult {
|
|
1510
|
+
credits: PromoCredit[];
|
|
1511
|
+
totalLamports: number;
|
|
1512
|
+
totalSOL: number;
|
|
1513
|
+
loading: boolean;
|
|
1514
|
+
error: Error | null;
|
|
1515
|
+
refetch: () => Promise<void>;
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Returns every active promo credit reserved to the authenticated user
|
|
1519
|
+
* (streak-milestone unlocks + any unused Twitter giveaway codes).
|
|
1520
|
+
*
|
|
1521
|
+
* Credits are kept on the server (`promo_codes` table); this hook just
|
|
1522
|
+
* mirrors them. After a streak shake that mints a new unlock, call
|
|
1523
|
+
* `refetch()` to pull the new credit into the list immediately.
|
|
1524
|
+
*/
|
|
1525
|
+
declare function useCredits(): UseCreditsResult;
|
|
1526
|
+
|
|
1493
1527
|
interface ConnectWalletButtonProps {
|
|
1494
1528
|
/** Button label. Defaults to "Connect Wallet" */
|
|
1495
1529
|
label?: string;
|
|
@@ -2229,4 +2263,4 @@ declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAd
|
|
|
2229
2263
|
*/
|
|
2230
2264
|
declare function ensurePngAvatar(url: string | null | undefined): string | undefined;
|
|
2231
2265
|
|
|
2232
|
-
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolResult, type ArcadePoolStats, AuthGate, type ConnectWalletScreenProps$1 as AuthGateConnectWalletProps, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type BuildJackpotEnterResult, type ChatConnectionStatus, type ChatContextValue, type ChatMention, type ChatMessage, type ChatNotification, type ChatPayment, ChatProvider, type ChatProviderProps, ChatSocket, type ChatSocketConfig, type ChatSocketListeners, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, type ConfirmJackpotEnterResult, ConnectWalletButton, type ConnectWalletButtonProps, ConnectWalletScreen, type ConnectWalletScreenProps, type Conversation, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, CreateGameSheet, type CreateGameSheetProps, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, type DirectMessage, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, type EnterJackpotMutationResult, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type FriendRequest, type FriendUser, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, type HighlightVideo, JackpotCard, type JackpotCardProps, type JackpotConfig, type JackpotEntry, type JackpotLastWinner, type JackpotRound, type JackpotRoundResult, JackpotSheet, type JackpotSheetProps, JackpotWidget, type JackpotWidgetProps, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, JoinGameSheet, type JoinGameSheetProps, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type OnlineUser, type Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type PromoCredit, type PushNotificationStatus, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, type SendDMParams, type SendMessageParams, type SentFriendRequest, SettingsSheet, type SettingsSheetProps, type ShortVideo, SolSlider, type SolSliderProps, type SolanaErrorCode, type StartAttemptResult, type SubmitScoreResult, type TokenStorage, type TypingEvent, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseArcadeBridgeOptions, type UseArcadeBridgeResult, type UseArcadeGameResult, type UseArcadePoolResult, type UseArcadePoolsResult, type UseAuthResult, type UseJackpotHistoryResult, type UseJackpotResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, type WhatsNewCategory, type WhatsNewPost, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useCancelFriendRequest, useChatContext, useChatMessages, useChatStatus, useClaim, useConversations, useCreateCustomGame, useCreateGame, useDirectMessages, useDubs, useDubsTheme, useEnterArcadePool, useEnterJackpot, useEvents, useFriendRequests, useFriends, useGame, useGames, useHasClaimed, useHighlights, useJackpot, useJackpotHistory, useJoinGame, useNetworkGames, useOnlineUsers, usePushNotifications, useRespondToFriendRequest, useSearchUsers, useSendFriendRequest, useSendMessage, useSentFriendRequests, useShorts, useUFCFightCard, useUFCFighterDetail, useUnreadCount, useWhatsNew };
|
|
2266
|
+
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolResult, type ArcadePoolStats, AuthGate, type ConnectWalletScreenProps$1 as AuthGateConnectWalletProps, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type BuildJackpotEnterResult, type ChatConnectionStatus, type ChatContextValue, type ChatMention, type ChatMessage, type ChatNotification, type ChatPayment, ChatProvider, type ChatProviderProps, ChatSocket, type ChatSocketConfig, type ChatSocketListeners, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, type ConfirmJackpotEnterResult, ConnectWalletButton, type ConnectWalletButtonProps, ConnectWalletScreen, type ConnectWalletScreenProps, type Conversation, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, CreateGameSheet, type CreateGameSheetProps, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, type DirectMessage, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, type EnterJackpotMutationResult, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type FriendRequest, type FriendUser, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, type HighlightVideo, JackpotCard, type JackpotCardProps, type JackpotConfig, type JackpotEntry, type JackpotLastWinner, type JackpotRound, type JackpotRoundResult, JackpotSheet, type JackpotSheetProps, JackpotWidget, type JackpotWidgetProps, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, JoinGameSheet, type JoinGameSheetProps, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type OnlineUser, type Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type PromoCredit, type PushNotificationStatus, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, type SendDMParams, type SendMessageParams, type SentFriendRequest, SettingsSheet, type SettingsSheetProps, type ShortVideo, SolSlider, type SolSliderProps, type SolanaErrorCode, type StartAttemptResult, type SubmitScoreResult, type TokenStorage, type TypingEvent, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseArcadeBridgeOptions, type UseArcadeBridgeResult, type UseArcadeGameResult, type UseArcadePoolResult, type UseArcadePoolsResult, type UseAuthResult, type UseCreditsResult, type UseJackpotHistoryResult, type UseJackpotResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, type WhatsNewCategory, type WhatsNewPost, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useCancelFriendRequest, useChatContext, useChatMessages, useChatStatus, useClaim, useConversations, useCreateCustomGame, useCreateGame, useCredits, useDirectMessages, useDubs, useDubsTheme, useEnterArcadePool, useEnterJackpot, useEvents, useFriendRequests, useFriends, useGame, useGames, useHasClaimed, useHighlights, useJackpot, useJackpotHistory, useJoinGame, useNetworkGames, useOnlineUsers, usePushNotifications, useRespondToFriendRequest, useSearchUsers, useSendFriendRequest, useSendMessage, useSentFriendRequests, useShorts, useUFCFightCard, useUFCFighterDetail, useUnreadCount, useWhatsNew };
|
package/dist/index.d.ts
CHANGED
|
@@ -131,11 +131,25 @@ interface JoinGameParams {
|
|
|
131
131
|
gameId: string;
|
|
132
132
|
teamChoice: 'home' | 'away' | 'draw';
|
|
133
133
|
amount: number;
|
|
134
|
+
/**
|
|
135
|
+
* When true, spend one of the user's active 0.01 SOL streak credits
|
|
136
|
+
* instead of paying buy-in from the player's own wallet. The SDK
|
|
137
|
+
* picks the oldest credit (FIFO). The treasury covers buy-in + tx
|
|
138
|
+
* fee; the player only signs to consent. No-op if the user has no
|
|
139
|
+
* active credits — call useCredits() to check before enabling.
|
|
140
|
+
*/
|
|
141
|
+
useCredit?: boolean;
|
|
134
142
|
}
|
|
135
143
|
interface JoinGameResult {
|
|
136
144
|
gameId: string;
|
|
137
145
|
transaction: string;
|
|
138
146
|
gameAddress: string;
|
|
147
|
+
/**
|
|
148
|
+
* Set when this join was sponsored. The mutation hook echoes this
|
|
149
|
+
* back to confirmGame so the server can mark the credit as used.
|
|
150
|
+
*/
|
|
151
|
+
promoCode?: string;
|
|
152
|
+
sponsorWallet?: string;
|
|
139
153
|
}
|
|
140
154
|
interface ConfirmGameParams {
|
|
141
155
|
gameId: string;
|
|
@@ -145,6 +159,8 @@ interface ConfirmGameParams {
|
|
|
145
159
|
wagerAmount?: number;
|
|
146
160
|
role?: 'creator' | 'joiner';
|
|
147
161
|
gameAddress?: string;
|
|
162
|
+
/** Echoed back from a sponsored joinGame so the server marks the credit as used. */
|
|
163
|
+
promoCode?: string;
|
|
148
164
|
}
|
|
149
165
|
interface ConfirmGameResult {
|
|
150
166
|
gameId: string;
|
|
@@ -1490,6 +1506,24 @@ declare function useEnterJackpot(): {
|
|
|
1490
1506
|
reset: () => void;
|
|
1491
1507
|
};
|
|
1492
1508
|
|
|
1509
|
+
interface UseCreditsResult {
|
|
1510
|
+
credits: PromoCredit[];
|
|
1511
|
+
totalLamports: number;
|
|
1512
|
+
totalSOL: number;
|
|
1513
|
+
loading: boolean;
|
|
1514
|
+
error: Error | null;
|
|
1515
|
+
refetch: () => Promise<void>;
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Returns every active promo credit reserved to the authenticated user
|
|
1519
|
+
* (streak-milestone unlocks + any unused Twitter giveaway codes).
|
|
1520
|
+
*
|
|
1521
|
+
* Credits are kept on the server (`promo_codes` table); this hook just
|
|
1522
|
+
* mirrors them. After a streak shake that mints a new unlock, call
|
|
1523
|
+
* `refetch()` to pull the new credit into the list immediately.
|
|
1524
|
+
*/
|
|
1525
|
+
declare function useCredits(): UseCreditsResult;
|
|
1526
|
+
|
|
1493
1527
|
interface ConnectWalletButtonProps {
|
|
1494
1528
|
/** Button label. Defaults to "Connect Wallet" */
|
|
1495
1529
|
label?: string;
|
|
@@ -2229,4 +2263,4 @@ declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAd
|
|
|
2229
2263
|
*/
|
|
2230
2264
|
declare function ensurePngAvatar(url: string | null | undefined): string | undefined;
|
|
2231
2265
|
|
|
2232
|
-
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolResult, type ArcadePoolStats, AuthGate, type ConnectWalletScreenProps$1 as AuthGateConnectWalletProps, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type BuildJackpotEnterResult, type ChatConnectionStatus, type ChatContextValue, type ChatMention, type ChatMessage, type ChatNotification, type ChatPayment, ChatProvider, type ChatProviderProps, ChatSocket, type ChatSocketConfig, type ChatSocketListeners, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, type ConfirmJackpotEnterResult, ConnectWalletButton, type ConnectWalletButtonProps, ConnectWalletScreen, type ConnectWalletScreenProps, type Conversation, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, CreateGameSheet, type CreateGameSheetProps, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, type DirectMessage, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, type EnterJackpotMutationResult, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type FriendRequest, type FriendUser, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, type HighlightVideo, JackpotCard, type JackpotCardProps, type JackpotConfig, type JackpotEntry, type JackpotLastWinner, type JackpotRound, type JackpotRoundResult, JackpotSheet, type JackpotSheetProps, JackpotWidget, type JackpotWidgetProps, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, JoinGameSheet, type JoinGameSheetProps, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type OnlineUser, type Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type PromoCredit, type PushNotificationStatus, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, type SendDMParams, type SendMessageParams, type SentFriendRequest, SettingsSheet, type SettingsSheetProps, type ShortVideo, SolSlider, type SolSliderProps, type SolanaErrorCode, type StartAttemptResult, type SubmitScoreResult, type TokenStorage, type TypingEvent, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseArcadeBridgeOptions, type UseArcadeBridgeResult, type UseArcadeGameResult, type UseArcadePoolResult, type UseArcadePoolsResult, type UseAuthResult, type UseJackpotHistoryResult, type UseJackpotResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, type WhatsNewCategory, type WhatsNewPost, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useCancelFriendRequest, useChatContext, useChatMessages, useChatStatus, useClaim, useConversations, useCreateCustomGame, useCreateGame, useDirectMessages, useDubs, useDubsTheme, useEnterArcadePool, useEnterJackpot, useEvents, useFriendRequests, useFriends, useGame, useGames, useHasClaimed, useHighlights, useJackpot, useJackpotHistory, useJoinGame, useNetworkGames, useOnlineUsers, usePushNotifications, useRespondToFriendRequest, useSearchUsers, useSendFriendRequest, useSendMessage, useSentFriendRequests, useShorts, useUFCFightCard, useUFCFighterDetail, useUnreadCount, useWhatsNew };
|
|
2266
|
+
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolResult, type ArcadePoolStats, AuthGate, type ConnectWalletScreenProps$1 as AuthGateConnectWalletProps, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type BuildJackpotEnterResult, type ChatConnectionStatus, type ChatContextValue, type ChatMention, type ChatMessage, type ChatNotification, type ChatPayment, ChatProvider, type ChatProviderProps, ChatSocket, type ChatSocketConfig, type ChatSocketListeners, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, type ConfirmJackpotEnterResult, ConnectWalletButton, type ConnectWalletButtonProps, ConnectWalletScreen, type ConnectWalletScreenProps, type Conversation, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, CreateGameSheet, type CreateGameSheetProps, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, type DirectMessage, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, type EnterJackpotMutationResult, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type FriendRequest, type FriendUser, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, type HighlightVideo, JackpotCard, type JackpotCardProps, type JackpotConfig, type JackpotEntry, type JackpotLastWinner, type JackpotRound, type JackpotRoundResult, JackpotSheet, type JackpotSheetProps, JackpotWidget, type JackpotWidgetProps, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, JoinGameSheet, type JoinGameSheetProps, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type OnlineUser, type Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type PromoCredit, type PushNotificationStatus, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, type SendDMParams, type SendMessageParams, type SentFriendRequest, SettingsSheet, type SettingsSheetProps, type ShortVideo, SolSlider, type SolSliderProps, type SolanaErrorCode, type StartAttemptResult, type SubmitScoreResult, type TokenStorage, type TypingEvent, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseArcadeBridgeOptions, type UseArcadeBridgeResult, type UseArcadeGameResult, type UseArcadePoolResult, type UseArcadePoolsResult, type UseAuthResult, type UseCreditsResult, type UseJackpotHistoryResult, type UseJackpotResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, type WhatsNewCategory, type WhatsNewPost, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useCancelFriendRequest, useChatContext, useChatMessages, useChatStatus, useClaim, useConversations, useCreateCustomGame, useCreateGame, useCredits, useDirectMessages, useDubs, useDubsTheme, useEnterArcadePool, useEnterJackpot, useEvents, useFriendRequests, useFriends, useGame, useGames, useHasClaimed, useHighlights, useJackpot, useJackpotHistory, useJoinGame, useNetworkGames, useOnlineUsers, usePushNotifications, useRespondToFriendRequest, useSearchUsers, useSendFriendRequest, useSendMessage, useSentFriendRequests, useShorts, useUFCFightCard, useUFCFighterDetail, useUnreadCount, useWhatsNew };
|
package/dist/index.js
CHANGED
|
@@ -86,6 +86,7 @@ __export(index_exports, {
|
|
|
86
86
|
useConversations: () => useConversations,
|
|
87
87
|
useCreateCustomGame: () => useCreateCustomGame,
|
|
88
88
|
useCreateGame: () => useCreateGame,
|
|
89
|
+
useCredits: () => useCredits,
|
|
89
90
|
useDirectMessages: () => useDirectMessages,
|
|
90
91
|
useDubs: () => useDubs,
|
|
91
92
|
useDubsTheme: () => useDubsTheme,
|
|
@@ -383,6 +384,19 @@ var DubsClient = class {
|
|
|
383
384
|
};
|
|
384
385
|
}
|
|
385
386
|
async joinGame(params) {
|
|
387
|
+
if (params.useCredit) {
|
|
388
|
+
const res2 = await this.request("POST", "/games/join-sponsored", {
|
|
389
|
+
gameId: params.gameId,
|
|
390
|
+
teamChoice: params.teamChoice
|
|
391
|
+
});
|
|
392
|
+
return {
|
|
393
|
+
gameId: res2.gameId,
|
|
394
|
+
transaction: res2.transaction,
|
|
395
|
+
gameAddress: res2.gameAddress,
|
|
396
|
+
promoCode: res2.promoCode,
|
|
397
|
+
sponsorWallet: res2.sponsorWallet
|
|
398
|
+
};
|
|
399
|
+
}
|
|
386
400
|
const res = await this.request(
|
|
387
401
|
"POST",
|
|
388
402
|
"/games/join",
|
|
@@ -2262,7 +2276,10 @@ function useJoinGame() {
|
|
|
2262
2276
|
teamChoice: params.teamChoice,
|
|
2263
2277
|
wagerAmount: params.amount,
|
|
2264
2278
|
role: "joiner",
|
|
2265
|
-
gameAddress: joinResult.gameAddress
|
|
2279
|
+
gameAddress: joinResult.gameAddress,
|
|
2280
|
+
// Pass through when this was a sponsored join — server marks
|
|
2281
|
+
// the credit as used after the on-chain confirm succeeds.
|
|
2282
|
+
promoCode: joinResult.promoCode
|
|
2266
2283
|
};
|
|
2267
2284
|
console.log("[useJoinGame] Step 3: Confirming with backend...", confirmParams);
|
|
2268
2285
|
const confirmResult = await client.confirmGame(confirmParams);
|
|
@@ -3363,6 +3380,32 @@ function useEnterJackpot() {
|
|
|
3363
3380
|
|
|
3364
3381
|
// src/hooks/useCredits.ts
|
|
3365
3382
|
var import_react28 = require("react");
|
|
3383
|
+
function useCredits() {
|
|
3384
|
+
const { client } = useDubs();
|
|
3385
|
+
const [credits, setCredits] = (0, import_react28.useState)([]);
|
|
3386
|
+
const [totalLamports, setTotalLamports] = (0, import_react28.useState)(0);
|
|
3387
|
+
const [totalSOL, setTotalSOL] = (0, import_react28.useState)(0);
|
|
3388
|
+
const [loading, setLoading] = (0, import_react28.useState)(false);
|
|
3389
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
3390
|
+
const fetch2 = (0, import_react28.useCallback)(async () => {
|
|
3391
|
+
setLoading(true);
|
|
3392
|
+
setError(null);
|
|
3393
|
+
try {
|
|
3394
|
+
const result = await client.getCredits();
|
|
3395
|
+
setCredits(result.credits);
|
|
3396
|
+
setTotalLamports(result.totalLamports);
|
|
3397
|
+
setTotalSOL(result.totalSOL);
|
|
3398
|
+
} catch (err) {
|
|
3399
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
3400
|
+
} finally {
|
|
3401
|
+
setLoading(false);
|
|
3402
|
+
}
|
|
3403
|
+
}, [client]);
|
|
3404
|
+
(0, import_react28.useEffect)(() => {
|
|
3405
|
+
fetch2();
|
|
3406
|
+
}, [fetch2]);
|
|
3407
|
+
return { credits, totalLamports, totalSOL, loading, error, refetch: fetch2 };
|
|
3408
|
+
}
|
|
3366
3409
|
|
|
3367
3410
|
// src/ui/AvatarEditor.tsx
|
|
3368
3411
|
var import_react_native7 = require("react-native");
|
|
@@ -6050,10 +6093,14 @@ function JoinGameSheet({
|
|
|
6050
6093
|
const t = useDubsTheme();
|
|
6051
6094
|
const { wallet } = useDubs();
|
|
6052
6095
|
const mutation = useJoinGame();
|
|
6096
|
+
const { credits, refetch: refetchCredits } = useCredits();
|
|
6053
6097
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
6054
6098
|
const [selectedTeam, setSelectedTeam] = (0, import_react41.useState)(null);
|
|
6055
6099
|
const [wager, setWager] = (0, import_react41.useState)(game.buyIn);
|
|
6056
6100
|
const [showSuccess, setShowSuccess] = (0, import_react41.useState)(false);
|
|
6101
|
+
const [useCredit, setUseCredit] = (0, import_react41.useState)(false);
|
|
6102
|
+
const oldestCredit = credits.length > 0 ? credits[0] : null;
|
|
6103
|
+
const canUseCredit = !!oldestCredit && oldestCredit.amountSOL >= game.buyIn;
|
|
6057
6104
|
const overlayOpacity = (0, import_react41.useRef)(new import_react_native21.Animated.Value(0)).current;
|
|
6058
6105
|
const successScale = (0, import_react41.useRef)(new import_react_native21.Animated.Value(0)).current;
|
|
6059
6106
|
const successOpacity = (0, import_react41.useRef)(new import_react_native21.Animated.Value(0)).current;
|
|
@@ -6142,11 +6189,15 @@ function JoinGameSheet({
|
|
|
6142
6189
|
playerWallet: wallet.publicKey.toBase58(),
|
|
6143
6190
|
gameId: game.gameId,
|
|
6144
6191
|
teamChoice: selectedTeam,
|
|
6145
|
-
|
|
6192
|
+
// When useCredit is on, the on-chain instruction transfers
|
|
6193
|
+
// exactly the credit's amount; pass that as the wager.
|
|
6194
|
+
amount: useCredit && oldestCredit ? oldestCredit.amountSOL : wager,
|
|
6195
|
+
useCredit: useCredit && canUseCredit ? true : void 0
|
|
6146
6196
|
});
|
|
6197
|
+
if (useCredit) refetchCredits();
|
|
6147
6198
|
} catch {
|
|
6148
6199
|
}
|
|
6149
|
-
}, [selectedTeam, wallet.publicKey, mutation.execute, game.gameId, wager]);
|
|
6200
|
+
}, [selectedTeam, wallet.publicKey, mutation.execute, game.gameId, wager, useCredit, oldestCredit, canUseCredit, refetchCredits]);
|
|
6150
6201
|
const statusLabel = STATUS_LABELS3[mutation.status] || "";
|
|
6151
6202
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6152
6203
|
import_react_native21.Modal,
|
|
@@ -6349,7 +6400,26 @@ function JoinGameSheet({
|
|
|
6349
6400
|
] })
|
|
6350
6401
|
] })
|
|
6351
6402
|
] }),
|
|
6352
|
-
selectedTeam && !
|
|
6403
|
+
selectedTeam && !alreadyJoined && canUseCredit && oldestCredit && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6404
|
+
import_react_native21.TouchableOpacity,
|
|
6405
|
+
{
|
|
6406
|
+
style: [styles15.creditRow, { backgroundColor: useCredit ? "#22C55E18" : t.surface, borderColor: useCredit ? "#22C55E" : t.border }],
|
|
6407
|
+
activeOpacity: 0.8,
|
|
6408
|
+
onPress: () => setUseCredit((v) => !v),
|
|
6409
|
+
children: [
|
|
6410
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.creditRowText, children: [
|
|
6411
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Text, { style: [styles15.creditTitle, { color: useCredit ? "#22C55E" : t.text }], children: [
|
|
6412
|
+
"\u{1F381} Use my ",
|
|
6413
|
+
formatSol(oldestCredit.amountSOL),
|
|
6414
|
+
" SOL credit"
|
|
6415
|
+
] }),
|
|
6416
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.creditSub, { color: t.textMuted }], children: useCredit ? "Treasury covers this bet \u2014 wager locked to credit amount" : `${credits.length} credit${credits.length === 1 ? "" : "s"} available from your streak` })
|
|
6417
|
+
] }),
|
|
6418
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.creditCheckbox, useCredit && { backgroundColor: "#22C55E", borderColor: "#22C55E" }], children: useCredit && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: styles15.creditCheck, children: "\u2713" }) })
|
|
6419
|
+
]
|
|
6420
|
+
}
|
|
6421
|
+
),
|
|
6422
|
+
selectedTeam && !isPoolModeEnabled && !alreadyJoined && !useCredit && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6353
6423
|
SolSlider,
|
|
6354
6424
|
{
|
|
6355
6425
|
value: wager,
|
|
@@ -6687,6 +6757,41 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
6687
6757
|
flexDirection: "row",
|
|
6688
6758
|
alignItems: "center",
|
|
6689
6759
|
gap: 10
|
|
6760
|
+
},
|
|
6761
|
+
creditRow: {
|
|
6762
|
+
flexDirection: "row",
|
|
6763
|
+
alignItems: "center",
|
|
6764
|
+
gap: 12,
|
|
6765
|
+
marginTop: 12,
|
|
6766
|
+
padding: 12,
|
|
6767
|
+
borderRadius: 12,
|
|
6768
|
+
borderWidth: 1.5
|
|
6769
|
+
},
|
|
6770
|
+
creditRowText: {
|
|
6771
|
+
flex: 1,
|
|
6772
|
+
gap: 2
|
|
6773
|
+
},
|
|
6774
|
+
creditTitle: {
|
|
6775
|
+
fontSize: 14,
|
|
6776
|
+
fontWeight: "700"
|
|
6777
|
+
},
|
|
6778
|
+
creditSub: {
|
|
6779
|
+
fontSize: 12,
|
|
6780
|
+
fontWeight: "500"
|
|
6781
|
+
},
|
|
6782
|
+
creditCheckbox: {
|
|
6783
|
+
width: 22,
|
|
6784
|
+
height: 22,
|
|
6785
|
+
borderRadius: 11,
|
|
6786
|
+
borderWidth: 2,
|
|
6787
|
+
borderColor: "#3A3A3C",
|
|
6788
|
+
alignItems: "center",
|
|
6789
|
+
justifyContent: "center"
|
|
6790
|
+
},
|
|
6791
|
+
creditCheck: {
|
|
6792
|
+
color: "#FFFFFF",
|
|
6793
|
+
fontSize: 14,
|
|
6794
|
+
fontWeight: "900"
|
|
6690
6795
|
}
|
|
6691
6796
|
});
|
|
6692
6797
|
|
|
@@ -9374,6 +9479,7 @@ function useWhatsNew() {
|
|
|
9374
9479
|
useConversations,
|
|
9375
9480
|
useCreateCustomGame,
|
|
9376
9481
|
useCreateGame,
|
|
9482
|
+
useCredits,
|
|
9377
9483
|
useDirectMessages,
|
|
9378
9484
|
useDubs,
|
|
9379
9485
|
useDubsTheme,
|