Home

Awesome

<h3 align="center"> <image src="https://user-images.githubusercontent.com/3428394/165078916-06fe0b1b-c11d-4c6f-9c1a-ac9291333852.png" alt="ledger-logo" height="100" /> &nbsp; <image src="https://user-images.githubusercontent.com/3428394/165078595-1b2a55ae-783a-4c8f-8548-c4f050ae5e76.png" alt="js-logo" height="100" /> <br/> <h3 align="center">The Ledger Live JavaScript Ecosystem</h3> <h4 align="center"> <a href="https://jobs.lever.co/ledger/?department=Tech"> We are hiring, join us! 👨‍💻👩‍💻 </a> </h4> </h3>

gitpoap badge

About

ledger-live is a monorepository whose purpose is to centralize all the JavaScript code related to the Ledger Live applications in one place.

Ledger Live is our platform of apps and services designed specifically for seamless integration with your Ledger device. Acting as a secure gateway to the crypto ecosystem, it allows direct access to a diverse range of crypto, NFT and DeFi services. This integration ensures a safer and more user-friendly experience that address a common security issue known as 'blind signing'.

Developers looking to integrate their blockchain in Ledger Live are invited to head to the Developer Portal where they will find the section Blockchain Support.

Installation

💡 This is only a minimal setup. You will need to perform additional installation steps depending on the package you want to work on, please refer to its nested readme file.

Cloning

git clone git@github.com:LedgerHQ/ledger-live.git
cd ledger-live

Proto

⚠️ Important: In order to install the right version of the tools you will need to install the proto toolchain manager. Please follow the instructions on the proto website to install it.

Once you have installed proto, please run the following command:

# Will download and install the supported versions of nodejs, npm and pnpm.
# Run it from the root or a subfolder of the repository.
proto use

Dependencies

Use the pnpm package manager to install the dependencies in the whole workspace:

pnpm i
# Alternatively, if you want to bypass the postinstall scripts which can be long to run
# pnpm i --ignore-scripts

Note: multiple postinstall steps will be triggered and fail if the applications prerequisites are not met. You can safely ignore the errors if you do not plan to work on those apps.

Common setup errors

Out of sync Podfile.lock

You may encounter this error when running pnpm i. Try:

rm -rf ~/.cocoapods/
pnpm clean && pnpm store prune && proto use && pnpm i && pnpm build:llm:deps
pnpm mobile pod

Note: If prompted to run bundle install do this in the ledger-live-mobile directory. Restart terminal if the error persists.

Usage

Important: All the commands should be run at the root of the monorepo.

Tools

We use pnpm workspaces and turborepo under the hood to handle local and external dependencies, orchestrate tasks and perform various optimizations like package hoisting or remote caching.

For changelog generation releases and package publishing we rely on the changesets library.

Root scripts

The scripts that are defined inside the root /package.json file will use turborepo under the hood and automatically perform needed tasks before running the action.

# This command will first build all the local dependencies needed in the right order.
# Only then it will attempt to build the `Ledger Live Desktop` app.
pnpm build:lld

Aliases

To run nested scripts which are not covered at the root, you should not change your working directory. Every package has an alias defined (see application or library tables or check out the package.json file) that you can use as a prefix when running the script from the root.

# `pnpm desktop` is one of the shorthands written to avoid changing the working directory.

# The following command will run the nested `test` script.
# `test` is defined inside the `./apps/ledger-live-desktop/package.json` file.
pnpm desktop test

Note that when using these kinds of scripts you will have to make sure that the dependencies are built beforehand.

Scoping

You can scope any pnpm or turborepo based script by using the --filter flag.

This is a very powerful feature that you should look into if you are a frequent contributor.

Please check out the pnpm or turborepo documentation for more details (the syntax is almost similar albeit pnpm being a bit more powerful).

Here are some examples:

# Install all the dependencies needed for the packages under ./libs
pnpm i -F "{libs/**}..."
# Run lint only on packages that have been changed compared to origin/develop
pnpm lint --filter=[origin/develop]
# Test every package that has been changed since the last commit excluding the applications
pnpm run test --continue --filter="!./apps/*" --filter="...[HEAD~1]"
# Run typechecks for the Ledger Live Mobile project
pnpm typecheck --filter="live-mobile"

Documentation

Each project folder has a README.md file which contains basic documentation. It includes background information about the project and how to setup, run and build it.

Please check the wiki for additional documentation.

Structure

The sub-packages are (roughly) split into three categories.

/app - Applications

The applications are user-facing programs which depend on one or more libraries.

<details><summary><b>Ledger Live Applications</b></summary> <br/> <p>
NameAliasDownload
Ledger Live Desktoppnpm desktopWebsite
Ledger Live Mobilepnpm mobileAndroid / iOS
</p> </details>

/libs - Libraries

Libraries serve as publicly available packages, designed for integration with other libraries or applications. These packages are deployed to the official npm repository under the @ledgerhq organization.

<details><summary><b>Ledger Live Libraries</b></summary> <br/> <p>
NameAliasUmbrellaPackage
@ledgerhq/ledger-live-commonpnpm common-----
---------------------
@ledgerhq/cryptoassetspnpm ljs:cryoptoassetsledgerjsnpm
@ledgerhq/devicespnpm ljs:devicesledgerjsnpm
@ledgerhq/errorspnpm ljs:errorsledgerjsnpm
@ledgerhq/hw-app-algorandpnpm ljs:hw-app-algorandledgerjsnpm
@ledgerhq/hw-app-btcpnpm ljs:hw-app-btcledgerjsnpm
@ledgerhq/hw-app-cosmospnpm ljs:hw-app-cosmosledgerjsnpm
@ledgerhq/hw-app-ethpnpm ljs:hw-app-ethledgerjsnpm
@ledgerhq/hw-app-heliumpnpm ljs:hw-app-heliumledgerjsnpm
@ledgerhq/hw-app-polkadotpnpm ljs:hw-app-polkadotledgerjsnpm
@ledgerhq/hw-app-solanapnpm ljs:hw-app-solanaledgerjsnpm
@ledgerhq/hw-app-strpnpm ljs:hw-app-strledgerjsnpm
@ledgerhq/hw-app-tezospnpm ljs:hw-app-tezosledgerjsnpm
@ledgerhq/hw-app-trxpnpm ljs:hw-app-trxledgerjsnpm
@ledgerhq/hw-app-xrppnpm ljs:hw-app-xrpledgerjsnpm
@ledgerhq/hw-transportpnpm ljs:hw-transportledgerjsnpm
@ledgerhq/hw-transport-httppnpm ljs:hw-transport-httpledgerjsnpm
@ledgerhq/hw-transport-mockerpnpm ljs:hw-transport-mockerledgerjsnpm
@ledgerhq/hw-transport-node-hidpnpm ljs:hw-transport-nodeledgerjsnpm
@ledgerhq/hw-transport-node-hid-noeventspnpm ljs:hw-transport-nodeledgerjsnpm
@ledgerhq/hw-transport-node-hid-singletonpnpm ljs:hw-transport-nodeledgerjsnpm
@ledgerhq/hw-transport-node-speculospnpm ljs:hw-transport-nodeledgerjsnpm
@ledgerhq/hw-transport-node-speculos-httppnpm ljs:hw-transport-nodeledgerjsnpm
@ledgerhq/hw-transport-web-blepnpm ljs:hw-transport-webledgerjsnpm
@ledgerhq/hw-transport-webhidpnpm ljs:hw-transport-webhidledgerjsnpm
@ledgerhq/hw-transport-webusbpnpm ljs:hw-transport-webusbledgerjsnpm
@ledgerhq/logspnpm ljs:logsledgerjsnpm
@ledgerhq/react-native-hidpnpm ljs:react-native-hidledgerjsnpm
@ledgerhq/react-native-hw-transport-blepnpm ljs:react-native-hwledgerjsnpm
@ledgerhq/types-cryptoassetspnpm ljs:types-cryptoassetsledgerjsnpm
@ledgerhq/types-devicespnpm ljs:types-devicesledgerjsnpm
@ledgerhq/types-livepnpm ljs:types-liveledgerjsnpm
---------------------
@ledgerhq/icons-uipnpm ui:iconsuinpm
@ledgerhq/native-uipnpm ui:nativeuinpm
@ledgerhq/react-uipnpm ui:reactuinpm
@ledgerhq/ui-sharedpnpm ui:shareduinpm
</p> </details>

/tools - Tools

⚠️ Tools are primarily intended for internal use and are largely undocumented.

A tool can be a github action, a shell script or a piece of JavaScript code that is used throughout this repository.

Contributing

Please check the general guidelines for contributing to Ledger Live projects: CONTRIBUTING.md.

Each individual project may include its own specific guidelines, located within its respective folder.

While you explore these projects, here are some key points to keep in mind:

Nightly Releases

Every night a github action merges the develop branch into the nightly branch.

For more information on the nightly releases, have a look at our wiki.

Ledger Live Desktop

Ledger Live Mobile

Libraries

Nightly versions of library packages are pushed every night to npm.

To install a nightly library use the @nightly dist-tag.

npm i @ledgerhq/live-common@nightly

License

Please check each project LICENSE file, most of them are under the MIT license.