@exodus/hardware-wallets

中文文档
3.6.5发布于 2026/08/21MITTypeScriptES Module近 30 天下载 1.1万

An Exodus SDK feature that provides a high level abstraction for interacting with hardware wallet devices

原始使用文档
文档目录9 节
  1. Device Support Matrix
  2. Usage
  3. With IoC
  4. Architecture
  5. Terminology
  6. scan({ assetName, accountIndexes, addressLimit, addressOffs…
  7. sync({ accountIndex })
  8. addPublicKeysToWalletAccount({ walletAccount, syncedKeysId …
  9. create({ syncedKeysId })

@exodus/hardware-wallets

This feature is a high level abstraction for interacting with hardware wallet devices.

FeatureSupported
Syncing Public Keys✅
Signing Transactions✅
Signing Messages✅
Firmware Management❌

Device Support Matrix

ManufacturerDevice ModelSupported
LedgerNano S✅
LedgerNano S+✅
LedgerNano X✅
LedgerStax✅
TrezorOne❌
TrezorT❌
TrezorSafe 3❌
TrezorSafe 5❌

Usage

With IoC

import hardwareWallets from '@exodus/hardware-wallets'

ioc.use(hardwareWallets())

Architecture

Terminology

A bit of terminology might be required to properly understand the distinctions between the various "states" of an asset.

  • supported assets: All assets supported by our implementation for the device.
  • installed assets: All assets supported by our implementation AND installed on the device by the user.
  • useable assets: All assets supported by our implementation, installed on the device AND opened on the device (ledger).
  • synced assets: All assets for which the public keys have been synced to the wallet account fusion channel.

scan({ assetName, accountIndexes, addressLimit, addressOffset })

The scan functions is used during onboarding to retrieve the addresses (n=2) starting at addressOffset for each account index in accountIndexes from the hardware wallet device. It retrieves the corresponding balance using an network API call. Calling this function does not make any permanent state changes and all its state is ephemeral. This function serves to allow the user to "scan" the accounts, their addresses and balances without having to commit to an account index & syncing it completely yet.

[!CAUTION] This function must only be used during onboarding of a hardware wallet device.

sequenceDiagram
    Consumer->>+HardwareWallets: scan({ assetName, accountIndexes, addressOffset })
    HardwareWallets->>+HardwareWalletDevice: getAddress({ assetName, derivationPath })
    HardwareWalletDevice-->>-HardwareWallets: address0
    HardwareWallets->>+HardwareWalletDevice: getAddress({ assetName, derivationPath })
    HardwareWalletDevice-->>-HardwareWallets: address1
    HardwareWallets->>+Asset: api.getBalanceForAddress(address0)
    Asset-->>-HardwareWallets: balance0
    HardwareWallets->>+Asset: api.getBalanceForAddress(address1)
    Asset-->>-HardwareWallets: balance1
    HardwareWallets-->>-Consumer: First N addresses with balance <br> for given account indexes

sync({ accountIndex })

Synchronizes public keys (XPUBs / public keys) for all useable assets for a given accountIndex from a hardware wallet device and stores them temporarily for future use. The hardware wallet device may disconnect after this method has been called and onboarding would still be possible.

[!CAUTION] Only a subset of the supported assets may be synced. Some hardware wallet devices like Ledger do not support multiple assets at the same time because the asset-specific application must be installed and opened on the device.

sequenceDiagram
    participant Consumer
    participant HardwareWallets
    participant Device
    participant BaseAsset

    Consumer->>HardwareWallets: sync({ accountIndex })
    activate HardwareWallets

    HardwareWallets->>Device: listUseableAssetNames()
    activate Device
    Device-->>HardwareWallets: [assetName0, assetName1, ...]
    deactivate Device

    loop for each assetName
        HardwareWallets->>BaseAsset: getSupportedPurposes({ compatibilityMode: 'ledger' })
        activate BaseAsset
        BaseAsset-->>HardwareWallets: [purpose0, purpose1, ...]
        deactivate BaseAsset

        loop for each purpose
            alt getXPub is supported
                HardwareWallets->>Device: getXPub({ assetName, derivationPath })
                activate Device
                Device-->>HardwareWallets: xpub
                deactivate Device
                HardwareWallets->>HardwareWallets: Store keyIdentifier and xpub
            else getPublicKey instead
                HardwareWallets->>Device: getPublicKey({ assetName, derivationPath })
                activate Device
                Device-->>HardwareWallets: publicKey
                deactivate Device
                HardwareWallets->>HardwareWallets: Store keyIdentifier and publicKey
            end
        end
    end

    HardwareWallets->>HardwareWallets: Generate random ID
    HardwareWallets->>HardwareWallets: Store keys in syncedKeysMap with ID

    HardwareWallets-->>Consumer: SyncedKeysId
    deactivate HardwareWallets

addPublicKeysToWalletAccount({ walletAccount, syncedKeysId })

Adds public keys (XPUBS / public keys) to an existing wallet account.

  • Moves the synchronized public keys (XPUBs / public keys) for syncedKeysId identifier from the temporary in-memory objectmap to a walletAccounts's public key store which will store it in fusion.
  • Start a restore procedure for the assets & trigger a refresh of the txLogMonitor
sequenceDiagram
    participant Consumer
    participant HardwareWallets
    participant PublicKeyStore
    participant RestoreProgressTracker
    participant TxLogMonitors

    Consumer->>HardwareWallets: addPublicKeysToWalletAccount({ walletAccount, syncedKeysId })
    activate HardwareWallets

    HardwareWallets->>HardwareWallets: Retrieve keys from syncedKeysMap using syncedKeysId
    Note right of HardwareWallets: Retrieves assetNames and keysToSync

    loop for each key in keysToSync
        HardwareWallets->>PublicKeyStore: add({ walletAccount, keyIdentifier, xpub, publicKey })

    end

    loop for each assetName in assetNames
        HardwareWallets->>RestoreProgressTracker: restoreAsset(assetName)
        HardwareWallets->>TxLogMonitors: update({ assetName, refresh: true })
    end

    deactivate HardwareWallets
    HardwareWallets-->>Consumer: void

create({ syncedKeysId })

Creates a new hardware wallet account and calls addPublicKeysToWalletAccount() to synchronize public keys to the newly created wallet account.

版本与发布记录

@exodus/hardware-wallets 共发布 35 个版本,首次发布于 2024/08/07;过去 12 个月发布了 8 个版本。

版本发布日期距今
3.6.5latest2026/08/212 个月前
3.6.42026/05/295 个月前
3.6.32026/05/136 个月前
3.6.22026/02/238 个月前
3.6.12026/02/099 个月前
3.6.02026/01/229 个月前

关于 @exodus/hardware-wallets 的常见问题

@exodus/hardware-wallets 是什么?

An Exodus SDK feature that provides a high level abstraction for interacting with hardware wallet devices

如何安装 @exodus/hardware-wallets?

在项目目录运行 npm install @exodus/hardware-wallets,或使用 pnpm add / yarn add / bun add。

@exodus/hardware-wallets 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@exodus/hardware-wallets 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@exodus/hardware-wallets 可以商用吗?

@exodus/hardware-wallets 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@exodus/hardware-wallets 的下载量有多少?

根据 npm 官方下载统计,@exodus/hardware-wallets 在 2026/10/14 – 2026/11/12 这 30 天内被下载 10,826 次,日均约 361 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@exodus/hardware-wallets 还在维护吗?

最新版本 3.6.5 发布于 2026/08/21(2 个月前);至今共发布 35 个版本,其中过去 12 个月发布了 8 个;首次发布于 2024/08/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。