@dubsdotapp/expo 0.2.4 → 0.2.6
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 +46 -1
- package/dist/index.d.ts +46 -1
- package/dist/index.js +524 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +505 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +32 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useCreateCustomGame.ts +81 -0
- package/src/index.ts +7 -2
- package/src/provider.tsx +17 -5
- package/src/types.ts +18 -0
- package/src/ui/AuthGate.tsx +11 -9
- package/src/ui/game/CreateCustomGameSheet.tsx +423 -0
- package/src/ui/game/index.ts +2 -0
- package/src/ui/index.ts +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -89,6 +89,20 @@ interface CreateGameResult {
|
|
|
89
89
|
lockTimestamp: number;
|
|
90
90
|
event: UnifiedEvent;
|
|
91
91
|
}
|
|
92
|
+
interface CreateCustomGameParams {
|
|
93
|
+
playerWallet: string;
|
|
94
|
+
teamChoice: 'home' | 'away';
|
|
95
|
+
wagerAmount: number;
|
|
96
|
+
title?: string;
|
|
97
|
+
maxPlayers?: number;
|
|
98
|
+
metadata?: Record<string, unknown>;
|
|
99
|
+
}
|
|
100
|
+
interface CreateCustomGameResult {
|
|
101
|
+
gameId: string;
|
|
102
|
+
gameAddress: string;
|
|
103
|
+
transaction: string;
|
|
104
|
+
lockTimestamp: number;
|
|
105
|
+
}
|
|
92
106
|
interface JoinGameParams {
|
|
93
107
|
playerWallet: string;
|
|
94
108
|
gameId: string;
|
|
@@ -318,6 +332,8 @@ declare class DubsClient {
|
|
|
318
332
|
createGame(params: CreateGameParams): Promise<CreateGameResult>;
|
|
319
333
|
joinGame(params: JoinGameParams): Promise<JoinGameResult>;
|
|
320
334
|
confirmGame(params: ConfirmGameParams): Promise<ConfirmGameResult>;
|
|
335
|
+
createCustomGame(params: CreateCustomGameParams): Promise<CreateCustomGameResult>;
|
|
336
|
+
confirmCustomGame(params: ConfirmGameParams): Promise<ConfirmGameResult>;
|
|
321
337
|
buildClaimTransaction(params: BuildClaimParams): Promise<BuildClaimResult>;
|
|
322
338
|
getGame(gameId: string): Promise<GameDetail>;
|
|
323
339
|
getLiveScore(gameId: string): Promise<LiveScore | null>;
|
|
@@ -468,6 +484,7 @@ interface DubsContextValue {
|
|
|
468
484
|
appName: string;
|
|
469
485
|
network: DubsNetwork;
|
|
470
486
|
disconnect: () => Promise<void>;
|
|
487
|
+
uiConfig: UiConfig;
|
|
471
488
|
}
|
|
472
489
|
interface DubsProviderProps {
|
|
473
490
|
apiKey: string;
|
|
@@ -495,6 +512,7 @@ interface DubsProviderProps {
|
|
|
495
512
|
}
|
|
496
513
|
declare function DubsProvider({ apiKey, children, appName, network, wallet: externalWallet, tokenStorage, baseUrl: baseUrlOverride, rpcUrl: rpcUrlOverride, renderConnectScreen, renderLoading, renderError, renderRegistration, managed, }: DubsProviderProps): react_jsx_runtime.JSX.Element | null;
|
|
497
514
|
declare function useDubs(): DubsContextValue;
|
|
515
|
+
declare function useAppConfig(): UiConfig;
|
|
498
516
|
|
|
499
517
|
/** The `transact` function signature from @solana-mobile/mobile-wallet-adapter-protocol-web3js */
|
|
500
518
|
type MwaTransactFn = (callback: (wallet: any) => Promise<any>) => Promise<any>;
|
|
@@ -602,6 +620,20 @@ declare function useClaim(): {
|
|
|
602
620
|
reset: () => void;
|
|
603
621
|
};
|
|
604
622
|
|
|
623
|
+
interface CreateCustomGameMutationResult {
|
|
624
|
+
gameId: string;
|
|
625
|
+
gameAddress: string;
|
|
626
|
+
signature: string;
|
|
627
|
+
explorerUrl: string;
|
|
628
|
+
}
|
|
629
|
+
declare function useCreateCustomGame(): {
|
|
630
|
+
execute: (params: CreateCustomGameParams) => Promise<CreateCustomGameMutationResult>;
|
|
631
|
+
status: MutationStatus;
|
|
632
|
+
error: Error | null;
|
|
633
|
+
data: CreateCustomGameMutationResult | null;
|
|
634
|
+
reset: () => void;
|
|
635
|
+
};
|
|
636
|
+
|
|
605
637
|
interface UseAuthResult {
|
|
606
638
|
/** Current auth status */
|
|
607
639
|
status: AuthStatus;
|
|
@@ -747,10 +779,23 @@ interface JoinGameButtonProps {
|
|
|
747
779
|
*/
|
|
748
780
|
declare function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }: JoinGameButtonProps): react_jsx_runtime.JSX.Element | null;
|
|
749
781
|
|
|
782
|
+
interface CreateCustomGameSheetProps {
|
|
783
|
+
visible: boolean;
|
|
784
|
+
onDismiss: () => void;
|
|
785
|
+
title?: string;
|
|
786
|
+
maxPlayers?: number;
|
|
787
|
+
fee?: number;
|
|
788
|
+
presetAmounts?: number[];
|
|
789
|
+
metadata?: Record<string, unknown>;
|
|
790
|
+
onSuccess?: (result: CreateCustomGameMutationResult) => void;
|
|
791
|
+
onError?: (error: Error) => void;
|
|
792
|
+
}
|
|
793
|
+
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, metadata, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
794
|
+
|
|
750
795
|
/**
|
|
751
796
|
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
|
752
797
|
* Returns the transaction signature.
|
|
753
798
|
*/
|
|
754
799
|
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
|
|
755
800
|
|
|
756
|
-
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 CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, 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, 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, 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, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAuth, useClaim, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
|
801
|
+
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, 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, 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, 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, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
package/dist/index.d.ts
CHANGED
|
@@ -89,6 +89,20 @@ interface CreateGameResult {
|
|
|
89
89
|
lockTimestamp: number;
|
|
90
90
|
event: UnifiedEvent;
|
|
91
91
|
}
|
|
92
|
+
interface CreateCustomGameParams {
|
|
93
|
+
playerWallet: string;
|
|
94
|
+
teamChoice: 'home' | 'away';
|
|
95
|
+
wagerAmount: number;
|
|
96
|
+
title?: string;
|
|
97
|
+
maxPlayers?: number;
|
|
98
|
+
metadata?: Record<string, unknown>;
|
|
99
|
+
}
|
|
100
|
+
interface CreateCustomGameResult {
|
|
101
|
+
gameId: string;
|
|
102
|
+
gameAddress: string;
|
|
103
|
+
transaction: string;
|
|
104
|
+
lockTimestamp: number;
|
|
105
|
+
}
|
|
92
106
|
interface JoinGameParams {
|
|
93
107
|
playerWallet: string;
|
|
94
108
|
gameId: string;
|
|
@@ -318,6 +332,8 @@ declare class DubsClient {
|
|
|
318
332
|
createGame(params: CreateGameParams): Promise<CreateGameResult>;
|
|
319
333
|
joinGame(params: JoinGameParams): Promise<JoinGameResult>;
|
|
320
334
|
confirmGame(params: ConfirmGameParams): Promise<ConfirmGameResult>;
|
|
335
|
+
createCustomGame(params: CreateCustomGameParams): Promise<CreateCustomGameResult>;
|
|
336
|
+
confirmCustomGame(params: ConfirmGameParams): Promise<ConfirmGameResult>;
|
|
321
337
|
buildClaimTransaction(params: BuildClaimParams): Promise<BuildClaimResult>;
|
|
322
338
|
getGame(gameId: string): Promise<GameDetail>;
|
|
323
339
|
getLiveScore(gameId: string): Promise<LiveScore | null>;
|
|
@@ -468,6 +484,7 @@ interface DubsContextValue {
|
|
|
468
484
|
appName: string;
|
|
469
485
|
network: DubsNetwork;
|
|
470
486
|
disconnect: () => Promise<void>;
|
|
487
|
+
uiConfig: UiConfig;
|
|
471
488
|
}
|
|
472
489
|
interface DubsProviderProps {
|
|
473
490
|
apiKey: string;
|
|
@@ -495,6 +512,7 @@ interface DubsProviderProps {
|
|
|
495
512
|
}
|
|
496
513
|
declare function DubsProvider({ apiKey, children, appName, network, wallet: externalWallet, tokenStorage, baseUrl: baseUrlOverride, rpcUrl: rpcUrlOverride, renderConnectScreen, renderLoading, renderError, renderRegistration, managed, }: DubsProviderProps): react_jsx_runtime.JSX.Element | null;
|
|
497
514
|
declare function useDubs(): DubsContextValue;
|
|
515
|
+
declare function useAppConfig(): UiConfig;
|
|
498
516
|
|
|
499
517
|
/** The `transact` function signature from @solana-mobile/mobile-wallet-adapter-protocol-web3js */
|
|
500
518
|
type MwaTransactFn = (callback: (wallet: any) => Promise<any>) => Promise<any>;
|
|
@@ -602,6 +620,20 @@ declare function useClaim(): {
|
|
|
602
620
|
reset: () => void;
|
|
603
621
|
};
|
|
604
622
|
|
|
623
|
+
interface CreateCustomGameMutationResult {
|
|
624
|
+
gameId: string;
|
|
625
|
+
gameAddress: string;
|
|
626
|
+
signature: string;
|
|
627
|
+
explorerUrl: string;
|
|
628
|
+
}
|
|
629
|
+
declare function useCreateCustomGame(): {
|
|
630
|
+
execute: (params: CreateCustomGameParams) => Promise<CreateCustomGameMutationResult>;
|
|
631
|
+
status: MutationStatus;
|
|
632
|
+
error: Error | null;
|
|
633
|
+
data: CreateCustomGameMutationResult | null;
|
|
634
|
+
reset: () => void;
|
|
635
|
+
};
|
|
636
|
+
|
|
605
637
|
interface UseAuthResult {
|
|
606
638
|
/** Current auth status */
|
|
607
639
|
status: AuthStatus;
|
|
@@ -747,10 +779,23 @@ interface JoinGameButtonProps {
|
|
|
747
779
|
*/
|
|
748
780
|
declare function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }: JoinGameButtonProps): react_jsx_runtime.JSX.Element | null;
|
|
749
781
|
|
|
782
|
+
interface CreateCustomGameSheetProps {
|
|
783
|
+
visible: boolean;
|
|
784
|
+
onDismiss: () => void;
|
|
785
|
+
title?: string;
|
|
786
|
+
maxPlayers?: number;
|
|
787
|
+
fee?: number;
|
|
788
|
+
presetAmounts?: number[];
|
|
789
|
+
metadata?: Record<string, unknown>;
|
|
790
|
+
onSuccess?: (result: CreateCustomGameMutationResult) => void;
|
|
791
|
+
onError?: (error: Error) => void;
|
|
792
|
+
}
|
|
793
|
+
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, metadata, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
794
|
+
|
|
750
795
|
/**
|
|
751
796
|
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
|
752
797
|
* Returns the transaction signature.
|
|
753
798
|
*/
|
|
754
799
|
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
|
|
755
800
|
|
|
756
|
-
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 CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, 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, 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, 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, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAuth, useClaim, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
|
801
|
+
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, 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, 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, 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, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|