Skip to content

fix: load MetaMask Connect EVM connector when extension is installed#720

Open
shahbaz17 wants to merge 1 commit into
lifinance:mainfrom
shahbaz17:fix/metamask-connect-evm-cold-start
Open

fix: load MetaMask Connect EVM connector when extension is installed#720
shahbaz17 wants to merge 1 commit into
lifinance:mainfrom
shahbaz17:fix/metamask-connect-evm-cold-start

Conversation

@shahbaz17
Copy link
Copy Markdown

Make the @metamask/connect-evm wagmi connector the canonical MetaMask entry whether or not the extension is installed. Previously the SDK connector was skipped when the extension was detected, leaving desktop on wagmi's EIP-6963 (io.metamask) path and mobile on the SDK path - divergent connector behavior across the two.

createDefaultWagmiConfig: drop the extension-presence gate. Wagmi's multiInjectedProviderDiscovery uses the connector's rdns: 'io.metamask' to dedupe against the EIP-6963 announcement, so no extra entry is added by wagmi itself. Broaden the lazy-load gate to match any prior MetaMask connection (io.metamask or metaMaskSDK) so a user who first connects via EIP-6963 still gets the SDK connector loaded on subsequent visits.

useCombinedWallets: keep only the first EVM connector per wallet entry. Configured connectors are unshifted to the front of the wagmi connector list, so they take precedence over auto-discovered EIP-6963 announcements. Fixes the duplicate-key React warning under MetaMask.

walletTags: tag metaMaskSDK as Installed (instead of GetStarted) when the extension is detected so MetaMask sorts to the top of the multi-ecosystem picker.

Which Linear task is linked to this PR?

Why was it implemented this way?

Explain the reasoning behind the implementation. Were there alternative approaches? Why was this solution chosen?

Visual showcase (Screenshots or Videos)

If applicable, attach screenshots, GIFs, or videos to showcase the functionality, UI changes, or bug fixes.

Checklist before requesting a review

  • I have performed a self-review and testing of my code.
  • This pull request is focused and addresses a single problem.
  • If this PR modifies the Widget API or adds new features that require documentation, I have updated the documentation in the public-docs repository.

Make the `@metamask/connect-evm` wagmi connector the canonical
MetaMask entry whether or not the extension is installed. Previously
the SDK connector was skipped when the extension was detected,
leaving desktop on wagmi's EIP-6963 (`io.metamask`) path and mobile
on the SDK path - divergent connector behavior across the two.

`createDefaultWagmiConfig`: drop the extension-presence gate. Wagmi's
`multiInjectedProviderDiscovery` uses the connector's
`rdns: 'io.metamask'` to dedupe against the EIP-6963 announcement,
so no extra entry is added by wagmi itself. Broaden the lazy-load
gate to match any prior MetaMask connection (`io.metamask` or
`metaMaskSDK`) so a user who first connects via EIP-6963 still gets
the SDK connector loaded on subsequent visits.

`useCombinedWallets`: keep only the first EVM connector per wallet
entry. Configured connectors are unshifted to the front of the wagmi
connector list, so they take precedence over auto-discovered EIP-6963
announcements. Fixes the duplicate-key React warning under MetaMask.

`walletTags`: tag `metaMaskSDK` as `Installed` (instead of
`GetStarted`) when the extension is detected so MetaMask sorts to
the top of the multi-ecosystem picker.

Co-authored-by: Cursor <cursoragent@cursor.com>
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