@onekeyfe/hardware-cli 1.2.0-alpha.162 → 1.2.0-alpha.164
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 +5 -6
- package/package.json +6 -6
- package/src/cli.ts +6 -10
package/dist/cli.js
CHANGED
|
@@ -932,18 +932,17 @@ 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 => (
|
|
938
|
-
device.name?.trim().toLowerCase() === requestedName.toLowerCase())
|
|
935
|
+
const normalizedName = deviceName?.trim().toLowerCase();
|
|
936
|
+
const matches = normalizedName
|
|
937
|
+
? devices.filter(device => device.name?.trim().toLowerCase() === normalizedName)
|
|
939
938
|
: devices.filter(device => device.deviceType?.toLowerCase() === 'classic');
|
|
940
939
|
if (matches.length === 0) {
|
|
941
|
-
throw new Error(
|
|
940
|
+
throw new Error(normalizedName
|
|
942
941
|
? `BLE device not found by name: ${deviceName}`
|
|
943
942
|
: 'No Classic/Pure BLE device found');
|
|
944
943
|
}
|
|
945
944
|
if (matches.length > 1) {
|
|
946
|
-
throw new Error(
|
|
945
|
+
throw new Error(normalizedName
|
|
947
946
|
? `Multiple BLE devices found by name: ${deviceName}`
|
|
948
947
|
: 'Multiple Classic/Pure BLE devices found; specify --device-name');
|
|
949
948
|
}
|
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.164",
|
|
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.164",
|
|
35
|
+
"@onekeyfe/hd-core": "1.2.0-alpha.164",
|
|
36
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.164",
|
|
37
|
+
"@onekeyfe/hd-transport-usb": "1.2.0-alpha.164",
|
|
38
38
|
"@stoprocent/noble": "2.3.16",
|
|
39
39
|
"commander": "^12.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "8a6f829b0ea1544d2c5f7a1fd0cc0f08d6df7dcd"
|
|
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
|
|
5
|
+
import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
resolveBatchGetAddress,
|
|
@@ -1217,25 +1217,21 @@ async function resolveLegacyFirmwareConnectId(
|
|
|
1217
1217
|
}
|
|
1218
1218
|
|
|
1219
1219
|
const devices = searchResult.payload as EnrichedSearchDevice[];
|
|
1220
|
-
const
|
|
1221
|
-
const matches =
|
|
1222
|
-
? devices.filter(
|
|
1223
|
-
device =>
|
|
1224
|
-
isSameOnekeyBleName(device.name, requestedName) ||
|
|
1225
|
-
device.name?.trim().toLowerCase() === requestedName.toLowerCase()
|
|
1226
|
-
)
|
|
1220
|
+
const normalizedName = deviceName?.trim().toLowerCase();
|
|
1221
|
+
const matches = normalizedName
|
|
1222
|
+
? devices.filter(device => device.name?.trim().toLowerCase() === normalizedName)
|
|
1227
1223
|
: devices.filter(device => device.deviceType?.toLowerCase() === 'classic');
|
|
1228
1224
|
|
|
1229
1225
|
if (matches.length === 0) {
|
|
1230
1226
|
throw new Error(
|
|
1231
|
-
|
|
1227
|
+
normalizedName
|
|
1232
1228
|
? `BLE device not found by name: ${deviceName}`
|
|
1233
1229
|
: 'No Classic/Pure BLE device found'
|
|
1234
1230
|
);
|
|
1235
1231
|
}
|
|
1236
1232
|
if (matches.length > 1) {
|
|
1237
1233
|
throw new Error(
|
|
1238
|
-
|
|
1234
|
+
normalizedName
|
|
1239
1235
|
? `Multiple BLE devices found by name: ${deviceName}`
|
|
1240
1236
|
: 'Multiple Classic/Pure BLE devices found; specify --device-name'
|
|
1241
1237
|
);
|