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
10 changes: 10 additions & 0 deletions apps/dashboard/src/@/components/blocks/BuyAndSwapEmbed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useTheme } from "next-themes";
import { useEffect, useMemo, useRef, useState } from "react";
import type { Chain } from "thirdweb";
import { BuyWidget, SwapWidget } from "thirdweb/react";
import type { Wallet } from "thirdweb/wallets";
import {
reportAssetBuyCancelled,
reportAssetBuyFailed,
Expand All @@ -25,6 +26,7 @@ import {
import { cn } from "@/lib/utils";
import { parseError } from "@/utils/errorParser";
import { getSDKTheme } from "@/utils/sdk-component-theme";
import { appMetadata } from "../../constants/connect";
import { getConfiguredThirdwebClient } from "../../constants/thirdweb.server";

type PageType = "asset" | "bridge" | "chain";
Expand All @@ -35,6 +37,7 @@ export function BuyAndSwapEmbed(props: {
buyAmount: string | undefined;
pageType: PageType;
isTestnet: boolean | undefined;
wallets?: Wallet[];
}) {
const { theme } = useTheme();
const [tab, setTab] = useState<"buy" | "swap">("swap");
Expand Down Expand Up @@ -91,6 +94,8 @@ export function BuyAndSwapEmbed(props: {
client={client}
connectOptions={{
autoConnect: false,
wallets: props.wallets,
appMetadata: appMetadata,
}}
onError={(e, quote) => {
const errorMessage = parseError(e);
Expand Down Expand Up @@ -184,6 +189,11 @@ export function BuyAndSwapEmbed(props: {
client={client}
theme={themeObj}
className="!rounded-2xl !border-none"
connectOptions={{
autoConnect: false,
wallets: props.wallets,
appMetadata: appMetadata,
}}
prefill={{
// buy this token by default
buyToken: {
Expand Down
13 changes: 3 additions & 10 deletions apps/dashboard/src/@/components/connect-wallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { resetAnalytics } from "@/analytics/reset";
import { CustomChainRenderer } from "@/components/misc/CustomChainRenderer";
import { LazyConfigureNetworkModal } from "@/components/misc/configure-networks/LazyConfigureNetworkModal";
import { Button } from "@/components/ui/button";
import { appMetadata } from "@/constants/connect";
import { popularChains } from "@/constants/popularChains";
import { useAllChainsData } from "@/hooks/chains/allChains";
import { useFavoriteChainIds } from "@/hooks/favorite-chains";
Expand Down Expand Up @@ -138,11 +139,7 @@ export const CustomConnectWallet = (props: {
return (
<>
<ConnectButton
appMetadata={{
logoUrl: "https://thirdweb.com/favicon.ico",
name: "thirdweb",
url: "https://thirdweb.com",
}}
appMetadata={appMetadata}
chain={props.chain}
chains={allChainsV5}
client={client}
Expand Down Expand Up @@ -280,11 +277,7 @@ export function useCustomConnectModal() {
return useCallback(
(options: { chain?: Chain; client: ThirdwebClient }) => {
return connect({
appMetadata: {
logoUrl: "https://thirdweb.com/favicon.ico",
name: "thirdweb",
url: "https://thirdweb.com",
},
appMetadata,
chain: options?.chain,
client: options.client,
privacyPolicyUrl: "/privacy-policy",
Expand Down
5 changes: 5 additions & 0 deletions apps/dashboard/src/@/constants/connect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const appMetadata = {
logoUrl: "https://thirdweb.com/favicon.ico",
name: "thirdweb",
url: "https://thirdweb.com",
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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

export function PublicPageConnectButton(props: {
connectButtonClassName?: string;
wallets?: Wallet[];
}) {
const { theme } = useTheme();
const t = theme === "light" ? "light" : "dark";
const { allChainsV5 } = useAllChainsData();

return (
<ConnectButton
appMetadata={{
logoUrl: "https://thirdweb.com/favicon.ico",
name: "thirdweb",
url: "https://thirdweb.com",
}}
appMetadata={appMetadata}
autoConnect={false}
chains={allChainsV5}
client={client}
Expand All @@ -38,6 +37,7 @@ export function PublicPageConnectButton(props: {
}}
// we have an AutoConnect already added in root layout with AA configuration
theme={getSDKTheme(t)}
wallets={props.wallets}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
useActiveWalletConnectionStatus,
} from "thirdweb/react";
import { Button } from "@/components/ui/button";
import { appMetadata } from "@/constants/connect";
import { useAllChainsData } from "@/hooks/chains/allChains";
import { cn } from "@/lib/utils";
import { getSDKTheme } from "@/utils/sdk-component-theme";
Expand Down Expand Up @@ -65,11 +66,7 @@ export const NebulaConnectWallet = (props: {
const { customDetailsButton } = props;
return (
<ConnectButton
appMetadata={{
logoUrl: "https://thirdweb.com/favicon.ico",
name: "thirdweb",
url: "https://thirdweb.com",
}}
appMetadata={appMetadata}
autoConnect={false}
chains={allChainsV5}
client={props.client}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
"use client";

import type { TokenInfo } from "thirdweb/react";
import { createWallet } from "thirdweb/wallets";
import { BuyAndSwapEmbed } from "@/components/blocks/BuyAndSwapEmbed";
import { appMetadata } from "@/constants/connect";
import { useV5DashboardChain } from "@/hooks/chains/v5-adapter";

export const bridgeWallets = [
createWallet("io.metamask"),
createWallet("com.coinbase.wallet", {
appMetadata,
}),
createWallet("me.rainbow"),
createWallet("io.rabby"),
createWallet("io.zerion.wallet"),
];

export function UniversalBridgeEmbed({
chainId,
token,
Expand All @@ -18,6 +30,7 @@ export function UniversalBridgeEmbed({
return (
<BuyAndSwapEmbed
chain={chain}
wallets={bridgeWallets}
buyAmount={amount}
tokenAddress={token?.address}
pageType="bridge"
Expand Down
6 changes: 5 additions & 1 deletion apps/dashboard/src/app/bridge/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ToggleThemeButton } from "@/components/blocks/color-mode-toggle";
import { cn } from "@/lib/utils";
import { PublicPageConnectButton } from "../../(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/_components/PublicPageConnectButton";
import { ThirdwebMiniLogo } from "../../(app)/components/ThirdwebMiniLogo";
import { bridgeWallets } from "./client/UniversalBridgeEmbed";

export function PageHeader(props: { containerClassName?: string }) {
return (
Expand Down Expand Up @@ -31,7 +32,10 @@ export function PageHeader(props: { containerClassName?: string }) {
Docs
</Link>
<ToggleThemeButton className="bg-transparent" />
<PublicPageConnectButton connectButtonClassName="!rounded-full" />
<PublicPageConnectButton
connectButtonClassName="!rounded-full"
wallets={bridgeWallets}
/>
</div>
</header>
</div>
Expand Down
Loading