The MetaMaskConnector supports connecting with MetaMask.
import { MetaMaskConnector } from 'vagmi/connectors/metaMask';const connector = new MetaMaskConnector();
Chains supported by app. Defaults to defaultChains
.
import { chain } from 'vagmi';import { MetaMaskConnector } from 'vagmi/connectors/metaMask';const connector = new MetaMaskConnector({ chains: [chain.mainnet, chain.optimism],});
Options for configuring the connector.
import { MetaMaskConnector } from 'vagmi/connectors/metaMask';const connector = new MetaMaskConnector({ options: { shimDisconnect: true, },});
Certain versions of MetaMask emit the "disconnect"
event when chain is changed. This flag prevents the "disconnect"
event from being emitted upon switching chains. Defaults to true
.
import { MetaMaskConnector } from 'vagmi/connectors/metaMask';const connector = new MetaMaskConnector({ options: { shimChainChangedDisconnect: false, },});
MetaMask does not support programmatic disconnect. This flag simulates the disconnect behavior by keeping track of connection status in storage. Defaults to true
.
import { MetaMaskConnector } from 'vagmi/connectors/metaMask';const connector = new MetaMaskConnector({ options: { shimDisconnect: false, },});