Skip to content

feat: MetaMask Connect#433

Open
wenfix wants to merge 25 commits into
mainfrom
feat/mm-connect
Open

feat: MetaMask Connect#433
wenfix wants to merge 25 commits into
mainfrom
feat/mm-connect

Conversation

@wenfix

@wenfix wenfix commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a new MetaMask Connect button backed by the published @metamask/connect-evm package.
  • Registers the Connect EVM provider as an EIP-1193 provider with explicit supported networks and shared dapp metadata.
  • Updates provider initialization and teardown so extension, EIP-6963, SDK Connect, WalletConnect, and MetaMask Connect flows can switch/disconnect without stale provider state.
  • Aligns local Node requirements with the published package and updates webpack's process shim so the production bundle resolves Connect EVM's ESM dependencies.

Notable behavior

  • The new button text is MetaMask Connect; the connected state is MetaMask Connect - Disconnect.
  • net_version is optional. Providers that do not support it fall back to the decimal value derived from eth_chainId.
  • Disconnecting an inactive provider no longer clears the currently active provider's accounts or connection state.
  • WalletConnect provider subscriptions are registered once and guarded against duplicate state transitions.

Node version bump

@metamask/connect-evm@1.4.0 (and several of its transitive deps) declare engines.node: ">=20.19.0" and rely on Node 20.19+ runtime behavior. This PR mirrors that floor in package.json engines and .nvmrc, and drops Node 18.x from the build-lint-test CI matrix so CI only runs against a supported runtime.

Verification

  • fnm exec --using=20.19.1 yarn lint
  • fnm exec --using=20.19.1 yarn build

Build completed with warnings only:

  • Existing MetaMask SDK optional dependency warning for @react-native-async-storage/async-storage
  • Existing webpack asset/entrypoint size warnings

Manual testing still recommended

  • Connect/disconnect with MetaMask Connect in a browser.
  • Switch active providers between extension/window.ethereum, EIP-6963, SDK Connect, WalletConnect, and MetaMask Connect.
  • Disconnect MetaMask Connect after switching away from it.
  • WalletConnect modal reconnect/disconnect flow.

Notes for reviewers

  • Socket Security flags @metamask/connect-evm and its transitive tree (network-access and obfuscated-code alerts, plus a protobufjs CVE). These require supply-chain triage via @SocketSecurity ignore ... comments rather than a code change.

Note

Medium Risk
Touches core provider switching/teardown used by all wallet flows; new third-party Connect EVM dependency tree adds supply-chain surface, though changes are localized to the test dapp.

Overview
Adds a MetaMask Connect flow using @metamask/connect-evm, with a new UI button, shared dapp-metadata, and registration of the Connect EVM EIP-1193 provider (supported networks + chain IDs).

Provider lifecycle is refactored so switching and disconnecting across extension, EIP-6963, SDK, WalletConnect, and Connect EVM does not leave stale state: teardown uses removeListener/off, clears contract/ethers context on close, only resets the UI when the active provider is removed, and treats any provider with request (not only isMetaMask) as usable. net_version is optional with fallback from eth_chainId; WalletConnect subscriptions are registered once with duplicate-transition guards.

Tooling: Node floor raised to ≥20.19.0 (.nvmrc, package.json engines, CI matrix drops 18.x); webpack process shim points at process/browser.js; Lavamoat allow-scripts entries for Connect EVM transitive deps; ESLint ecmaVersion: 2020 for src/**/*.js.

Reviewed by Cursor Bugbot for commit 1f3fb25. Bugbot is set up for automated code reviews on this repo. Configure here.

@socket-security

socket-security Bot commented May 28, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​metamask/​connect-evm@​1.4.0781001009750

View full report

@socket-security

socket-security Bot commented May 28, 2026

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring alerts on:

  • @metamask/analytics@0.6.0
  • @metamask/connect-evm@1.4.0
  • @metamask/connect-multichain@0.15.0
  • @metamask/mobile-wallet-protocol-core@0.4.0
  • @metamask/mobile-wallet-protocol-dapp-client@0.3.0
  • @metamask/multichain-api-client@0.10.1
  • @metamask/multichain-ui@0.4.1
  • @protobufjs/aspromise@1.1.2
  • @protobufjs/base64@1.1.2
  • @protobufjs/codegen@2.0.5
  • @protobufjs/eventemitter@1.1.1
  • @protobufjs/fetch@1.1.1
  • @protobufjs/float@1.0.2
  • @protobufjs/inquire@1.1.2
  • @protobufjs/path@1.1.2
  • @protobufjs/pool@1.1.0
  • @protobufjs/utf8@1.1.1
  • @types/lodash@4.17.24
  • centrifuge@5.6.0
  • lodash@4.18.1
  • long@5.3.2
  • pako@2.1.0
  • protobufjs@7.6.1
  • qr-code-styling@1.9.2
  • qrcode-generator@1.5.2
  • ws@8.21.0
  • @metamask/utils@11.11.0
  • uuid@11.1.1
  • @metamask/rpc-errors@7.0.3
  • @types/node@25.9.1
  • async-mutex@0.5.0
  • eciesjs@0.4.17
  • undici-types@7.24.6

View full report

@wenfix wenfix changed the title Add MetaMask Connect option feat: MetaMask Connect May 28, 2026
wenfix added 4 commits June 25, 2026 13:11
`@metamask/connect-evm` raises the project's node floor to >=20.19.0
(reflected in package.json engines and .nvmrc), so testing on node 18.x
no longer matches a supported runtime. Run the matrix on 20.x only.
`yarn allow-scripts` failed in CI because the @metamask/connect-evm
dependency tree introduced a package with an install script
(protobufjs, via connect-multichain > mobile-wallet-protocol-core >
centrifuge) and re-resolved keccak/secp256k1 under ethereum-cryptography,
which no longer matched the existing allowlist paths.

Ran `yarn allow-scripts auto`; the new entries default to false
(scripts disabled), consistent with every other entry in the config.
strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [20.x]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mm-connect requires node version >=20.19.0

@wenfix

wenfix commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore-all

these are all introduced by @metamask/connect-evm, a package we own.

@wenfix wenfix marked this pull request as ready for review June 25, 2026 13:21
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