> **Key takeaway:**  ☞   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.

# How to initialize and use the Ledger Wallet API

## Goal

Initialize the  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`:

```sh npm2yarn
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`.

```javascript
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  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.
