MetaMask Developer Documentation

repository·main·Indexed 21 days ago

https://github.com/metamask/metamask-docs

Source documentation for the MetaMask developer site. Includes guides on MetaMask Embedded Wallet SDKs (formerly Web3Auth Plug and Play SDKs) for Web and Mobile, blockchain connection configuration via the dashboard, and using the Agent Wallet to manage Aave V3 positions (supply, borrow, withdraw, and repay) across multiple chains including Ethereum, Polygon, Arbitrum, Optimism, Avalanche, and Base.

Tokens
543.6K
Snippets
1.4K
Records
2K
Agent score
74%

What's inside MetaMask Docs

  1. Introduction to MetaMask Connect EVM

    main

    MetaMask Connect EVM (@metamask/connect-evm) is the modern replacement for @metamask/sdk. It allows you to connect your dapp to Ethereum and other EVM-compatible networks via the MetaMask mobile app or browser extension.

    Key features include:

    • EIP-1193 Compatibility: Provides a provider with the same shape as window.ethereum, allowing existing code for viem, ethers.js, or web3.js to work without changes.
    • Automatic Platform Detection: Detects the environment (mobile vs. extension).
    • Relay-based Connections: Facilitates connectivity.
    • Session Persistence: Maintains user sessions.
    • Convenience Methods: Includes methods like connectAndSign and connectWith.

    Note for Multichain Developers: If your dapp supports both EVM and Solana, use the multichain client instead. The EVM and Solana clients share the same underlying multichain session, allowing the user to approve once for both.

  2. Overview of Embedded Wallets Authentication

    main

    MetaMask Embedded Wallets (formerly Web3Auth) provides an authentication system that bridges Web2 and Web3 identities. It allows developers to implement secure onboarding flows by offering control over login experiences and wallet integrations.

    Applications use Embedded Wallets SDKs to authenticate users through various mechanisms, supporting both traditional social/email identities and decentralized wallet-based identities.

    Note on Branding: While the product is now branded as MetaMask Embedded Wallet SDKs, the package names and APIs still use the web3auth identifier (e.g., Web3Auth React SDK).

  3. Overview of MetaMask Agent Wallet

    main

    MetaMask Agent Wallet is a self-custodial wallet designed for AI agents. It allows agents to trade autonomously within user-defined limits, resolving the trade-off between agent freedom and fund security. Agents interact with the wallet by routing natural-language requests to the mm CLI through installed "skills."

    Key Security Features: All supported EVM transactions pass through a mandatory 3-step pipeline:

    1. Transaction simulation: Surfaces balance changes, approvals, and gas costs before signing.
    2. Threat scanning: Powered by Blockaid to auto-bounce malicious transactions or flag them for manual approval.
    3. Smart Transactions: Provides MEV protection, improved gas efficiency, and fewer failures where supported.

    Eligible transactions may be covered by Transaction Protection up to $10,000/month.

  4. Overview of the Embedded Wallets Flutter SDK

    main
    The Embedded Wallets Flutter SDK provides a suite of functions for handling authentication, user management, and blockchain interactions within Flutter applications. It enables developers to implement user login, Multi-Factor Authentication (MFA), private key retrieval, and Wallet Services (such as transaction signing UI) with minimal integration effort.
  5. Overview of MetaMask Connect SDK

    main

    MetaMask Connect is a Dapp Wallet Integration SDK designed to provide seamless connections between a dapp and the MetaMask wallet across desktop browsers (extensions), mobile browsers, and native apps.

    It replaces the legacy MetaMask SDK and is built on the CAIP-25 Multichain API. The SDK automatically detects the user's environment to select the optimal connection method: direct communication with the browser extension, QR code scanning for mobile, or deep-linking to the MetaMask mobile app.

    Key capabilities include:

    • Cross-platform support: Works on desktop, mobile, and native apps.
    • Multichain sessions: Request access to multiple ecosystems (EVM, Solana) in a single connection.
    • Persistent sessions: Maintains connections across page reloads and new tabs.
    • Consistent API: Provides a unified interface regardless of the connection method used.
  6. Overview of MetaMask Embedded Wallets

    main
    MetaMask Embedded Wallets allow developers to integrate MetaMask wallet capabilities directly into their decentralized applications (dapps). Before starting an integration, developers must choose a signing scheme that matches their dapp's requirements. The available signing schemes and their characteristics are provided in the technical comparison documentation.
  7. Introduction to MetaMask Connect Multichain

    main

    MetaMask Connect Multichain (@metamask/connect-multichain) is a cross-chain wallet API that allows a dapp to connect to multiple blockchain ecosystems (such as EVM networks and Solana) within a single user session.

    Instead of requiring separate connection flows for each chain, the multichain client enables a single connection prompt that covers all requested networks. This is built on the CAIP-25 specification, which provides a chain-agnostic standard for wallet-dapp communication.

    Key capabilities:

    • Unified Sessions: Request access to multiple ecosystems (e.g., Ethereum, Polygon, and Solana) at once.
    • Cross-Chain Requests: Send transactions or requests to any chain authorized in the current session.
    • Lifecycle Management: Use SDK methods to connect, retrieve session data, invoke methods on specific chains, and disconnect.
  8. Overview of React hooks for Web3Auth Modal

    main
    Embedded Wallets provides a suite of React hooks designed to streamline integration and state management in React applications. These hooks abstract common authentication, wallet operations, and blockchain interactions, reducing the boilerplate required to implement Embedded Wallets features. Hooks are categorized by their functional area: Web3Auth core, Authentication, Identity, Blockchain, Multi-Factor Authentication (MFA), and Wallet Services plugins.
  9. Overview of Vue composables for Web3Auth Modal

    main

    Embedded Wallets provides a suite of Vue composables designed to streamline integration and state management in Vue applications. These composables abstract authentication, wallet operations, and blockchain interactions, reducing boilerplate when implementing Web3Auth features.

    Composables are categorized into several functional areas:

    • Embedded Wallets: Core initialization and state management.
    • Authentication: Connection and disconnection processes.
    • Identity: Managing user information and identity tokens.
    • Blockchain: Network and chain switching.
    • MFA: Multi-Factor Authentication setup and management.
    • Wallet Services Plugin: Specialized features like WalletConnect scanning, UI management, checkout, and swapping.
  10. Introduction to MetaMask Smart Accounts Kit

    main

    The MetaMask Smart Accounts Kit is a suite of contracts, libraries, and services designed to help developers build decentralized applications (dapps) using programmable account behavior and granular permission sharing.

    Key capabilities include:

    • Programmable Account Behavior: Leveraging MetaMask Smart Accounts for advanced features like multi-signature approvals and gas abstraction.
    • Delegation: Secure, rule-based permission sharing powered by the Delegation Framework.
    • Advanced Permissions (ERC-7715): Requesting fine-grained permissions directly via the MetaMask browser extension to perform executions on behalf of users.
  11. Integrate Embedded Wallets with the Mint Blockchain

    main

    You can integrate MetaMask Embedded Wallets with the EVM-based Mint blockchain across different platforms. The method of interaction depends on the SDK being used:

    • Web SDKs: Web3Auth returns a provider. You can use this provider directly to initialize blockchain libraries such as ethers.js or web3.js to make blockchain calls.
    • Mobile & Gaming SDKs: The private key is available within the user scope. You can use this private key to initialize your preferred blockchain interaction libraries and make calls to the Mint network.
  12. Integrate MetaMask Embedded Wallets with Solana

    main

    MetaMask Embedded Wallet SDKs (formerly Web3Auth Plug and Play SDKs) provide native support for the Solana blockchain. Upon user authentication, the SDK provides an ed25519 private key compatible with Solana. This allows developers to perform secure transaction signing and JSON-RPC interactions, such as submitting transactions, querying data, and managing sessions, across Solana networks.

    Note on Branding: While the SDKs are now branded as MetaMask Embedded Wallet SDKs, the package names and APIs still use web3auth identifiers (e.g., Web3Auth React SDK).