Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?


.env.local
81 changes: 35 additions & 46 deletions src/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { useState } from "react";
import { useAccount } from "wagmi";
import { ConnectButton } from "@rainbow-me/rainbowkit";
import { Link, useNavigate } from "react-router-dom";
import { useState } from "react"
import { useAccount } from "wagmi"
import { ConnectButton } from "@rainbow-me/rainbowkit"
import { Link, useNavigate } from "react-router-dom"

const Navbar = () => {
const [isOpen, setIsOpen] = useState(false);

const Account = useAccount();
const navigate = useNavigate();
const [isOpen, setIsOpen] = useState(false)
const { isConnected } = useAccount()
const navigate = useNavigate()

return (
<div className="py-5 bg-slate-950 flex flex-row justify-between align-middle flex-wrap px-4">
<div className="flex flex-row gap-6">
<Link to={"/"} className="flex items-center">
<img src="/Benelogo.svg" alt="" className="w-8 h-8 flex items mt-[1px]"/>
<span className=" text-2xl px-1 font-bold text-white">Bene</span>
<Link to="/" className="flex items-center">
<img
src="/Benelogo.svg"
alt="Bene logo"
className="w-8 h-8 mt-[1px]"
/>
<span className="text-2xl px-1 font-bold text-white">Bene</span>
</Link>

<div className="w-80 hidden md:block">
<label className="mb-2 text-sm font-medium sr-only bg-slate-950 text-white">
Search
</label>
<div className="relative">
<div className="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
<svg
Expand All @@ -31,23 +32,22 @@ const Navbar = () => {
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"
/>
</svg>
</div>
<input
type="search"
id="search"
className="block w-full p-2 ps-10 text-sm border rounded-sm bg-slate-900 border-slate-700 placeholder-zinc-400 text-white focus:ring-purple-800 focus:border-purple-800"
className="block w-full p-2 ps-10 text-sm border rounded-sm bg-slate-900 border-slate-700 placeholder-zinc-400 text-white focus:ring-purple-800 focus:border-purple-800"
placeholder="Search a Funding Vault"
required
/>
</div>
</div>
</div>

<button
className="text-white text-2xl xl:hidden"
onClick={() => setIsOpen(!isOpen)}
Expand All @@ -58,37 +58,26 @@ const Navbar = () => {
<div
className={`${
isOpen ? "block" : "hidden"
} xl:flex flex flex-col xl:flex-row xl:justify-items-center w-full xl:w-auto gap-4 mt-4 xl:mt-0`}
} xl:flex flex-col xl:flex-row w-full xl:w-auto gap-4 mt-4 xl:mt-0`}
>
{/* <button
// onClick={() => scrollToSection("skills")}
className="text-white text-lg sm:text-xl hover:bg-purple-800 px-5 rounded-sm shadow-md "
>
Skills
</button> */}

{Account.address ? (
{isConnected && (
<button
onClick={() => {
if (Account.address) navigate("/create");
}}
className="text-white bg-zinc-800 font-bold text-sm h-10 hover:bg-zinc-900 px-3 rounded-lg shadow-md "
onClick={() => navigate("/create")}
className="text-white bg-zinc-800 font-bold text-sm h-10 hover:bg-zinc-900 px-3 rounded-lg shadow-md"
>
Raise Funds for a New Project
</button>
) : (
<div></div>
)}
<div>
<ConnectButton
accountStatus={{
smallScreen: "avatar",
largeScreen: "full",
}}
/>
</div>

<ConnectButton
accountStatus={{
smallScreen: "avatar",
largeScreen: "full",
}}
/>
</div>
</div>
);
};
export default Navbar;
)
}

export default Navbar
Empty file added src/app/layout.tsx
Empty file.
20 changes: 20 additions & 0 deletions src/app/providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use client"

import { WagmiProvider } from "wagmi"
import { RainbowKitProvider } from "@rainbow-me/rainbowkit"
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { wagmiConfig } from "@/lib/wallet/config"

const queryClient = new QueryClient()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Move QueryClient instantiation into component state.

Creating the QueryClient at module level is an anti-pattern in React. The same instance will be shared across all component mounts, potentially causing stale cache issues, memory leaks, and unexpected behavior during hot reloads or in SSR contexts.

Apply this diff to instantiate the client per component:

-const queryClient = new QueryClient()
-
 export function Providers({ children }: { children: React.ReactNode }) {
+  const [queryClient] = useState(() => new QueryClient())
+
   return (
     <WagmiProvider config={wagmiConfig}>

Don't forget to import useState:

 "use client"
 
+import { useState } from "react"
 import { WagmiProvider } from "wagmi"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const queryClient = new QueryClient()
"use client"
import { useState } from "react"
import { WagmiProvider } from "wagmi"
export function Providers({ children }: { children: React.ReactNode }) {
const [queryClient] = useState(() => new QueryClient())
return (
<WagmiProvider config={wagmiConfig}>
{children}
</WagmiProvider>
)
}
🤖 Prompt for AI Agents
In src/app/providers.tsx around line 8, the QueryClient is created at module
scope which can cause shared-instance issues; move its instantiation into the
Providers component by importing useState and creating the client inside the
component (e.g., useState with an initializer to return a new QueryClient) so
each mount gets its own instance, then use that state-held client for
QueryClientProvider and remove the module-level const.


export function Providers({ children }: { children: React.ReactNode }) {
return (
<WagmiProvider config={wagmiConfig}>
<QueryClientProvider client={queryClient}>
<RainbowKitProvider>
{children}
</RainbowKitProvider>
</QueryClientProvider>
</WagmiProvider>
)
}
7 changes: 7 additions & 0 deletions src/components/wallet-connect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use client"

import { ConnectButton } from "@rainbow-me/rainbowkit"

export default function WalletConnect() {
return <ConnectButton />
}
Comment on lines +5 to +7
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for imports or usage of WalletConnect component
rg -nP --type=ts --type=tsx -C3 '\bWalletConnect\b' -g '!src/components/wallet-connect.tsx'

Repository: StabilityNexus/Bene-FundRaising-EVM-Frontend

Length of output: 115


🏁 Script executed:

#!/bin/bash
# Search for imports or usage of WalletConnect component
rg -nP -t ts -C3 '\bWalletConnect\b' -g '!src/components/wallet-connect.tsx'

Repository: StabilityNexus/Bene-FundRaising-EVM-Frontend

Length of output: 70


🏁 Script executed:

#!/bin/bash
# Check if Navbar.tsx exists and examine its imports
fd -e tsx -e ts 'Navbar' | head -5

Repository: StabilityNexus/Bene-FundRaising-EVM-Frontend

Length of output: 102


🏁 Script executed:

#!/bin/bash
# Read the first part of Navbar.tsx to see imports
head -80 src/Navbar.tsx | cat -n

Repository: StabilityNexus/Bene-FundRaising-EVM-Frontend

Length of output: 3238


Remove the unused WalletConnect wrapper component.

The WalletConnect component is not imported or used anywhere in the codebase. Navbar.tsx imports ConnectButton directly from @rainbow-me/rainbowkit (line 3) and renders it with custom props (lines 72-77). This wrapper provides no value and should be deleted.

🤖 Prompt for AI Agents
In src/components/wallet-connect.tsx around lines 5 to 7, the WalletConnect
wrapper simply returns <ConnectButton /> and is unused; delete this file and
remove any imports referencing it (if present) so components import
ConnectButton directly from @rainbow-me/rainbowkit (like Navbar.tsx already
does). Ensure there are no leftover exports or barrel-file references to
src/components/wallet-connect.tsx and run the build/tests to confirm nothing
else depends on it.

13 changes: 13 additions & 0 deletions src/hooks/useWallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useAccount, useChainId } from "wagmi"

export function useWallet() {
const { address, isConnected, connector } = useAccount()
const chainId = useChainId()

return {
address,
isConnected,
chainId,
connector,
}
}
Comment on lines +3 to +13
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

rg -nP --type=ts --type=tsx -C3 '\buseWallet\b' -g '!src/hooks/useWallet.ts'

Repository: StabilityNexus/Bene-FundRaising-EVM-Frontend

Length of output: 115


🏁 Script executed:

rg -nP '\buseWallet\b' -g '*.ts' -g '*.tsx' --exclude='src/hooks/useWallet.ts'

Repository: StabilityNexus/Bene-FundRaising-EVM-Frontend

Length of output: 499


🏁 Script executed:

rg '\buseWallet\b' -g '*.ts' -g '*.tsx'

Repository: StabilityNexus/Bene-FundRaising-EVM-Frontend

Length of output: 140


Remove the unused useWallet hook.

This custom hook is not referenced anywhere in the codebase and is dead code. Since components import useAccount directly from wagmi instead, the wrapper provides no value.

🤖 Prompt for AI Agents
In src/hooks/useWallet.ts around lines 3 to 13, the useWallet hook is unused
dead code; delete the file (or remove the exported function) and clean up any
exports/index barrel that re-exports it; search the repo for imports of
src/hooks/useWallet.ts and replace them to import useAccount/useChainId directly
from wagmi where needed, then run tests/TypeScript build to ensure no missing
references remain.

8 changes: 8 additions & 0 deletions src/lib/wallet/chains.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mainnet, polygon, optimism, arbitrum } from "wagmi/chains"

export const supportedChains = [
mainnet,
polygon,
optimism,
arbitrum,
]
11 changes: 11 additions & 0 deletions src/lib/wallet/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { getDefaultConfig } from "@rainbow-me/rainbowkit"
import { supportedChains } from "./chains"



export const wagmiConfig = getDefaultConfig({
appName: "YourAppName",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Replace placeholder appName with actual application name.

The appName is set to "YourAppName", which is clearly a placeholder. This value appears in wallet connection prompts and should reflect the actual application name "Bene" (as seen in the Navbar logo).

Apply this diff:

 export const wagmiConfig = getDefaultConfig({
-  appName: "YourAppName",
+  appName: "Bene",
   projectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID!,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
appName: "YourAppName",
appName: "Bene",
🤖 Prompt for AI Agents
In src/lib/wallet/config.ts around line 7, the appName is currently set to the
placeholder "YourAppName"; update this value to the real application name "Bene"
so wallet connection prompts and related UI display the correct app name
(replace the placeholder string with "Bene").

projectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID!,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add runtime validation for required environment variable.

The non-null assertion operator (!) on NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID will fail silently if the variable is undefined, leading to runtime errors when wallet functionality is used. Add explicit validation with a helpful error message.

Apply this diff to validate the environment variable:

+const projectId = process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID
+if (!projectId) {
+  throw new Error(
+    "NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID is not defined. " +
+    "Please add it to your .env.local file."
+  )
+}
+
 export const wagmiConfig = getDefaultConfig({
   appName: "YourAppName",
-  projectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID!,
+  projectId,
   chains: supportedChains as const,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
projectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID!,
const projectId = process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID
if (!projectId) {
throw new Error(
"NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID is not defined. " +
"Please add it to your .env.local file."
)
}
export const wagmiConfig = getDefaultConfig({
appName: "YourAppName",
projectId,
chains: supportedChains as const,
🤖 Prompt for AI Agents
In src/lib/wallet/config.ts around line 8, the code uses a non-null assertion
for NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID which can fail silently; replace this
with an explicit runtime validation: read
process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID into a const, check if it's
missing or empty, and if so throw a clear Error (e.g. "Missing
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID environment variable - required for
WalletConnect") so the application fails fast with an actionable message;
otherwise assign the validated value to projectId.

chains: supportedChains as const,
ssr: true,
})