diff --git a/.changeset/thirty-cheetahs-matter.md b/.changeset/thirty-cheetahs-matter.md
new file mode 100644
index 00000000000..e222700a9ba
--- /dev/null
+++ b/.changeset/thirty-cheetahs-matter.md
@@ -0,0 +1,5 @@
+---
+"thirdweb": patch
+---
+
+Allow connecting wallets without setting them as active with useConnect
diff --git a/apps/portal/src/app/nebula/plugins/openAI/page.mdx b/apps/portal/src/app/nebula/plugins/openai/page.mdx
similarity index 100%
rename from apps/portal/src/app/nebula/plugins/openAI/page.mdx
rename to apps/portal/src/app/nebula/plugins/openai/page.mdx
diff --git a/packages/thirdweb/src/react/core/account/provider.tsx b/packages/thirdweb/src/react/core/account/provider.tsx
index 5209f829240..7fbb2aa046f 100644
--- a/packages/thirdweb/src/react/core/account/provider.tsx
+++ b/packages/thirdweb/src/react/core/account/provider.tsx
@@ -3,7 +3,6 @@
import type React from "react";
import { createContext, useContext } from "react";
import type { ThirdwebClient } from "../../../client/client.js";
-import { isAddress } from "../../../utils/address.js";
/**
* Props for the component
* @component
@@ -53,9 +52,6 @@ export function AccountProvider(
"AccountProvider: No address passed. Ensure an address is always provided to the AccountProvider",
);
}
- if (!isAddress(props.address)) {
- throw new Error(`AccountProvider: Invalid address: ${props.address}`);
- }
return (
{props.children}
diff --git a/packages/thirdweb/src/react/core/utils/walletname.ts b/packages/thirdweb/src/react/core/utils/walletname.ts
index dff60d34898..8c4d0df0a6b 100644
--- a/packages/thirdweb/src/react/core/utils/walletname.ts
+++ b/packages/thirdweb/src/react/core/utils/walletname.ts
@@ -24,7 +24,7 @@ export function useWalletName(props: {
/**
* @internal Exported for tests only
*/
-function getQueryKeys(props: {
+export function getQueryKeys(props: {
id: WalletId;
formatFn?: (str: string) => string;
}) {
@@ -41,7 +41,7 @@ function getQueryKeys(props: {
/**
* @internal Exported for tests only
*/
-async function fetchWalletName(props: {
+export async function fetchWalletName(props: {
id: WalletId;
formatFn?: (str: string) => string;
}) {
diff --git a/packages/thirdweb/src/wallets/manager/index.ts b/packages/thirdweb/src/wallets/manager/index.ts
index 3deb84395c0..473fec32632 100644
--- a/packages/thirdweb/src/wallets/manager/index.ts
+++ b/packages/thirdweb/src/wallets/manager/index.ts
@@ -24,6 +24,7 @@ export type ConnectionManager = ReturnType;
export type ConnectManagerOptions = {
client: ThirdwebClient;
accountAbstraction?: SmartWalletOptions;
+ setWalletAsActive?: boolean;
onConnect?: (wallet: Wallet) => void;
};
@@ -146,7 +147,9 @@ export function createConnectionManager(storage: AsyncStorage) {
// add personal wallet to connected wallets list even if it's not the active one
addConnectedWallet(wallet);
- handleSetActiveWallet(activeWallet);
+ if (options?.setWalletAsActive !== false) {
+ handleSetActiveWallet(activeWallet);
+ }
wallet.subscribe("accountChanged", async () => {
// We reimplement connect here to prevent memory leaks