# JavaScript

The JavaScript version of the MetaMask SDK enables all JavaScript-based apps to easily connect with a MetaMask wallet client. It supports:

To install, import, instantiate and use the SDK, see the getting started section. Deviations from the standard are highlighted on each of the supported frameworks.

# Getting started

# 1. Install a MetaMask Mobile version compatible with the SDK

In order to test the MetaMask SDK, developers need access to a MetaMask Mobile build that is compatible with the SDK. Please install MetaMask Mobile v5.8.1 or above.

# 2. Install the SDK

yarn add @metamask/sdk
npm i @metamask/sdk

# 3. Import the SDK

import MetaMaskSDK from '@metamask/sdk';

# 4. Instantiate the SDK

For all Javascript-based apps, instantiate the SDK like this:

const MMSDK = new MetaMaskSDK(options);
const ethereum = MMSDK.getProvider(); // You can also access via window.ethereum

For a list of possible options check here

# 5. Use the SDK

ethereum.request({ method: 'eth_requestAccounts', params: [] });

You should always call eth_requestAccounts first!

For possible methods, check the Ethereum Provider API