Skip to Content
We're improving our docs. Share your experience and help shape what comes next.

How to initialize and use the Ledger Wallet API

☞ The renaming of “Ledger Live” to “Ledger Wallet” and “wallet” (in the hardware sense) to “signer” is still in progress. This page may contain legacy references that will be updated.

Goal

Initialize the Ledger Wallet API Core client, connect to a transport, and perform basic interactions (e.g., read accounts), then cleanly disconnect.

Installation

You can use your favorite package manager to install @ledgerhq/wallet-api-client:

npm install @ledgerhq/wallet-api-client

Step 1 - Initialize the transport

Set up the WindowMessageTransport (provided by @ledgerhq/wallet-api-core and re-exposed by @ledgerhq/wallet-api-client) to enable communication between your app and Ledger devices.

Step 2 - Create and initialize the client

Use the transport to initialize WalletAPIClient.

import { WalletAPIClient, WindowMessageTransport, } from "@ledgerhq/wallet-api-client"; async function initializeWalletApiClient() { // 1) Connect the Window Message Transport const windowMessageTransport = new WindowMessageTransport(); windowMessageTransport.connect(); // 2) Initialize the Wallet API Client const walletApiClient = new WalletAPIClient(windowMessageTransport); // 3) Use the client (example: list accounts) // const accounts = await walletApiClient.account.getAccounts(); // Your application logic here... // 4) Disconnect when done windowMessageTransport.disconnect(); } // Execute the function initializeWalletApiClient().catch((error) => console.error(error));

Step 3 - Disconnect when finished

Always close the communication channel by calling disconnect on the transport after your operations are complete.

Outcome

You have a connected Ledger Wallet API client and can call methods such as account.getAccounts() to interact with Ledger devices.

Next steps

  • Explore available methods in the API reference to retrieve accounts, request signatures, and perform transactions.
  • Integrate error handling and UI flows for device connection states.
Last updated on
Ledger
Copyright © Ledger SAS. All rights reserved. Ledger, Ledger Stax, Ledger Flex, Ledger Nano, Ledger Nano S, Ledger OS, Ledger Wallet, [LEDGER] (logo), [L] (logo) are trademarks owned by Ledger SAS.