metaMask ​
Connector for the MetaMask SDK.
Import ​
import { metaMask } from '@wagmi/connectors'
import { metaMask } from '@wagmi/connectors'
Usage ​
import { createConfig, http } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
import { metaMask } from '@wagmi/connectors'
export const config = createConfig({
chains: [mainnet, sepolia],
connectors: [metaMask()],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
import { createConfig, http } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/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'
import { type MetaMaskParameters } from '@wagmi/connectors'
Check out the MetaMask SDK docs for more info. A few options are omitted that Wagmi manages internally.
communicationLayerPreference ​
CommunicationLayerPreference | undefined
The preferred communication layer to use for the SDK.
communicationServerUrl ​
string | undefined
The URL of the communication server to use for the SDK.
dappMetadata ​
DappMetadata | undefined
- Metadata about the dapp using the SDK.
- Defaults to
{ name: 'wagmi' }
.
enableDebug ​
boolean | undefined
- Send anonymous analytics to MetaMask to help us improve the SDK.
- Defaults to
false
.
extensionOnly ​
boolean | undefined
- If MetaMask browser extension is detected, directly use it.
- Defaults to
true
.
forceDeleteProvider ​
boolean | undefined
If true, the SDK will force delete the provider from the global window
object.
forceInjectProvider ​
boolean | undefined
If true, the SDK will force inject the provider into the global window
object.
infuraAPIKey ​
string | undefined
The Infura API key to use for RPC requests.
injectProvider ​
boolean | undefined
If true, the SDK will inject the provider into the global window
object.
logging ​
SDKLoggingOptions | undefined
Options for customizing the logging behavior of the SDK.
modals ​
RemoteConnectionProps['modals'] | undefined
An object that allows you to customize or translate each of the displayed modals. See the nodejs example for more information.
openDeeplink ​
((arg: string) => void) | undefined
A function that will be called to open a deeplink to the MetaMask Mobile app.
preferDesktop ​
boolean | undefined
If true, the SDK will prefer the desktop version of MetaMask over the mobile version.
shouldShimWeb3 ​
boolean | undefined
If true, the SDK will shim the window.web3 object with the provider returned by the SDK (useful for compatibility with older browser).
storage ​
StorageManagerProps | undefined
Options for customizing the storage manager used by the SDK.
timer ​
any | undefined
A timer object to use for scheduling tasks.
transports ​
string[] | undefined
An array of transport protocols to use for communication with the MetaMask wallet.
ui ​
SDKUIOptions | undefined
Options for customizing the SDK UI.
useDeeplink ​
boolean | undefined
- If
true
, the SDK will use deeplinks to connect with MetaMask Mobile. Iffalse
, the SDK will use universal links to connect with MetaMask Mobile. - Defaults to
true
.
wakeLockType ​
WakeLockStatus | undefined
The type of wake lock to use when the SDK is running in the background.