Skip to content
Docs
/
Connectors
/
Injected

Injected

The InjectedConnector supports wallets that inject an Ethereum Provider into the browser or window. The MetaMask browser extension is the most popular example of this.

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

Usage

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

const connector = new InjectedConnector()

Configuration

chains (optional)

Chains supported by app. Defaults to defaultChains.

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

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

options (optional)

Options for configuring the connector.

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

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

shimDisconnect

MetaMask and other injected providers do 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,
  },
})