Introduction
All the JavaScript code related to the Ledger Live applications is in the ledger-live
monorepository. The work to integrate a Blockchain in Ledger Live will all happen in this monorepository.
Ledger Live Common (./libs/ledger-live-common
) is the shared core library used by Ledger Live Desktop and Mobile, that also includes a CLI for testing purpose or for using Ledger Live features directly from a terminal (in a limited way).
This library is built upon a pretty standard ES6 + Typescript stack and relies on a bunch of ledgerjs packages, RxJS 6.x, bignumber.js and React + Redux for some front-end utilities and hooks.
It is designed to have very generic models and mechanics (for currencies, accounts, storage, synchronisation, events…) that also facilitates new blockchain integrations through flexibility.
All integrated coins are implemented in a libs/ledger-live-common/src/families
dedicated folder which contains the specifics of a coin family - that can be shared by multiple crypto-assets that use the same implementation (i.e. Bitcoin-like coins share the same bitcoin
family).
This document only concerns new blockchain integrations using Typescript - we will use an imaginary coin named MyCoin
as a walkthrough.
Setup
Requirements
Hardware prerequisites
- A physical device (Ledger Nano S, S Plus, X or a Stax)
- MyCoin app installed on device
Installation
Structure
Your whole implementation of MyCoin must reside in a mycoin
folder in libs/ledger-live-common/src/families/
with the exception of some changes to apply in shared code.
Here is a typical family folder structure (TS integration):
./src/families/mycoin
├── bridge
│ └── js.ts
├── hw-app-mycoin
│ └── MyCoin.ts
├── api.ts
├── hw-getAddress.ts
├── errors.ts
├── deviceTransactionConfig.ts
├── account.ts
├── transaction.ts
├── serialization.ts
├── cli-transaction.ts
├── logic.ts
├── cache.ts
├── preload.ts
├── react.ts
├── specs.ts
├── speculos-deviceActions.ts
├── bridge.integration.test.ts
├── test-specifics.ts
└── types.ts
Note
You can refer to existing implementations to complete given examples, like Polkadot integration