butr
API reference

@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-eth for EVM
  • @ledgerhq/hw-app-solana for SVM
  • @ledgerhq/hw-app-sui for Sui
  • @ledgerhq/hw-app-btc for 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

FieldTypeDefault
platform"evm" (required)
chainIdnumber1
accountCountnumber1
derivationPathPrefixstring"44'/60'/0'/0"
idstring"ledger"
namestring"Ledger"
iconstringLEDGER_DEFAULT_ICON
loadEthEthAppConstructorDI for tests
transportFactoryTransportFactoryDI for tests

SvmLedgerOptions

FieldTypeDefault
platform"svm" (required)
clusterSolanaCluster"mainnet"
accountCountnumber1
derivationPathPrefixstring"44'/501'/0'"
id / name / iconstringLEDGER_SVM_DEFAULT_ICON
loadSolanaSolanaAppConstructorDI for tests
transportFactoryTransportFactoryDI for tests

SuiLedgerOptions

FieldTypeDefault
platform"sui" (required)
clusterSuiCluster"mainnet"
accountCountnumber1
derivationPathPrefixstring"44'/784'/0'/0'"
id / name / iconstringLEDGER_SUI_DEFAULT_ICON
loadSuiSuiAppConstructorDI for tests
transportFactoryTransportFactoryDI for tests

BitcoinLedgerOptions

FieldTypeDefault
platform"bitcoin" (required)
chainIdstring (CAIP-2)"bip122:0000…1e93" mainnet
addressFormat"legacy" | "p2sh" | "bech32" | "bech32m""bech32"
accountCountnumber1
derivationPathPrefixstring"84'/0'/0'/0"
id / name / iconstringLEDGER_BITCOIN_DEFAULT_ICON
loadBtcBtcAppConstructorDI for tests
transportFactoryTransportFactoryDI 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 overrides signMessage: false since @ledgerhq/hw-app-sui doesn't expose signPersonalMessage at 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.

On this page