File tree Expand file tree Collapse file tree 8 files changed +35
-12
lines changed Expand file tree Collapse file tree 8 files changed +35
-12
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " thirdweb " : patch
3
+ ---
4
+
5
+ Better handling for multiple accounts connected
Original file line number Diff line number Diff line change @@ -87,3 +87,9 @@ export {
87
87
type AutoConnectProps ,
88
88
} from "../react/core/hooks/connection/AutoConnect.js" ;
89
89
export { useAutoConnect } from "../react/core/hooks/connection/useAutoConnect.js" ;
90
+
91
+ // wallet info
92
+ export {
93
+ useWalletInfo ,
94
+ useWalletImage ,
95
+ } from "../react/web/ui/hooks/useWalletInfo.js" ;
Original file line number Diff line number Diff line change @@ -129,3 +129,9 @@ export {
129
129
useConnectModal ,
130
130
type UseConnectModalOptions ,
131
131
} from "../react/web/ui/ConnectWallet/useConnectModal.js" ;
132
+
133
+ // wallet info
134
+ export {
135
+ useWalletInfo ,
136
+ useWalletImage ,
137
+ } from "../react/web/ui/hooks/useWalletInfo.js" ;
Original file line number Diff line number Diff line change @@ -96,5 +96,6 @@ export type {
96
96
97
97
export { getAllWalletsList } from "../wallets/getAllWalletsList.js" ;
98
98
export { getWalletInfo } from "../wallets/__generated__/getWalletInfo.js" ;
99
+ export { type WalletInfo } from "../wallets/wallet-info.js" ;
99
100
100
101
export { createWalletAdapter } from "../adapters/wallet-adapter.js" ;
Original file line number Diff line number Diff line change 9
9
} from "../../wallets/in-app/core/authentication/index.js" ;
10
10
11
11
export { hasStoredPasskey } from "../../wallets/in-app/web/lib/auth/passkeys.js" ;
12
+
13
+ export { socialIcons } from "../../react/web/wallets/in-app/socialIcons.js" ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import type { WalletInfo } from "../../../../wallets/wallet-info.js";
4
4
import type { WalletId } from "../../../../wallets/wallet-types.js" ;
5
5
6
6
/**
7
- * @internal
7
+ * Returns the wallet info for the provided wallet id.
8
8
*/
9
9
export function useWalletInfo ( id : WalletId ) {
10
10
return useQuery < WalletInfo > ( {
@@ -17,7 +17,7 @@ export function useWalletInfo(id: WalletId) {
17
17
}
18
18
19
19
/**
20
- * @internal
20
+ * Returns the wallet image for the provided wallet id.
21
21
*/
22
22
export function useWalletImage ( id : WalletId ) {
23
23
return useQuery ( {
Original file line number Diff line number Diff line change @@ -73,15 +73,17 @@ export function createConnectionManager(storage: AsyncStorage) {
73
73
} ;
74
74
75
75
const onWalletDisconnect = ( wallet : Wallet ) => {
76
- const currentMap = walletIdToConnectedWalletMap . getValue ( ) ;
77
76
deleteConnectParamsFromStorage ( storage , wallet . id ) ;
77
+ removeConnectedWallet ( wallet ) ;
78
78
79
- const newMap = new Map ( currentMap ) ;
80
- newMap . delete ( wallet . id ) ;
81
-
82
- walletIdToConnectedWalletMap . setValue ( newMap ) ;
79
+ // there are still connected wallets, switch to the next one
80
+ if ( connectedWallets . getValue ( ) . length > 0 ) {
81
+ const nextWallet = connectedWallets . getValue ( ) [ 0 ] as Wallet ;
82
+ setActiveWallet ( nextWallet ) ;
83
+ return ;
84
+ }
83
85
84
- // if disconnecting the active wallet
86
+ // if disconnecting the last wallet
85
87
if ( activeWalletStore . getValue ( ) === wallet ) {
86
88
storage . removeItem ( LAST_ACTIVE_EOA_ID ) ;
87
89
activeAccountStore . setValue ( undefined ) ;
Original file line number Diff line number Diff line change @@ -280,17 +280,18 @@ async function initProvider(
280
280
if ( walletId !== "walletConnect" ) {
281
281
function handleSessionRequest ( ) {
282
282
const preferNative =
283
- walletInfo . mobile . native || walletInfo . mobile . universal ;
283
+ provider . session ?. peer ?. metadata ?. redirect ?. native ||
284
+ walletInfo . mobile . native ||
285
+ walletInfo . mobile . universal ;
284
286
285
287
if ( isReactNative ( ) ) {
286
288
const { Linking } = require ( "react-native" ) ;
287
- const appUrl = preferNative ;
288
- if ( ! appUrl ) {
289
+ if ( ! preferNative ) {
289
290
throw new Error (
290
291
"No app url found for wallet connect to redirect to." ,
291
292
) ;
292
293
}
293
- Linking . openURL ( appUrl ) ;
294
+ Linking . openURL ( preferNative ) ;
294
295
return ;
295
296
}
296
297
You can’t perform that action at this time.
0 commit comments