Skip to content

Commit 94e2d5b

Browse files
[SDK] fix: Account linking for ecosystem smart wallets (#6074)
1 parent 40fa323 commit 94e2d5b

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.changeset/new-maps-enjoy.md

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+
Fix account linking for ecosystem smart wallets

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/LinkProfileScreen.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { isEcosystemWallet } from "../../../../../wallets/ecosystem/is-ecosystem
77
import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
88
import type { EcosystemWalletId } from "../../../../../wallets/wallet-types.js";
99
import { iconSize } from "../../../../core/design-system/index.js";
10+
import { useActiveWallet } from "../../../../core/hooks/wallets/useActiveWallet.js";
1011
import { useActiveWalletChain } from "../../../../core/hooks/wallets/useActiveWalletChain.js";
1112
import { useAdminWallet } from "../../../../core/hooks/wallets/useAdminWallet.js";
1213
import EcosystemWalletConnectUI from "../../../wallets/ecosystem/EcosystemWalletConnectUI.js";
@@ -28,20 +29,23 @@ export function LinkProfileScreen(props: {
2829
client: ThirdwebClient;
2930
walletConnect: { projectId?: string } | undefined;
3031
}) {
31-
const activeWallet = useAdminWallet();
32+
const adminWallet = useAdminWallet();
33+
const activeWallet = useActiveWallet();
3234
const chain = useActiveWalletChain();
3335
const queryClient = useQueryClient();
3436

35-
if (!activeWallet) {
37+
const wallet = adminWallet || activeWallet;
38+
39+
if (!wallet) {
3640
return <LoadingScreen />;
3741
}
3842

39-
if (activeWallet.id === "inApp") {
43+
if (wallet.id === "inApp") {
4044
return (
4145
<Suspense fallback={<LoadingScreen />}>
4246
<InAppWalletConnectUI
4347
walletConnect={props.walletConnect}
44-
wallet={activeWallet as Wallet<"inApp">}
48+
wallet={wallet as Wallet<"inApp">}
4549
done={() => {
4650
setTimeout(() => {
4751
queryClient.invalidateQueries({ queryKey: ["profiles"] });
@@ -63,11 +67,11 @@ export function LinkProfileScreen(props: {
6367
);
6468
}
6569

66-
if (isEcosystemWallet(activeWallet)) {
70+
if (isEcosystemWallet(wallet)) {
6771
return (
6872
<Suspense fallback={<LoadingScreen />}>
6973
<EcosystemWalletConnectUI
70-
wallet={activeWallet as Wallet<EcosystemWalletId>}
74+
wallet={wallet as Wallet<EcosystemWalletId>}
7175
done={() => {
7276
setTimeout(() => {
7377
queryClient.invalidateQueries({ queryKey: ["profiles"] });

0 commit comments

Comments
 (0)