Mobile web browser providing access to websites that use the Ethereum blockchain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ricky cafc79d6c5
Switch from `develop` to `main` (#3508)
1 year ago
.github Add lavamoat (#3367) 1 year ago
.vscode Introduce e2e tests via Detox (#51) 5 years ago
android Update build version. Update change logs. (#3642) 1 year ago
app Switch from `develop` to `main` (#3508) 1 year ago
e2e Experiment/upgrade react native 66 (#3509) 1 year ago
ios Update build version. Update change logs. (#3642) 1 year ago
locales Switch from `develop` to `main` (#3508) 1 year ago
patches Experiment/upgrade react native 66 (#3509) 1 year ago
scripts Patch recent disclosures (#3641) 1 year ago
sourcemaps Prevent autocomplete crash (#878) 4 years ago
.android.env.example Fix approval transaction getting mistakenly treated as a swap transaction (#3295) 1 year ago
.buckconfig Inception 5 years ago
.editorconfig Experiment/upgrade react native 66 (#3509) 1 year ago
.eslintrc.js promote no-console rule to full error (#3369) 1 year ago
.flowconfig Experiment/upgrade react native 66 (#3509) 1 year ago
.gitattributes Experiment/upgrade react native 66 (#3509) 1 year ago
.gitignore Experiment/upgrade react native 66 (#3509) 1 year ago
.gitmodules GitHub Actions (#3298) 1 year ago
.ios.env.example Fix approval transaction getting mistakenly treated as a swap transaction (#3295) 1 year ago
.js.env.example Fix approval transaction getting mistakenly treated as a swap transaction (#3295) 1 year ago
.nvmrc Upgrade .nvmrc to node v14 (#2588) 2 years ago
.prettierignore Bug/update contract metadata (#3171) 2 years ago
.watchmanconfig Upgrade react native to v0.58.4 (#393) 4 years ago
.yarnrc Add lavamoat (#3367) 1 year ago
CHANGELOG.md Update build version. Update change logs. (#3642) 1 year ago
LICENSE Feature/add license file (#3254) 1 year ago
README.md Switch from `develop` to `main` (#3508) 1 year ago
RELEASE.MD rename master to main (#2493) 2 years ago
app.json Inception 5 years ago
architecture.svg Added Architecture diagram (#1281) 3 years ago
babel.config.js Experiment/upgrade react native 66 (#3509) 1 year ago
bitrise.yml Update build version. Update change logs. (#3642) 1 year ago
branch.json Upgrade react native to v0.58.4 (#393) 4 years ago
index.js Experiment/upgrade react native 66 (#3509) 1 year ago
jest.config.js Experiment/upgrade react native 66 (#3509) 1 year ago
jest.preprocessor.js Upgraded to React Native 0.59 & Pin deps to exact version (#515) 4 years ago
logo.png Tooling 5 years ago
metro.config.js Add react-native-svg-asset-plugin. Update tests. (#3207) 1 year ago
package.json Patch recent disclosures (#3641) 1 year ago
react-native.config.js Add typescript eslint from metamask (#3088) 2 years ago
sentry.debug.properties.example Replace Fabric Crashlytics with Sentry (#1376) 3 years ago
sentry.properties fix builds (#1597) 3 years ago
sentry.release.properties.example Replace Fabric Crashlytics with Sentry (#1376) 3 years ago
shim.js Fix mixed tabs and spaces (#1379) 3 years ago
tsconfig.json Feature/2816 token detection mvp (#2901) 2 years ago
yarn.lock Patch recent disclosures (#3641) 1 year ago

README.md

MetaMask logo

MetaMask

CI CLA

MetaMask is a mobile web browser that provides easy access to websites that use the Ethereum blockchain.

For up to the minute news, follow our Twitter or Medium pages.

To learn how to develop MetaMask-compatible applications, visit our Developer Docs.

MetaMask Mobile

Building Locally

The code is built using React-Native and running code locally requires a Mac or Linux OS.

  • Install sentry-cli tools: brew install getsentry/tools/sentry-cli

  • Install Node.js version 14 (latest stable) and yarn@1 (latest)

    • If you are using nvm (recommended) running nvm use will automatically choose the right node version for you.
  • Install the shared React Native dependencies (React Native CLI, not Expo CLI)

  • Install cocoapods by running:

sudo gem install cocoapods
  • MetaMask Only: Rename the .*.env.example files (remove the .example) in the root of the project and fill in the appropriate values for each key. Get the values from another MetaMask Mobile developer.

  • Clone this repo and install our dependencies:

git clone ...
cd metamask-mobile
yarn setup # not the usual install command, this will run a lengthy postinstall flow
cd ios && pod install && cd .. # install pods for iOS
  • Non-MetaMask Only: In the project root folder run
  cp .ios.env.example .ios.env && \
  cp .android.env.example .android.env && \
  cp .js.env.example .js.env
  • Non-MetaMask Only: Create an account and generate your own API key at Infura in order to connect to main and test nets. Fill MM_INFURA_PROJECT_ID in .js.env. (App will run without it, but will not be able to connect to actual network.)

  • Then, in one terminal, run:

yarn watch

Android

  • Install the Android SDK, via Android Studio.
    • MetaMask Only: To create production builds, you need to install Google Play Licensing Library via the SDK Manager in Android Studio.
  • Install the Android NDK, via Android Studio's SDK Manager.
    • In the SDK Manager, select the SDK Tools tab and install NDK version 21.4.7075529. You'll need to click "Show Package Details" in order to select the appropriate version.
  • Linux only:
    • Ensure that you have the secret-tool binary on your machine.
      • Part of the libsecret-tools package on Debian/Ubuntu based distributions.
  • Install the correct emulator
  • Finally, start the emulator from Android Studio, and run:
yarn start:android

iOS

  • Install the iOS dependencies
  • Install the correct simulator
    • iOS OS Version: Latest, unless told otherwise
    • Device: iPhone 11 Pro
yarn start:ios

Build Troubleshooting

Unfortunately, the build system may fail to pick up local changes, such as installing new NPM packages or yarn linking a dependency. If the app is behaving strangely or not picking up your local changes, it may be due to build issues. To ensure that you're starting with a clean slate, close all emulators/simulators, stop the yarn watch process, and run:

yarn clean

# if you're going to `yarn link` any packages,
# do that here, before the next command

yarn watch:clean

# ...and then, in another terminal

yarn start:ios

# or

yarn start:android

If yarn link fails after going through these steps, try directly yarn adding the local files instead.

Debugging

First, make sure you have the following running:

  • yarn watch
  • Your Android emulator or iOS simulator
  • yarn start:android or yarn start:ios

Next, install the Flipper desktop app (verified working with v0.127.0)

  • Once Flipper is installed, configure your system as follows:
    • Install react-devtools: npm i -g react-devtools@4.22.1
    • Update Android SDK location settings by accessing Flipper's settings via the Gear Icon -> Settings
      • Example SDK path: /Users/<USER_NAME>/Library/Android/sdk

Finally, check that the debugger is working:

  • Open your emulator or simulator alongside the Flipper app
  • Flipper should auto-detect the device and the application to debug
  • You should now be able to access features such as Logs

Debugging Physical iOS devices

  • Debugging physical iOS devices requires idb to be installed, which consists of 2 parts
  • Install the two idb parts:
    1. brew tap facebook/fb & brew install idb-companion
    2. pip3.9 install fb-idb (This step may require that you install python3 via python -m pip3 install --upgrade pip)

Miscellaneous

Running Tests

Unit Tests

yarn test:unit

E2E Tests (iOS)

First, follow the instructions here to install applesimutils. Then:

yarn test:e2e:ios

E2E Tests (Android)

yarn test:e2e:android

Changing dependencies

Whenever you change dependencies (adding, removing, or updating, either in package.json or yarn.lock), there are various files that must be kept up-to-date.

  • yarn.lock:
    • Run yarn setup again after your changes to ensure yarn.lock has been properly updated.
  • The allow-scripts configuration in package.json
    • Run yarn allow-scripts auto to update the allow-scripts configuration automatically. This config determines whether the package's install/postinstall scripts are allowed to run. Review each new package to determine whether the install script needs to run or not, testing if necessary.
    • Unfortunately, yarn allow-scripts auto will behave inconsistently on different platforms. macOS and Windows users may see extraneous changes relating to optional dependencies.

Architecture

To get a better understanding of the internal architecture of this app take a look at this diagram.