Skip to content

Commit 915442e

Browse files
feat: enable wallet linking and guest mode for ecosystem wallets (#4740)
1 parent 89728c6 commit 915442e

File tree

5 files changed

+43
-1
lines changed

5 files changed

+43
-1
lines changed

.changeset/cuddly-parrots-laugh.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+
Enable wallet linking and guest mode for ecosystem wallets

packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/AnyWalletConnectUI.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ export function AnyWalletConnectUI(props: {
287287
client={props.client}
288288
size={props.size}
289289
meta={props.meta}
290+
walletConnect={props.walletConnect}
290291
connectLocale={props.connectLocale}
291292
/>
292293
</Suspense>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export function LinkProfileScreen(props: {
7878
title: props.locale.manageWallet.linkProfile,
7979
showThirdwebBranding: false,
8080
}}
81+
walletConnect={props.walletConnect}
8182
isLinking={true}
8283
goBack={props.onBack}
8384
/>

packages/thirdweb/src/react/web/wallets/ecosystem/EcosystemWalletConnectUI.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import {
88
useSetSelectionData,
99
} from "../../providers/wallet-ui-states-provider.js";
1010
import type { ConnectLocale } from "../../ui/ConnectWallet/locale/types.js";
11+
import { WalletAuth } from "../in-app/WalletAuth.js";
1112
import { useInAppWalletLocale } from "../in-app/useInAppWalletLocale.js";
1213
import type { ConnectWalletSelectUIState } from "../shared/ConnectWalletSocialOptions.js";
14+
import { GuestLogin } from "../shared/GuestLogin.js";
1315
import { LoadingScreen } from "../shared/LoadingScreen.js";
1416
import { OTPLoginUI } from "../shared/OTPLoginUI.js";
1517
import { PassKeyLogin } from "../shared/PassKeyLogin.js";
@@ -35,6 +37,7 @@ function EcosystemWalletConnectUI(props: {
3537
termsOfServiceUrl?: string;
3638
privacyPolicyUrl?: string;
3739
};
40+
walletConnect: { projectId?: string } | undefined;
3841
isLinking?: boolean;
3942
}) {
4043
const data = useSelectionData();
@@ -114,6 +117,37 @@ function EcosystemWalletConnectUI(props: {
114117
);
115118
}
116119

120+
if (state?.walletLogin) {
121+
return (
122+
<WalletAuth
123+
meta={props.meta}
124+
inAppLocale={locale}
125+
walletConnect={props.walletConnect}
126+
wallet={props.wallet}
127+
client={props.client}
128+
size={props.size}
129+
done={done}
130+
onBack={goBackToMain || (() => setSelectionData({}))}
131+
locale={props.connectLocale}
132+
/>
133+
);
134+
}
135+
136+
if (state?.guestLogin) {
137+
return (
138+
<GuestLogin
139+
locale={locale}
140+
done={done}
141+
goBack={goBackToMain}
142+
wallet={props.wallet}
143+
state={state}
144+
client={props.client}
145+
size={props.size}
146+
connectLocale={props.connectLocale}
147+
/>
148+
);
149+
}
150+
117151
return (
118152
<EcosystemWalletFormUIScreen
119153
select={() => {}}

packages/thirdweb/src/react/web/wallets/in-app/WalletAuth.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineChain } from "../../../../chains/utils.js";
33
import type { ThirdwebClient } from "../../../../client/client.js";
44
import { linkProfile } from "../../../../wallets/in-app/core/wallet/profiles.js";
55
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
6+
import type { EcosystemWalletId } from "../../../../wallets/wallet-types.js";
67
import { iconSize } from "../../../core/design-system/index.js";
78
import { useAddConnectedWallet } from "../../../core/hooks/wallets/useAddConnectedWallet.js";
89
import AllWalletsUI from "../../ui/ConnectWallet/Modal/AllWalletsUI.js";
@@ -18,7 +19,7 @@ import { LoadingState } from "../shared/LoadingState.js";
1819
import type { InAppWalletLocale } from "../shared/locale/types.js";
1920

2021
export function WalletAuth(props: {
21-
wallet: Wallet<"inApp">;
22+
wallet: Wallet<"inApp" | EcosystemWalletId>;
2223
client: ThirdwebClient;
2324
done: () => void;
2425
size: "compact" | "wide";

0 commit comments

Comments
 (0)