Wallet interoperability
A web dapp can integrate with multiple installed browser wallets simultaneously by adding support for
EIP-6963, which introduces an alternative wallet detection
mechanism to the window.ethereum
injected provider.
This mechanism is enabled by using the standardized interfaces defined by EIP-6963.
EIP-1193 standardizes the interface for wallet providers, but it results in conflicts when users have multiple wallets installed, due to how the provider object is injected. This can cause issues with wallet discovery, user onboarding, and connecting. The wallet discovery mechanism introduced by EIP-6963 solves these issues.
The following is a demo of the user experience of detecting multiple wallets, showing the data provided from each installed wallet:
You can connect to MetaMask using EIP-6963 and see the EIP-6963 Vite React + TypeScript demo for more information.
EIP-6963 interfaces
Wallets that support EIP-6963 implement and expose the following standardized interfaces. When connecting to MetaMask using EIP-6963, it's important to review and understand these interfaces.
Provider info
The EIP6963ProviderInfo
interface
represents the assets needed to display a wallet:
uuid
- The wallet ID (UUIDv4).name
- A human-readable name of the wallet.icon
- A URI pointing to an icon of the wallet.rdns
- The wallet's domain name.
Provider detail
The EIP6963ProviderDetail
interface
represents additional metadata about the wallet:
info
- TheEIP6963ProviderInfo
.provider
- TheEIP1193Provider
defined by EIP-1193.
Announce and request events
The EIP6963AnnounceProviderEvent
interface announces an event dispatched by the wallet:
interface EIP6963AnnounceProviderEvent extends CustomEvent {
type: "eip6963:announceProvider"
detail: EIP6963ProviderDetail
}
The EIP6963RequestProviderEvent
interface requests an event dispatched by a dapp:
interface EIP6963RequestProviderEvent extends Event {
type: "eip6963:requestProvider"
}
Third-party library support
The following third-party libraries support EIP-6963:
MIPD Store
The MIPD Store stores the wallet providers and enables you to subscribe to the store and retrieve the providers. Unlike Wagmi and Web3-Onboard, which are libraries that provide components and connectors for multiple wallets and depend on MetaMask SDK for integration, the MIPD Store is a utility library that makes it easier to work with EIP-6963 and supports TypeScript types.
MetaMask SDK support
MetaMask SDK does not support connecting to non-MetaMask wallets via EIP-6963. If you intend to support discovery of other wallets, we recommend using other methods of adding EIP-6963 support such as Wagmi 2+.
The MetaMask JavaScript SDK automatically checks for the presence of the MetaMask extension via EIP-6963. This eliminates the need for manual configuration or detection methods, simplifying the initial setup process for both developers and users.
By adhering to the standards set by EIP-6963, the SDK unambiguously identifies and connects to MetaMask, resolving potential conflicts that might arise with other wallet extensions, ensuring a more stable and reliable interaction for users.
The SDK is also being integrated into Wagmi 2+, which supports EIP-6963. The SDK on its own supports connecting only to MetaMask via EIP-6963, so if you intend to support discovery of other wallets, we recommend using other methods of adding EIP-6963 support, such as Wagmi 2+.
Wallet support
The EIP-6963 alternative discovery mechanism works for wallets that have implemented support for EIP-6963. This includes MetaMask, Coinbase, Trust Wallet, OKX, and other major wallets. See the list of wallets that support EIP-6963.
Backwards compatibility
Dapps that do not support EIP-6963 can still
detect MetaMask using the window.ethereum
provider.
However, we recommend adding support to improve the user experience for multiple installed wallets.
Read more about EIP-6963 backwards compatibility.