Skip to content

Commit dd3d1e9

Browse files
[SDK] feat: Optional wallet activation during connection
1 parent ca22e46 commit dd3d1e9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Allow connecting wallets without setting them as active with useConnect

packages/thirdweb/src/wallets/manager/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export type ConnectionManager = ReturnType<typeof createConnectionManager>;
2424
export type ConnectManagerOptions = {
2525
client: ThirdwebClient;
2626
accountAbstraction?: SmartWalletOptions;
27+
setWalletAsActive?: boolean;
2728
onConnect?: (wallet: Wallet) => void;
2829
};
2930

@@ -146,7 +147,9 @@ export function createConnectionManager(storage: AsyncStorage) {
146147
// add personal wallet to connected wallets list even if it's not the active one
147148
addConnectedWallet(wallet);
148149

149-
handleSetActiveWallet(activeWallet);
150+
if (options?.setWalletAsActive !== false) {
151+
handleSetActiveWallet(activeWallet);
152+
}
150153

151154
wallet.subscribe("accountChanged", async () => {
152155
// We reimplement connect here to prevent memory leaks

0 commit comments

Comments
 (0)