diff --git a/.changeset/new-maps-enjoy.md b/.changeset/new-maps-enjoy.md
new file mode 100644
index 00000000000..31b47264dbf
--- /dev/null
+++ b/.changeset/new-maps-enjoy.md
@@ -0,0 +1,5 @@
+---
+"thirdweb": patch
+---
+
+Fix account linking for ecosystem smart wallets
diff --git a/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/LinkProfileScreen.tsx b/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/LinkProfileScreen.tsx
index dcfac333282..caed3ecfb32 100644
--- a/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/LinkProfileScreen.tsx
+++ b/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/LinkProfileScreen.tsx
@@ -7,6 +7,7 @@ import { isEcosystemWallet } from "../../../../../wallets/ecosystem/is-ecosystem
import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
import type { EcosystemWalletId } from "../../../../../wallets/wallet-types.js";
import { iconSize } from "../../../../core/design-system/index.js";
+import { useActiveWallet } from "../../../../core/hooks/wallets/useActiveWallet.js";
import { useActiveWalletChain } from "../../../../core/hooks/wallets/useActiveWalletChain.js";
import { useAdminWallet } from "../../../../core/hooks/wallets/useAdminWallet.js";
import EcosystemWalletConnectUI from "../../../wallets/ecosystem/EcosystemWalletConnectUI.js";
@@ -28,20 +29,23 @@ export function LinkProfileScreen(props: {
client: ThirdwebClient;
walletConnect: { projectId?: string } | undefined;
}) {
- const activeWallet = useAdminWallet();
+ const adminWallet = useAdminWallet();
+ const activeWallet = useActiveWallet();
const chain = useActiveWalletChain();
const queryClient = useQueryClient();
- if (!activeWallet) {
+ const wallet = adminWallet || activeWallet;
+
+ if (!wallet) {
return ;
}
- if (activeWallet.id === "inApp") {
+ if (wallet.id === "inApp") {
return (
}>
}
+ wallet={wallet as Wallet<"inApp">}
done={() => {
setTimeout(() => {
queryClient.invalidateQueries({ queryKey: ["profiles"] });
@@ -63,11 +67,11 @@ export function LinkProfileScreen(props: {
);
}
- if (isEcosystemWallet(activeWallet)) {
+ if (isEcosystemWallet(wallet)) {
return (
}>
}
+ wallet={wallet as Wallet}
done={() => {
setTimeout(() => {
queryClient.invalidateQueries({ queryKey: ["profiles"] });