8 - Ledger Services Kit
- Fork github.com/LedgerHQ/wallet-api
- Clone the repo
Running the Ledger Services Kit project
cd wallet-api
pnpm i
pnpm dev
Adding the crypto in the Ledger Services Kit
-
In
packages/core/src/families
create a folder for your family if it doesn’t already exist -
In
packages/core/src/families/common.ts
update theFAMILIES
array to add your new coin family name -
In
packages/core/src/families/{COIN_FAMILY}/validation.ts
define and export coin family types related schema using Zod. At minimum, aschemaRaw{COIN_FAMILY}Transaction
-
In
packages/core/src/families/{COIN_FAMILY}/types.ts
define and export types related to your type. At minimum, a{COIN_FAMILY}Transaction
and aRaw{COIN_FAMILY}Transaction
-
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 -
In
packages/core/src/families/index.ts
export your new family types -
In
packages/core/src/families/types.ts
updateTransaction
type to add your new coin related transaction type -
In
packages/core/src/families/validation.ts
updateschemaRawTransaction
to add your new coin related transaction schema -
In
packages/core/src/families/serializer.ts
add your new coin family transactions serialization and deserialization logics inserializeTransaction
anddeserializeTransaction
-
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) -
Create a PR on the wallet-api repo in order to get a new version to use in LL
Examples:
Updating Ledger Live
-
Clone the repo
-
Update the version of
@ledgerhq/wallet-api-core
,@ledgerhq/wallet-api-server
and@ledgerhq/wallet-api-client
used in Ledger Live -
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
)