feat: add more trezor paths, export path type, add ledger bluetooth
Summary by CodeRabbit
-
New Features
- BLE (Bluetooth Low Energy) support for Ledger devices; added Bitcoin Test / SegWit network support.
-
Documentation
- Added comprehensive README for the hardware wallet package: getting started, usage, API, supported networks, and Vue guidance.
-
Chores
- Package bumped to 0.0.14 and Node requirement raised to v20; added BLE transport dependency and dependency updates.
-
Refactor
- Expanded and reorganized supported networks and derivation path listings.
-
Behavior
- Ledger transport now prefers BLE with WebUSB fallback; browser-extension detection adjusts available network paths.
Walkthrough
Adds README and package metadata updates; expands BIP44 derivation paths; introduces a LedgerInit transport initializer (BLE-first, WebUSB fallback) used by Ledger providers; adapts Trezor providers to use network-based supported paths and extension detection; and exports additional TypeScript types.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
Documentation packages/hw-wallets/README.md |
Added comprehensive README: getting started, install, usage examples, API docs, path-extension guidance, Vue reactivity note. |
Package metadata packages/hw-wallets/package.json |
Version bump to 0.0.14; added exports mapping; raised Node engine to >=20; bumped @ledgerhq/hw-app-btc; added @ledgerhq/hw-transport-web-ble. |
Global configs (BIP44 paths) packages/hw-wallets/src/configs.ts |
Added many BIP44 path entries and BitcoinTest ledger app name; expanded bip44Paths. |
Public API / types packages/hw-wallets/src/index.ts |
Exported additional TypeScript types (AddressResponse, getAddressRequest, HWWalletProvider, isConnectedRequest, PathType, SignMessageRequest, SignTransactionRequest) and minor formatting tweaks. |
Ledger initializer packages/hw-wallets/src/ledger/ledgerInitializer.ts |
New LedgerInit class: manages transport, initializes BLE-first then WebUSB, attaches disconnect handler, exposes init() and transport. |
Ledger — Ethereum packages/hw-wallets/src/ledger/ethereum/index.ts |
Now extends LedgerInit and calls super(); removed per-class init; transport handling delegated to LedgerInit; minor catch formatting change. |
Ledger — Bitcoin packages/hw-wallets/src/ledger/bitcoin/configs.ts, packages/hw-wallets/src/ledger/bitcoin/index.ts |
Added BitcoinTest supported-path mapping; isSegwit includes BitcoinTest; class now extends LedgerInit; signTransaction input tuple shape changed (4-element input arrays). |
Ledger — Solana / Substrate packages/hw-wallets/src/ledger/solana/index.ts, packages/hw-wallets/src/ledger/substrate/index.ts |
Classes converted to extend LedgerInit (call super()), per-class init removed; transport initialization moved to LedgerInit. |
Trezor — Ethereum configs packages/hw-wallets/src/trezor/ethereum/configs.ts |
Renamed supportedPaths → networkBasedSupportedPaths; added and exported ALL_SUPPORTED_PATHS (comprehensive path list). |
Trezor — Ethereum provider packages/hw-wallets/src/trezor/ethereum/index.ts |
Uses networkBasedSupportedPaths; added isExtension detection; getAddress, getSupportedPaths, and getSupportedNetworks adjusted to behave differently when running as an extension. |
Trezor — Bitcoin configs packages/hw-wallets/src/trezor/bitcoin/configs.ts |
Added BitcoinTest mapping and TrezorNetworkConfigs entry (symbol: "test", isSegwit: true). |
Trezor helper packages/hw-wallets/src/trezor/trezorConnect.ts |
Changed init call to TrezorConnect.init(...) and return TrezorConnect instead of TrezorConnect.default. |
Dev-only keyrings packages/extension/src/libs/keyring/public-keyring.ts |
Added a fake BTC account entry in the development-only block. |
Sequence Diagram(s)
sequenceDiagram
participant App
participant HWwalletManager
participant LedgerProvider
participant LedgerInit
participant BLETransport
participant WebUSBTransport
App->>HWwalletManager: getAddress(network, provider)
HWwalletManager->>LedgerProvider: getAddress(...)
LedgerProvider->>LedgerInit: ensure transport (super.init)
LedgerInit->>BLETransport: isSupported? / create()
alt BLE supported & created
BLETransport-->>LedgerInit: transport instance
LedgerInit->>LedgerProvider: transport ready
BLETransport-->>LedgerInit: disconnect -> clear transport
else BLE unsupported/failed
LedgerInit->>WebUSBTransport: isSupported? / openConnected() or create()
alt WebUSB available
WebUSBTransport-->>LedgerInit: transport instance
LedgerInit->>LedgerProvider: transport ready
else
LedgerInit-->>LedgerProvider: Error (no transport)
end
end
LedgerProvider-->>HWwalletManager: Address / Error
HWwalletManager-->>App: Address / Error
sequenceDiagram
participant App
participant TrezorProvider
participant TrezorConnect
App->>TrezorProvider: getAddress(options)
TrezorProvider->>TrezorProvider: detect isExtension (chrome.runtime)
alt isExtension == true and network not in networkBasedSupportedPaths
TrezorProvider-->>App: Error (unsupported network)
else
TrezorProvider->>TrezorConnect: request address (allow ALL_SUPPORTED_PATHS when not extension)
TrezorConnect-->>TrezorProvider: Address
TrezorProvider-->>App: Address
end
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
Areas to focus review on:
- ledgerInitializer.ts: BLE/WebUSB selection, error handling, and disconnect listener correctness.
- signTransaction change in Ledger Bitcoin: shape of CreateTransactionArg.inputs and downstream compatibility.
- Trezor provider changes: isExtension detection and conditional path selection (security/UX impact).
- package.json exports/engines bump for packaging and publish implications.
Possibly related PRs
- enkryptcom/enKrypt#707 — Refactors and ledger/trezor initialization changes that overlap the new ledgerInitializer and provider adaptations.
- enkryptcom/enKrypt#704 — Changes to trezor Ethereum configs and supported paths; relates to renaming/ALL_SUPPORTED_PATHS edits.
- enkryptcom/enKrypt#713 — Modifies hw-wallet providers (Ledger Ethereum) and message signing APIs; related to provider refactors and type exports.
Suggested reviewers
- kvhnuke
- olgakup
- SemajaM8
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title Check | ✅ Passed | The pull request title "feat: add more trezor paths, export path type, add ledger bluetooth" is specific and directly related to the changeset. All three components mentioned in the title are present in the PR: Trezor Ethereum paths are expanded through the new ALL_SUPPORTED_PATHS constant, path-related TypeScript types (PathType and others) are exported from the main index, and Ledger Bluetooth support is added via the new @ledgerhq/hw-transport-web-ble dependency and the LedgerInit class that implements BLE transport initialization. While the PR contains additional changes (including BitcoinTest network support, the LedgerInit architectural refactoring, and documentation), the title appropriately highlights the key feature additions without being exhaustive, which is standard for commit messages. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
devop/hw-wallets-update
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
:briefcase: Build Files chrome: enkrypt-chrome-78320926.zip firefox: enkrypt-firefox-78320926.zip
:syringe: Virus total analysis chrome: 78320926 firefox: 78320926