Skip to content
Docs
/
Connectors
/
MetaMask

MetaMask

The MetaMaskConnector supports connecting with MetaMask.

import { MetaMaskConnector } from 'wagmi/connectors/metaMask'

Usage

import { MetaMaskConnector } from 'wagmi/connectors/metaMask'

const connector = new MetaMaskConnector()

Configuration

chains (optional)

Chains supported by app. Defaults to defaultChains.

import { chain } from 'wagmi'
import { MetaMaskConnector } from 'wagmi/connectors/metaMask'

const connector = new MetaMaskConnector({
  chains: [chain.mainnet, chain.optimism],
})

options (optional)

Options for configuring the connector.

import { MetaMaskConnector } from 'wagmi/connectors/metaMask'

const connector = new MetaMaskConnector({
  options: {
    shimDisconnect: true,
  },
})

shimDisconnect

MetaMask does not support programmatic disconnect. This flag simulates the disconnect behavior by keeping track of connection status in storage. Defaults to true.

import { InjectedConnector } from 'wagmi/connectors/injected'

const connector = new InjectedConnector({
  options: {
    shimDisconnect: false,
  },
})