From 45bc82862fd1f9044ca83c941baef2ffa06b2afd Mon Sep 17 00:00:00 2001 From: tom Date: Mon, 8 Dec 2025 09:34:16 +0100 Subject: [PATCH] Promote Credit Wallet in WalletConnect for all Creditcoin chains Resolves #3162 --- configs/app/features/blockchainInteraction.ts | 5 +++-- deploy/tools/envs-validator/schemas/services.ts | 2 ++ deploy/tools/envs-validator/test/.env.base | 1 + docs/ENVS.md | 5 +++-- ui/shared/Web3ModalProvider.tsx | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/configs/app/features/blockchainInteraction.ts b/configs/app/features/blockchainInteraction.ts index ce8709f6b6..bbf91b46ff 100644 --- a/configs/app/features/blockchainInteraction.ts +++ b/configs/app/features/blockchainInteraction.ts @@ -1,14 +1,14 @@ import type { Feature } from './types'; import chain from '../chain'; -import { getEnvValue } from '../utils'; +import { getEnvValue, parseEnvJson } from '../utils'; import opSuperchain from './opSuperchain'; const walletConnectProjectId = getEnvValue('NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID'); const title = 'Blockchain interaction (writing to contract, etc.)'; -const config: Feature<{ walletConnect: { projectId: string } }> = (() => { +const config: Feature<{ walletConnect: { projectId: string; featuredWalletIds: Array } }> = (() => { // all chain parameters are required for wagmi provider // @wagmi/chains/dist/index.d.ts @@ -32,6 +32,7 @@ const config: Feature<{ walletConnect: { projectId: string } }> = (() => { isEnabled: true, walletConnect: { projectId: walletConnectProjectId, + featuredWalletIds: parseEnvJson>(getEnvValue('NEXT_PUBLIC_WALLET_CONNECT_FEATURED_WALLET_IDS')) ?? [], }, }); } diff --git a/deploy/tools/envs-validator/schemas/services.ts b/deploy/tools/envs-validator/schemas/services.ts index bf6600704d..93cc23eea7 100644 --- a/deploy/tools/envs-validator/schemas/services.ts +++ b/deploy/tools/envs-validator/schemas/services.ts @@ -4,6 +4,8 @@ import * as yup from 'yup'; // External services envs export default yup.object({ NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: yup.string(), + NEXT_PUBLIC_WALLET_CONNECT_FEATURED_WALLET_IDS: yup.array().transform(replaceQuotes).json().of(yup.string()), + NEXT_PUBLIC_RE_CAPTCHA_APP_SITE_KEY: yup.string(), NEXT_PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: yup.string(), NEXT_PUBLIC_GROWTH_BOOK_CLIENT_KEY: yup.string(), diff --git a/deploy/tools/envs-validator/test/.env.base b/deploy/tools/envs-validator/test/.env.base index d1653846c8..8f73e4586b 100644 --- a/deploy/tools/envs-validator/test/.env.base +++ b/deploy/tools/envs-validator/test/.env.base @@ -1,6 +1,7 @@ NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN=https://rollbar.com NEXT_PUBLIC_IS_ACCOUNT_SUPPORTED=true NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=xxx +NEXT_PUBLIC_WALLET_CONNECT_FEATURED_WALLET_IDS=['xxx'] NEXT_PUBLIC_RE_CAPTCHA_APP_SITE_KEY=xxx NEXT_PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID=UA-XXXXXX-X NEXT_PUBLIC_MIXPANEL_PROJECT_TOKEN=xxx diff --git a/docs/ENVS.md b/docs/ENVS.md index b7995c763e..3a5b632fe7 100644 --- a/docs/ENVS.md +++ b/docs/ENVS.md @@ -8,7 +8,7 @@ The app instance can be customized by passing the following variables to the Nod Please note that in the tables below, the "Compulsoriness" column indicates whether the variable is required for starting up the application, except for the "App Features" section. All features are optional by definition; therefore, the "Compulsoriness" column indicates whether a certain variable is required or optional only within the context of that feature, not for the entire application. ### Disclaimer about using variables -Please be aware that all environment variables prefixed with `NEXT_PUBLIC_` will be exposed to the browser. So any user can obtain its values. Make sure that for all 3rd-party services keys (e.g., Auth0, WalletConnect, etc.) in the services administration panel you have created a whitelist of allowed origins and have added your app domain into it. That will help you prevent using your key by unauthorized app, if someone gets its value. +Please be aware that all environment variables prefixed with `NEXT_PUBLIC_` will be exposed to the browser. So any user can obtain its values. Make sure that for all 3rd-party services keys (e.g., Auth0, Reown, etc.) in the services administration panel you have created a whitelist of allowed origins and have added your app domain into it. That will help you prevent using your key by unauthorized app, if someone gets its value. ### Note about escaping variables values All json-like values should be single-quoted. If it contains a hash (`#`) or a dollar-sign (`$`) the whole value should be wrapped in single quotes as well (see `dotenv` [readme](https://github.com/bkeepers/dotenv#variable-substitution) for the reference) @@ -449,7 +449,8 @@ This feature is **enabled by default**. To switch it off pass `NEXT_PUBLIC_ADVAN | Variable | Type| Description | Compulsoriness | Default value | Example value | Version | | --- | --- | --- | --- | --- | --- | --- | -| NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID | `string` | Project id for [WalletConnect](https://cloud.walletconnect.com/) integration | Required | - | `` | v1.0.x+ | +| NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID | `string` | Project id for [Reown AppKit](https://cloud.reown.com//) integration | Required | - | `` | v1.0.x+ | +| NEXT_PUBLIC_WALLET_CONNECT_FEATURED_WALLET_IDS | `Array` | List of [featured wallet IDs](https://docs.reown.com/appkit/react/core/options#featuredwalletids) in the "Connect your wallet" modal. To obtain the wallet ID, please use [WalletGuild](https://walletguide.walletconnect.network). | - | - | `['c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576']` | upcoming | | NEXT_PUBLIC_NETWORK_RPC_URL | `string` | See in [Blockchain parameters](#blockchain-parameters) section | Required | - | `https://core.poa.network` | v1.0.x+ | | NEXT_PUBLIC_NETWORK_NAME | `string` | See in [Blockchain parameters](#blockchain-parameters) section | Required | - | `Gnosis Chain` | v1.0.x+ | | NEXT_PUBLIC_NETWORK_ID | `number` | See in [Blockchain parameters](#blockchain-parameters) section | Required | - | `99` | v1.0.x+ | diff --git a/ui/shared/Web3ModalProvider.tsx b/ui/shared/Web3ModalProvider.tsx index b62ba2599d..bb012760e6 100644 --- a/ui/shared/Web3ModalProvider.tsx +++ b/ui/shared/Web3ModalProvider.tsx @@ -43,7 +43,7 @@ const init = () => { '--w3m-border-radius-master': '2px', '--w3m-z-index': zIndex?.modal2?.value, }, - featuredWalletIds: [], + featuredWalletIds: feature.walletConnect.featuredWalletIds, allowUnsupportedChain: true, }); } catch (error) {}