MetaMask Wallet API: Build Power Dapps with Web3’s Leading Wallet

Introducing the MetaMask Wallet API. Learn the key benefits and how to integrate it into your workflow and join the MetaMask Developer community

by Kingsley OkonkwoFebruary 6, 2024
Introducing the MetaMask Wallet API. Learn the key benefits and how to integrate it into your workflow and join the MetaMask Developer community.

The MetaMask wallet, with over 100M installs and 30M monthly active users, stands as the leading web3 wallet with one of the largest active user bases in web3. MetaMask processes 100M transactions monthly through more than 17,000 web3 dapps. This positions MetaMask as the preferred choice for developers who build dapps that attract web3 power users across networks and ecosystems.

We created MetaMask Developer: to provide a comprehensive set of tools, APIs, and SDKs for onboarding millions of the web3’s most engaged users, built on the trusted and secure foundations of MetaMask and Infura.

The first step to achieving this goal is to ensure that integrating with MetaMask is as seamless as possible. Thankfully, EIP-1193 focuses on establishing a uniform JavaScript Ethereum Provider API across clients and applications. This sets an industry standard for connecting to Ethereum wallets, which MetaMask supports through its Wallet API.

What is the MetaMask Wallet API

The MetaMask Wallet API is a global JavaScript API that can be connected to websites visited by users who have the MetaMask wallet installed via the window.ethereum provider object. Adhering to the EIP-1193 specification, the API enables Ethereum accounts to read blockchain data, suggest signing messages and transactions, and more.

The Wallet API leverages the window.ethereum.request(args) function from the provider API to offer a suite of JSON-RPC APIs. This suite expands upon the standard Ethereum methods by incorporating MetaMask-specific enhancements, providing a comprehensive and versatile toolset for developers. The methods supported by the Wallet API are organized into several related categories:

  1. Ethereum API: This category encompasses the standard Ethereum JSON-RPC API methods as defined by EIP 1193, the foundation for Ethereum blockchain interactions.
  2. MetaMask: These are MetaMask-specific methods that provide functionality not necessarily supported by other wallets, offering unique features available only to MetaMask users.
  3. Snaps: This category includes methods specific to the Snaps feature, allowing for a broader range of interactions within the MetaMask ecosystem.
  4. Restricted: Methods under this category require explicit permission from the MetaMask user, obtained through the wallet_requestPermissions call, ensuring a secure and user-consented experience.
  5. Mobile: This category is dedicated to mobile-specific methods that are not supported by the desktop extension, tailoring the user experience for mobile users.

For a comprehensive overview of all methods supported by the MetaMask Wallet API, including their parameters, expected responses, and the categories they belong to, please refer to the interactive API reference.

While developers have the option to integrate with MetaMask directly through the API, we recommend utilizing the MetaMask SDK for an enhanced and seamless user experience.

Building upon the MetaMask API, the SDK is a comprehensive library designed to facilitate a reliable, secure, and smooth connection between your dapp and both the MetaMask browser extension and MetaMask Mobile. This SDK allows for a variety of connection methods to MetaMask across different dapp platforms, eliminating the dependency on third-party libraries for integration.

Furthermore, the MetaMask SDK enhances the development experience by enabling automatic detection of the MetaMask wallet through EIP-6963. This eliminates the need for manual configuration or detection methods, thereby simplifying the initial setup process for developers and users alike.

Reasons to use the MetaMask Wallet API

Using the MetaMask Wallet API offers five key advantages:

  1. Access to MetaMask-specific methods: The Wallet API provides developers with several MetaMask-specific, battle-tested methods that enable tracking of specific tokens and assets, permission requests, redirection of onboarded users back to your dapp, and simplification of the connect & sign experience, among others.

  2. Access to an established power user base: Developers gain access to MetaMask's extensive user base, which includes over 100M installs and 30M monthly active users, and processes 100M monthly transactions through more than 17,000 connected web3 dapps.

  3. Cross-chain support: MetaMask supports all EVM chains and can be extended to support other chains through MetaMask Snaps, which facilitates transactions and dapps on networks such as Sui, Solana, Bitcoin, Algorand, Cosmos, Tezos, and Polkadot.

  4. Unified, cross-platform support: The MetaMask SDK supports dapps across JavaScript, iOS, Android, and game engines, allowing developers to integrate with MetaMask using just a few lines of code.

  5. Integration with popular libraries: The MetaMask SDK integrates with popular web3 connection libraries like Wagmi, web3onboard, web3 react, ethers.js, web3 auth, WalletConnect, and other wallet-agnostic connection libraries, fitting seamlessly into existing workflows.

Build with the MetaMask Wallet API to onboard millions of web3 power users to your dapp

Connecting with the MetaMask Wallet API offers an unparalleled opportunity to tap into a vast network of web3 enthusiasts and power users. By leveraging the robust, secure, and versatile features of the API and SDK, developers can significantly enhance the user experience of their dapps, streamline onboarding processes, and ensure compatibility across blockchain networks.

To get started, visit the MetaMask Developer portal today. Here, you'll find comprehensive guides, tutorials, templates, and everything you need to seamlessly integrate MetaMask into your dapp.

Receive our Newsletter