[{"_path":"/connectors/metamask","_draft":false,"_partial":false,"_empty":false,"title":"MetaMask","description":"The MetaMaskConnector supports connecting with MetaMask.","excerpt":{"type":"root","children":[{"type":"element","tag":"h2","props":{"id":"usage"},"children":[{"type":"text","value":"Usage"}]},{"type":"element","tag":"code","props":{"code":"import { MetaMaskConnector } from 'vagmi/connectors/metaMask';\n\nconst connector = new MetaMaskConnector();\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { MetaMaskConnector } from 'vagmi/connectors/metaMask';\n\nconst connector = new MetaMaskConnector();\n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"configuration"},"children":[{"type":"text","value":"Configuration"}]},{"type":"element","tag":"h3","props":{"id":"chains-optional"},"children":[{"type":"text","value":"chains (optional)"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Chains supported by app. Defaults to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"defaultChains"}]},{"type":"text","value":"."}]},{"type":"element","tag":"code","props":{"code":"import { chain } from 'vagmi';\nimport { MetaMaskConnector } from 'vagmi/connectors/metaMask';\n\nconst connector = new MetaMaskConnector({\n  chains: [chain.mainnet, chain.optimism],\n});\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { chain } from 'vagmi';\nimport { MetaMaskConnector } from 'vagmi/connectors/metaMask';\n\nconst connector = new MetaMaskConnector({\n  chains: [chain.mainnet, chain.optimism],\n});\n"}]}]}]},{"type":"element","tag":"h3","props":{"id":"options-optional"},"children":[{"type":"text","value":"options (optional)"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Options for configuring the connector."}]},{"type":"element","tag":"code","props":{"code":"import { MetaMaskConnector } from 'vagmi/connectors/metaMask';\n\nconst connector = new MetaMaskConnector({\n  options: {\n    shimDisconnect: true,\n  },\n});\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { MetaMaskConnector } from 'vagmi/connectors/metaMask';\n\nconst connector = new MetaMaskConnector({\n  options: {\n    shimDisconnect: true,\n  },\n});\n"}]}]}]},{"type":"element","tag":"h4","props":{"id":"shimchainchangeddisconnect"},"children":[{"type":"text","value":"shimChainChangedDisconnect"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Certain versions of MetaMask "},{"type":"element","tag":"a","props":{"href":"https://github.com/MetaMask/metamask-extension/issues/13375#issuecomment-1027663334","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"emit the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"\"disconnect\""}]},{"type":"text","value":" event when chain is changed"}]},{"type":"text","value":". This flag prevents the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"\"disconnect\""}]},{"type":"text","value":" event from being emitted upon switching chains. Defaults to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":"."}]},{"type":"element","tag":"code","props":{"code":"import { MetaMaskConnector } from 'vagmi/connectors/metaMask';\n\nconst connector = new MetaMaskConnector({\n  options: {\n    shimChainChangedDisconnect: false,\n  },\n});\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { MetaMaskConnector } from 'vagmi/connectors/metaMask';\n\nconst connector = new MetaMaskConnector({\n  options: {\n    shimChainChangedDisconnect: false,\n  },\n});\n"}]}]}]},{"type":"element","tag":"h4","props":{"id":"shimdisconnect"},"children":[{"type":"text","value":"shimDisconnect"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"MetaMask "},{"type":"element","tag":"a","props":{"href":"https://github.com/MetaMask/metamask-extension/issues/10353","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"does not support programmatic disconnect"}]},{"type":"text","value":". This flag simulates the disconnect behavior by keeping track of connection status in storage. Defaults to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":"."}]},{"type":"element","tag":"code","props":{"code":"import { MetaMaskConnector } from 'vagmi/connectors/metaMask';\n\nconst connector = new MetaMaskConnector({\n  options: {\n    shimDisconnect: false,\n  },\n});\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { MetaMaskConnector } from 'vagmi/connectors/metaMask';\n\nconst connector = new MetaMaskConnector({\n  options: {\n    shimDisconnect: false,\n  },\n});\n"}]}]}]}]},"_type":"markdown","_id":"content:4.connectors:3.metamask.md","_source":"content","_file":"4.connectors/3.metamask.md","_extension":"md"},{"_path":"/connectors/walletconnectlegacy","_draft":false,"_partial":false,"_empty":false,"title":"WalletConnect","description":"Official vagmi Connector for WalletConnect.","excerpt":{"type":"root","children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"import { Callout } from 'nextra-theme-docs'"}]},{"type":"element","tag":"callout","props":{"type":"error"},"children":[{"type":"text","value":"\n  WalletConnect v1 has been sunset. You must migrate to the [WalletConnect v2\n  Connector](/react/connectors/walletConnect) before June 28, after which, this\n  Connector will be removed.\n"}]},{"type":"element","tag":"h1","props":{"id":"walletconnect-legacy"},"children":[{"type":"text","value":"WalletConnect Legacy"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"WalletConnectLegacyConnector"}]},{"type":"text","value":" uses WalletConnect v1 by default and wraps the "},{"type":"element","tag":"a","props":{"href":"https://walletconnect.com","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"WalletConnect Ethereum Provider"}]},{"type":"text","value":" and supports its configuration options. This is a great option for adding support for many wallets to your app."}]},{"type":"element","tag":"code","props":{"code":"import { WalletConnectLegacyConnector } from 'vagmi/connectors/walletConnectLegacy'\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { WalletConnectLegacyConnector } from 'vagmi/connectors/walletConnectLegacy'\n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"usage"},"children":[{"type":"text","value":"Usage"}]},{"type":"element","tag":"code","props":{"code":"import { WalletConnectLegacyConnector } from 'vagmi/connectors/walletConnectLegacy'\n\nconst connector = new WalletConnectLegacyConnector({\n  options: {\n    qrcode: true,\n  },\n})\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { WalletConnectLegacyConnector } from 'vagmi/connectors/walletConnectLegacy'\n\nconst connector = new WalletConnectLegacyConnector({\n  options: {\n    qrcode: true,\n  },\n})\n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"configuration"},"children":[{"type":"text","value":"Configuration"}]},{"type":"element","tag":"h3","props":{"id":"chains-optional"},"children":[{"type":"text","value":"chains (optional)"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Chains supported by app. Defaults to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"defaultChains"}]},{"type":"text","value":"."}]},{"type":"element","tag":"code","props":{"code":"import { mainnet, optimism } from 'vagmi/chains'\nimport { WalletConnectLegacyConnector } from 'vagmi/connectors/walletConnectLegacy'\n\nconst connector = new WalletConnectLegacyConnector({\n  chains: [mainnet, optimism],\n  options: {\n    qrcode: true,\n  },\n})\n","highlights":[5],"language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { mainnet, optimism } from 'vagmi/chains'\nimport { WalletConnectLegacyConnector } from 'vagmi/connectors/walletConnectLegacy'\n\nconst connector = new WalletConnectLegacyConnector({\n  chains: [mainnet, optimism],\n  options: {\n    qrcode: true,\n  },\n})\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Note: Upon connection, the connector will connect to the previously connected chain unless otherwise specified by a "},{"type":"element","tag":"a","props":{"href":"/react/hooks/useConnect#chainid-optional"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"chainId"}]},{"type":"text","value":" config on useConnect"}]},{"type":"text","value":"."}]},{"type":"element","tag":"h3","props":{"id":"options"},"children":[{"type":"text","value":"options"}]},{"type":"element","tag":"h4","props":{"id":"projectid-optional"},"children":[{"type":"text","value":"projectId (optional)"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"WalletConnect Cloud Project ID. Required for WalletConnect v2. You can find your Project ID "},{"type":"element","tag":"a","props":{"href":"https://cloud.walletconnect.com/sign-in","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":"."}]},{"type":"element","tag":"code","props":{"code":"import { WalletConnectLegacyConnector } from 'vagmi/connectors/walletConnectLegacy'\n\nconst connector = new WalletConnectLegacyConnector({\n  options: {\n    qrcode: true,\n    projectId: '...',\n  },\n})\n","highlights":[7],"language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { WalletConnectLegacyConnector } from 'vagmi/connectors/walletConnectLegacy'\n\nconst connector = new WalletConnectLegacyConnector({\n  options: {\n    qrcode: true,\n    projectId: '...',\n  },\n})\n"}]}]}]},{"type":"element","tag":"h4","props":{"id":"other-options"},"children":[{"type":"text","value":"Other options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You can pass through options supported by the "},{"type":"element","tag":"a","props":{"href":"https://github.com/WalletConnect/walletconnect-monorepo/blob/v1.0/packages/helpers/types/index.d.ts#L300-L314","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"WalletConnect v1 "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"WalletConnectProvider"}]}]},{"type":"text","value":" or the "},{"type":"element","tag":"a","props":{"href":"https://github.com/WalletConnect/walletconnect-monorepo/blob/3f0f22b9b85294caed60cdf74f61363ce5ce686b/providers/universal-provider/src/types/misc.ts#L8-L16","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"WalletConnect v2 "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"UniversalProvider"}]}]},{"type":"text","value":":"}]},{"type":"element","tag":"code","props":{"code":"import { WalletConnectLegacyConnector } from 'vagmi/connectors/walletConnectLegacy'\n\nconst connector = new WalletConnectLegacyConnector({\n  options: {\n    qrcode: true,\n    rpc: {\n      1: 'https://eth-mainnet.alchemyapi.io/v2/yourAlchemyId',\n    },\n  },\n})\n","highlights":[4,5,6,7,8,9],"language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { WalletConnectLegacyConnector } from 'vagmi/connectors/walletConnectLegacy'\n\nconst connector = new WalletConnectLegacyConnector({\n  options: {\n    qrcode: true,\n    rpc: {\n      1: 'https://eth-mainnet.alchemyapi.io/v2/yourAlchemyId',\n    },\n  },\n})\n"}]}]}]}]},"_type":"markdown","_id":"content:4.connectors:5.walletconnectLegacy.md","_source":"content","_file":"4.connectors/5.walletconnectLegacy.md","_extension":"md"}]