DocumentationLedger LiveAccountsIntegration walkthroughsBlockchainLedger Services Kit

8 - Ledger Services Kit

  1. Fork github.com/LedgerHQ/wallet-api
  2. Clone the repo

Running the Ledger Services Kit project

cd wallet-api
pnpm i
pnpm dev

Adding the crypto in the Ledger Services Kit

  1. In packages/core/src/families create a folder for your family if it doesn’t already exist

  2. In packages/core/src/families/common.ts update the FAMILIES array to add your new coin family name

  3. In packages/core/src/families/{COIN_FAMILY}/validation.ts define and export coin family types related schema using Zod. At minimum, a schemaRaw{COIN_FAMILY}Transaction

  4. In packages/core/src/families/{COIN_FAMILY}/types.ts define and export types related to your type. At minimum, a {COIN_FAMILY}Transaction and a Raw{COIN_FAMILY}Transaction

  5. In packages/core/src/families/{COIN_FAMILY}/serializer.ts add the logic to serialize and deserialize a transaction in a raw transaction (type comprised of only json compatible types) to be transferred through JSON-RPC

  6. In packages/core/src/families/index.ts export your new family types

  7. In packages/core/src/families/types.ts update Transaction type to add your new coin related transaction type

  8. In packages/core/src/families/validation.ts update schemaRawTransaction to add your new coin related transaction schema

  9. In packages/core/src/families/serializer.ts add your new coin family transactions serialization and deserialization logics in serializeTransaction and deserializeTransaction

  10. Create a changeset with the command pnpm changelog, you should only need to select @ledgerhq/wallet-api-core then you can select it again for the minor bump as we introduce a new feature and add a summary of the changes (you can edit the file after creation)

  11. Create a PR on the wallet-api repo in order to get a new version to use in LL

Examples:

Updating Ledger Live

  1. Fork github.com/LedgerHQ/ledger-live

  2. Clone the repo

  3. Update the version of @ledgerhq/wallet-api-core, @ledgerhq/wallet-api-server and @ledgerhq/wallet-api-client used in Ledger Live

  4. In LL, you might need to create an adapter for your coin family to transform a WalletAPITransaction (the type of the transaction from the Ledger Services Kit point of view) to a Ledger Live Transaction (the type of the transaction from the Ledger Live point of view)

  • libs/ledger-live-common/src/generated/walletApiAdapter.ts import your adapter and add it to the export
ℹ️

The file above is automatically generated at build time by this script. It should not be updated manually but you should still check that your adapter is included in this file once added.

The actual adapted file to add is described bellow:

  • libs/ledger-live-common/src/families/{COIN_FAMILY}/walletApiAdapter.ts the actual transaction adapter
    (here is an example adapter for ethereum: libs/ledger-live-common/src/families/ethereum/walletApiAdapter.ts)

Examples:

Ledger
Copyright © Ledger SAS. All rights reserved. Ledger, Ledger Nano S, Ledger Vault, Ledger OS are registered trademarks of Ledger SAS