Skip to content

fix(wallets): connect Brave Wallet on mobile without a second tap - #2699

Open
jackkru69 wants to merge 1 commit into
rainbow-me:mainfrom
jackkru69:fix/brave-wallet-mobile-connection
Open

jackkru69 wants to merge 1 commit into
rainbow-me:mainfrom
jackkru69:fix/brave-wallet-mobile-connection

Conversation

@jackkru69

@jackkru69 jackkru69 commented Aug 23, 2026 •

Copy link
Copy Markdown

Summary

Fixes Brave Wallet connections on mobile browsers requiring a second tap in RainbowKit’s connect modal.

Problem

Wagmi’s injected connector uses wallet_requestPermissions when shimDisconnect is enabled. On Brave mobile, the permission response may not include account addresses in caveats, causing Wagmi to fall back to eth_requestAccounts.

While the native permissions dialog is still closing, that second request can fail with -32002 (“Already processing request”), leaving the modal open until the user taps the connector again.

Solution

  • Keep Wagmi’s default shimDisconnect behavior, so an explicit disconnect remains persisted across reloads.
  • On mobile Brave only, adapt the connection handshake so wallet_requestPermissions is fulfilled through one direct eth_requestAccounts request and returns a Wagmi-compatible permission response.
  • Scope the adapter strictly to connector.connect(). After connecting, connector.getProvider() resolves to the original Brave provider, so application-initiated wallet_requestPermissions calls and their caveats are forwarded unchanged.
  • Add unit coverage for:
    • first-tap mobile connection;
    • desktop default permissions behavior;
    • persisted disconnect state;
    • forwarding post-connect permission requests unchanged.

Testing

  • pnpm test
  • pnpm --filter @rainbow-me/rainbowkit typecheck
  • formatting and diff checks

@jackkru69
jackkru69 requested a review from a team August 23, 2026 16:40
@changeset-bot

changeset-bot Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5f3eaf6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@rainbow-me/rainbowkit Patch
example Patch
@rainbow-me/rainbow-button Patch
rainbowkit-next-app Patch
site Patch
with-create-react-app Patch
with-next-app-i18n Patch
with-next-app Patch
with-next-custom-button Patch
with-next-mint-nft Patch
with-next-siwe-iron-session Patch
with-next-siwe-next-auth Patch
with-next-wallet-button Patch
with-next Patch
with-react-router Patch
with-remix Patch
with-vite Patch
with-next-rainbow-button Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

@jackkru69 is attempting to deploy a commit to the rainbowdotme Team on Vercel.

A member of the Team first needs to authorize it.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05fd323d1d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/rainbowkit/src/wallets/walletConnectors/braveWallet/braveWallet.ts Outdated
Comment thread packages/rainbowkit/src/wallets/walletConnectors/braveWallet/braveWallet.ts Outdated
@jackkru69
jackkru69 force-pushed the fix/brave-wallet-mobile-connection branch 2 times, most recently from 9b43a68 to b173172 Compare August 23, 2026 16:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b173172e4c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/rainbowkit/src/wallets/walletConnectors/braveWallet/braveWallet.ts Outdated
@jackkru69
jackkru69 force-pushed the fix/brave-wallet-mobile-connection branch from b173172 to 5f3eaf6 Compare August 23, 2026 17:08

This branch has not been deployed

No deployments
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.

1 participant