-
Notifications
You must be signed in to change notification settings - Fork 234
feat: add more trezor paths, export path type, add ledger bluetooth #710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
96a0984
dd5709c
cca3fcd
4d029f1
47ff858
1cabb24
59dc545
39569a6
95c33f0
8b2069e
80bbc5c
a888bf2
4bd0a69
2c07681
7832092
de1b0c0
4c27c77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,84 @@ | ||
| # @enkryptcom/hw-wallets | ||
|
|
||
| ## v0.0.12 | ||
|
|
||
| ## Hardware wallet manager for enkrypt | ||
|
|
||
| ### Getting started | ||
|
|
||
| #### Minimum Node version | ||
|
|
||
| `node v20` | ||
|
|
||
| #### Installation | ||
|
|
||
| NPM: `npm install @enkryptcom/hw-wallets @enkryptcom/types` | ||
| Yarn: `yarn add @enkryptcom/hw-wallets @enkryptcom/types` | ||
| PNPM `pnpm add @enkryptcom/hw-wallets @enkryptcom/types` | ||
|
|
||
| ### How to use | ||
|
|
||
| 1. Create an instance of `HWwalletManager` | ||
|
|
||
| ``` | ||
| import HWwalletManager from @enkryptcom/hw-wallets | ||
|
|
||
| const hwManager = new HWwalletManager() | ||
| ``` | ||
|
|
||
| 2. Call methods within class, passing network names and providers. Class automatically handles which wallet to use. | ||
|
|
||
| ### API | ||
|
|
||
| #### `getAddress(options: getAddressRequest): Promise<AddressResponse>` | ||
|
|
||
| Returns wallet address based off of the path provided in the `getAddressRequest`. | ||
|
|
||
| #### `signPersonalMessage(options: SignMessageRequest): Promise<string>` | ||
|
|
||
| Signs personal message. | ||
|
|
||
| #### `signTransaction(options: SignTransactionRequest): Promise<string>` | ||
|
|
||
| Returns an RPC sign you can then add to a transaction object. | ||
|
|
||
| #### `getSupportedPaths(options: isConnectedRequest): Promise<PathType[]>` | ||
|
|
||
| Returns supported paths based on options provided. | ||
|
|
||
| #### `isNetworkSupported(networkName: NetworkNames): boolean` | ||
|
|
||
| Checks network name support. | ||
|
|
||
| #### `isConnected(options: isConnectedRequest): Promise<boolean>` | ||
|
|
||
| Checks connection status. | ||
|
|
||
| #### `close(): Promise<void>` | ||
|
|
||
| Closes all HW wallet connections | ||
|
|
||
| ### Types | ||
|
|
||
| `NetworkNames`: https://github.com/enkryptcom/enKrypt/blob/main/packages/types/src/networks.ts#L1 | ||
| `getAddressRequest`: https://github.com/enkryptcom/enKrypt/blob/main/packages/hw-wallets/src/types.ts#L74 | ||
| `AddressResponse`: https://github.com/enkryptcom/enKrypt/blob/main/packages/hw-wallets/src/types.ts#L31 | ||
| `SignMessageRequest`: https://github.com/enkryptcom/enKrypt/blob/main/packages/hw-wallets/src/types.ts#L54 | ||
| `SignTransactionRequest`: https://github.com/enkryptcom/enKrypt/blob/main/packages/hw-wallets/src/types.ts#L65 | ||
| `isConnectedRequest`: https://github.com/enkryptcom/enKrypt/blob/main/packages/hw-wallets/src/types.ts#L78 | ||
|
|
||
| ### Adding more paths | ||
|
|
||
| Navigate to `src/configs.ts` and add your new derivation path at the bottom. | ||
| Make sure to follow the configuration in that file. | ||
| Import path in the corresponding `Trezor` provider `config.ts`. | ||
| See `src/trezor/ethereum/configs.ts` for example. | ||
|
|
||
| ### Notes | ||
|
|
||
| Connection request to hardware wallet actually happens on `getAddress()` request. | ||
| `Ledger` can't have any paths as each paths are defined by the corresponding app. | ||
|
|
||
| #### For Vue devs | ||
|
|
||
| `ref/reactive` will mess with how Vue compiles these classes because of how Vue utilizes proxies. If you want to store an instance into a ref or reactive, use [`makeRaw`](https://vuejs.org/api/reactivity-advanced#markraw). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,17 @@ | ||
| { | ||
| "name": "@enkryptcom/hw-wallets", | ||
| "version": "0.0.13", | ||
| "version": "0.0.14", | ||
| "description": "Hardware wallet manager for enkrypt", | ||
| "type": "module", | ||
| "main": "src/index.ts", | ||
| "module": "src/index.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.js", | ||
| "require": "./dist/index.cjs" | ||
| } | ||
| }, | ||
| "publishConfig": { | ||
| "main": "dist/index.cjs", | ||
| "module": "dist/index.js", | ||
|
|
@@ -19,7 +26,7 @@ | |
| "test": "vitest run" | ||
| }, | ||
| "engines": { | ||
| "node": ">=14.15.0" | ||
| "node": ">=20" | ||
| }, | ||
|
Comment on lines
28
to
30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify Node 20 compatibility and transport package versions
echo "=== Checking package.json for transport dependencies ==="
cat packages/hw-wallets/package.json | grep -A 20 '"dependencies"'
echo -e "\n=== Checking for Node version config files ==="
cd packages/hw-wallets
for file in .nvmrc .node-version; do
if [ -f "$file" ]; then
echo "Found $file:"; cat "$file"
fi
done
cd ../..
echo -e "\n=== Checking root .nvmrc or node version config ==="
for file in .nvmrc .node-version; do
if [ -f "$file" ]; then
echo "Found $file:"; cat "$file"
fi
done
echo -e "\n=== Checking for CHANGELOG or migration docs ==="
fd -i changelog -i migration -i "release.*notes" packages/hw-wallets/ || echo "No changelog found in hw-wallets"
echo -e "\n=== Checking if Node version requirement is documented in README ==="
if [ -f "packages/hw-wallets/README.md" ]; then
echo "Checking README.md:"; grep -i "node" packages/hw-wallets/README.md || echo "No Node version mentioned"
fi
echo -e "\n=== Checking git for any Node version changes ==="
git log --oneline --all -S ">=20" -- "packages/hw-wallets/package.json" 2>/dev/null | head -5 || echo "Git history not available"
echo -e "\n=== Checking for any CI/CD config mentioning Node version ==="
fd "\.github|\.gitlab|\.circleci|\.travis" -t d || echo "No CI configs found"Repository: enkryptcom/enKrypt Length of output: 1532 🏁 Script executed: #!/bin/bash
# Check if hw-wallets .nvmrc is the issue and confirm package version compatibility
echo "=== Checking Node versions represented by .nvmrc files ==="
echo "lts/fermium = Node 14 (EOL)"
echo "v22.18.0 = Node 22 LTS"
echo -e "\n=== Verifying hw-wallets/.nvmrc content ==="
cat packages/hw-wallets/.nvmrc
echo -e "\n=== Checking @ledgerhq peer dependencies in lock file ==="
if [ -f "pnpm-lock.yaml" ]; then
echo "Checking pnpm-lock.yaml for @ledgerhq transport conflicts..."
rg -A 3 "@ledgerhq/hw-transport" pnpm-lock.yaml | head -40
elif [ -f "package-lock.json" ]; then
echo "Checking package-lock.json..."
grep -A 5 "@ledgerhq/hw-transport" package-lock.json | head -30
fi
echo -e "\n=== Checking if transport package versions have peer dependency constraints ==="
# Search for package metadata that might indicate version conflicts
rg "peerDependencies|engines" packages/hw-wallets/package.jsonRepository: enkryptcom/enKrypt Length of output: 382 Update hw-wallets/.nvmrc to align with Node >=20 requirement. The package.json correctly specifies 🤖 Prompt for AI Agents |
||
| "devDependencies": { | ||
| "@types/node": "^24.10.1", | ||
|
|
@@ -56,6 +63,7 @@ | |
| "@ledgerhq/hw-app-eth": "^6.47.0", | ||
| "@ledgerhq/hw-app-solana": "^7.6.0", | ||
| "@ledgerhq/hw-transport": "^6.31.13", | ||
| "@ledgerhq/hw-transport-web-ble": "^6.29.13", | ||
| "@ledgerhq/hw-transport-webusb": "^6.29.13", | ||
| "@ledgerhq/live-common": "^34.20.0", | ||
| "@metamask/eth-sig-util": "^8.2.0", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify the test account's basePath matches the intended test scenario.
The basePath
"m/49'/2'/0'/1"appears inconsistent with the account details:m/49') is typically for P2SH-wrapped SegWit addresses (starting with3), not native SegWit2'per SLIP-44 is Litecoin testnet, not Bitcoinbc1qaddress prefix indicates Bitcoin native SegWit, which typically uses BIP84 (m/84') with coin type0'Since this is test data, please confirm this path matches your intended test scenario for Bitcoin accounts.