Skip to content

fix: resolve MetaMask wallet connection (missing @metamask/sdk + ThemeProvider) - #16

Open
aravpatel19 wants to merge 1 commit into
FIL-Builders:mainfrom
aravpatel19:fix/metamask-wallet-connection
Open

aravpatel19 wants to merge 1 commit into
FIL-Builders:mainfrom
aravpatel19:fix/metamask-wallet-connection

Conversation

@aravpatel19

Copy link
Copy Markdown

Problem

Clicking Connect Wallet then MetaMask produced no popup. Two root causes:

  1. Missing @metamask/sdk dependency — RainbowKit's metaMaskWallet connector requires @metamask/sdk as a peer dependency, but it was not in package.json. This caused wagmi to throw at module evaluation, preventing all wallet connectors from initialising.

  2. Missing ThemeProvider — RainbowKitProviderWrapper calls useTheme() from next-themes, but ThemeProvider was never added to the React tree, causing a context error.

Changes

  • package.json / pnpm-lock.yaml: add @metamask/sdk@0.33.1
  • src/providers/web3-provider/wagmi.ts: read projectId from NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID env var, falling back to the existing placeholder
  • src/providers/web3-provider/web3-provitsx: wrap provider stack in ThemeProvider from next-themes
  • .env.local.example: document all available environment variables

Testing

cp .env.local.example .env.local && pnpm install && pnpm dev

Open http://localhost:3000, click Connect Wallet, MetaMask popup appears and connects successfully.

…dk dependency

- Install @metamask/sdk@0.33.1, the peer dependency required by RainbowKit's
  metaMaskWallet connector. Its absence caused wagmi to throw at module
  evaluation, preventing all wallet connectors from initialising.
- Read WalletConnect projectId from NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID env
  var (falling back to the original placeholder) so contributors can supply a
  real WalletConnect Cloud ID without touching source code.
- Add ThemeProvider from next-themes so that useTheme() inside
  RainbowKitProviderWrapper has the required context.
- Add .env.local.example documenting all available environment variables.

Made-with: Cursor
@netlify

netlify Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for filecoin-onchain-cloud-dapp ready!

Name Link
🔨 Latest commit 18207a3
🔍 Latest deploy log https://app.netlify.com/projects/filecoin-onchain-cloud-dapp/deploys/69a69c850a2edb0008f4d8a8
😎 Deploy Preview https://deploy-preview-16--filecoin-onchain-cloud-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for fs-upload-dapp ready!

Name Link
🔨 Latest commit 18207a3
🔍 Latest deploy log https://app.netlify.com/projects/fs-upload-dapp/deploys/69a69c85a71cbd0008fdc141
😎 Deploy Preview https://deploy-preview-16--fs-upload-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread package.json
"@filoz/synapse-sdk": "^0.38.0",
"@hookform/resolvers": "^5.2.2",
"@ipld/car": "^5.4.2",
"@metamask/sdk": "^0.33.1",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the best solution here is to not include @metamask/sdk at all and just remove metamask from wagmi.ts rainbowkit includes metamask by default from what they are saying here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yup, looked at the docs and that makes sense. Thanks for making the fix on the live version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants