Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/new-maps-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Fix account linking for ecosystem smart wallets
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 <LoadingScreen />;
}

if (activeWallet.id === "inApp") {
if (wallet.id === "inApp") {
return (
<Suspense fallback={<LoadingScreen />}>
<InAppWalletConnectUI
walletConnect={props.walletConnect}
wallet={activeWallet as Wallet<"inApp">}
wallet={wallet as Wallet<"inApp">}
done={() => {
setTimeout(() => {
queryClient.invalidateQueries({ queryKey: ["profiles"] });
Expand All @@ -63,11 +67,11 @@ export function LinkProfileScreen(props: {
);
}

if (isEcosystemWallet(activeWallet)) {
if (isEcosystemWallet(wallet)) {
return (
<Suspense fallback={<LoadingScreen />}>
<EcosystemWalletConnectUI
wallet={activeWallet as Wallet<EcosystemWalletId>}
wallet={wallet as Wallet<EcosystemWalletId>}
done={() => {
setTimeout(() => {
queryClient.invalidateQueries({ queryKey: ["profiles"] });
Expand Down
Loading