@usebutr/ledger
Per-platform Ledger factories (EVM, SVM, Sui, Bitcoin), options, and constants.
Ledger hardware-wallet adapter (WebUSB). Requires the optional peer
dependency @ledgerhq/hw-transport-webusb plus the per-platform Ledger app
module:
@ledgerhq/hw-app-ethfor EVM@ledgerhq/hw-app-solanafor SVM@ledgerhq/hw-app-suifor Sui@ledgerhq/hw-app-btcfor Bitcoin
Each app module is loaded dynamically; you only pay for the ones you actually use.
Factories
createLedgerAdapter(options): Promise<WalletAdapter>
Unified factory. Dispatches to the per-platform factory based on
options.platform. The discriminant is always required.
// EVM
await createLedgerAdapter({ platform: "evm", chainId: 1, accountCount: 3 });
// SVM
await createLedgerAdapter({ platform: "svm", cluster: "mainnet" });
// Sui
await createLedgerAdapter({ platform: "sui", cluster: "mainnet" });
// Bitcoin
await createLedgerAdapter({ platform: "bitcoin", addressFormat: "bech32" });Per-platform factories
Each factory is also exported directly:
createEvmLedgerAdapter(options: EvmLedgerOptions): Promise<WalletAdapter>createSvmLedgerAdapter(options: SvmLedgerOptions): Promise<WalletAdapter>createSuiLedgerAdapter(options: SuiLedgerOptions): Promise<WalletAdapter>createBitcoinLedgerAdapter(options: BitcoinLedgerOptions): Promise<WalletAdapter>
The dispatch's default branch is a true never exhaustiveness check — every
ChainPlatform variant is covered today.
Options
EvmLedgerOptions
| Field | Type | Default |
|---|---|---|
platform | "evm" (required) | — |
chainId | number | 1 |
accountCount | number | 1 |
derivationPathPrefix | string | "44'/60'/0'/0" |
id | string | "ledger" |
name | string | "Ledger" |
icon | string | LEDGER_DEFAULT_ICON |
loadEth | EthAppConstructor | DI for tests |
transportFactory | TransportFactory | DI for tests |
SvmLedgerOptions
| Field | Type | Default |
|---|---|---|
platform | "svm" (required) | — |
cluster | SolanaCluster | "mainnet" |
accountCount | number | 1 |
derivationPathPrefix | string | "44'/501'/0'" |
id / name / icon | string | LEDGER_SVM_DEFAULT_ICON |
loadSolana | SolanaAppConstructor | DI for tests |
transportFactory | TransportFactory | DI for tests |
SuiLedgerOptions
| Field | Type | Default |
|---|---|---|
platform | "sui" (required) | — |
cluster | SuiCluster | "mainnet" |
accountCount | number | 1 |
derivationPathPrefix | string | "44'/784'/0'/0'" |
id / name / icon | string | LEDGER_SUI_DEFAULT_ICON |
loadSui | SuiAppConstructor | DI for tests |
transportFactory | TransportFactory | DI for tests |
BitcoinLedgerOptions
| Field | Type | Default |
|---|---|---|
platform | "bitcoin" (required) | — |
chainId | string (CAIP-2) | "bip122:0000…1e93" mainnet |
addressFormat | "legacy" | "p2sh" | "bech32" | "bech32m" | "bech32" |
accountCount | number | 1 |
derivationPathPrefix | string | "84'/0'/0'/0" |
id / name / icon | string | LEDGER_BITCOIN_DEFAULT_ICON |
loadBtc | BtcAppConstructor | DI for tests |
transportFactory | TransportFactory | DI for tests |
LedgerOptions = EvmLedgerOptions | SvmLedgerOptions | SuiLedgerOptions | BitcoinLedgerOptions.
Constants
LEDGER_DEFAULT_ICON: string— EVM default SVG.LEDGER_SVM_DEFAULT_ICON: string— SVM default SVG.LEDGER_SUI_DEFAULT_ICON: string— Sui default SVG.LEDGER_BITCOIN_DEFAULT_ICON: string— Bitcoin default SVG.LEDGER_CAPABILITIES: WalletCapabilities— signing-only baseline. Sui overridessignMessage: falsesince@ledgerhq/hw-app-suidoesn't exposesignPersonalMessageat the current version.
Types
LedgerOptions, EvmLedgerOptions, SvmLedgerOptions, SuiLedgerOptions,
BitcoinLedgerOptions, BitcoinAddressFormat, SolanaCluster, SuiCluster,
EthAppLike / EthAppConstructor, SolanaAppLike / SolanaAppConstructor,
SuiAppLike / SuiAppConstructor, BtcAppLike / BtcAppConstructor,
TransportLike, TransportFactory.
See the Ledger connector guide for browser-support, per-platform capabilities, and signing-only caveats.
Source: packages/ledger/src/index.ts.