Skip to main content

Connect to EVM networks

MetaMask Connect EVM (@metamask/connect-evm) is the modern replacement for @metamask/sdk. Use it to connect your dapp to Ethereum and other EVM networks in the MetaMask mobile app or browser extension.

The EVM client provides an EIP-1193-compatible provider with the same shape as window.ethereum, meaning existing viem, ethers.js, or web3.js code works without changes. It also includes automatic platform detection, relay-based connections, session persistence, and convenience methods like connectAndSign and connectWith.

Coming from @metamask/sdk?

See the migration guide for a step-by-step upgrade path covering package changes, API differences, and new capabilities.

Going multichain?

If your dapp supports (or plans to support) both EVM and Solana, use the multichain client instead. The EVM and Solana clients share the same underlying multichain session, meaning the user only approves once. Get started with the multichain quickstart.

Supported platforms and libraries

MetaMask Connect EVM supports multiple integration paths. You can install it from npm, use it through developer libraries like Wagmi, or integrate it through supported third-party libraries.

Choose a quickstart based on your stack.

Library compatibility

The EVM client works seamlessly with popular Ethereum libraries:

LibraryCompatibility
viemUse with custom() transport
ethers.jsPass client.getProvider() to BrowserProvider
web3.jsPass client.getProvider() to Web3 constructor

Frequently asked questions

What libraries does MetaMask Connect EVM work with?

MetaMask Connect EVM provides an EIP-1193 compatible provider that works with viem (via custom() transport), ethers.js (via BrowserProvider), web3.js (via Web3 constructor), and Wagmi (via the metamask() connector). It also supports wallet connector libraries like RainbowKit, ConnectKit, Dynamic, Privy, Web3Auth, and more.

Do I need an Infura API key for MetaMask Connect EVM?

We recommend using an Infura API key for production dapps. MetaMask Connect EVM uses RPC URLs to route read requests and relay connections. Use the getInfuraRpcUrls helper to generate URLs for all Infura-supported chains automatically, or provide your own RPC endpoints in the api.supportedNetworks configuration.

How do I migrate from @metamask/sdk to @metamask/connect-evm?

To migrate:

  • Replace @metamask/sdk with @metamask/connect-evm in your dependencies.
  • Update imports from MetaMaskSDK to createEVMClient.
  • Switch from synchronous to asynchronous initialization.
  • Update your provider access pattern.

See the migration guide for a step-by-step walkthrough with code examples for each change.