Skip to content

Commit 295c3b0

Browse files
committed
Moving project ID to client side environment variable
1 parent feab0d8 commit 295c3b0

5 files changed

Lines changed: 8 additions & 5 deletions

File tree

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ CERAMIC_PRIVATE_KEY=""
1919
# Special Aggregation Model ID (you can leave this as-is)
2020
AGGREGATION_ID="kjzl6hvfrbw6cbe5nn2fktpmpbq42ouepa91pjv899k01yluz6r1zuq5phlliaq"
2121

22+
# Client-side project ID variable from walletconnect
23+
NEXT_PUBLIC_PROJECT_ID=""
24+
2225

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ A default value for this environment variable has been provided for you within t
3838

3939
**PROJECT_ID**
4040

41-
We will be using [WalletConnect's](https://walletconnect.com/) Web3Modal for Web3 authentication. In your [_app.tsx](./src/pages/_app.tsx) file, you will need to enter an active value for the `PROJECT_ID` constant defined on line 10.
41+
We will be using [WalletConnect's](https://walletconnect.com/) Web3Modal for Web3 authentication. In your new .env file, assign your project id to the key labeled `NEXT_PUBLIC_PROJECT_ID`.
4242

4343
You can set up a developer account for free by visiting [cloud.walletconnect.com](https://cloud.walletconnect.com/sign-in). Once authenticated, create a new app and copy over the "Project ID" value (found in the dashboard view for that corresponding app).
4444

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/env.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const env = createEnv({
3434
*/
3535
client: {
3636
// NEXT_PUBLIC_CLIENTVAR: z.string(),
37+
NEXT_PUBLIC_PROJECT_ID: z.string(),
3738
},
3839

3940
/**
@@ -48,6 +49,7 @@ export const env = createEnv({
4849
DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET,
4950
CERAMIC_PRIVATE_KEY: process.env.CERAMIC_PRIVATE_KEY,
5051
AGGREGATION_ID: process.env.AGGREGATION_ID,
52+
NEXT_PUBLIC_PROJECT_ID: process.env.NEXT_PUBLIC_PROJECT_ID,
5153
},
5254
/**
5355
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially

src/pages/_app.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import { SessionProvider } from "next-auth/react";
44
import { WagmiConfig } from "wagmi";
55
import { mainnet } from "wagmi/chains";
66
import { createWeb3Modal, defaultWagmiConfig } from "@web3modal/wagmi/react";
7+
import {env} from "@/env";
78
import "@/styles/globals.css";
89

9-
const PROJECT_ID = "";
10+
const PROJECT_ID = env.NEXT_PUBLIC_PROJECT_ID ?? "";
1011

1112
const chains = [mainnet];
1213
const wagmiConfig = defaultWagmiConfig({ chains, projectId: PROJECT_ID });

0 commit comments

Comments
 (0)