@dubsdotapp/expo 0.2.19 → 0.2.20
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 +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +31 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -48
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useClaim.ts +2 -1
- package/src/hooks/useCreateCustomGame.ts +2 -1
- package/src/hooks/useCreateGame.ts +2 -1
- package/src/hooks/useJoinGame.ts +2 -1
- package/src/managed-wallet.tsx +14 -7
- package/src/utils/transaction.ts +9 -2
- package/src/wallet/phantom-deeplink/phantom-deeplink-adapter.ts +0 -40
package/dist/index.d.mts
CHANGED
|
@@ -625,7 +625,6 @@ declare class PhantomDeeplinkAdapter implements WalletAdapter {
|
|
|
625
625
|
connect(): Promise<void>;
|
|
626
626
|
disconnect(): void;
|
|
627
627
|
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
628
|
-
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
629
628
|
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
630
629
|
/** Remove the Linking event listener. Call when the adapter is no longer needed. */
|
|
631
630
|
destroy(): void;
|
|
@@ -864,8 +863,10 @@ declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers,
|
|
|
864
863
|
|
|
865
864
|
/**
|
|
866
865
|
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
|
866
|
+
* Prefers signAndSendTransaction if available (MWA), otherwise falls back to
|
|
867
|
+
* signTransaction + sendRawTransaction via RPC (Phantom deeplinks).
|
|
867
868
|
* Returns the transaction signature.
|
|
868
869
|
*/
|
|
869
|
-
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
|
|
870
|
+
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
|
|
870
871
|
|
|
871
872
|
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, 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, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
package/dist/index.d.ts
CHANGED
|
@@ -625,7 +625,6 @@ declare class PhantomDeeplinkAdapter implements WalletAdapter {
|
|
|
625
625
|
connect(): Promise<void>;
|
|
626
626
|
disconnect(): void;
|
|
627
627
|
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
628
|
-
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
629
628
|
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
630
629
|
/** Remove the Linking event listener. Call when the adapter is no longer needed. */
|
|
631
630
|
destroy(): void;
|
|
@@ -864,8 +863,10 @@ declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers,
|
|
|
864
863
|
|
|
865
864
|
/**
|
|
866
865
|
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
|
866
|
+
* Prefers signAndSendTransaction if available (MWA), otherwise falls back to
|
|
867
|
+
* signTransaction + sendRawTransaction via RPC (Phantom deeplinks).
|
|
867
868
|
* Returns the transaction signature.
|
|
868
869
|
*/
|
|
869
|
-
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
|
|
870
|
+
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
|
|
870
871
|
|
|
871
872
|
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, 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, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
package/dist/index.js
CHANGED
|
@@ -971,38 +971,6 @@ var PhantomDeeplinkAdapter = class {
|
|
|
971
971
|
console.log(TAG2, "Decrypted signed transaction, length:", data.transaction?.length);
|
|
972
972
|
return import_web32.Transaction.from(import_bs582.default.decode(data.transaction));
|
|
973
973
|
}
|
|
974
|
-
async signAndSendTransaction(transaction) {
|
|
975
|
-
this.assertConnected();
|
|
976
|
-
console.log(TAG2, "signAndSendTransaction() \u2014 serializing transaction");
|
|
977
|
-
const serializedTx = import_bs582.default.encode(
|
|
978
|
-
transaction.serialize({ requireAllSignatures: false, verifySignatures: false })
|
|
979
|
-
);
|
|
980
|
-
console.log(TAG2, "Transaction serialized, length:", serializedTx.length);
|
|
981
|
-
const { nonce, ciphertext } = encryptPayload(
|
|
982
|
-
{ transaction: serializedTx, session: this._sessionToken },
|
|
983
|
-
this._sharedSecret
|
|
984
|
-
);
|
|
985
|
-
const requestId = nextRequestId();
|
|
986
|
-
const redirectLink = this.config.redirectUri;
|
|
987
|
-
console.log(TAG2, `signAndSendTransaction() requestId=${requestId}`);
|
|
988
|
-
const params = new URLSearchParams({
|
|
989
|
-
dapp_encryption_public_key: import_bs582.default.encode(this._dappKeyPair.publicKey),
|
|
990
|
-
nonce,
|
|
991
|
-
payload: ciphertext,
|
|
992
|
-
redirect_link: redirectLink
|
|
993
|
-
});
|
|
994
|
-
const url = `https://phantom.app/ul/v1/signAndSendTransaction?${params.toString()}`;
|
|
995
|
-
console.log(TAG2, "Opening Phantom signAndSendTransaction deeplink...");
|
|
996
|
-
const response = await this.handler.send(url, requestId, this.timeout);
|
|
997
|
-
console.log(TAG2, "Received signAndSendTransaction response");
|
|
998
|
-
const data = decryptPayload(
|
|
999
|
-
response.params.data,
|
|
1000
|
-
response.params.nonce,
|
|
1001
|
-
this._sharedSecret
|
|
1002
|
-
);
|
|
1003
|
-
console.log(TAG2, "Transaction sent! Signature:", data.signature);
|
|
1004
|
-
return data.signature;
|
|
1005
|
-
}
|
|
1006
974
|
async signMessage(message) {
|
|
1007
975
|
this.assertConnected();
|
|
1008
976
|
console.log(TAG2, "signMessage() \u2014 message length:", message.length);
|
|
@@ -1327,12 +1295,23 @@ function ManagedWalletProvider({
|
|
|
1327
1295
|
}
|
|
1328
1296
|
return;
|
|
1329
1297
|
}
|
|
1330
|
-
console.log(TAG3, "Phantom path \u2014 clearing any saved session, will require fresh connect");
|
|
1331
|
-
await storage.deleteItem(STORAGE_KEYS.PHANTOM_SESSION).catch(() => {
|
|
1332
|
-
});
|
|
1333
1298
|
try {
|
|
1299
|
+
const savedSession = await storage.getItem(STORAGE_KEYS.PHANTOM_SESSION);
|
|
1300
|
+
if (savedSession && !cancelled) {
|
|
1301
|
+
const session = JSON.parse(savedSession);
|
|
1302
|
+
console.log(TAG3, "Found saved Phantom session, restoring for wallet:", session.walletPublicKey);
|
|
1303
|
+
phantom.restoreSession(session);
|
|
1304
|
+
if (!cancelled) {
|
|
1305
|
+
console.log(TAG3, "Phantom reconnected from saved session");
|
|
1306
|
+
setConnected(true);
|
|
1307
|
+
}
|
|
1308
|
+
} else {
|
|
1309
|
+
console.log(TAG3, "No saved Phantom session");
|
|
1310
|
+
}
|
|
1334
1311
|
} catch (err) {
|
|
1335
|
-
console.log(TAG3, "
|
|
1312
|
+
console.log(TAG3, "Phantom session restore failed:", err instanceof Error ? err.message : err);
|
|
1313
|
+
await storage.deleteItem(STORAGE_KEYS.PHANTOM_SESSION).catch(() => {
|
|
1314
|
+
});
|
|
1336
1315
|
} finally {
|
|
1337
1316
|
if (!cancelled) {
|
|
1338
1317
|
console.log(TAG3, "Phantom init complete, marking ready");
|
|
@@ -1549,7 +1528,7 @@ var import_react6 = require("react");
|
|
|
1549
1528
|
|
|
1550
1529
|
// src/utils/transaction.ts
|
|
1551
1530
|
var import_web33 = require("@solana/web3.js");
|
|
1552
|
-
async function signAndSendBase64Transaction(base64Tx, wallet) {
|
|
1531
|
+
async function signAndSendBase64Transaction(base64Tx, wallet, connection) {
|
|
1553
1532
|
if (!wallet.publicKey) throw new Error("Wallet not connected");
|
|
1554
1533
|
const binaryStr = atob(base64Tx);
|
|
1555
1534
|
const bytes = new Uint8Array(binaryStr.length);
|
|
@@ -1560,12 +1539,14 @@ async function signAndSendBase64Transaction(base64Tx, wallet) {
|
|
|
1560
1539
|
if (wallet.signAndSendTransaction) {
|
|
1561
1540
|
return wallet.signAndSendTransaction(transaction);
|
|
1562
1541
|
}
|
|
1563
|
-
|
|
1542
|
+
const signed = await wallet.signTransaction(transaction);
|
|
1543
|
+
const signature = await connection.sendRawTransaction(signed.serialize());
|
|
1544
|
+
return signature;
|
|
1564
1545
|
}
|
|
1565
1546
|
|
|
1566
1547
|
// src/hooks/useCreateGame.ts
|
|
1567
1548
|
function useCreateGame() {
|
|
1568
|
-
const { client, wallet } = useDubs();
|
|
1549
|
+
const { client, wallet, connection } = useDubs();
|
|
1569
1550
|
const [status, setStatus] = (0, import_react6.useState)("idle");
|
|
1570
1551
|
const [error, setError] = (0, import_react6.useState)(null);
|
|
1571
1552
|
const [data, setData] = (0, import_react6.useState)(null);
|
|
@@ -1586,7 +1567,8 @@ function useCreateGame() {
|
|
|
1586
1567
|
console.log("[useCreateGame] Step 2: Signing and sending...");
|
|
1587
1568
|
const signature = await signAndSendBase64Transaction(
|
|
1588
1569
|
createResult.transaction,
|
|
1589
|
-
wallet
|
|
1570
|
+
wallet,
|
|
1571
|
+
connection
|
|
1590
1572
|
);
|
|
1591
1573
|
console.log("[useCreateGame] Step 2 done. Signature:", signature);
|
|
1592
1574
|
setStatus("confirming");
|
|
@@ -1626,7 +1608,7 @@ function useCreateGame() {
|
|
|
1626
1608
|
// src/hooks/useJoinGame.ts
|
|
1627
1609
|
var import_react7 = require("react");
|
|
1628
1610
|
function useJoinGame() {
|
|
1629
|
-
const { client, wallet } = useDubs();
|
|
1611
|
+
const { client, wallet, connection } = useDubs();
|
|
1630
1612
|
const [status, setStatus] = (0, import_react7.useState)("idle");
|
|
1631
1613
|
const [error, setError] = (0, import_react7.useState)(null);
|
|
1632
1614
|
const [data, setData] = (0, import_react7.useState)(null);
|
|
@@ -1647,7 +1629,8 @@ function useJoinGame() {
|
|
|
1647
1629
|
console.log("[useJoinGame] Step 2: Signing and sending transaction...");
|
|
1648
1630
|
const signature = await signAndSendBase64Transaction(
|
|
1649
1631
|
joinResult.transaction,
|
|
1650
|
-
wallet
|
|
1632
|
+
wallet,
|
|
1633
|
+
connection
|
|
1651
1634
|
);
|
|
1652
1635
|
console.log("[useJoinGame] Step 2 done. Signature:", signature);
|
|
1653
1636
|
setStatus("confirming");
|
|
@@ -1688,7 +1671,7 @@ function useJoinGame() {
|
|
|
1688
1671
|
// src/hooks/useClaim.ts
|
|
1689
1672
|
var import_react8 = require("react");
|
|
1690
1673
|
function useClaim() {
|
|
1691
|
-
const { client, wallet } = useDubs();
|
|
1674
|
+
const { client, wallet, connection } = useDubs();
|
|
1692
1675
|
const [status, setStatus] = (0, import_react8.useState)("idle");
|
|
1693
1676
|
const [error, setError] = (0, import_react8.useState)(null);
|
|
1694
1677
|
const [data, setData] = (0, import_react8.useState)(null);
|
|
@@ -1709,7 +1692,8 @@ function useClaim() {
|
|
|
1709
1692
|
console.log("[useClaim] Step 2: Signing and sending...");
|
|
1710
1693
|
const signature = await signAndSendBase64Transaction(
|
|
1711
1694
|
claimResult.transaction,
|
|
1712
|
-
wallet
|
|
1695
|
+
wallet,
|
|
1696
|
+
connection
|
|
1713
1697
|
);
|
|
1714
1698
|
console.log("[useClaim] Step 2 done. Signature:", signature);
|
|
1715
1699
|
const explorerUrl = `https://solscan.io/tx/${signature}`;
|
|
@@ -1736,7 +1720,7 @@ function useClaim() {
|
|
|
1736
1720
|
// src/hooks/useCreateCustomGame.ts
|
|
1737
1721
|
var import_react9 = require("react");
|
|
1738
1722
|
function useCreateCustomGame() {
|
|
1739
|
-
const { client, wallet } = useDubs();
|
|
1723
|
+
const { client, wallet, connection } = useDubs();
|
|
1740
1724
|
const [status, setStatus] = (0, import_react9.useState)("idle");
|
|
1741
1725
|
const [error, setError] = (0, import_react9.useState)(null);
|
|
1742
1726
|
const [data, setData] = (0, import_react9.useState)(null);
|
|
@@ -1757,7 +1741,8 @@ function useCreateCustomGame() {
|
|
|
1757
1741
|
console.log("[useCreateCustomGame] Step 2: Signing and sending...");
|
|
1758
1742
|
const signature = await signAndSendBase64Transaction(
|
|
1759
1743
|
createResult.transaction,
|
|
1760
|
-
wallet
|
|
1744
|
+
wallet,
|
|
1745
|
+
connection
|
|
1761
1746
|
);
|
|
1762
1747
|
console.log("[useCreateCustomGame] Step 2 done. Signature:", signature);
|
|
1763
1748
|
setStatus("confirming");
|