@onekeyfe/hardware-cli 1.2.0-alpha.157 → 1.2.0-alpha.159
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/dist/cli.js +6 -5
- package/package.json +6 -6
- package/src/cli.ts +10 -6
package/dist/cli.js
CHANGED
|
@@ -932,17 +932,18 @@ async function resolveLegacyFirmwareConnectId(sdk, explicitConnectId, deviceName
|
|
|
932
932
|
throw new Error('Unable to scan BLE devices');
|
|
933
933
|
}
|
|
934
934
|
const devices = searchResult.payload;
|
|
935
|
-
const
|
|
936
|
-
const matches =
|
|
937
|
-
? devices.filter(device => device.name
|
|
935
|
+
const requestedName = deviceName?.trim();
|
|
936
|
+
const matches = requestedName
|
|
937
|
+
? devices.filter(device => (0, hd_shared_1.isSameOnekeyBleName)(device.name, requestedName) ||
|
|
938
|
+
device.name?.trim().toLowerCase() === requestedName.toLowerCase())
|
|
938
939
|
: devices.filter(device => device.deviceType?.toLowerCase() === 'classic');
|
|
939
940
|
if (matches.length === 0) {
|
|
940
|
-
throw new Error(
|
|
941
|
+
throw new Error(requestedName
|
|
941
942
|
? `BLE device not found by name: ${deviceName}`
|
|
942
943
|
: 'No Classic/Pure BLE device found');
|
|
943
944
|
}
|
|
944
945
|
if (matches.length > 1) {
|
|
945
|
-
throw new Error(
|
|
946
|
+
throw new Error(requestedName
|
|
946
947
|
? `Multiple BLE devices found by name: ${deviceName}`
|
|
947
948
|
: 'Multiple Classic/Pure BLE devices found; specify --device-name');
|
|
948
949
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hardware-cli",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.159",
|
|
4
4
|
"description": "OneKey hardware wallet CLI for testing device communication",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"test": "jest"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@onekeyfe/hd-common-connect-sdk": "1.2.0-alpha.
|
|
35
|
-
"@onekeyfe/hd-core": "1.2.0-alpha.
|
|
36
|
-
"@onekeyfe/hd-shared": "1.2.0-alpha.
|
|
37
|
-
"@onekeyfe/hd-transport-usb": "1.2.0-alpha.
|
|
34
|
+
"@onekeyfe/hd-common-connect-sdk": "1.2.0-alpha.159",
|
|
35
|
+
"@onekeyfe/hd-core": "1.2.0-alpha.159",
|
|
36
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.159",
|
|
37
|
+
"@onekeyfe/hd-transport-usb": "1.2.0-alpha.159",
|
|
38
38
|
"@stoprocent/noble": "2.3.16",
|
|
39
39
|
"commander": "^12.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "302f9ff916b3769cdb0cf79d58d09a87eeac68c2"
|
|
42
42
|
}
|
package/src/cli.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
|
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import { UI_EVENT, UI_REQUEST, getDeviceType } from '@onekeyfe/hd-core';
|
|
5
|
-
import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
5
|
+
import { EDeviceType, isSameOnekeyBleName } from '@onekeyfe/hd-shared';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
resolveBatchGetAddress,
|
|
@@ -1217,21 +1217,25 @@ async function resolveLegacyFirmwareConnectId(
|
|
|
1217
1217
|
}
|
|
1218
1218
|
|
|
1219
1219
|
const devices = searchResult.payload as EnrichedSearchDevice[];
|
|
1220
|
-
const
|
|
1221
|
-
const matches =
|
|
1222
|
-
? devices.filter(
|
|
1220
|
+
const requestedName = deviceName?.trim();
|
|
1221
|
+
const matches = requestedName
|
|
1222
|
+
? devices.filter(
|
|
1223
|
+
device =>
|
|
1224
|
+
isSameOnekeyBleName(device.name, requestedName) ||
|
|
1225
|
+
device.name?.trim().toLowerCase() === requestedName.toLowerCase()
|
|
1226
|
+
)
|
|
1223
1227
|
: devices.filter(device => device.deviceType?.toLowerCase() === 'classic');
|
|
1224
1228
|
|
|
1225
1229
|
if (matches.length === 0) {
|
|
1226
1230
|
throw new Error(
|
|
1227
|
-
|
|
1231
|
+
requestedName
|
|
1228
1232
|
? `BLE device not found by name: ${deviceName}`
|
|
1229
1233
|
: 'No Classic/Pure BLE device found'
|
|
1230
1234
|
);
|
|
1231
1235
|
}
|
|
1232
1236
|
if (matches.length > 1) {
|
|
1233
1237
|
throw new Error(
|
|
1234
|
-
|
|
1238
|
+
requestedName
|
|
1235
1239
|
? `Multiple BLE devices found by name: ${deviceName}`
|
|
1236
1240
|
: 'Multiple Classic/Pure BLE devices found; specify --device-name'
|
|
1237
1241
|
);
|