From 7ad520b7fba1de46971b6bf70dec5aa61746bc2f Mon Sep 17 00:00:00 2001 From: devinxl <94832688+devinxl@users.noreply.github.com> Date: Thu, 3 Dec 2026 10:33:08 +0800 Subject: [PATCH 1/2] fix(dcellar-web-ui): load the WalletConnect project ID at build time --- apps/dcellar-web-ui/.env.example | 3 +++ .../components/WalletConnectProvider.tsx | 14 ++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/dcellar-web-ui/.env.example b/apps/dcellar-web-ui/.env.example index 0ab4ee5c..9ef8e52d 100644 --- a/apps/dcellar-web-ui/.env.example +++ b/apps/dcellar-web-ui/.env.example @@ -1,4 +1,7 @@ # For local development, copy this file to .env.local and update the values as needed. +# WalletConnect Cloud project ID for this environment. Set it before running the Next.js build. +NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID= + NEXT_PUBLIC_ENV=development NEXT_PUBLIC_GOOGLE_ANALYTICS_ID='' diff --git a/apps/dcellar-web-ui/src/context/WalletConnectContext/components/WalletConnectProvider.tsx b/apps/dcellar-web-ui/src/context/WalletConnectContext/components/WalletConnectProvider.tsx index 86c51a2a..3098ff19 100644 --- a/apps/dcellar-web-ui/src/context/WalletConnectContext/components/WalletConnectProvider.tsx +++ b/apps/dcellar-web-ui/src/context/WalletConnectContext/components/WalletConnectProvider.tsx @@ -7,19 +7,25 @@ import { GREENFIELD_CHAIN_ID } from '@/base/env'; import { metaMask, trustWallet, walletConnect } from '@totejs/walletkit/wallets'; import * as Sentry from '@sentry/nextjs'; import { reportEvent } from '@/utils/gtag'; -import * as process from 'process'; import { ReactNode } from 'react'; import { customTheme } from '@/base/theme/wallet'; import { DCLink } from '@/components/common/DCLink'; +const walletConnectProjectId = process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID?.trim() ?? ''; + +if (typeof window !== 'undefined' && !walletConnectProjectId) { + console.warn( + 'WalletConnect is disabled. Set NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID before building dcellar-web-ui.', + ); +} + const config = createConfig( getDefaultConfig({ chains: [bscChain, greenFieldChain], appName: 'Connect a Wallet', autoConnect: true, - /* WC 2.0 requires a project ID (get one here: https://cloud.walletconnect.com/sign-in) */ - walletConnectProjectId: '89848e3205cafe0bf76c91aa1aaa71d0', - connectors: [trustWallet(), metaMask(), walletConnect()], + walletConnectProjectId, + connectors: [trustWallet(), metaMask(), ...(walletConnectProjectId ? [walletConnect()] : [])], }), ); From bc31784c3e9f5bc2832ef10ac2fd2264513b71ee Mon Sep 17 00:00:00 2001 From: devinxl <94832688+devinxl@users.noreply.github.com> Date: Thu, 3 Dec 2026 10:35:38 +0800 Subject: [PATCH 2/2] Keep the WalletConnect configuration warning lint-clean --- .../WalletConnectContext/components/WalletConnectProvider.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/dcellar-web-ui/src/context/WalletConnectContext/components/WalletConnectProvider.tsx b/apps/dcellar-web-ui/src/context/WalletConnectContext/components/WalletConnectProvider.tsx index 3098ff19..f5c0dc97 100644 --- a/apps/dcellar-web-ui/src/context/WalletConnectContext/components/WalletConnectProvider.tsx +++ b/apps/dcellar-web-ui/src/context/WalletConnectContext/components/WalletConnectProvider.tsx @@ -14,6 +14,7 @@ import { DCLink } from '@/components/common/DCLink'; const walletConnectProjectId = process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID?.trim() ?? ''; if (typeof window !== 'undefined' && !walletConnectProjectId) { + // eslint-disable-next-line no-console console.warn( 'WalletConnect is disabled. Set NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID before building dcellar-web-ui.', );