@exodus/hw-ledger 2.13.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/lib/module/assets/bitcoin.d.ts +4 -0
- package/lib/module/device.d.ts +3 -3
- package/lib/module/device.js +6 -3
- package/lib/module/discovery.d.ts +0 -1
- package/lib/module/discovery.js +15 -18
- package/package.json +4 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@3.0.0...@exodus/hw-ledger@3.1.0) (2024-10-17)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- support adding model to wallet account ([#9936](https://github.com/ExodusMovement/exodus-hydra/issues/9936)) ([8c858f6](https://github.com/ExodusMovement/exodus-hydra/commit/8c858f6e08e41bee3261f444c3d25e8bdd385014))
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- unify user refused error handling ([#10052](https://github.com/ExodusMovement/exodus-hydra/issues/10052)) ([db85d10](https://github.com/ExodusMovement/exodus-hydra/commit/db85d108333630d09bad545c5ec1169b937e08fe))
|
|
15
|
+
|
|
16
|
+
## [3.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@2.13.1...@exodus/hw-ledger@3.0.0) (2024-10-15)
|
|
17
|
+
|
|
18
|
+
### ⚠ BREAKING CHANGES
|
|
19
|
+
|
|
20
|
+
- remove `getFirstDevice` from hardware wallet discovery (#9821)
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
- remove `getFirstDevice` from hardware wallet discovery ([#9821](https://github.com/ExodusMovement/exodus-hydra/issues/9821)) ([ad3e902](https://github.com/ExodusMovement/exodus-hydra/commit/ad3e902fd9e27dfccd8311089b6d966767cc6d0a))
|
|
25
|
+
|
|
6
26
|
## [2.13.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@2.13.0...@exodus/hw-ledger@2.13.1) (2024-10-09)
|
|
7
27
|
|
|
8
28
|
**Note:** Version bump only for package @exodus/hw-ledger
|
|
@@ -7,6 +7,10 @@ export interface BitcoinMessage {
|
|
|
7
7
|
address: string;
|
|
8
8
|
message: Bytes;
|
|
9
9
|
};
|
|
10
|
+
bip137Message?: {
|
|
11
|
+
address: string;
|
|
12
|
+
message: Bytes;
|
|
13
|
+
};
|
|
10
14
|
}
|
|
11
15
|
declare function createHandler(transport: Transport, walletPolicyAtom?: Atom<Record<string, Buffer>>): Promise<HardwareWalletAssetHandler<BitcoinMessage>>;
|
|
12
16
|
declare const metadata: {
|
package/lib/module/device.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { GetAddressParams, GetPublicKeyParams, GetXPubParams, HardwareWalletDevice, SignMessageParams, SignTransactionParams } from '@exodus/hw-common';
|
|
1
|
+
import type { GetAddressParams, GetPublicKeyParams, GetXPubParams, HardwareWalletDescriptor, HardwareWalletDevice, SignMessageParams, SignTransactionParams } from '@exodus/hw-common';
|
|
2
2
|
import type { TransportFactory } from './types';
|
|
3
3
|
import type { Atom } from '@exodus/atoms';
|
|
4
|
-
export type Descriptor = unknown;
|
|
5
4
|
export type Dependencies = {
|
|
6
5
|
transportFactory: TransportFactory;
|
|
7
|
-
descriptor:
|
|
6
|
+
descriptor: HardwareWalletDescriptor;
|
|
8
7
|
walletPolicyAtom: Atom<Record<string, Buffer>>;
|
|
9
8
|
};
|
|
10
9
|
export declare class LedgerDevice implements HardwareWalletDevice {
|
|
11
10
|
#private;
|
|
12
11
|
constructor({ transportFactory, descriptor, walletPolicyAtom }: Dependencies);
|
|
12
|
+
get descriptor(): HardwareWalletDescriptor;
|
|
13
13
|
ensureApplicationIsOpened: (baseAssetName: string) => Promise<void>;
|
|
14
14
|
listSupportedAssetNames: () => Promise<string[]>;
|
|
15
15
|
listInstalledAssetNames: () => Promise<string[]>;
|
package/lib/module/device.js
CHANGED
|
@@ -12,8 +12,11 @@ export class LedgerDevice {
|
|
|
12
12
|
this.#descriptor = descriptor;
|
|
13
13
|
this.#walletPolicyAtom = walletPolicyAtom;
|
|
14
14
|
}
|
|
15
|
+
get descriptor() {
|
|
16
|
+
return this.#descriptor;
|
|
17
|
+
}
|
|
15
18
|
#runInSession = async (operation, expectErrorWhenClosing = false) => {
|
|
16
|
-
const transport = await this.#transportFactory.open(this.#descriptor);
|
|
19
|
+
const transport = await this.#transportFactory.open(this.#descriptor.internalDescriptor);
|
|
17
20
|
try {
|
|
18
21
|
return await operation(transport);
|
|
19
22
|
}
|
|
@@ -158,8 +161,8 @@ function transformToCommonError(_err) {
|
|
|
158
161
|
if (err.name === 'LockedDeviceError') {
|
|
159
162
|
return new DeviceLockedError();
|
|
160
163
|
}
|
|
161
|
-
if (err.name === 'UserRefusedOnDevice') {
|
|
162
|
-
return new UserRefusedError();
|
|
164
|
+
if (err.name === 'UserRefusedOnDevice' || err.statusCode === 0x69_85) {
|
|
165
|
+
return new UserRefusedError(true);
|
|
163
166
|
}
|
|
164
167
|
if ([
|
|
165
168
|
'HwTransportError',
|
|
@@ -18,7 +18,6 @@ export declare class LedgerDiscovery implements HardwareWalletDiscovery {
|
|
|
18
18
|
scan: () => Promise<void>;
|
|
19
19
|
stopScan: (clearDevices?: boolean) => void;
|
|
20
20
|
list: () => Promise<HardwareWalletDescriptor[]>;
|
|
21
|
-
getFirstDevice: () => Promise<import("@exodus/hw-common").HardwareWalletDevice<import("@exodus/hw-common").Message>>;
|
|
22
21
|
stop: () => Promise<void>;
|
|
23
22
|
}
|
|
24
23
|
declare const _default: {
|
package/lib/module/discovery.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getInfosForServiceUuid, identifyUSBProductId } from '@exodus/ledgerhq-devices';
|
|
2
|
-
import { NoDeviceFoundError } from '@exodus/hw-common';
|
|
3
2
|
import { APDU_PORT } from './constants';
|
|
4
3
|
import { LedgerDevice } from './device';
|
|
5
4
|
import { UnknownTransportError } from './errors';
|
|
@@ -96,53 +95,58 @@ export class LedgerDiscovery {
|
|
|
96
95
|
for (const [transportName, transportFactory] of Object.entries(this.#transportsFactories)) {
|
|
97
96
|
switch (transportName) {
|
|
98
97
|
case 'usb':
|
|
99
|
-
const deviceList = await transportFactory.list();
|
|
98
|
+
const deviceList = (await transportFactory.list());
|
|
100
99
|
const usbDeviceList = deviceList.map((hidDevice) => {
|
|
101
100
|
const deviceModel = identifyUSBProductId(hidDevice.productId);
|
|
102
|
-
|
|
101
|
+
const descriptor = {
|
|
103
102
|
name: deviceModel?.productName ?? 'Ledger USB',
|
|
104
103
|
manufacturer: 'ledger',
|
|
105
104
|
transport: 'usb',
|
|
106
105
|
model: deviceModel?.id ?? 'unknown',
|
|
106
|
+
internalDescriptor: hidDevice,
|
|
107
107
|
get: async () => new LedgerDevice({
|
|
108
108
|
transportFactory,
|
|
109
|
-
descriptor
|
|
109
|
+
descriptor,
|
|
110
110
|
walletPolicyAtom: this.#walletPolicyAtom,
|
|
111
111
|
}),
|
|
112
112
|
};
|
|
113
|
+
return descriptor;
|
|
113
114
|
});
|
|
114
115
|
descriptors.push(...usbDeviceList);
|
|
115
116
|
break;
|
|
116
117
|
case 'bluetooth':
|
|
117
118
|
const bluetoothDeviceList = Object.values(this.#discoveredBluetoothDevices).map((bluetoothDevice) => {
|
|
118
|
-
const deviceModel = getInfosForServiceUuid(bluetoothDevice.serviceUUIDs?.[0] ?? '')
|
|
119
|
-
|
|
120
|
-
return {
|
|
119
|
+
const deviceModel = getInfosForServiceUuid(bluetoothDevice.serviceUUIDs?.[0] ?? '')?.deviceModel;
|
|
120
|
+
const descriptor = {
|
|
121
121
|
name: bluetoothDevice.localName ?? deviceModel?.productName,
|
|
122
122
|
manufacturer: 'ledger',
|
|
123
123
|
transport: 'bluetooth',
|
|
124
124
|
model: deviceModel?.id ?? 'unknown',
|
|
125
|
+
internalDescriptor: bluetoothDevice,
|
|
125
126
|
get: async () => new LedgerDevice({
|
|
126
127
|
transportFactory,
|
|
127
|
-
descriptor
|
|
128
|
+
descriptor,
|
|
128
129
|
walletPolicyAtom: this.#walletPolicyAtom,
|
|
129
130
|
}),
|
|
130
131
|
};
|
|
132
|
+
return descriptor;
|
|
131
133
|
});
|
|
132
134
|
descriptors.push(...bluetoothDeviceList);
|
|
133
135
|
break;
|
|
134
136
|
case 'tcp':
|
|
135
|
-
|
|
137
|
+
const descriptor = {
|
|
136
138
|
name: 'TCP Emulator',
|
|
137
139
|
manufacturer: 'ledger',
|
|
138
140
|
transport: 'tcp',
|
|
139
141
|
model: 'unknown',
|
|
142
|
+
internalDescriptor: { apduPort: APDU_PORT },
|
|
140
143
|
get: async () => new LedgerDevice({
|
|
141
144
|
transportFactory,
|
|
142
|
-
descriptor
|
|
145
|
+
descriptor,
|
|
143
146
|
walletPolicyAtom: this.#walletPolicyAtom,
|
|
144
147
|
}),
|
|
145
|
-
}
|
|
148
|
+
};
|
|
149
|
+
descriptors.push(descriptor);
|
|
146
150
|
break;
|
|
147
151
|
default:
|
|
148
152
|
throw new UnknownTransportError(transportName);
|
|
@@ -150,13 +154,6 @@ export class LedgerDiscovery {
|
|
|
150
154
|
}
|
|
151
155
|
return descriptors;
|
|
152
156
|
};
|
|
153
|
-
getFirstDevice = async () => {
|
|
154
|
-
const devices = await this.list();
|
|
155
|
-
if (devices[0]) {
|
|
156
|
-
return devices[0].get();
|
|
157
|
-
}
|
|
158
|
-
throw new NoDeviceFoundError();
|
|
159
|
-
};
|
|
160
157
|
stop = async () => {
|
|
161
158
|
this.#statusBluetooth?.unsubscribe();
|
|
162
159
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/hw-ledger",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "The ledger module",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "run -T tsc --build tsconfig.build.json",
|
|
23
|
-
"build:watch": "run -T tsc --build tsconfig.build.json &&
|
|
23
|
+
"build:watch": "run -T tsc --build tsconfig.build.json && run -T tsc --build -w tsconfig.build.json",
|
|
24
24
|
"clean": "run -T tsc --build --clean",
|
|
25
25
|
"test": "run -T jest --testMatch='**/*.unit.test.js' --coverageDirectory coverage/unit",
|
|
26
26
|
"zemu:install": "docker pull zondax/builder-zemu:speculos-745fe46f81cfc18114b94a37beaefb58a09c0fcd",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@exodus/bip322-js": "^1.1.0-exodus.4",
|
|
35
35
|
"@exodus/bitcoinjs-lib": "^6.1.5-exodus.0",
|
|
36
36
|
"@exodus/ethersproject-transactions": "^5.4.2-exodus.0",
|
|
37
|
-
"@exodus/hw-common": "^
|
|
37
|
+
"@exodus/hw-common": "^3.0.0",
|
|
38
38
|
"@exodus/ledger-bitcoin": "^0.2.3-exodus.3",
|
|
39
39
|
"@exodus/ledgerhq-devices": "^8.1.0-exodus.3",
|
|
40
40
|
"@exodus/ledgerhq-hw-app-eth": "^6.33.7-exodus.8",
|
|
@@ -51,26 +51,19 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@exodus/bip32": "^3.3.0",
|
|
53
53
|
"@exodus/dependency-types": "^2.1.0",
|
|
54
|
-
"@exodus/ethersproject-abi": "^5.4.2-exodus.3",
|
|
55
54
|
"@ledgerhq/hw-transport-node-hid": "^6.27.17",
|
|
56
|
-
"@ledgerhq/hw-transport-node-speculos": "^6.27.16",
|
|
57
55
|
"@solana/web3.js": "^1.78.0",
|
|
58
56
|
"@types/bs58": "^4.0.1",
|
|
59
57
|
"@types/bs58check": "^2.1.0",
|
|
60
|
-
"@types/create-hash": "^1.2.6",
|
|
61
|
-
"@types/jest-when": "^3.5.2",
|
|
62
58
|
"@types/minimalistic-assert": "^1.0.1",
|
|
63
59
|
"@types/secp256k1": "^4.0.3",
|
|
64
60
|
"@types/semver": "^7.3.5",
|
|
65
61
|
"@zondax/zemu": "^0.43.1",
|
|
66
62
|
"bitcoinjs-lib": "^6.1.3",
|
|
67
|
-
"concurrently": "^7.6.0",
|
|
68
63
|
"ecpair": "^2.1.0",
|
|
69
|
-
"istanbul-combine": "^0.3.0",
|
|
70
|
-
"jest-when": "^3.5.2",
|
|
71
64
|
"redux": "^4.2.1",
|
|
72
65
|
"tiny-secp256k1": "^2.2.3",
|
|
73
66
|
"ts-jest": "^29.0.3"
|
|
74
67
|
},
|
|
75
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "a4f949331317cbeb49ea2392703722914a67fcac"
|
|
76
69
|
}
|