@dubsdotapp/expo 0.2.30 → 0.2.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/dist/index.d.mts +14 -9
- package/dist/index.d.ts +14 -9
- package/dist/index.js +305 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +314 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +0 -2
- package/src/hooks/useCreateCustomGame.ts +0 -2
- package/src/index.ts +2 -1
- package/src/types.ts +0 -5
- package/src/ui/game/ClaimPrizeSheet.tsx +365 -0
- package/src/ui/game/CreateCustomGameSheet.tsx +1 -4
- package/src/ui/game/index.ts +2 -0
- package/src/ui/index.ts +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -118,14 +118,12 @@ interface CreateCustomGameParams {
|
|
|
118
118
|
title?: string;
|
|
119
119
|
maxPlayers?: number;
|
|
120
120
|
metadata?: Record<string, unknown>;
|
|
121
|
-
externalGameId?: string;
|
|
122
121
|
}
|
|
123
122
|
interface CreateCustomGameResult {
|
|
124
123
|
gameId: string;
|
|
125
124
|
gameAddress: string;
|
|
126
125
|
transaction: string;
|
|
127
126
|
lockTimestamp: number;
|
|
128
|
-
externalGameId?: string | null;
|
|
129
127
|
}
|
|
130
128
|
interface JoinGameParams {
|
|
131
129
|
playerWallet: string;
|
|
@@ -191,7 +189,6 @@ interface GameDetail {
|
|
|
191
189
|
drawPool: number;
|
|
192
190
|
totalPool: number;
|
|
193
191
|
media: GameMedia;
|
|
194
|
-
externalGameId?: string | null;
|
|
195
192
|
createdAt: string;
|
|
196
193
|
updatedAt: string;
|
|
197
194
|
}
|
|
@@ -211,14 +208,12 @@ interface GameListItem {
|
|
|
211
208
|
league: string | null;
|
|
212
209
|
lockTimestamp: number | null;
|
|
213
210
|
createdAt: string;
|
|
214
|
-
externalGameId?: string | null;
|
|
215
211
|
opponents: GameListOpponent[];
|
|
216
212
|
media: GameMedia;
|
|
217
213
|
}
|
|
218
214
|
interface GetGamesParams {
|
|
219
215
|
wallet?: string;
|
|
220
216
|
status?: 'open' | 'locked' | 'resolved';
|
|
221
|
-
externalGameId?: string;
|
|
222
217
|
limit?: number;
|
|
223
218
|
offset?: number;
|
|
224
219
|
}
|
|
@@ -738,7 +733,6 @@ interface CreateCustomGameMutationResult {
|
|
|
738
733
|
signature: string;
|
|
739
734
|
explorerUrl: string;
|
|
740
735
|
buyIn: number;
|
|
741
|
-
externalGameId?: string | null;
|
|
742
736
|
}
|
|
743
737
|
declare function useCreateCustomGame(): {
|
|
744
738
|
execute: (params: CreateCustomGameParams) => Promise<CreateCustomGameMutationResult>;
|
|
@@ -902,12 +896,11 @@ interface CreateCustomGameSheetProps {
|
|
|
902
896
|
presetAmounts?: number[];
|
|
903
897
|
defaultAmount?: number;
|
|
904
898
|
metadata?: Record<string, unknown>;
|
|
905
|
-
externalGameId?: string;
|
|
906
899
|
onAmountChange?: (amount: number | null) => void;
|
|
907
900
|
onSuccess?: (result: CreateCustomGameMutationResult) => void;
|
|
908
901
|
onError?: (error: Error) => void;
|
|
909
902
|
}
|
|
910
|
-
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata,
|
|
903
|
+
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata, onAmountChange, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
911
904
|
|
|
912
905
|
interface JoinGameSheetProps {
|
|
913
906
|
visible: boolean;
|
|
@@ -926,6 +919,18 @@ interface JoinGameSheetProps {
|
|
|
926
919
|
}
|
|
927
920
|
declare function JoinGameSheet({ visible, onDismiss, game, ImageComponent, shortName, homeColor, awayColor, onSuccess, onError, }: JoinGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
928
921
|
|
|
922
|
+
interface ClaimPrizeSheetProps {
|
|
923
|
+
visible: boolean;
|
|
924
|
+
onDismiss: () => void;
|
|
925
|
+
gameId: string;
|
|
926
|
+
/** Prize amount in SOL */
|
|
927
|
+
prizeAmount: number;
|
|
928
|
+
/** Callbacks */
|
|
929
|
+
onSuccess?: (result: ClaimMutationResult) => void;
|
|
930
|
+
onError?: (error: Error) => void;
|
|
931
|
+
}
|
|
932
|
+
declare function ClaimPrizeSheet({ visible, onDismiss, gameId, prizeAmount, onSuccess, onError, }: ClaimPrizeSheetProps): react_jsx_runtime.JSX.Element;
|
|
933
|
+
|
|
929
934
|
/**
|
|
930
935
|
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
|
931
936
|
* Prefers signAndSendTransaction if available (MWA), otherwise falls back to
|
|
@@ -934,4 +939,4 @@ declare function JoinGameSheet({ visible, onDismiss, game, ImageComponent, short
|
|
|
934
939
|
*/
|
|
935
940
|
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
|
|
936
941
|
|
|
937
|
-
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, type ClaimMutationResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, 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 Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
|
942
|
+
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, 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 Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
package/dist/index.d.ts
CHANGED
|
@@ -118,14 +118,12 @@ interface CreateCustomGameParams {
|
|
|
118
118
|
title?: string;
|
|
119
119
|
maxPlayers?: number;
|
|
120
120
|
metadata?: Record<string, unknown>;
|
|
121
|
-
externalGameId?: string;
|
|
122
121
|
}
|
|
123
122
|
interface CreateCustomGameResult {
|
|
124
123
|
gameId: string;
|
|
125
124
|
gameAddress: string;
|
|
126
125
|
transaction: string;
|
|
127
126
|
lockTimestamp: number;
|
|
128
|
-
externalGameId?: string | null;
|
|
129
127
|
}
|
|
130
128
|
interface JoinGameParams {
|
|
131
129
|
playerWallet: string;
|
|
@@ -191,7 +189,6 @@ interface GameDetail {
|
|
|
191
189
|
drawPool: number;
|
|
192
190
|
totalPool: number;
|
|
193
191
|
media: GameMedia;
|
|
194
|
-
externalGameId?: string | null;
|
|
195
192
|
createdAt: string;
|
|
196
193
|
updatedAt: string;
|
|
197
194
|
}
|
|
@@ -211,14 +208,12 @@ interface GameListItem {
|
|
|
211
208
|
league: string | null;
|
|
212
209
|
lockTimestamp: number | null;
|
|
213
210
|
createdAt: string;
|
|
214
|
-
externalGameId?: string | null;
|
|
215
211
|
opponents: GameListOpponent[];
|
|
216
212
|
media: GameMedia;
|
|
217
213
|
}
|
|
218
214
|
interface GetGamesParams {
|
|
219
215
|
wallet?: string;
|
|
220
216
|
status?: 'open' | 'locked' | 'resolved';
|
|
221
|
-
externalGameId?: string;
|
|
222
217
|
limit?: number;
|
|
223
218
|
offset?: number;
|
|
224
219
|
}
|
|
@@ -738,7 +733,6 @@ interface CreateCustomGameMutationResult {
|
|
|
738
733
|
signature: string;
|
|
739
734
|
explorerUrl: string;
|
|
740
735
|
buyIn: number;
|
|
741
|
-
externalGameId?: string | null;
|
|
742
736
|
}
|
|
743
737
|
declare function useCreateCustomGame(): {
|
|
744
738
|
execute: (params: CreateCustomGameParams) => Promise<CreateCustomGameMutationResult>;
|
|
@@ -902,12 +896,11 @@ interface CreateCustomGameSheetProps {
|
|
|
902
896
|
presetAmounts?: number[];
|
|
903
897
|
defaultAmount?: number;
|
|
904
898
|
metadata?: Record<string, unknown>;
|
|
905
|
-
externalGameId?: string;
|
|
906
899
|
onAmountChange?: (amount: number | null) => void;
|
|
907
900
|
onSuccess?: (result: CreateCustomGameMutationResult) => void;
|
|
908
901
|
onError?: (error: Error) => void;
|
|
909
902
|
}
|
|
910
|
-
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata,
|
|
903
|
+
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata, onAmountChange, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
911
904
|
|
|
912
905
|
interface JoinGameSheetProps {
|
|
913
906
|
visible: boolean;
|
|
@@ -926,6 +919,18 @@ interface JoinGameSheetProps {
|
|
|
926
919
|
}
|
|
927
920
|
declare function JoinGameSheet({ visible, onDismiss, game, ImageComponent, shortName, homeColor, awayColor, onSuccess, onError, }: JoinGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
928
921
|
|
|
922
|
+
interface ClaimPrizeSheetProps {
|
|
923
|
+
visible: boolean;
|
|
924
|
+
onDismiss: () => void;
|
|
925
|
+
gameId: string;
|
|
926
|
+
/** Prize amount in SOL */
|
|
927
|
+
prizeAmount: number;
|
|
928
|
+
/** Callbacks */
|
|
929
|
+
onSuccess?: (result: ClaimMutationResult) => void;
|
|
930
|
+
onError?: (error: Error) => void;
|
|
931
|
+
}
|
|
932
|
+
declare function ClaimPrizeSheet({ visible, onDismiss, gameId, prizeAmount, onSuccess, onError, }: ClaimPrizeSheetProps): react_jsx_runtime.JSX.Element;
|
|
933
|
+
|
|
929
934
|
/**
|
|
930
935
|
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
|
931
936
|
* Prefers signAndSendTransaction if available (MWA), otherwise falls back to
|
|
@@ -934,4 +939,4 @@ declare function JoinGameSheet({ visible, onDismiss, game, ImageComponent, short
|
|
|
934
939
|
*/
|
|
935
940
|
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
|
|
936
941
|
|
|
937
|
-
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, type ClaimMutationResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, 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 Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
|
942
|
+
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, 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 Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AuthGate: () => AuthGate,
|
|
34
|
+
ClaimPrizeSheet: () => ClaimPrizeSheet,
|
|
34
35
|
ConnectWalletScreen: () => ConnectWalletScreen,
|
|
35
36
|
CreateCustomGameSheet: () => CreateCustomGameSheet,
|
|
36
37
|
DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
|
|
@@ -344,8 +345,7 @@ var DubsClient = class {
|
|
|
344
345
|
gameId: res.gameId,
|
|
345
346
|
gameAddress: res.gameAddress,
|
|
346
347
|
transaction: res.transaction,
|
|
347
|
-
lockTimestamp: res.lockTimestamp
|
|
348
|
-
externalGameId: res.externalGameId ?? null
|
|
348
|
+
lockTimestamp: res.lockTimestamp
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
351
|
async confirmCustomGame(params) {
|
|
@@ -392,7 +392,6 @@ var DubsClient = class {
|
|
|
392
392
|
const qs = new URLSearchParams();
|
|
393
393
|
if (params?.wallet) qs.set("wallet", params.wallet);
|
|
394
394
|
if (params?.status) qs.set("status", params.status);
|
|
395
|
-
if (params?.externalGameId) qs.set("externalGameId", params.externalGameId);
|
|
396
395
|
if (params?.limit != null) qs.set("limit", String(params.limit));
|
|
397
396
|
if (params?.offset != null) qs.set("offset", String(params.offset));
|
|
398
397
|
const query = qs.toString();
|
|
@@ -1914,8 +1913,7 @@ function useCreateCustomGame() {
|
|
|
1914
1913
|
gameAddress: createResult.gameAddress,
|
|
1915
1914
|
signature,
|
|
1916
1915
|
explorerUrl,
|
|
1917
|
-
buyIn: params.wagerAmount
|
|
1918
|
-
externalGameId: createResult.externalGameId ?? null
|
|
1916
|
+
buyIn: params.wagerAmount
|
|
1919
1917
|
};
|
|
1920
1918
|
setData(result);
|
|
1921
1919
|
setStatus("success");
|
|
@@ -3497,7 +3495,6 @@ function CreateCustomGameSheet({
|
|
|
3497
3495
|
presetAmounts = [0.01, 0.1, 0.5, 1],
|
|
3498
3496
|
defaultAmount = 0.01,
|
|
3499
3497
|
metadata,
|
|
3500
|
-
externalGameId,
|
|
3501
3498
|
onAmountChange,
|
|
3502
3499
|
onSuccess,
|
|
3503
3500
|
onError
|
|
@@ -3572,12 +3569,11 @@ function CreateCustomGameSheet({
|
|
|
3572
3569
|
wagerAmount: effectiveAmount,
|
|
3573
3570
|
title,
|
|
3574
3571
|
maxPlayers,
|
|
3575
|
-
metadata
|
|
3576
|
-
externalGameId
|
|
3572
|
+
metadata
|
|
3577
3573
|
});
|
|
3578
3574
|
} catch {
|
|
3579
3575
|
}
|
|
3580
|
-
}, [effectiveAmount, wallet.publicKey, mutation.execute, title, maxPlayers, metadata
|
|
3576
|
+
}, [effectiveAmount, wallet.publicKey, mutation.execute, title, maxPlayers, metadata]);
|
|
3581
3577
|
const statusLabel = STATUS_LABELS2[mutation.status] || "";
|
|
3582
3578
|
const playersLabel = playerCount === 2 ? "2 (1v1)" : `${playerCount} players`;
|
|
3583
3579
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
@@ -4216,9 +4212,309 @@ var styles10 = import_react_native15.StyleSheet.create({
|
|
|
4216
4212
|
fontWeight: "700"
|
|
4217
4213
|
}
|
|
4218
4214
|
});
|
|
4215
|
+
|
|
4216
|
+
// src/ui/game/ClaimPrizeSheet.tsx
|
|
4217
|
+
var import_react22 = require("react");
|
|
4218
|
+
var import_react_native16 = require("react-native");
|
|
4219
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
4220
|
+
var STATUS_LABELS4 = {
|
|
4221
|
+
building: "Building transaction...",
|
|
4222
|
+
signing: "Approve in wallet...",
|
|
4223
|
+
success: "Claimed!"
|
|
4224
|
+
};
|
|
4225
|
+
function ClaimPrizeSheet({
|
|
4226
|
+
visible,
|
|
4227
|
+
onDismiss,
|
|
4228
|
+
gameId,
|
|
4229
|
+
prizeAmount,
|
|
4230
|
+
onSuccess,
|
|
4231
|
+
onError
|
|
4232
|
+
}) {
|
|
4233
|
+
const t = useDubsTheme();
|
|
4234
|
+
const { wallet } = useDubs();
|
|
4235
|
+
const mutation = useClaim();
|
|
4236
|
+
const overlayOpacity = (0, import_react22.useRef)(new import_react_native16.Animated.Value(0)).current;
|
|
4237
|
+
const celebrationScale = (0, import_react22.useRef)(new import_react_native16.Animated.Value(0)).current;
|
|
4238
|
+
const celebrationOpacity = (0, import_react22.useRef)(new import_react_native16.Animated.Value(0)).current;
|
|
4239
|
+
const [showCelebration, setShowCelebration] = (0, import_react22.useState)(false);
|
|
4240
|
+
(0, import_react22.useEffect)(() => {
|
|
4241
|
+
import_react_native16.Animated.timing(overlayOpacity, {
|
|
4242
|
+
toValue: visible ? 1 : 0,
|
|
4243
|
+
duration: 250,
|
|
4244
|
+
useNativeDriver: true
|
|
4245
|
+
}).start();
|
|
4246
|
+
}, [visible, overlayOpacity]);
|
|
4247
|
+
(0, import_react22.useEffect)(() => {
|
|
4248
|
+
if (visible) {
|
|
4249
|
+
mutation.reset();
|
|
4250
|
+
setShowCelebration(false);
|
|
4251
|
+
celebrationScale.setValue(0);
|
|
4252
|
+
celebrationOpacity.setValue(0);
|
|
4253
|
+
}
|
|
4254
|
+
}, [visible]);
|
|
4255
|
+
(0, import_react22.useEffect)(() => {
|
|
4256
|
+
if (mutation.status === "success" && mutation.data) {
|
|
4257
|
+
setShowCelebration(true);
|
|
4258
|
+
import_react_native16.Animated.parallel([
|
|
4259
|
+
import_react_native16.Animated.spring(celebrationScale, {
|
|
4260
|
+
toValue: 1,
|
|
4261
|
+
tension: 50,
|
|
4262
|
+
friction: 6,
|
|
4263
|
+
useNativeDriver: true
|
|
4264
|
+
}),
|
|
4265
|
+
import_react_native16.Animated.timing(celebrationOpacity, {
|
|
4266
|
+
toValue: 1,
|
|
4267
|
+
duration: 300,
|
|
4268
|
+
useNativeDriver: true
|
|
4269
|
+
})
|
|
4270
|
+
]).start();
|
|
4271
|
+
onSuccess?.(mutation.data);
|
|
4272
|
+
const timer = setTimeout(() => {
|
|
4273
|
+
onDismiss();
|
|
4274
|
+
}, 2500);
|
|
4275
|
+
return () => clearTimeout(timer);
|
|
4276
|
+
}
|
|
4277
|
+
}, [mutation.status, mutation.data]);
|
|
4278
|
+
(0, import_react22.useEffect)(() => {
|
|
4279
|
+
if (mutation.status === "error" && mutation.error) {
|
|
4280
|
+
onError?.(mutation.error);
|
|
4281
|
+
}
|
|
4282
|
+
}, [mutation.status, mutation.error]);
|
|
4283
|
+
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
4284
|
+
const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
|
|
4285
|
+
const handleClaim = (0, import_react22.useCallback)(async () => {
|
|
4286
|
+
if (!wallet.publicKey) return;
|
|
4287
|
+
try {
|
|
4288
|
+
await mutation.execute({
|
|
4289
|
+
playerWallet: wallet.publicKey.toBase58(),
|
|
4290
|
+
gameId
|
|
4291
|
+
});
|
|
4292
|
+
} catch {
|
|
4293
|
+
}
|
|
4294
|
+
}, [wallet.publicKey, mutation.execute, gameId]);
|
|
4295
|
+
const statusLabel = STATUS_LABELS4[mutation.status] || "";
|
|
4296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4297
|
+
import_react_native16.Modal,
|
|
4298
|
+
{
|
|
4299
|
+
visible,
|
|
4300
|
+
animationType: "slide",
|
|
4301
|
+
transparent: true,
|
|
4302
|
+
onRequestClose: onDismiss,
|
|
4303
|
+
children: [
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Animated.View, { style: [styles11.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.TouchableOpacity, { style: styles11.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
4305
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4306
|
+
import_react_native16.KeyboardAvoidingView,
|
|
4307
|
+
{
|
|
4308
|
+
style: styles11.keyboardView,
|
|
4309
|
+
behavior: import_react_native16.Platform.OS === "ios" ? "padding" : void 0,
|
|
4310
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.View, { style: styles11.sheetPositioner, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.View, { style: [styles11.sheet, { backgroundColor: t.background }], children: [
|
|
4311
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.View, { style: styles11.handleRow, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.View, { style: [styles11.handle, { backgroundColor: t.textMuted }] }) }),
|
|
4312
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.View, { style: styles11.header, children: [
|
|
4313
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.headerTitle, { color: t.text }], children: showCelebration ? "Prize Claimed!" : "Claim Prize" }),
|
|
4314
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.TouchableOpacity, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
4315
|
+
] }),
|
|
4316
|
+
showCelebration && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4317
|
+
import_react_native16.Animated.View,
|
|
4318
|
+
{
|
|
4319
|
+
style: [
|
|
4320
|
+
styles11.celebrationContainer,
|
|
4321
|
+
{
|
|
4322
|
+
opacity: celebrationOpacity,
|
|
4323
|
+
transform: [{ scale: celebrationScale }]
|
|
4324
|
+
}
|
|
4325
|
+
],
|
|
4326
|
+
children: [
|
|
4327
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: styles11.celebrationEmoji, children: "\u{1F3C6}" }),
|
|
4328
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.Text, { style: [styles11.celebrationText, { color: t.success }], children: [
|
|
4329
|
+
"+",
|
|
4330
|
+
prizeAmount,
|
|
4331
|
+
" SOL"
|
|
4332
|
+
] }),
|
|
4333
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.celebrationSubtext, { color: t.textMuted }], children: "Winnings sent to your wallet" })
|
|
4334
|
+
]
|
|
4335
|
+
}
|
|
4336
|
+
),
|
|
4337
|
+
!showCelebration && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.View, { style: [styles11.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4338
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.View, { style: styles11.summaryRow, children: [
|
|
4339
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Prize" }),
|
|
4340
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.Text, { style: [styles11.summaryValue, { color: t.success }], children: [
|
|
4341
|
+
prizeAmount,
|
|
4342
|
+
" SOL"
|
|
4343
|
+
] })
|
|
4344
|
+
] }),
|
|
4345
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.View, { style: [styles11.summarySep, { backgroundColor: t.border }] }),
|
|
4346
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.View, { style: styles11.summaryRow, children: [
|
|
4347
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Game" }),
|
|
4348
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4349
|
+
import_react_native16.Text,
|
|
4350
|
+
{
|
|
4351
|
+
style: [styles11.summaryValue, { color: t.text }],
|
|
4352
|
+
numberOfLines: 1,
|
|
4353
|
+
children: [
|
|
4354
|
+
gameId.slice(0, 8),
|
|
4355
|
+
"...",
|
|
4356
|
+
gameId.slice(-4)
|
|
4357
|
+
]
|
|
4358
|
+
}
|
|
4359
|
+
)
|
|
4360
|
+
] })
|
|
4361
|
+
] }),
|
|
4362
|
+
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.View, { style: [styles11.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
4363
|
+
!showCelebration && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4364
|
+
import_react_native16.TouchableOpacity,
|
|
4365
|
+
{
|
|
4366
|
+
style: [
|
|
4367
|
+
styles11.ctaButton,
|
|
4368
|
+
{ backgroundColor: canClaim ? t.success : t.border }
|
|
4369
|
+
],
|
|
4370
|
+
disabled: !canClaim,
|
|
4371
|
+
onPress: handleClaim,
|
|
4372
|
+
activeOpacity: 0.8,
|
|
4373
|
+
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.View, { style: styles11.ctaLoading, children: [
|
|
4374
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.ActivityIndicator, { size: "small", color: "#FFFFFF" }),
|
|
4375
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: styles11.ctaText, children: statusLabel })
|
|
4376
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native16.Text, { style: [styles11.ctaText, !canClaim && { opacity: 0.5 }], children: [
|
|
4377
|
+
"Claim Prize \u2014 ",
|
|
4378
|
+
prizeAmount,
|
|
4379
|
+
" SOL"
|
|
4380
|
+
] })
|
|
4381
|
+
}
|
|
4382
|
+
),
|
|
4383
|
+
mutation.data?.explorerUrl && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native16.Text, { style: [styles11.explorerHint, { color: t.textMuted }], children: "View on Solscan" })
|
|
4384
|
+
] }) })
|
|
4385
|
+
}
|
|
4386
|
+
)
|
|
4387
|
+
]
|
|
4388
|
+
}
|
|
4389
|
+
);
|
|
4390
|
+
}
|
|
4391
|
+
var styles11 = import_react_native16.StyleSheet.create({
|
|
4392
|
+
overlay: {
|
|
4393
|
+
...import_react_native16.StyleSheet.absoluteFillObject,
|
|
4394
|
+
backgroundColor: "rgba(0,0,0,0.5)"
|
|
4395
|
+
},
|
|
4396
|
+
overlayTap: {
|
|
4397
|
+
flex: 1
|
|
4398
|
+
},
|
|
4399
|
+
keyboardView: {
|
|
4400
|
+
flex: 1,
|
|
4401
|
+
justifyContent: "flex-end"
|
|
4402
|
+
},
|
|
4403
|
+
sheetPositioner: {
|
|
4404
|
+
justifyContent: "flex-end"
|
|
4405
|
+
},
|
|
4406
|
+
sheet: {
|
|
4407
|
+
borderTopLeftRadius: 24,
|
|
4408
|
+
borderTopRightRadius: 24,
|
|
4409
|
+
paddingHorizontal: 20,
|
|
4410
|
+
paddingBottom: 40
|
|
4411
|
+
},
|
|
4412
|
+
handleRow: {
|
|
4413
|
+
alignItems: "center",
|
|
4414
|
+
paddingTop: 10,
|
|
4415
|
+
paddingBottom: 8
|
|
4416
|
+
},
|
|
4417
|
+
handle: {
|
|
4418
|
+
width: 36,
|
|
4419
|
+
height: 4,
|
|
4420
|
+
borderRadius: 2,
|
|
4421
|
+
opacity: 0.4
|
|
4422
|
+
},
|
|
4423
|
+
header: {
|
|
4424
|
+
flexDirection: "row",
|
|
4425
|
+
alignItems: "center",
|
|
4426
|
+
justifyContent: "space-between",
|
|
4427
|
+
paddingVertical: 12
|
|
4428
|
+
},
|
|
4429
|
+
headerTitle: {
|
|
4430
|
+
fontSize: 20,
|
|
4431
|
+
fontWeight: "700"
|
|
4432
|
+
},
|
|
4433
|
+
closeButton: {
|
|
4434
|
+
fontSize: 20,
|
|
4435
|
+
padding: 4
|
|
4436
|
+
},
|
|
4437
|
+
// Celebration
|
|
4438
|
+
celebrationContainer: {
|
|
4439
|
+
alignItems: "center",
|
|
4440
|
+
paddingVertical: 32,
|
|
4441
|
+
gap: 8
|
|
4442
|
+
},
|
|
4443
|
+
celebrationEmoji: {
|
|
4444
|
+
fontSize: 64
|
|
4445
|
+
},
|
|
4446
|
+
celebrationText: {
|
|
4447
|
+
fontSize: 32,
|
|
4448
|
+
fontWeight: "800"
|
|
4449
|
+
},
|
|
4450
|
+
celebrationSubtext: {
|
|
4451
|
+
fontSize: 14,
|
|
4452
|
+
marginTop: 4
|
|
4453
|
+
},
|
|
4454
|
+
// Summary
|
|
4455
|
+
summaryCard: {
|
|
4456
|
+
marginTop: 20,
|
|
4457
|
+
borderRadius: 16,
|
|
4458
|
+
borderWidth: 1,
|
|
4459
|
+
overflow: "hidden"
|
|
4460
|
+
},
|
|
4461
|
+
summaryRow: {
|
|
4462
|
+
flexDirection: "row",
|
|
4463
|
+
alignItems: "center",
|
|
4464
|
+
justifyContent: "space-between",
|
|
4465
|
+
paddingHorizontal: 16,
|
|
4466
|
+
paddingVertical: 14
|
|
4467
|
+
},
|
|
4468
|
+
summaryLabel: {
|
|
4469
|
+
fontSize: 14
|
|
4470
|
+
},
|
|
4471
|
+
summaryValue: {
|
|
4472
|
+
fontSize: 15,
|
|
4473
|
+
fontWeight: "700"
|
|
4474
|
+
},
|
|
4475
|
+
summarySep: {
|
|
4476
|
+
height: 1,
|
|
4477
|
+
marginHorizontal: 16
|
|
4478
|
+
},
|
|
4479
|
+
// Error
|
|
4480
|
+
errorBox: {
|
|
4481
|
+
marginTop: 16,
|
|
4482
|
+
borderRadius: 12,
|
|
4483
|
+
borderWidth: 1,
|
|
4484
|
+
padding: 12
|
|
4485
|
+
},
|
|
4486
|
+
errorText: {
|
|
4487
|
+
fontSize: 13,
|
|
4488
|
+
fontWeight: "500"
|
|
4489
|
+
},
|
|
4490
|
+
// CTA
|
|
4491
|
+
ctaButton: {
|
|
4492
|
+
marginTop: 20,
|
|
4493
|
+
height: 56,
|
|
4494
|
+
borderRadius: 14,
|
|
4495
|
+
justifyContent: "center",
|
|
4496
|
+
alignItems: "center"
|
|
4497
|
+
},
|
|
4498
|
+
ctaText: {
|
|
4499
|
+
color: "#FFFFFF",
|
|
4500
|
+
fontSize: 16,
|
|
4501
|
+
fontWeight: "700"
|
|
4502
|
+
},
|
|
4503
|
+
ctaLoading: {
|
|
4504
|
+
flexDirection: "row",
|
|
4505
|
+
alignItems: "center",
|
|
4506
|
+
gap: 10
|
|
4507
|
+
},
|
|
4508
|
+
explorerHint: {
|
|
4509
|
+
textAlign: "center",
|
|
4510
|
+
marginTop: 12,
|
|
4511
|
+
fontSize: 13
|
|
4512
|
+
}
|
|
4513
|
+
});
|
|
4219
4514
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4220
4515
|
0 && (module.exports = {
|
|
4221
4516
|
AuthGate,
|
|
4517
|
+
ClaimPrizeSheet,
|
|
4222
4518
|
ConnectWalletScreen,
|
|
4223
4519
|
CreateCustomGameSheet,
|
|
4224
4520
|
DEFAULT_BASE_URL,
|