diff --git a/apps/dashboard/src/app/bridge/components/client/Providers.client.tsx b/apps/dashboard/src/app/bridge/components/client/Providers.client.tsx new file mode 100644 index 00000000000..f76044fbf44 --- /dev/null +++ b/apps/dashboard/src/app/bridge/components/client/Providers.client.tsx @@ -0,0 +1,20 @@ +"use client"; +import { ThemeProvider } from "next-themes"; +import { Toaster } from "sonner"; +import { ThirdwebProvider } from "thirdweb/react"; + +export function Providers({ children }: { children: React.ReactNode }) { + return ( + + + {children} + + + + ); +} diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(bridge)/bridge/components/client/UniversalBridgeEmbed.tsx b/apps/dashboard/src/app/bridge/components/client/UniversalBridgeEmbed.tsx similarity index 57% rename from apps/dashboard/src/app/(app)/(dashboard)/(bridge)/bridge/components/client/UniversalBridgeEmbed.tsx rename to apps/dashboard/src/app/bridge/components/client/UniversalBridgeEmbed.tsx index 000ccd47908..0ba8ed0ba1d 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(bridge)/bridge/components/client/UniversalBridgeEmbed.tsx +++ b/apps/dashboard/src/app/bridge/components/client/UniversalBridgeEmbed.tsx @@ -1,21 +1,18 @@ "use client"; -import { getSDKTheme } from "app/(app)/components/sdk-component-theme"; -import { useV5DashboardChain } from "lib/v5-adapter"; import { useTheme } from "next-themes"; -import type { ThirdwebClient } from "thirdweb"; import { PayEmbed } from "thirdweb/react"; +import { getSDKTheme } from "../../../(app)/components/sdk-component-theme"; +import { useV5DashboardChain } from "../../../../lib/v5-adapter"; +import { bridgeAppThirdwebClient } from "../../constants"; -export function UniversalBridgeEmbed({ - chainId, - client, -}: { chainId?: number; client: ThirdwebClient }) { +export function UniversalBridgeEmbed({ chainId }: { chainId?: number }) { const { theme } = useTheme(); const chain = useV5DashboardChain(chainId || 1); return ( + + {children} + + + ); +} diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(bridge)/bridge/page.tsx b/apps/dashboard/src/app/bridge/page.tsx similarity index 82% rename from apps/dashboard/src/app/(app)/(dashboard)/(bridge)/bridge/page.tsx rename to apps/dashboard/src/app/bridge/page.tsx index 7301c834584..0b3d256c6d4 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(bridge)/bridge/page.tsx +++ b/apps/dashboard/src/app/bridge/page.tsx @@ -1,6 +1,5 @@ import { ArrowUpRightIcon } from "lucide-react"; import type { Metadata } from "next"; -import { getClientThirdwebClient } from "../../../../../@/constants/thirdweb-client.client"; import { UniversalBridgeEmbed } from "./components/client/UniversalBridgeEmbed"; const title = "Universal Bridge: Swap, Bridge, and Onramp"; @@ -16,18 +15,14 @@ export const metadata: Metadata = { }, }; -export default async function RoutesPage({ +export default async function BridgePage({ searchParams, -}: { searchParams: Record }) { - const { chainId } = searchParams; - const client = getClientThirdwebClient(undefined); +}: { searchParams: Promise> }) { + const { chainId } = await searchParams; return (
- +
{/* eslint-disable-next-line @next/next/no-img-element */} @@ -37,7 +32,7 @@ export default async function RoutesPage({ className="-bottom-12 -right-12 pointer-events-none absolute lg:right-0 lg:bottom-0" /> -
+
diff --git a/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx b/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx index ce437bdfdb1..5b948c09299 100644 --- a/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +++ b/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx @@ -78,6 +78,13 @@ export function SwapConfirmationScreen(props: { message: "Your wallet rejected the approval request.", }; } + if (error.toLowerCase().includes("insufficient funds for gas")) { + return { + title: "Insufficient Native Funds", + message: + "You do not have enough native funds to approve the transaction.", + }; + } return { title: "Failed to Approve", message: @@ -96,6 +103,13 @@ export function SwapConfirmationScreen(props: { message: "Your wallet rejected the confirmation request.", }; } + if (error.toLowerCase().includes("insufficient funds for gas")) { + return { + title: "Insufficient Native Funds", + message: + "You do not have enough native funds to confirm the transaction.", + }; + } return { title: "Failed to Confirm", message: @@ -333,6 +347,7 @@ export function SwapConfirmationScreen(props: { } catch (e) { console.error(e); setStatus("error"); + setError((e as Error).message); } } }} diff --git a/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx b/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx index 1118c8cc296..e90cb641fdf 100644 --- a/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +++ b/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx @@ -126,6 +126,13 @@ export function TransferConfirmationScreen( message: "Your wallet rejected the approval request.", }; } + if (status.error.toLowerCase().includes("insufficient funds for gas")) { + return { + title: "Insufficient Native Funds", + message: + "You do not have enough native funds to approve the transaction.", + }; + } return { title: "Failed to Approve", message: @@ -138,12 +145,23 @@ export function TransferConfirmationScreen( status.id === "error" && status.error ) { - if (status.error.toLowerCase().includes("user rejected")) { + if ( + status.error.toLowerCase().includes("user rejected") || + status.error.toLowerCase().includes("user closed modal") || + status.error.toLowerCase().includes("user denied") + ) { return { title: "Failed to Confirm", message: "Your wallet rejected the confirmation request.", }; } + if (status.error.toLowerCase().includes("insufficient funds for gas")) { + return { + title: "Insufficient Native Funds", + message: + "You do not have enough native funds to confirm the transaction.", + }; + } return { title: "Failed to Confirm", message: