metaMask
Connector for MetaMask SDK.
Import
import { metaMask } from 'wagmi/connectors'
Usage
import { createConfig, http } from 'wagmi'
import { mainnet, sepolia } from 'wagmi/chains'
import { metaMask } from 'wagmi/connectors'
export const config = createConfig({
chains: [mainnet, sepolia],
connectors: [metaMask()],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
Parameters
import { type MetaMaskParameters } from 'wagmi/connectors'
Check out the MetaMask SDK docs for more info. A few options are omitted that Wagmi manages internally.
dappMetadata
DappMetadata | undefined
Metadata about the dapp using the SDK, including, name
, url
, and iconUrl
. By default, url
gets its value from window.location.origin
.
import { metaMask } from 'wagmi/connectors'
const connector = metaMask({
dappMetadata: {
name: 'My Wagmi App',
url: 'https://example.com',
iconUrl: 'https://example.com/favicon.ico',
}
})
logging
SDKLoggingOptions | undefined
Options for customizing the logging behavior of the SDK.
headless
boolean | undefined
Enables or disables headless mode. Setting this to true
disables the MetaMask modal, allowing you to create your own UI. To get the deeplink to display in the QR code, listen to the display_uri
event.
The default is false
.
import { metaMask } from 'wagmi/connectors'
const connector = metaMask({
headless: true
})
Advanced
By default, if the EIP-6963 MetaMask injected provider is detected, this connector will replace it. See the rdns
property for more information.