@onekeyfe/hd-core 1.2.8-alpha.51 → 1.2.8-alpha.53

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.
@@ -1,4 +1,7 @@
1
- import Core, { initConnector } from '../src/core';
1
+ import { HardwareErrorCode, createDeferred } from '@onekeyfe/hd-shared';
2
+
3
+ import Core, { init, initConnector, initCore, switchTransport } from '../src/core';
4
+ import DataManager from '../src/data-manager/DataManager';
2
5
  import TransportManager from '../src/data-manager/TransportManager';
3
6
  import { DevicePool } from '../src/device/DevicePool';
4
7
 
@@ -31,4 +34,114 @@ describe('Core.dispose', () => {
31
34
  expect(transportStop).toHaveBeenCalledTimes(1);
32
35
  expect(disposeDevicePool).toHaveBeenCalledTimes(1);
33
36
  });
37
+
38
+ test('disposal rejects a queued switch without recreating a transport or connector', async () => {
39
+ const previous = TransportManager.transport;
40
+ const { settings } = DataManager;
41
+ const active = { stop: jest.fn().mockResolvedValue(undefined) };
42
+ const replacement = jest.fn(() => ({ stop: jest.fn().mockResolvedValue(undefined) }));
43
+ TransportManager.transport = active as never;
44
+ const core = initCore();
45
+ initConnector();
46
+ const switching = switchTransport({ env: 'emulator', Transport: replacement });
47
+ const rejected = expect(switching).rejects.toMatchObject({
48
+ errorCode: HardwareErrorCode.NotInitialized,
49
+ });
50
+ try {
51
+ await core.dispose();
52
+ await rejected;
53
+ expect(replacement).not.toHaveBeenCalled();
54
+ expect(TransportManager.transport).toBe(active);
55
+ expect(DataManager.settings).toBe(settings);
56
+ expect(DevicePool.emitter.eventNames()).toHaveLength(0);
57
+ } finally {
58
+ await Promise.allSettled([switching]);
59
+ await core.dispose();
60
+ TransportManager.transport = previous;
61
+ DataManager.settings = settings;
62
+ }
63
+ });
64
+
65
+ test.each(['dispose/reinit', 'init', 'initCore'] as const)(
66
+ '%s invalidates running and queued switches without blocking a new lifecycle',
67
+ async lifecycle => {
68
+ const previous = TransportManager.transport;
69
+ const { settings } = DataManager;
70
+ const entered = createDeferred<void>();
71
+ const closing = createDeferred<void>();
72
+ const loading = createDeferred<void>();
73
+ const active = {
74
+ stop: jest.fn(() => {
75
+ entered.resolve();
76
+ return closing.promise;
77
+ }),
78
+ };
79
+ const intermediate = jest.fn(() => ({ stop: jest.fn().mockResolvedValue(undefined) }));
80
+ const stale = jest.fn(() => ({ stop: jest.fn().mockResolvedValue(undefined) }));
81
+ const fresh = { stop: jest.fn().mockResolvedValue(undefined) };
82
+ const current = { stop: jest.fn().mockResolvedValue(undefined) };
83
+ const Fresh = jest.fn(() => fresh);
84
+ jest.spyOn(DataManager, 'load').mockImplementation(async next => {
85
+ await loading.promise;
86
+ DataManager.settings = next;
87
+ });
88
+ TransportManager.transport = active as never;
89
+ let core = initCore();
90
+ initConnector();
91
+ const first = switchTransport({ env: 'emulator', Transport: intermediate });
92
+ await entered.promise;
93
+ const second = switchTransport({ env: 'webusb', Transport: stale });
94
+ const rejected = Promise.all([
95
+ expect(first).rejects.toMatchObject({ errorCode: HardwareErrorCode.NotInitialized }),
96
+ expect(second).rejects.toMatchObject({ errorCode: HardwareErrorCode.NotInitialized }),
97
+ ]);
98
+ rejected.catch(() => undefined);
99
+ let initializing: ReturnType<typeof init> | undefined;
100
+ try {
101
+ if (lifecycle === 'dispose/reinit') {
102
+ const disposing = core.dispose();
103
+ closing.resolve();
104
+ await disposing;
105
+ }
106
+ if (lifecycle === 'initCore') {
107
+ TransportManager.transport = fresh as never;
108
+ DataManager.settings = { ...settings, env: 'desktop-web-ble' };
109
+ core = initCore();
110
+ initConnector();
111
+ } else {
112
+ initializing = init({ ...settings, env: 'desktop-web-ble' }, Fresh);
113
+ if (lifecycle === 'init') {
114
+ closing.resolve();
115
+ await rejected;
116
+ }
117
+ loading.resolve();
118
+ const initialized = await initializing;
119
+ if (!initialized) throw new Error('Core initialization failed');
120
+ core = initialized;
121
+ }
122
+ await switchTransport({
123
+ env: 'emulator',
124
+ Transport: function Current() {
125
+ return current;
126
+ },
127
+ });
128
+ closing.resolve();
129
+ await rejected;
130
+ expect(intermediate).not.toHaveBeenCalled();
131
+ expect(stale).not.toHaveBeenCalled();
132
+ expect(TransportManager.transport).toBe(current);
133
+ expect(DataManager.getSettings('env')).toBe('emulator');
134
+ expect(fresh.stop).toHaveBeenCalledTimes(1);
135
+ expect(current.stop).not.toHaveBeenCalled();
136
+ } finally {
137
+ closing.resolve();
138
+ loading.resolve();
139
+ await initializing;
140
+ await Promise.allSettled([first, second, rejected]);
141
+ await core.dispose();
142
+ TransportManager.transport = previous;
143
+ DataManager.settings = settings;
144
+ }
145
+ }
146
+ );
34
147
  });
@@ -45,6 +45,23 @@ describe('Core 错误输出边界', () => {
45
45
  });
46
46
  });
47
47
 
48
+ test.each([
49
+ [HardwareErrorCode.TransportProtocolProbeFailed, { expectedProtocol: 'V1' }],
50
+ [
51
+ HardwareErrorCode.TransportProtocolMismatch,
52
+ { expectedProtocol: 'V2', detectedProtocol: 'V1' },
53
+ ],
54
+ ] as const)(
55
+ 'preserves protocol error %s and structured context across the public boundary',
56
+ (code, params) => {
57
+ const error = ERRORS.TypedError(code, undefined, params);
58
+ expect(JSON.parse(JSON.stringify(createErrorMessage(error)))).toEqual({
59
+ success: false,
60
+ payload: { code, error: error.message, params },
61
+ });
62
+ }
63
+ );
64
+
48
65
  test.each([
49
66
  ['webusb', false],
50
67
  ['desktop-webusb', false],
@@ -129,6 +146,8 @@ describe('Core 错误输出边界', () => {
129
146
  HardwareErrorCode.BleUnsupported,
130
147
  HardwareErrorCode.BridgeNeedsPermission,
131
148
  HardwareErrorCode.WebUsbDeviceAccessError,
149
+ HardwareErrorCode.TransportProtocolProbeFailed,
150
+ HardwareErrorCode.TransportProtocolMismatch,
132
151
  ])(
133
152
  'preserves terminal transport error %s in the public response without polling again',
134
153
  async errorCode => {
@@ -138,6 +157,8 @@ describe('Core 错误输出边界', () => {
138
157
  [
139
158
  HardwareErrorCode.BridgeNeedsPermission,
140
159
  HardwareErrorCode.WebUsbDeviceAccessError,
160
+ HardwareErrorCode.TransportProtocolProbeFailed,
161
+ HardwareErrorCode.TransportProtocolMismatch,
141
162
  ].includes(errorCode)
142
163
  ? ('desktop-webusb' as never)
143
164
  : ('react-native' as never)
@@ -75,8 +75,11 @@ describe('DeviceConnector protocol validation', () => {
75
75
  });
76
76
  const connector = new DeviceConnector();
77
77
 
78
- await expect(connector.acquire('classic-id', undefined, undefined, 'V2')).rejects.toThrow(
79
- 'Device protocol mismatch: expected V2, detected V1'
78
+ await expect(connector.acquire('classic-id', undefined, undefined, 'V2')).rejects.toMatchObject(
79
+ {
80
+ errorCode: HardwareErrorCode.TransportProtocolMismatch,
81
+ params: { expectedProtocol: 'V2', detectedProtocol: 'V1' },
82
+ }
80
83
  );
81
84
  });
82
85
 
@@ -610,7 +610,9 @@ describe('public device lifecycle events', () => {
610
610
  );
611
611
 
612
612
  test.each([
613
- [HardwareErrorCode.RuntimeError, true],
613
+ [HardwareErrorCode.TransportProtocolProbeFailed, true],
614
+ [HardwareErrorCode.TransportProtocolMismatch, false],
615
+ [HardwareErrorCode.RuntimeError, false],
614
616
  [HardwareErrorCode.BleDeviceBondError, false],
615
617
  ] as const)(
616
618
  'retries a Protocol V2 probe mismatch with error code %s: %s',
@@ -618,8 +620,8 @@ describe('public device lifecycle events', () => {
618
620
  const method = { payload: { connectProtocol: 'V2' } } as never;
619
621
  const error = {
620
622
  errorCode,
621
- message:
622
- 'Device protocol mismatch: expected V2, but device did not respond to expected protocol',
623
+ message: 'diagnostic wording is not used for classification',
624
+ params: { expectedProtocol: 'V2' },
623
625
  };
624
626
 
625
627
  expect(isRetryableBleProtocolV2ProbeError(method, error)).toBe(expected);
@@ -629,6 +631,8 @@ describe('public device lifecycle events', () => {
629
631
  test.each([
630
632
  [HardwareErrorCode.BleConnectedError, true],
631
633
  [HardwareErrorCode.BleTimeoutError, true],
634
+ [HardwareErrorCode.TransportProtocolProbeFailed, true],
635
+ [HardwareErrorCode.TransportProtocolMismatch, false],
632
636
  [HardwareErrorCode.PollingTimeout, false],
633
637
  [HardwareErrorCode.BleDeviceBondError, false],
634
638
  ] as const)('retries a BLE connection error with error code %s: %s', (errorCode, expected) => {
@@ -641,6 +645,21 @@ describe('public device lifecycle events', () => {
641
645
  expect(isRetryableBleConnectionError(method, error)).toBe(expected);
642
646
  });
643
647
 
648
+ test('does not retry a failed strict V1 probe as a V2 probe or after user cancellation', () => {
649
+ const error = ERRORS.TypedError(HardwareErrorCode.TransportProtocolProbeFailed, undefined, {
650
+ expectedProtocol: 'V1',
651
+ });
652
+ const method = { payload: { connectProtocol: 'V2' } } as never;
653
+ expect(isRetryableBleProtocolV2ProbeError(method, error)).toBe(false);
654
+ expect(isRetryableBleConnectionError(method, error)).toBe(false);
655
+ expect(
656
+ isRetryableBleConnectionError(
657
+ { payload: {}, device: { wasInterruptedByUser: () => true } } as never,
658
+ ERRORS.TypedError(HardwareErrorCode.TransportProtocolProbeFailed)
659
+ )
660
+ ).toBe(false);
661
+ });
662
+
644
663
  test('does not retry the desktop acquire deadline fallback', () => {
645
664
  const method = { payload: { connectProtocol: 'V2' } } as never;
646
665
  const error = {
@@ -54,6 +54,14 @@ describe('SolSignOffchainMessage', () => {
54
54
  });
55
55
  });
56
56
 
57
+ test('maps omitted required signers to an empty repeated field', () => {
58
+ const method = createMethod({ requiredSigners: undefined });
59
+
60
+ method.init();
61
+
62
+ expect(method.params.required_signers).toEqual([]);
63
+ });
64
+
57
65
  test.each([
58
66
  { requiredSigners: ['11'], error: '32-byte hex public key' },
59
67
  { requiredSigners: [signerB, signerA], error: 'strictly sorted and unique' },
@@ -1,4 +1,4 @@
1
- import { DeviceType } from '@onekeyfe/hd-transport';
1
+ import protocolTransport, { DeviceType } from '@onekeyfe/hd-transport';
2
2
  import { EDeviceType } from '@onekeyfe/hd-shared';
3
3
 
4
4
  import {
@@ -55,6 +55,7 @@ describe('isolated USB identity probe', () => {
55
55
  deviceType: EDeviceType.Classic1s,
56
56
  connectProtocol: 'V1',
57
57
  commType: 'webusb',
58
+ mode: 'normal',
58
59
  },
59
60
  ]);
60
61
  expect(DataManager.settings).toBe(settings);
@@ -148,6 +149,41 @@ describe('isolated USB identity probe', () => {
148
149
  );
149
150
  });
150
151
 
152
+ test.each([
153
+ { onekey_device_type: 'CLASSIC', major_version: 2, minor_version: 8, patch_version: 0 },
154
+ { onekey_device_type: 'TOUCH', major_version: 4, minor_version: 4, patch_version: 0 },
155
+ ])(
156
+ 'preserves GetFeatures identity when the legacy V1 schema has no vendor query (%s)',
157
+ async firmware => {
158
+ const transport = createTransport();
159
+ let messages = protocolTransport.parseConfigure(
160
+ JSON.stringify(DataManager.getProtobufMessages())
161
+ );
162
+ transport.configure.mockImplementation((schema: string) => {
163
+ messages = protocolTransport.parseConfigure(schema);
164
+ });
165
+ transport.call.mockImplementation((_session, name, data) => {
166
+ protocolTransport.ProtocolV1.encodeMessageChunks(messages, name, data);
167
+ return Promise.resolve({
168
+ type: 'Features',
169
+ message: { ...firmware, device_id: 'LEGACY_WALLET_ID' },
170
+ });
171
+ });
172
+ await expect(
173
+ probeUsbDeviceIdentitiesWithTransport(transport, 'webusb')
174
+ ).resolves.toMatchObject([
175
+ {
176
+ path: descriptor.path,
177
+ serialNo: null,
178
+ deviceId: 'LEGACY_WALLET_ID',
179
+ connectProtocol: 'V1',
180
+ },
181
+ ]);
182
+ expect(transport.call.mock.calls.map(call => call[1])).toEqual(['GetFeatures']);
183
+ expect(transport.release).toHaveBeenCalledWith('usb-transport-handle', false);
184
+ }
185
+ );
186
+
151
187
  test('does not substitute a USB path for a missing business identity', async () => {
152
188
  const transport = createTransport();
153
189
  transport.call
@@ -158,6 +194,70 @@ describe('isolated USB identity probe', () => {
158
194
  );
159
195
  });
160
196
 
197
+ test.each([
198
+ ['CLASSIC1S', EDeviceType.Classic1s],
199
+ ['PURE', EDeviceType.ClassicPure],
200
+ ])(
201
+ 'retains %s bootloader state without querying unsupported vendor features',
202
+ async (model, deviceType) => {
203
+ const transport = createTransport();
204
+ const path = '000000000000000000000000';
205
+ transport.enumerate.mockResolvedValue([{ ...descriptor, path }]);
206
+ transport.call.mockImplementation((_session, method) => {
207
+ if (method !== 'GetFeatures')
208
+ return Promise.reject(new Error('Unsupported loader query timed out'));
209
+ return Promise.resolve({
210
+ type: 'Features',
211
+ message: {
212
+ onekey_device_type: model,
213
+ model: '1',
214
+ bootloader_mode: true,
215
+ firmware_present: true,
216
+ major_version: 3,
217
+ minor_version: 0,
218
+ patch_version: 0,
219
+ },
220
+ });
221
+ });
222
+ await expect(probeUsbDeviceIdentitiesWithTransport(transport, 'webusb')).resolves.toEqual([
223
+ {
224
+ path,
225
+ serialNo: null,
226
+ deviceId: null,
227
+ deviceType,
228
+ mode: 'bootloader',
229
+ connectProtocol: 'V1',
230
+ commType: 'webusb',
231
+ },
232
+ ]);
233
+ expect(transport.call.mock.calls.map(call => call[1])).toEqual(['GetFeatures']);
234
+ expect(transport.release).toHaveBeenCalledWith('usb-transport-handle', false);
235
+ }
236
+ );
237
+
238
+ test.each(['TOUCH', 'PRO'])(
239
+ 'preserves the existing %s loader vendor-identity query',
240
+ async model => {
241
+ const transport = createTransport();
242
+ transport.call
243
+ .mockResolvedValueOnce({
244
+ type: 'Features',
245
+ message: { onekey_device_type: model, bootloader_mode: true },
246
+ })
247
+ .mockResolvedValueOnce({
248
+ type: 'OnekeyFeatures',
249
+ message: { onekey_serial_no: 'VENDOR_SERIAL' },
250
+ });
251
+ await expect(
252
+ probeUsbDeviceIdentitiesWithTransport(transport, 'webusb')
253
+ ).resolves.toMatchObject([{ serialNo: 'VENDOR_SERIAL', mode: 'bootloader' }]);
254
+ expect(transport.call.mock.calls.map(call => call[1])).toEqual([
255
+ 'GetFeatures',
256
+ 'OnekeyGetFeatures',
257
+ ]);
258
+ }
259
+ );
260
+
161
261
  test.each([
162
262
  { ...descriptor, device: { opened: true } },
163
263
  { ...descriptor, commType: 'bridge', session: 'owned-bridge-transport' },
@@ -171,6 +271,19 @@ describe('isolated USB identity probe', () => {
171
271
  expect(transport.release).not.toHaveBeenCalled();
172
272
  });
173
273
 
274
+ test.each([undefined, 'occupied-transport-handle'])(
275
+ 'does not initialize or acquire a Bridge identity probe (session: %s)',
276
+ async session => {
277
+ const transport = createTransport();
278
+ transport.enumerate.mockResolvedValue([{ ...descriptor, commType: 'bridge', session }]);
279
+ await expect(probeUsbDeviceIdentitiesWithTransport(transport, 'bridge')).resolves.toEqual([]);
280
+ expect(transport.init).not.toHaveBeenCalled();
281
+ expect(transport.enumerate).not.toHaveBeenCalled();
282
+ expect(transport.acquire).not.toHaveBeenCalled();
283
+ expect(transport.release).not.toHaveBeenCalled();
284
+ }
285
+ );
286
+
174
287
  test('reuses identity only for the exact active WebUSB handle', () => {
175
288
  const handle = {};
176
289
  const endpoint = { ...descriptor, device: handle };
@@ -1 +1 @@
1
- {"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkD,MAAM,qBAAqB,CAAC;AA0BlG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAiC/E,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,6BAA6B,CAAC;AAuErC,wBAAgB,wCAAwC,CACtD,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,sBAAsB,EAC9B,0BAA0B,UAAQ,QAiCnC;AA6UD,eAAO,MAAM,oCAAoC,WACvC,WAAW,GAAG,UAAU,eACnB,MAAM,GAAG,SAAS,YAKhC,CAAC;AAEF,eAAO,MAAM,iCAAiC,0BACrB,MAAM,uBACR,MAAM,iBACZ,MAAM,eACR,MAAM,SAsBpB,CAAC;AAUF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,wBAAwB,CAAC,sBAAsB,CAAC;IAC5F,OAAO,CAAC,8BAA8B,CAAC,CAAS;IAEhD,OAAO,CAAC,sBAAsB,CAAC,CAAS;IAExC,OAA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,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,GAAG,SAAS,CAAC;CAC7E,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,UAAU,CAAC,GAClF,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;AA4CpD,eAAO,MAAM,yBAAyB,eACxB,0BAA0B,gBACxB,kBAAkB,KAC/B,iBAAiB,GAAG,SAatB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,SAAS,EACT,SAAS,GAAG,MAAM,GAAG,iBAAiB,GAAG,qBAAqB,CAC/D,GAAG;IACF,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,SAAS,EAAE,MAAM,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAAC;IACvD,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC9D,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD,CAAC;AAYF,eAAO,MAAM,qCAAqC,cACrC,yBAAyB,YAC1B,iBAAiB,CAAC,UAAU,CAAC,mCACP,0BAA0B,KAAK,iBAAiB,GAAG,SAAS,kBAC3F,QAAQ,iBAAiB,EAAE,CA4G7B,CAAC;AAsBF,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD,SAAS,CAAC,EAAE,eAAe,CAAa;IAExC,IAAI;IAME,GAAG,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;CAuFrC"}
@@ -38,5 +38,5 @@ export declare const switchTransport: ({ env, Transport, plugin, }: {
38
38
  env: ConnectSettings['env'];
39
39
  Transport: any;
40
40
  plugin?: LowlevelTransportSharedPlugin | undefined;
41
- }) => void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mC/B;AAED,eAAO,MAAM,QAAQ,YAMpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAYzB,CAAC;AAMF,eAAO,MAAM,IAAI,aACL,eAAe,aACd,GAAG,WACL,6BAA6B,8BAmBvC,CAAC;AAEF,eAAO,MAAM,eAAe;SAKrB,eAAe,CAAC,KAAK,CAAC;eAChB,GAAG;;mBAyBf,CAAC"}
@@ -31,7 +31,7 @@ export declare const cancelDeviceInPrompt: (device: Device, expectResponse?: boo
31
31
  };
32
32
  } | {
33
33
  success: boolean;
34
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
34
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 604 | 605 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
35
35
  payload: {
36
36
  message: string;
37
37
  };
@@ -50,7 +50,7 @@ export declare const cancelDeviceWithInitialize: (device: Device) => Promise<{
50
50
  };
51
51
  } | {
52
52
  success: boolean;
53
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
53
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 604 | 605 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
54
54
  payload: {
55
55
  message: string;
56
56
  };
@@ -81,7 +81,7 @@ export declare class DeviceCommands {
81
81
  };
82
82
  } | {
83
83
  success: boolean;
84
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
84
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 604 | 605 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
85
85
  payload: {
86
86
  message: string;
87
87
  };
@@ -100,7 +100,7 @@ export declare class DeviceCommands {
100
100
  };
101
101
  } | {
102
102
  success: boolean;
103
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
103
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 604 | 605 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
104
104
  payload: {
105
105
  message: string;
106
106
  };
package/dist/index.d.ts CHANGED
@@ -145,7 +145,7 @@ declare class DeviceCommands {
145
145
  };
146
146
  } | {
147
147
  success: boolean;
148
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
148
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 604 | 605 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
149
149
  payload: {
150
150
  message: string;
151
151
  };
@@ -164,7 +164,7 @@ declare class DeviceCommands {
164
164
  };
165
165
  } | {
166
166
  success: boolean;
167
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
167
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 604 | 605 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
168
168
  payload: {
169
169
  message: string;
170
170
  };
@@ -392,6 +392,8 @@ type UsbDeviceIdentity = {
392
392
  deviceType: IDeviceType;
393
393
  connectProtocol: HardwareConnectProtocol;
394
394
  commType: 'webusb' | 'bridge';
395
+ /** Mode confirmed by the device response; absent when discovery cannot establish it. */
396
+ mode?: DeviceStateMode;
395
397
  };
396
398
  type Device$1 = KnownDevice;
397
399
  type DeviceFeaturesProtocol = 'V1' | 'V2' | 'unknown';
@@ -1154,7 +1156,7 @@ declare const switchTransport: ({ env, Transport, plugin, }: {
1154
1156
  env: ConnectSettings['env'];
1155
1157
  Transport: any;
1156
1158
  plugin?: LowlevelTransportSharedPlugin | undefined;
1157
- }) => void;
1159
+ }) => Promise<void>;
1158
1160
 
1159
1161
  type UploadPortfolioParams = {
1160
1162
  packageBase64: string;
package/dist/index.js CHANGED
@@ -47211,7 +47211,7 @@ const getOwningRequestDevice = (descriptor, requestQueue) => {
47211
47211
  return undefined;
47212
47212
  };
47213
47213
  const getOwnedUsbDeviceIdentity = (descriptor, requestQueue) => {
47214
- var _a;
47214
+ var _a, _b, _c;
47215
47215
  const owner = getOwningRequestDevice(descriptor, requestQueue);
47216
47216
  if (!owner || descriptor.commType !== 'webusb' || ((_a = owner.originalDescriptor) === null || _a === void 0 ? void 0 : _a.commType) !== 'webusb')
47217
47217
  return undefined;
@@ -47222,6 +47222,7 @@ const getOwnedUsbDeviceIdentity = (descriptor, requestQueue) => {
47222
47222
  deviceType: owner.getCurrentDeviceType(),
47223
47223
  connectProtocol: owner.getProtocol(),
47224
47224
  commType: 'webusb',
47225
+ mode: (_c = (_b = owner.features) === null || _b === void 0 ? void 0 : _b.mode) !== null && _c !== void 0 ? _c : undefined,
47225
47226
  };
47226
47227
  };
47227
47228
  const identityProbeLogger = {
@@ -47233,6 +47234,8 @@ const identityProbeLogger = {
47233
47234
  };
47234
47235
  const probeUsbDeviceIdentitiesWithTransport = (transport, commType, getOwnedIdentity) => __awaiter(void 0, void 0, void 0, function* () {
47235
47236
  var _a;
47237
+ if (commType !== 'webusb')
47238
+ return [];
47236
47239
  yield transport.init(identityProbeLogger);
47237
47240
  const defaultMessages = JSON.stringify(DataManager.getProtobufMessages());
47238
47241
  yield transport.configure(defaultMessages);
@@ -47240,7 +47243,7 @@ const probeUsbDeviceIdentitiesWithTransport = (transport, commType, getOwnedIden
47240
47243
  const descriptors = yield transport.enumerate();
47241
47244
  const identities = [];
47242
47245
  const readIdentity = (descriptor) => __awaiter(void 0, void 0, void 0, function* () {
47243
- var _b, _c;
47246
+ var _b, _c, _d;
47244
47247
  const { path } = descriptor;
47245
47248
  if (!path || descriptor.commType !== commType)
47246
47249
  return undefined;
@@ -47265,13 +47268,18 @@ const probeUsbDeviceIdentitiesWithTransport = (transport, commType, getOwnedIden
47265
47268
  if (response.type !== 'Features')
47266
47269
  return undefined;
47267
47270
  let features = buildProtocolV1FeaturesPayload(response.message);
47268
- if (!features.serialNo) {
47269
- const { messages } = getSupportProtocolV1MessageSchema(features);
47270
- if (messages)
47271
- yield transport.configure(JSON.stringify(messages));
47272
- const vendor = yield transport.call(session, 'OnekeyGetFeatures', {}, { timeoutMs: 3000 });
47273
- if (vendor.type === 'OnekeyFeatures') {
47274
- features = buildProtocolV1FeaturesPayload(Object.assign(Object.assign({}, response.message), vendor.message));
47271
+ if (!features.serialNo &&
47272
+ (features.mode !== 'bootloader' ||
47273
+ features.deviceType === hdShared.EDeviceType.Touch ||
47274
+ features.deviceType === hdShared.EDeviceType.Pro)) {
47275
+ const { messages, protocolV1MessageSchema } = getSupportProtocolV1MessageSchema(features);
47276
+ if (protocolV1MessageSchema === 'v1CurrentSchema') {
47277
+ if (messages)
47278
+ yield transport.configure(JSON.stringify(messages));
47279
+ const vendor = yield transport.call(session, 'OnekeyGetFeatures', {}, { timeoutMs: 3000 });
47280
+ if (vendor.type === 'OnekeyFeatures') {
47281
+ features = buildProtocolV1FeaturesPayload(Object.assign(Object.assign({}, response.message), vendor.message));
47282
+ }
47275
47283
  }
47276
47284
  }
47277
47285
  identified = {
@@ -47281,6 +47289,7 @@ const probeUsbDeviceIdentitiesWithTransport = (transport, commType, getOwnedIden
47281
47289
  deviceType: features.deviceType,
47282
47290
  connectProtocol: 'V1',
47283
47291
  commType,
47292
+ mode: (_c = features.mode) !== null && _c !== void 0 ? _c : undefined,
47284
47293
  };
47285
47294
  }
47286
47295
  else if (protocol === 'V2') {
@@ -47292,20 +47301,20 @@ const probeUsbDeviceIdentitiesWithTransport = (transport, commType, getOwnedIden
47292
47301
  path,
47293
47302
  serialNo: (identity === null || identity === void 0 ? void 0 : identity.serialNo) || null,
47294
47303
  deviceId: (identity === null || identity === void 0 ? void 0 : identity.deviceId) || null,
47295
- deviceType: (_c = identity === null || identity === void 0 ? void 0 : identity.deviceType) !== null && _c !== void 0 ? _c : hdShared.EDeviceType.Unknown,
47304
+ deviceType: (_d = identity === null || identity === void 0 ? void 0 : identity.deviceType) !== null && _d !== void 0 ? _d : hdShared.EDeviceType.Unknown,
47296
47305
  connectProtocol: 'V2',
47297
47306
  commType,
47298
47307
  };
47299
47308
  }
47300
47309
  }
47301
- catch (_d) {
47310
+ catch (_e) {
47302
47311
  }
47303
47312
  finally {
47304
47313
  if (session) {
47305
47314
  try {
47306
47315
  yield transport.release(session, false);
47307
47316
  }
47308
- catch (_e) {
47317
+ catch (_f) {
47309
47318
  identified = undefined;
47310
47319
  }
47311
47320
  }
@@ -52753,9 +52762,10 @@ const PROTOCOL_V2_TARGET_STATUS_BY_DECODED_NAME = new Map([
52753
52762
  ['FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS', 10],
52754
52763
  ]);
52755
52764
  const isProtocolV2ReconnectProbeError = (error) => {
52756
- const message = getProtocolV2UnknownErrorText(error).toLowerCase();
52757
- return ((message.includes('device protocol mismatch') && message.includes('expected v2')) ||
52758
- message.includes('did not respond to expected protocol'));
52765
+ var _a;
52766
+ return getProtocolV2ErrorCode(error) === hdShared.HardwareErrorCode.TransportProtocolProbeFailed &&
52767
+ ((_a = error === null || error === void 0 ? void 0 : error.params) === null || _a === void 0 ? void 0 : _a.expectedProtocol) ===
52768
+ 'V2';
52759
52769
  };
52760
52770
  const isProtocolV2FirmwareStatusEndpointUnavailable = (error) => {
52761
52771
  const message = getProtocolV2UnknownErrorText(error).toLowerCase();
@@ -65955,7 +65965,10 @@ class DeviceConnector {
65955
65965
  : undefined;
65956
65966
  const detectedProtocol = acquiredProtocol !== null && acquiredProtocol !== void 0 ? acquiredProtocol : transport.getProtocolType(path);
65957
65967
  if (detectedProtocol !== expectedProtocol) {
65958
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Device protocol mismatch: expected ${expectedProtocol}, detected ${detectedProtocol}`);
65968
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportProtocolMismatch, undefined, {
65969
+ expectedProtocol,
65970
+ detectedProtocol,
65971
+ });
65959
65972
  }
65960
65973
  }
65961
65974
  return res;
@@ -66286,6 +66299,8 @@ const parseInitOptions = (method) => ({
66286
66299
  protocolV2DeviceInfoTimeoutMs: method === null || method === void 0 ? void 0 : method.payload.protocolV2DeviceInfoTimeoutMs,
66287
66300
  });
66288
66301
  let _core;
66302
+ let transportSwitchGeneration = 0;
66303
+ let pendingTransportSwitch = Promise.resolve();
66289
66304
  let _deviceList;
66290
66305
  let _connector;
66291
66306
  let _uiPromises = [];
@@ -66899,16 +66914,14 @@ function canSkipInitialize(method, device) {
66899
66914
  return true;
66900
66915
  }
66901
66916
  function isRetryableBleProtocolV2ProbeError(method, error) {
66917
+ var _a;
66902
66918
  const typedError = error;
66903
- const message = typeof (typedError === null || typedError === void 0 ? void 0 : typedError.message) === 'string' ? typedError.message : String(error !== null && error !== void 0 ? error : '');
66904
66919
  return (method.payload.connectProtocol === 'V2' &&
66905
- (typedError === null || typedError === void 0 ? void 0 : typedError.errorCode) === hdShared.HardwareErrorCode.RuntimeError &&
66906
- message.includes('Device protocol mismatch') &&
66907
- message.includes('expected V2') &&
66908
- message.includes('did not respond to expected protocol'));
66920
+ (typedError === null || typedError === void 0 ? void 0 : typedError.errorCode) === hdShared.HardwareErrorCode.TransportProtocolProbeFailed &&
66921
+ ((_a = typedError.params) === null || _a === void 0 ? void 0 : _a.expectedProtocol) === 'V2');
66909
66922
  }
66910
66923
  function isRetryableBleConnectionError(method, error) {
66911
- var _a, _b;
66924
+ var _a, _b, _c;
66912
66925
  if ((_a = method.device) === null || _a === void 0 ? void 0 : _a.wasInterruptedByUser()) {
66913
66926
  return false;
66914
66927
  }
@@ -66919,6 +66932,8 @@ function isRetryableBleConnectionError(method, error) {
66919
66932
  }
66920
66933
  return ((typedError === null || typedError === void 0 ? void 0 : typedError.errorCode) === hdShared.HardwareErrorCode.BleTimeoutError ||
66921
66934
  (typedError === null || typedError === void 0 ? void 0 : typedError.errorCode) === hdShared.HardwareErrorCode.BleConnectedError ||
66935
+ ((typedError === null || typedError === void 0 ? void 0 : typedError.errorCode) === hdShared.HardwareErrorCode.TransportProtocolProbeFailed &&
66936
+ !((_c = typedError.params) === null || _c === void 0 ? void 0 : _c.expectedProtocol)) ||
66922
66937
  isRetryableBleProtocolV2ProbeError(method, error) ||
66923
66938
  isMissingDetectedProtocolV2Error(method, error));
66924
66939
  }
@@ -67094,6 +67109,8 @@ const ensureConnected = (_context, method, connectId, pollingId, abortSignal) =>
67094
67109
  hdShared.HardwareErrorCode.BridgeTimeoutError,
67095
67110
  hdShared.HardwareErrorCode.BridgeNeedsPermission,
67096
67111
  hdShared.HardwareErrorCode.WebUsbDeviceAccessError,
67112
+ hdShared.HardwareErrorCode.TransportProtocolProbeFailed,
67113
+ hdShared.HardwareErrorCode.TransportProtocolMismatch,
67097
67114
  ].includes(error.errorCode)) {
67098
67115
  _deviceList = undefined;
67099
67116
  reject(error);
@@ -67169,6 +67186,8 @@ const ensureConnected = (_context, method, connectId, pollingId, abortSignal) =>
67169
67186
  hdShared.HardwareErrorCode.BleCharacteristicNotifyChangeFailure,
67170
67187
  hdShared.HardwareErrorCode.BridgeNeedsPermission,
67171
67188
  hdShared.HardwareErrorCode.WebUsbDeviceAccessError,
67189
+ hdShared.HardwareErrorCode.TransportProtocolProbeFailed,
67190
+ hdShared.HardwareErrorCode.TransportProtocolMismatch,
67172
67191
  hdShared.HardwareErrorCode.DeviceInterruptedFromUser,
67173
67192
  hdShared.HardwareErrorCode.CallQueueActionCancelled,
67174
67193
  ].includes(error.errorCode) ||
@@ -67560,6 +67579,8 @@ class Core extends events.exports {
67560
67579
  var _a, _b;
67561
67580
  return __awaiter(this, void 0, void 0, function* () {
67562
67581
  Log.debug(`[Core] Disposing SDK instance: ${this.sdkInstanceId}`);
67582
+ transportSwitchGeneration += 1;
67583
+ pendingTransportSwitch = Promise.resolve();
67563
67584
  pollingManager.stopAll();
67564
67585
  this.requestQueue.abortAllRequests();
67565
67586
  cleanup();
@@ -67591,6 +67612,8 @@ class Core extends events.exports {
67591
67612
  }
67592
67613
  }
67593
67614
  const initCore = () => {
67615
+ transportSwitchGeneration += 1;
67616
+ pendingTransportSwitch = Promise.resolve();
67594
67617
  const core = new Core();
67595
67618
  _core = core;
67596
67619
  return core;
@@ -67610,6 +67633,8 @@ const initTransport = (Transport, plugin) => {
67610
67633
  };
67611
67634
  const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0, function* () {
67612
67635
  try {
67636
+ transportSwitchGeneration += 1;
67637
+ pendingTransportSwitch = Promise.resolve();
67613
67638
  yield DataManager.load(settings);
67614
67639
  initTransport(Transport, plugin);
67615
67640
  enableLog(DataManager.getSettings('debug'));
@@ -67626,12 +67651,28 @@ const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0,
67626
67651
  }
67627
67652
  });
67628
67653
  const switchTransport = ({ env, Transport, plugin, }) => {
67629
- DataManager.updateEnv(env);
67630
- TransportManager.setTransport(Transport, plugin);
67631
- _deviceList = undefined;
67632
- DevicePool.resetState();
67633
- _connector = undefined;
67634
- initConnector();
67654
+ const generation = transportSwitchGeneration;
67655
+ const switching = pendingTransportSwitch
67656
+ .catch(() => undefined)
67657
+ .then(() => __awaiter(void 0, void 0, void 0, function* () {
67658
+ var _a, _b;
67659
+ if (generation !== transportSwitchGeneration) {
67660
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.NotInitialized);
67661
+ }
67662
+ _connector === null || _connector === void 0 ? void 0 : _connector.stop();
67663
+ yield ((_b = (_a = TransportManager.getTransport()) === null || _a === void 0 ? void 0 : _a.stop) === null || _b === void 0 ? void 0 : _b.call(_a));
67664
+ if (generation !== transportSwitchGeneration) {
67665
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.NotInitialized);
67666
+ }
67667
+ DataManager.updateEnv(env);
67668
+ TransportManager.setTransport(Transport, plugin);
67669
+ _deviceList = undefined;
67670
+ DevicePool.resetState();
67671
+ _connector = undefined;
67672
+ initConnector();
67673
+ }));
67674
+ pendingTransportSwitch = switching;
67675
+ return switching;
67635
67676
  };
67636
67677
 
67637
67678
  const HardwareSdk = ({ init, call, dispose, eventEmitter, uiResponse, cancel, updateSettings, switchTransport, }) => inject({
@@ -54,6 +54,7 @@ export type UsbDeviceIdentity = {
54
54
  deviceType: IDeviceType;
55
55
  connectProtocol: HardwareConnectProtocol;
56
56
  commType: 'webusb' | 'bridge';
57
+ mode?: DeviceStateMode;
57
58
  };
58
59
  export type Device = KnownDevice;
59
60
  export type DeviceFeaturesProtocol = 'V1' | 'V2' | 'unknown';
@@ -1 +1 @@
1
- {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/types/device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEpG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,IAAI,sBAAsB,EACtC,YAAY,IAAI,sBAAsB,EACvC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG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,GAAG,iBAAiB,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,gBAAgB,EAAE,kBAAkB,CAAC;CACtC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.2.8-alpha.51",
3
+ "version": "1.2.8-alpha.53",
4
4
  "description": "Core processes and APIs for communicating with OneKey hardware devices.",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-shared": "1.2.8-alpha.51",
29
- "@onekeyfe/hd-transport": "1.2.8-alpha.51",
28
+ "@onekeyfe/hd-shared": "1.2.8-alpha.53",
29
+ "@onekeyfe/hd-transport": "1.2.8-alpha.53",
30
30
  "axios": "1.15.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "buffer": "^6.0.3",
@@ -46,5 +46,5 @@
46
46
  "@types/w3c-web-usb": "^1.0.10",
47
47
  "@types/web-bluetooth": "^0.0.21"
48
48
  },
49
- "gitHead": "0ccbc08199c62e96f6084e864e558055100b66ed"
49
+ "gitHead": "8b628967c6057e743ffe0d5fa8a8d2120e64c5e3"
50
50
  }
@@ -352,13 +352,10 @@ const PROTOCOL_V2_TARGET_STATUS_BY_DECODED_NAME = new Map<string, number>([
352
352
  ['FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS', 10],
353
353
  ]);
354
354
 
355
- const isProtocolV2ReconnectProbeError = (error: unknown) => {
356
- const message = getProtocolV2UnknownErrorText(error).toLowerCase();
357
- return (
358
- (message.includes('device protocol mismatch') && message.includes('expected v2')) ||
359
- message.includes('did not respond to expected protocol')
360
- );
361
- };
355
+ const isProtocolV2ReconnectProbeError = (error: unknown) =>
356
+ getProtocolV2ErrorCode(error) === HardwareErrorCode.TransportProtocolProbeFailed &&
357
+ (error as { params?: { expectedProtocol?: unknown } } | undefined)?.params?.expectedProtocol ===
358
+ 'V2';
362
359
 
363
360
  const isProtocolV2FirmwareStatusEndpointUnavailable = (error: unknown) => {
364
361
  const message = getProtocolV2UnknownErrorText(error).toLowerCase();
@@ -87,6 +87,7 @@ export const getOwnedUsbDeviceIdentity = (
87
87
  deviceType: owner.getCurrentDeviceType(),
88
88
  connectProtocol: owner.getProtocol(),
89
89
  commType: 'webusb',
90
+ mode: owner.features?.mode ?? undefined,
90
91
  };
91
92
  };
92
93
 
@@ -115,6 +116,7 @@ export const probeUsbDeviceIdentitiesWithTransport = async (
115
116
  commType: UsbDeviceIdentity['commType'],
116
117
  getOwnedIdentity?: (descriptor: UsbIdentityProbeDescriptor) => UsbDeviceIdentity | undefined
117
118
  ): Promise<UsbDeviceIdentity[]> => {
119
+ if (commType !== 'webusb') return [];
118
120
  await transport.init(identityProbeLogger);
119
121
  const defaultMessages = JSON.stringify(DataManager.getProtobufMessages());
120
122
  await transport.configure(defaultMessages);
@@ -148,20 +150,30 @@ export const probeUsbDeviceIdentitiesWithTransport = async (
148
150
  const response = await transport.call(session, 'GetFeatures', {}, { timeoutMs: 3000 });
149
151
  if (response.type !== 'Features') return undefined;
150
152
  let features = buildProtocolV1FeaturesPayload(response.message as PROTO.Features);
151
- if (!features.serialNo) {
152
- const { messages } = getSupportProtocolV1MessageSchema(features);
153
- if (messages) await transport.configure(JSON.stringify(messages));
154
- const vendor = await transport.call(
155
- session,
156
- 'OnekeyGetFeatures',
157
- {},
158
- { timeoutMs: 3000 }
159
- );
160
- if (vendor.type === 'OnekeyFeatures') {
161
- features = buildProtocolV1FeaturesPayload({
162
- ...response.message,
163
- ...vendor.message,
164
- } as PROTO.Features);
153
+ // Classic-family loaders expose their supported information in Features.
154
+ // Touch/Pro retain their existing vendor-feature query.
155
+ if (
156
+ !features.serialNo &&
157
+ (features.mode !== 'bootloader' ||
158
+ features.deviceType === EDeviceType.Touch ||
159
+ features.deviceType === EDeviceType.Pro)
160
+ ) {
161
+ const { messages, protocolV1MessageSchema } = getSupportProtocolV1MessageSchema(features);
162
+ // Legacy V1 has no OnekeyGetFeatures; keep the identity confirmed by GetFeatures.
163
+ if (protocolV1MessageSchema === 'v1CurrentSchema') {
164
+ if (messages) await transport.configure(JSON.stringify(messages));
165
+ const vendor = await transport.call(
166
+ session,
167
+ 'OnekeyGetFeatures',
168
+ {},
169
+ { timeoutMs: 3000 }
170
+ );
171
+ if (vendor.type === 'OnekeyFeatures') {
172
+ features = buildProtocolV1FeaturesPayload({
173
+ ...response.message,
174
+ ...vendor.message,
175
+ } as PROTO.Features);
176
+ }
165
177
  }
166
178
  }
167
179
  identified = {
@@ -171,6 +183,7 @@ export const probeUsbDeviceIdentitiesWithTransport = async (
171
183
  deviceType: features.deviceType,
172
184
  connectProtocol: 'V1',
173
185
  commType,
186
+ mode: features.mode ?? undefined,
174
187
  };
175
188
  } else if (protocol === 'V2') {
176
189
  const response = await transport.call(
package/src/core/index.ts CHANGED
@@ -126,6 +126,8 @@ const parseInitOptions = (method?: BaseMethod): InitOptions => ({
126
126
  });
127
127
 
128
128
  let _core: Core | undefined;
129
+ let transportSwitchGeneration = 0;
130
+ let pendingTransportSwitch: Promise<void> = Promise.resolve();
129
131
  let _deviceList: DeviceList | undefined;
130
132
  let _connector: DeviceConnector | undefined;
131
133
  let _uiPromises: UiPromise<UiPromiseResponse['type']>[] = []; // Waiting for ui response
@@ -991,15 +993,11 @@ function canSkipInitialize(method: BaseMethod, device: Device): boolean {
991
993
  }
992
994
 
993
995
  export function isRetryableBleProtocolV2ProbeError(method: BaseMethod, error: unknown) {
994
- const typedError = error as { errorCode?: unknown; message?: unknown };
995
- const message =
996
- typeof typedError?.message === 'string' ? typedError.message : String(error ?? '');
996
+ const typedError = error as { errorCode?: unknown; params?: { expectedProtocol?: unknown } };
997
997
  return (
998
998
  method.payload.connectProtocol === 'V2' &&
999
- typedError?.errorCode === HardwareErrorCode.RuntimeError &&
1000
- message.includes('Device protocol mismatch') &&
1001
- message.includes('expected V2') &&
1002
- message.includes('did not respond to expected protocol')
999
+ typedError?.errorCode === HardwareErrorCode.TransportProtocolProbeFailed &&
1000
+ typedError.params?.expectedProtocol === 'V2'
1003
1001
  );
1004
1002
  }
1005
1003
 
@@ -1009,7 +1007,7 @@ export function isRetryableBleConnectionError(method: BaseMethod, error: unknown
1009
1007
  }
1010
1008
  const typedError = error as {
1011
1009
  errorCode?: unknown;
1012
- params?: { acquireDeadlineExceeded?: unknown };
1010
+ params?: { acquireDeadlineExceeded?: unknown; expectedProtocol?: unknown };
1013
1011
  };
1014
1012
  if (
1015
1013
  typedError?.errorCode === HardwareErrorCode.BleTimeoutError &&
@@ -1020,6 +1018,8 @@ export function isRetryableBleConnectionError(method: BaseMethod, error: unknown
1020
1018
  return (
1021
1019
  typedError?.errorCode === HardwareErrorCode.BleTimeoutError ||
1022
1020
  typedError?.errorCode === HardwareErrorCode.BleConnectedError ||
1021
+ (typedError?.errorCode === HardwareErrorCode.TransportProtocolProbeFailed &&
1022
+ !typedError.params?.expectedProtocol) ||
1023
1023
  isRetryableBleProtocolV2ProbeError(method, error) ||
1024
1024
  isMissingDetectedProtocolV2Error(method, error)
1025
1025
  );
@@ -1274,6 +1274,8 @@ const ensureConnected = async (
1274
1274
  HardwareErrorCode.BridgeTimeoutError,
1275
1275
  HardwareErrorCode.BridgeNeedsPermission,
1276
1276
  HardwareErrorCode.WebUsbDeviceAccessError,
1277
+ HardwareErrorCode.TransportProtocolProbeFailed,
1278
+ HardwareErrorCode.TransportProtocolMismatch,
1277
1279
  ].includes(error.errorCode)
1278
1280
  ) {
1279
1281
  _deviceList = undefined;
@@ -1361,6 +1363,8 @@ const ensureConnected = async (
1361
1363
  HardwareErrorCode.BleCharacteristicNotifyChangeFailure,
1362
1364
  HardwareErrorCode.BridgeNeedsPermission,
1363
1365
  HardwareErrorCode.WebUsbDeviceAccessError,
1366
+ HardwareErrorCode.TransportProtocolProbeFailed,
1367
+ HardwareErrorCode.TransportProtocolMismatch,
1364
1368
  HardwareErrorCode.DeviceInterruptedFromUser,
1365
1369
  HardwareErrorCode.CallQueueActionCancelled,
1366
1370
  ].includes(error.errorCode) ||
@@ -1964,6 +1968,8 @@ export default class Core extends EventEmitter {
1964
1968
 
1965
1969
  private async disposeResources(): Promise<void> {
1966
1970
  Log.debug(`[Core] Disposing SDK instance: ${this.sdkInstanceId}`);
1971
+ transportSwitchGeneration += 1;
1972
+ pendingTransportSwitch = Promise.resolve();
1967
1973
  pollingManager.stopAll();
1968
1974
  this.requestQueue.abortAllRequests();
1969
1975
  cleanup();
@@ -1998,6 +2004,8 @@ export default class Core extends EventEmitter {
1998
2004
  }
1999
2005
 
2000
2006
  export const initCore = () => {
2007
+ transportSwitchGeneration += 1;
2008
+ pendingTransportSwitch = Promise.resolve();
2001
2009
  const core = new Core();
2002
2010
  _core = core;
2003
2011
  return core;
@@ -2027,6 +2035,8 @@ export const init = async (
2027
2035
  plugin?: LowlevelTransportSharedPlugin
2028
2036
  ) => {
2029
2037
  try {
2038
+ transportSwitchGeneration += 1;
2039
+ pendingTransportSwitch = Promise.resolve();
2030
2040
  await DataManager.load(settings);
2031
2041
  initTransport(Transport, plugin);
2032
2042
  enableLog(DataManager.getSettings('debug'));
@@ -2052,10 +2062,26 @@ export const switchTransport = ({
2052
2062
  Transport: any;
2053
2063
  plugin?: LowlevelTransportSharedPlugin;
2054
2064
  }) => {
2055
- DataManager.updateEnv(env);
2056
- TransportManager.setTransport(Transport, plugin);
2057
- _deviceList = undefined;
2058
- DevicePool.resetState();
2059
- _connector = undefined;
2060
- initConnector();
2065
+ const generation = transportSwitchGeneration;
2066
+ // Preserve request order while native transport cleanup is pending.
2067
+ const switching = pendingTransportSwitch
2068
+ .catch(() => undefined)
2069
+ .then(async () => {
2070
+ if (generation !== transportSwitchGeneration) {
2071
+ throw ERRORS.TypedError(HardwareErrorCode.NotInitialized);
2072
+ }
2073
+ _connector?.stop();
2074
+ await TransportManager.getTransport()?.stop?.();
2075
+ if (generation !== transportSwitchGeneration) {
2076
+ throw ERRORS.TypedError(HardwareErrorCode.NotInitialized);
2077
+ }
2078
+ DataManager.updateEnv(env);
2079
+ TransportManager.setTransport(Transport, plugin);
2080
+ _deviceList = undefined;
2081
+ DevicePool.resetState();
2082
+ _connector = undefined;
2083
+ initConnector();
2084
+ });
2085
+ pendingTransportSwitch = switching;
2086
+ return switching;
2061
2087
  };
@@ -133,10 +133,10 @@ export default class DeviceConnector {
133
133
  : undefined;
134
134
  const detectedProtocol = acquiredProtocol ?? transport.getProtocolType(path);
135
135
  if (detectedProtocol !== expectedProtocol) {
136
- throw ERRORS.TypedError(
137
- HardwareErrorCode.RuntimeError,
138
- `Device protocol mismatch: expected ${expectedProtocol}, detected ${detectedProtocol}`
139
- );
136
+ throw ERRORS.TypedError(HardwareErrorCode.TransportProtocolMismatch, undefined, {
137
+ expectedProtocol,
138
+ detectedProtocol,
139
+ });
140
140
  }
141
141
  }
142
142
  return res;
@@ -93,6 +93,8 @@ export type UsbDeviceIdentity = {
93
93
  deviceType: IDeviceType;
94
94
  connectProtocol: HardwareConnectProtocol;
95
95
  commType: 'webusb' | 'bridge';
96
+ /** Mode confirmed by the device response; absent when discovery cannot establish it. */
97
+ mode?: DeviceStateMode;
96
98
  };
97
99
 
98
100
  // export type UnknownDevice = {