diff --git a/.env.example b/.env.example index 6642c2c52c..d1c57bab82 100644 --- a/.env.example +++ b/.env.example @@ -40,4 +40,7 @@ NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING= NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING= # Redefine -NEXT_PUBLIC_REDEFINE_API= \ No newline at end of file +NEXT_PUBLIC_REDEFINE_API= + +# Default chain id +NEXT_PUBLIC_DEFAULT_CHAIN_ID=5611 \ No newline at end of file diff --git a/README.md b/README.md index c2bdf1146f..1521170ec9 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ Here's the list of all the required and optional variables: | `NEXT_PUBLIC_FIREBASE_VAPID_KEY_PRODUCTION` | optional | FCM vapid key on production | `NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING` | optional | FCM `initializeApp` options on staging | `NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING` | optional | FCM vapid key on staging +| `NEXT_DEFAULT_CHAIN_ID` | optional | Default chain id to use when connecting to a wallet If you don't provide some of the optional vars, the corresponding features will be disabled in the UI. diff --git a/src/config/constants.ts b/src/config/constants.ts index 7edd0dd2e1..a92612d589 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -98,3 +98,6 @@ export const IS_OFFICIAL_HOST = process.env.NEXT_PUBLIC_IS_OFFICIAL_HOST === 'tr export const REDEFINE_SIMULATION_URL = 'https://dashboard.redefine.net/reports/' export const REDEFINE_API = process.env.NEXT_PUBLIC_REDEFINE_API export const REDEFINE_ARTICLE = 'https://safe.mirror.xyz/rInLWZwD_sf7enjoFerj6FIzCYmVMGrrV8Nhg4THdwI' + +// Default chain id +export const DEFAULT_CHAIN_ID = process.env.NEXT_PUBLIC_DEFAULT_CHAIN_ID || chains.eth diff --git a/src/hooks/useChainId.ts b/src/hooks/useChainId.ts index 8be8d525ff..69be7f52b8 100644 --- a/src/hooks/useChainId.ts +++ b/src/hooks/useChainId.ts @@ -1,6 +1,6 @@ import { useParams } from 'next/navigation' import { parse, type ParsedUrlQuery } from 'querystring' -import { IS_PRODUCTION } from '@/config/constants' +import { DEFAULT_CHAIN_ID } from '@/config/constants' import chains from '@/config/chains' import { useAppSelector } from '@/store' import { selectSession } from '@/store/sessionSlice' @@ -9,7 +9,7 @@ import { prefixedAddressRe } from '@/utils/url' import useWallet from './wallets/useWallet' import useChains from './useChains' -const defaultChainId = IS_PRODUCTION ? chains.eth : chains.gor +const defaultChainId = DEFAULT_CHAIN_ID // Use the location object directly because Next.js's router.query is available only on mount const getLocationQuery = (): ParsedUrlQuery => {