> ## Documentation Index
> Fetch the complete documentation index at: https://cosmos-docs-cosmjs-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# @cosmjs/ledger-amino

> Ledger hardware wallet integration for Amino signing

Provides Ledger hardware wallet support for Amino transaction signing. Implements the `OfflineAminoSigner` interface, making it compatible with `SigningStargateClient` and `SigningCosmWasmClient`.

```bash theme={"system"}
npm install @cosmjs/ledger-amino
```

<Info>
  Requires the Cosmos app installed on your Ledger device and a transport library like `@ledgerhq/hw-transport-webusb` (browser) or `@ledgerhq/hw-transport-node-hid` (Node.js).
</Info>

## LedgerSigner

Implements `OfflineAminoSigner` using a Ledger hardware wallet.

| Method        | Parameters                                                 | Returns                                                                                   |
| ------------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `constructor` | `transport: Transport`, `options?: LedgerConnectorOptions` | `LedgerSigner`                                                                            |
| `getAccounts` | —                                                          | `Promise<readonly AccountData[]>`                                                         |
| `signAmino`   | `signerAddress: string`, `signDoc: StdSignDoc`             | `Promise<AminoSignResponse>`                                                              |
| `showAddress` | `path?: HdPath`                                            | `Promise<AddressAndPubkey>` (asks the device to display an address for user confirmation) |

### Options

```typescript theme={"system"}
interface LedgerConnectorOptions {
  readonly hdPaths?: readonly HdPath[];
  readonly prefix?: string;
  readonly testModeAllowed?: boolean;
  readonly ledgerAppName?: string;
  readonly minLedgerAppVersion?: string;
}
```

### Usage

```typescript theme={"system"}
import TransportWebUSB from "@ledgerhq/hw-transport-webusb";
import { LedgerSigner } from "@cosmjs/ledger-amino";
import { makeCosmoshubPath } from "@cosmjs/amino";
import { SigningStargateClient, GasPrice } from "@cosmjs/stargate";

const transport = await TransportWebUSB.create();
const signer = new LedgerSigner(transport, {
  hdPaths: [makeCosmoshubPath(0)],
  prefix: "cosmos",
});

const [{ address }] = await signer.getAccounts();

const client = await SigningStargateClient.connectWithSigner(
  "https://rpc.my-chain.network",
  signer,
  { gasPrice: GasPrice.fromString("0.025uatom") },
);

const result = await client.sendTokens(
  address,
  "cosmos1recipient...",
  [{ denom: "uatom", amount: "1000000" }],
  "auto",
);
```

## LedgerConnector

Low-level interface for direct communication with the Cosmos Ledger app.

| Method                | Parameters                                                 | Returns                                                       |
| --------------------- | ---------------------------------------------------------- | ------------------------------------------------------------- |
| `constructor`         | `transport: Transport`, `options?: LedgerConnectorOptions` | `LedgerConnector`                                             |
| `getCosmosAppVersion` | —                                                          | `Promise<string>`                                             |
| `getPubkey`           | `hdPath?: HdPath`                                          | `Promise<Uint8Array>`                                         |
| `getPubkeys`          | —                                                          | `Promise<readonly Uint8Array[]>` (one per configured HD path) |
| `getCosmosAddress`    | `pubkey?: Uint8Array`                                      | `Promise<string>`                                             |
| `sign`                | `message: Uint8Array`, `hdPath?: HdPath`                   | `Promise<Uint8Array>`                                         |
| `showAddress`         | `hdPath?: HdPath`                                          | `Promise<AddressAndPubkey>`                                   |

### Types

```typescript theme={"system"}
interface AddressAndPubkey {
  readonly address: string;
  readonly pubkey: Secp256k1Pubkey;
}
```

When constructing `LedgerConnector` without options, these defaults apply: `ledgerAppName` is `"Cosmos"`, `minLedgerAppVersion` is `"1.5.3"`, `testModeAllowed` is `false`, `prefix` is `"cosmos"`, and `hdPaths` defaults to `[makeCosmoshubPath(0)]`.
