Skip to content

fix: improve EVM wallet detection and provider discovery#2468

Merged
broody merged 4 commits intomainfrom
fix/evm-wallet-detection
Mar 4, 2026
Merged

fix: improve EVM wallet detection and provider discovery#2468
broody merged 4 commits intomainfrom
fix/evm-wallet-detection

Conversation

@broody
Copy link
Contributor

@broody broody commented Mar 4, 2026

Summary

  • Use user agent for mobile detection instead of viewport width for more reliable isAvailable() checks
  • Add fallback provider detection for MetaMask and Phantom EVM when EIP-6963 announcements are missed
  • Share a single EIP-6963 store across all EVM wallet adapters so late announcements are captured once and visible to every adapter
  • Clean up redundant provider detection logic in the base class

Test plan

  • Verify MetaMask detection and connection works in both iframe and standalone modes
  • Verify Phantom EVM detection and connection works in iframe mode
  • Verify mobile wallet detection uses user agent correctly
  • Verify multiple EVM wallets installed simultaneously are all discovered

🤖 Generated with Claude Code

broody and others added 4 commits March 4, 2026 11:46
Viewport-based detection incorrectly flagged popup windows as mobile,
preventing EVM wallet detection in the forcePopup auth flow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove isMobile() gate from wallet detection — extensions don't exist
on mobile so the check was redundant and broke popup windows.

Re-scan EIP-6963 providers on each isAvailable() call to handle late
announcements. Add getFallbackProvider() hook for subclasses: MetaMask
falls back to window.ethereum, Phantom EVM to window.phantom.ethereum.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each EthereumWalletBase instance was creating its own mipd store,
causing late provider announcements (e.g. Phantom EVM) to be missed.
A shared store captures all announcements in one place.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
controller-example-next Ready Ready Preview Mar 4, 2026 9:48pm
keychain Ready Ready Preview Mar 4, 2026 9:48pm
keychain-storybook Ready Ready Preview Mar 4, 2026 9:48pm

Request Review

@claude
Copy link
Contributor

claude bot commented Mar 4, 2026

Claude finished @broody's task —— View job


Analyzing PR changes for documentation impact

  • Review PR changes to understand technical modifications
  • Determine if changes affect user-facing APIs or behavior
  • Assess documentation update requirements

Analysis Result

No documentation updates required.

This PR contains internal implementation improvements that do not affect the user-facing API or documented behavior:

What changed (internally):

  • Refactored mobile detection from viewport-based to user agent-based
  • Added shared EIP-6963 store for better provider discovery
  • Implemented fallback provider detection for MetaMask and Phantom EVM
  • Cleaned up redundant provider detection logic

Why no docs updates are needed:

  1. No API changes: The public interface for MetaMask and Phantom wallet adapters remains unchanged - developers use the same methods (connect(), isAvailable(), etc.)
  2. Implementation detail: The changes improve reliability of wallet detection but don't change how developers integrate with these wallets
  3. No new configuration: No new options, methods, or parameters were added that need documentation
  4. Bug fix nature: This PR fixes reliability issues (missed EIP-6963 announcements, mobile detection) rather than adding features

Existing documentation coverage:
The signer-management.md file already documents MetaMask and Phantom wallets at a user-facing level (lines 169-180), which remains accurate. The internal improvements make these existing features more reliable without changing their documented behavior.

Following the direct prompt rule #1: DEFAULT TO NO CHANGES - internal refactors and bug fixes do not require documentation updates.


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