Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

LedgerHQ/ledger-live-mobile

Repository files navigation

⛔️ DEPRECATED

This repository is now deprecated. We moved to a new mono repository architecture containing all of Ledger Live JavaScript Ecosystem that you can find here. You can follow the migration guide to help you make the transition.

We are hiring, join us! 👨‍💻👩‍💻

ledger-live-mobile

Ledger Live is a mobile companion app for Ledger hardware wallets. It allows users to manage their crypto assets securely, such as Bitcoin, Ethereum, XRP and many others. Ledger Live mobile is available for iOS and Android.

Architecture

Ledger Live is a native mobile application built with React Native, React, Redux, RxJS, etc. and some native libraries. The architecture is analog to the desktop application and also uses our C++ library, lib-ledger-core, to deal with blockchains (sync, broadcast...) via ledger-core-react-native-bindings. It communicates with the Ledger Nano X via Bluetooth (or USB for using the Ledger Nano S on Android) to manage installed applications, update the device firmware, verify public addresses and sign transactions with ledgerjs. We also share some logic in live-common.

Developing on ledger-live-mobile

Pre-requisites

iOS

Android

  • Android Studio
  • JDK 11
  • Required SDK tools: (go to Android Studio > Tools > SDK Manager > SDK Tools > check "Show Package Details" at the bottom right)
    • Android NDK 21.4.7075529 (in case this doc is outdated, check the version specified as ndkVersion in android/build.gradle)
    • CMake 3.10.2

Scripts

yarn install

install dependencies.

yarn start

Runs your app in development mode.

Sometimes you may need to reset or clear the React Native packager's cache. To do so, you can pass the --reset-cache flag to the start script:

yarn start -- --reset-cache

yarn test

yarn run ios

or open ios/ledgerlivemobile.xcworkspace

yarn run android

or open android/ in Android Studio.

yarn android:clean

Delete the application data for Ledger Live Mobile, equivalent to doing it manually through settings

yarn android:import importDataString

Passing a base64 encoded export string (the export from desktop) will trigger an import activity and allow easy data setting for development.

Environment variables

Optional environment variables you can put in .env, .env.production or .env.staging for debug, release, or staging release builds respectively.

A more exhaustive list of documented environment variables can be found here.

  • DEVICE_PROXY_URL=http://localhost:8435 Use the ledger device over HTTP. Useful for debugging on an emulator. More info about this in the section Connection via HTTP bridge.
  • BRIDGESTREAM_DATA=... Come from console.log of the desktop app during the qrcode export. allow to bypass the bridgestream scanning.
  • DEBUG_RNDEBUGGER=1 Enable react native debugger.
  • DISABLE_READ_ONLY=1 Disable readonly mode by default.
  • SKIP_ONBOARDING=1 Skips the onboarding flow.

Maintenance

Refresh the flow-typed from flow-typed Github

yarn sync-flowtyped

Refresh the languages (when we add new languages)

yarn sync-locales

Debugging

Javascript / React

It's recommended to use react-native-debugger instead of Chrome dev tools as it features some additional React and Redux panels.

  • Get the react-native-debugger app from the official repo
  • Run it
  • Run Ledger Live Mobile in debug mode (yarn ios or yarn android)
  • Open React Native Development menu (shake gesture)
  • Chose Enable Remote JS Debugging

Keep in mind that doing so will run your Javascript code on a Chromium JS engine (V8) on your computer, instead of iOS' system JS engine (JavaScript Core), or our bundled JS engine (JSC for now, soon to be replaced with Hermes) on Android.

End to end testing

Refer to the e2e specific README.md

Native code

XCode / Android studio

Run the app from the Apple or Google own IDE to get some native debugging features like breakpoints etc.

And more

Flipper 🐬

Flipper has been integrated in the project, so you can use it to get additional debugging information (like network monitoring) and find other useful data you could previously get from scattered places, here neatly presented in a single interface (like logs and crash reports for both platforms).

React Native integration seems pretty bleeding edge right now, so don't expect everything to work just yet.

  • Install Flipper on your computer
  • Launch it 🚀
  • Run Ledger Live Mobile in debug as usual
  • No need to enable remote debug!

Working on iOS or Android emulators

Connection via HTTP bridge

It is possible to run Ledger Live Mobile on an emulator and connect to a Nano that is plugged in via USB.

  • Install the ledger-live cli.
  • Plug in your Nano to your computer.
  • Run ledger-live proxy. A server starts and displays variable environments that can be used to build Ledger-Live Mobile. For example:
    DEVICE_PROXY_URL=ws://localhost:8435
    DEVICE_PROXY_URL=ws://192.168.1.14:8435
    Nano S proxy started on 192.168.1.14
    
  • Either do export DEVICE_PROXY_URL=the_adress_given_by_the_server or paste this variable environment in the .env file at the root of the project (create it if it doesn't exist)
  • Build & run Ledger Live Mobile yarn ios or yarn android
  • When prompted to choose a Nano device in Ledger Live Mobile, you will see your Nano available with the adress from above, just select it and it should work normally.

Extra Docs 📄