Skip to content

Commit 3db3982

Browse files
committed
[MNY-270] Remove in-app wallet options from bridge page connect modal (#8270)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces a centralized `appMetadata` constant for consistent branding across various components and refactors the code to utilize this constant, reducing redundancy and improving maintainability. ### Detailed summary - Added `appMetadata` constant in `connect.ts`. - Refactored `NebulaConnectButton` to use `appMetadata`. - Updated `PageHeader` to include `wallets` prop in `PublicPageConnectButton`. - Created `bridgeWallets` array in `UniversalBridgeEmbed` using `createWallet` with `appMetadata`. - Modified multiple components to utilize `appMetadata` instead of hardcoded values. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Wallet selection is now customizable for Buy, Swap, and Bridge flows. * App branding metadata centralized for consistent presentation across all wallet connection points. * Bridge now includes preset wallet options to streamline onboarding and autoconnect behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent bf90104 commit 3db3982

File tree

7 files changed

+43
-21
lines changed

7 files changed

+43
-21
lines changed

apps/dashboard/src/@/components/blocks/BuyAndSwapEmbed.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useTheme } from "next-themes";
44
import { useEffect, useMemo, useRef, useState } from "react";
55
import type { Chain } from "thirdweb";
66
import { BuyWidget, SwapWidget } from "thirdweb/react";
7+
import type { Wallet } from "thirdweb/wallets";
78
import {
89
reportAssetBuyCancelled,
910
reportAssetBuyFailed,
@@ -25,6 +26,7 @@ import {
2526
import { cn } from "@/lib/utils";
2627
import { parseError } from "@/utils/errorParser";
2728
import { getSDKTheme } from "@/utils/sdk-component-theme";
29+
import { appMetadata } from "../../constants/connect";
2830
import { getConfiguredThirdwebClient } from "../../constants/thirdweb.server";
2931

3032
type PageType = "asset" | "bridge" | "chain";
@@ -35,6 +37,7 @@ export function BuyAndSwapEmbed(props: {
3537
buyAmount: string | undefined;
3638
pageType: PageType;
3739
isTestnet: boolean | undefined;
40+
wallets?: Wallet[];
3841
}) {
3942
const { theme } = useTheme();
4043
const [tab, setTab] = useState<"buy" | "swap">("swap");
@@ -91,6 +94,8 @@ export function BuyAndSwapEmbed(props: {
9194
client={client}
9295
connectOptions={{
9396
autoConnect: false,
97+
wallets: props.wallets,
98+
appMetadata: appMetadata,
9499
}}
95100
onError={(e, quote) => {
96101
const errorMessage = parseError(e);
@@ -184,6 +189,11 @@ export function BuyAndSwapEmbed(props: {
184189
client={client}
185190
theme={themeObj}
186191
className="!rounded-2xl !border-none"
192+
connectOptions={{
193+
autoConnect: false,
194+
wallets: props.wallets,
195+
appMetadata: appMetadata,
196+
}}
187197
prefill={{
188198
// buy this token by default
189199
buyToken: {

apps/dashboard/src/@/components/connect-wallet/index.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { resetAnalytics } from "@/analytics/reset";
1717
import { CustomChainRenderer } from "@/components/misc/CustomChainRenderer";
1818
import { LazyConfigureNetworkModal } from "@/components/misc/configure-networks/LazyConfigureNetworkModal";
1919
import { Button } from "@/components/ui/button";
20+
import { appMetadata } from "@/constants/connect";
2021
import { popularChains } from "@/constants/popularChains";
2122
import { useAllChainsData } from "@/hooks/chains/allChains";
2223
import { useFavoriteChainIds } from "@/hooks/favorite-chains";
@@ -138,11 +139,7 @@ export const CustomConnectWallet = (props: {
138139
return (
139140
<>
140141
<ConnectButton
141-
appMetadata={{
142-
logoUrl: "https://thirdweb.com/favicon.ico",
143-
name: "thirdweb",
144-
url: "https://thirdweb.com",
145-
}}
142+
appMetadata={appMetadata}
146143
chain={props.chain}
147144
chains={allChainsV5}
148145
client={client}
@@ -280,11 +277,7 @@ export function useCustomConnectModal() {
280277
return useCallback(
281278
(options: { chain?: Chain; client: ThirdwebClient }) => {
282279
return connect({
283-
appMetadata: {
284-
logoUrl: "https://thirdweb.com/favicon.ico",
285-
name: "thirdweb",
286-
url: "https://thirdweb.com",
287-
},
280+
appMetadata,
288281
chain: options?.chain,
289282
client: options.client,
290283
privacyPolicyUrl: "/privacy-policy",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const appMetadata = {
2+
logoUrl: "https://thirdweb.com/favicon.ico",
3+
name: "thirdweb",
4+
url: "https://thirdweb.com",
5+
};

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/_components/PublicPageConnectButton.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import { useTheme } from "next-themes";
44
import { ConnectButton } from "thirdweb/react";
5+
import type { Wallet } from "thirdweb/wallets";
6+
import { appMetadata } from "@/constants/connect";
57
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
68
import { useAllChainsData } from "@/hooks/chains/allChains";
79
import { getSDKTheme } from "@/utils/sdk-component-theme";
@@ -10,18 +12,15 @@ const client = getClientThirdwebClient();
1012

1113
export function PublicPageConnectButton(props: {
1214
connectButtonClassName?: string;
15+
wallets?: Wallet[];
1316
}) {
1417
const { theme } = useTheme();
1518
const t = theme === "light" ? "light" : "dark";
1619
const { allChainsV5 } = useAllChainsData();
1720

1821
return (
1922
<ConnectButton
20-
appMetadata={{
21-
logoUrl: "https://thirdweb.com/favicon.ico",
22-
name: "thirdweb",
23-
url: "https://thirdweb.com",
24-
}}
23+
appMetadata={appMetadata}
2524
autoConnect={false}
2625
chains={allChainsV5}
2726
client={client}
@@ -38,6 +37,7 @@ export function PublicPageConnectButton(props: {
3837
}}
3938
// we have an AutoConnect already added in root layout with AA configuration
4039
theme={getSDKTheme(t)}
40+
wallets={props.wallets}
4141
/>
4242
);
4343
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/ai/components/NebulaConnectButton.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
useActiveWalletConnectionStatus,
1212
} from "thirdweb/react";
1313
import { Button } from "@/components/ui/button";
14+
import { appMetadata } from "@/constants/connect";
1415
import { useAllChainsData } from "@/hooks/chains/allChains";
1516
import { cn } from "@/lib/utils";
1617
import { getSDKTheme } from "@/utils/sdk-component-theme";
@@ -65,11 +66,7 @@ export const NebulaConnectWallet = (props: {
6566
const { customDetailsButton } = props;
6667
return (
6768
<ConnectButton
68-
appMetadata={{
69-
logoUrl: "https://thirdweb.com/favicon.ico",
70-
name: "thirdweb",
71-
url: "https://thirdweb.com",
72-
}}
69+
appMetadata={appMetadata}
7370
autoConnect={false}
7471
chains={allChainsV5}
7572
client={props.client}

apps/dashboard/src/app/bridge/components/client/UniversalBridgeEmbed.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
"use client";
22

33
import type { TokenInfo } from "thirdweb/react";
4+
import { createWallet } from "thirdweb/wallets";
45
import { BuyAndSwapEmbed } from "@/components/blocks/BuyAndSwapEmbed";
6+
import { appMetadata } from "@/constants/connect";
57
import { useV5DashboardChain } from "@/hooks/chains/v5-adapter";
68

9+
export const bridgeWallets = [
10+
createWallet("io.metamask"),
11+
createWallet("com.coinbase.wallet", {
12+
appMetadata,
13+
}),
14+
createWallet("me.rainbow"),
15+
createWallet("io.rabby"),
16+
createWallet("io.zerion.wallet"),
17+
];
18+
719
export function UniversalBridgeEmbed({
820
chainId,
921
token,
@@ -18,6 +30,7 @@ export function UniversalBridgeEmbed({
1830
return (
1931
<BuyAndSwapEmbed
2032
chain={chain}
33+
wallets={bridgeWallets}
2134
buyAmount={amount}
2235
tokenAddress={token?.address}
2336
pageType="bridge"

apps/dashboard/src/app/bridge/components/header.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ToggleThemeButton } from "@/components/blocks/color-mode-toggle";
33
import { cn } from "@/lib/utils";
44
import { PublicPageConnectButton } from "../../(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/_components/PublicPageConnectButton";
55
import { ThirdwebMiniLogo } from "../../(app)/components/ThirdwebMiniLogo";
6+
import { bridgeWallets } from "./client/UniversalBridgeEmbed";
67

78
export function PageHeader(props: { containerClassName?: string }) {
89
return (
@@ -31,7 +32,10 @@ export function PageHeader(props: { containerClassName?: string }) {
3132
Docs
3233
</Link>
3334
<ToggleThemeButton className="bg-transparent" />
34-
<PublicPageConnectButton connectButtonClassName="!rounded-full" />
35+
<PublicPageConnectButton
36+
connectButtonClassName="!rounded-full"
37+
wallets={bridgeWallets}
38+
/>
3539
</div>
3640
</header>
3741
</div>

0 commit comments

Comments
 (0)