@onekeyfe/hd-transport 1.2.2-alpha.1 → 1.2.2-alpha.100
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/README.md +1 -1
- package/__tests__/messages.test.js +0 -25
- package/__tests__/protocol-v2-link-manager.test.js +0 -70
- package/__tests__/protocol-v2-usb-transport-base.test.js +4 -6
- package/__tests__/protocol-v2.test.js +0 -151
- package/dist/index.d.ts +3 -64
- package/dist/index.js +13 -98
- package/dist/protocols/v2/link-manager.d.ts +0 -1
- package/dist/protocols/v2/link-manager.d.ts.map +1 -1
- package/dist/protocols/v2/session.d.ts +1 -9
- package/dist/protocols/v2/session.d.ts.map +1 -1
- package/dist/types/messages.d.ts +1 -38
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transport.d.ts +0 -2
- package/dist/types/transport.d.ts.map +1 -1
- package/messages-protocol-v2.json +1 -111
- package/package.json +2 -2
- package/src/protocols/v2/link-manager.ts +5 -46
- package/src/protocols/v2/session.ts +3 -67
- package/src/types/messages.ts +1 -47
- package/src/types/transport.ts +0 -4
|
@@ -446,9 +446,6 @@
|
|
|
446
446
|
"MessageType_DeviceCertificateSignature": 60423,
|
|
447
447
|
"MessageType_DeviceCertificateSign": 60424,
|
|
448
448
|
"MessageType_DeviceMiscUsbMscControl": 60440,
|
|
449
|
-
"MessageType_DeviceFindMyTokenState": 60450,
|
|
450
|
-
"MessageType_DeviceFindMyTokenUpdate": 60451,
|
|
451
|
-
"MessageType_DeviceFindMyTokenStateGet": 60452,
|
|
452
449
|
"MessageType_DeviceInfoGet": 60600,
|
|
453
450
|
"MessageType_DeviceInfo": 60601,
|
|
454
451
|
"MessageType_DeviceStatusGet": 60602,
|
|
@@ -5407,10 +5404,6 @@
|
|
|
5407
5404
|
"request_id": {
|
|
5408
5405
|
"type": "bytes",
|
|
5409
5406
|
"id": 5
|
|
5410
|
-
},
|
|
5411
|
-
"source_fingerprint": {
|
|
5412
|
-
"type": "uint32",
|
|
5413
|
-
"id": 6
|
|
5414
5407
|
}
|
|
5415
5408
|
}
|
|
5416
5409
|
},
|
|
@@ -5546,14 +5539,6 @@
|
|
|
5546
5539
|
"tx_type": {
|
|
5547
5540
|
"type": "uint32",
|
|
5548
5541
|
"id": 10
|
|
5549
|
-
},
|
|
5550
|
-
"expected_address": {
|
|
5551
|
-
"type": "bytes",
|
|
5552
|
-
"id": 12
|
|
5553
|
-
},
|
|
5554
|
-
"source_fingerprint": {
|
|
5555
|
-
"type": "uint32",
|
|
5556
|
-
"id": 13
|
|
5557
5542
|
}
|
|
5558
5543
|
}
|
|
5559
5544
|
},
|
|
@@ -5634,14 +5619,6 @@
|
|
|
5634
5619
|
"rule": "repeated",
|
|
5635
5620
|
"type": "EthereumAccessListOneKey",
|
|
5636
5621
|
"id": 11
|
|
5637
|
-
},
|
|
5638
|
-
"expected_address": {
|
|
5639
|
-
"type": "bytes",
|
|
5640
|
-
"id": 12
|
|
5641
|
-
},
|
|
5642
|
-
"source_fingerprint": {
|
|
5643
|
-
"type": "uint32",
|
|
5644
|
-
"id": 13
|
|
5645
5622
|
}
|
|
5646
5623
|
}
|
|
5647
5624
|
},
|
|
@@ -5818,10 +5795,6 @@
|
|
|
5818
5795
|
"chain_id": {
|
|
5819
5796
|
"type": "uint64",
|
|
5820
5797
|
"id": 3
|
|
5821
|
-
},
|
|
5822
|
-
"source_fingerprint": {
|
|
5823
|
-
"type": "uint32",
|
|
5824
|
-
"id": 4
|
|
5825
5798
|
}
|
|
5826
5799
|
}
|
|
5827
5800
|
},
|
|
@@ -9501,10 +9474,6 @@
|
|
|
9501
9474
|
"rule": "required",
|
|
9502
9475
|
"type": "bytes",
|
|
9503
9476
|
"id": 2
|
|
9504
|
-
},
|
|
9505
|
-
"source_fingerprint": {
|
|
9506
|
-
"type": "uint32",
|
|
9507
|
-
"id": 3
|
|
9508
9477
|
}
|
|
9509
9478
|
}
|
|
9510
9479
|
},
|
|
@@ -9549,10 +9518,6 @@
|
|
|
9549
9518
|
"application_domain": {
|
|
9550
9519
|
"type": "bytes",
|
|
9551
9520
|
"id": 5
|
|
9552
|
-
},
|
|
9553
|
-
"source_fingerprint": {
|
|
9554
|
-
"type": "uint32",
|
|
9555
|
-
"id": 6
|
|
9556
9521
|
}
|
|
9557
9522
|
}
|
|
9558
9523
|
},
|
|
@@ -9570,10 +9535,6 @@
|
|
|
9570
9535
|
"rule": "required",
|
|
9571
9536
|
"type": "bytes",
|
|
9572
9537
|
"id": 2
|
|
9573
|
-
},
|
|
9574
|
-
"source_fingerprint": {
|
|
9575
|
-
"type": "uint32",
|
|
9576
|
-
"id": 3
|
|
9577
9538
|
}
|
|
9578
9539
|
}
|
|
9579
9540
|
},
|
|
@@ -11803,27 +11764,6 @@
|
|
|
11803
11764
|
}
|
|
11804
11765
|
}
|
|
11805
11766
|
},
|
|
11806
|
-
"DeviceFindMyTokenUpdate": {
|
|
11807
|
-
"fields": {
|
|
11808
|
-
"token": {
|
|
11809
|
-
"rule": "required",
|
|
11810
|
-
"type": "bytes",
|
|
11811
|
-
"id": 1
|
|
11812
|
-
}
|
|
11813
|
-
}
|
|
11814
|
-
},
|
|
11815
|
-
"DeviceFindMyTokenStateGet": {
|
|
11816
|
-
"fields": {}
|
|
11817
|
-
},
|
|
11818
|
-
"DeviceFindMyTokenState": {
|
|
11819
|
-
"fields": {
|
|
11820
|
-
"burned": {
|
|
11821
|
-
"rule": "required",
|
|
11822
|
-
"type": "bool",
|
|
11823
|
-
"id": 1
|
|
11824
|
-
}
|
|
11825
|
-
}
|
|
11826
|
-
},
|
|
11827
11767
|
"DeviceFactoryAck": {
|
|
11828
11768
|
"values": {
|
|
11829
11769
|
"FACTORY_ACK_SUCCESS": 0,
|
|
@@ -11953,13 +11893,6 @@
|
|
|
11953
11893
|
"FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS": 10
|
|
11954
11894
|
}
|
|
11955
11895
|
},
|
|
11956
|
-
"DeviceFirmwareUpdatePhase": {
|
|
11957
|
-
"values": {
|
|
11958
|
-
"FW_MGMT_UPDATER_PHASE_PREPARE": 0,
|
|
11959
|
-
"FW_MGMT_UPDATER_PHASE_INSTALL": 1,
|
|
11960
|
-
"FW_MGMT_UPDATER_PHASE_VERIFY": 2
|
|
11961
|
-
}
|
|
11962
|
-
},
|
|
11963
11896
|
"DeviceFirmwareTarget": {
|
|
11964
11897
|
"fields": {
|
|
11965
11898
|
"target_id": {
|
|
@@ -11984,26 +11917,7 @@
|
|
|
11984
11917
|
}
|
|
11985
11918
|
},
|
|
11986
11919
|
"DeviceFirmwareUpdateRequest": {
|
|
11987
|
-
"fields": {
|
|
11988
|
-
"reboot_after_update": {
|
|
11989
|
-
"type": "bool",
|
|
11990
|
-
"id": 1
|
|
11991
|
-
}
|
|
11992
|
-
}
|
|
11993
|
-
},
|
|
11994
|
-
"DeviceFirmwareUpdatePhaseInfo": {
|
|
11995
|
-
"fields": {
|
|
11996
|
-
"phase": {
|
|
11997
|
-
"rule": "required",
|
|
11998
|
-
"type": "DeviceFirmwareUpdatePhase",
|
|
11999
|
-
"id": 1
|
|
12000
|
-
},
|
|
12001
|
-
"progress_percent": {
|
|
12002
|
-
"rule": "required",
|
|
12003
|
-
"type": "uint32",
|
|
12004
|
-
"id": 2
|
|
12005
|
-
}
|
|
12006
|
-
}
|
|
11920
|
+
"fields": {}
|
|
12007
11921
|
},
|
|
12008
11922
|
"DeviceFirmwareUpdateRecord": {
|
|
12009
11923
|
"fields": {
|
|
@@ -12016,14 +11930,6 @@
|
|
|
12016
11930
|
"type": "DeviceFirmwareUpdateTaskStatus",
|
|
12017
11931
|
"id": 10
|
|
12018
11932
|
},
|
|
12019
|
-
"progress_percent": {
|
|
12020
|
-
"type": "uint32",
|
|
12021
|
-
"id": 11
|
|
12022
|
-
},
|
|
12023
|
-
"phase_info": {
|
|
12024
|
-
"type": "DeviceFirmwareUpdatePhaseInfo",
|
|
12025
|
-
"id": 12
|
|
12026
|
-
},
|
|
12027
11933
|
"payload_version": {
|
|
12028
11934
|
"type": "uint32",
|
|
12029
11935
|
"id": 20
|
|
@@ -12040,14 +11946,6 @@
|
|
|
12040
11946
|
"type": "bool",
|
|
12041
11947
|
"id": 10
|
|
12042
11948
|
},
|
|
12043
|
-
"progress_percent": {
|
|
12044
|
-
"type": "bool",
|
|
12045
|
-
"id": 11
|
|
12046
|
-
},
|
|
12047
|
-
"phase_info": {
|
|
12048
|
-
"type": "bool",
|
|
12049
|
-
"id": 12
|
|
12050
|
-
},
|
|
12051
11949
|
"payload_version": {
|
|
12052
11950
|
"type": "bool",
|
|
12053
11951
|
"id": 20
|
|
@@ -12815,10 +12713,6 @@
|
|
|
12815
12713
|
"text_id": {
|
|
12816
12714
|
"type": "uint32",
|
|
12817
12715
|
"id": 3
|
|
12818
|
-
},
|
|
12819
|
-
"text_arg": {
|
|
12820
|
-
"type": "string",
|
|
12821
|
-
"id": 4
|
|
12822
12716
|
}
|
|
12823
12717
|
}
|
|
12824
12718
|
},
|
|
@@ -12886,10 +12780,6 @@
|
|
|
12886
12780
|
"title_id": {
|
|
12887
12781
|
"type": "uint32",
|
|
12888
12782
|
"id": 8
|
|
12889
|
-
},
|
|
12890
|
-
"title_arg": {
|
|
12891
|
-
"type": "string",
|
|
12892
|
-
"id": 9
|
|
12893
12783
|
}
|
|
12894
12784
|
}
|
|
12895
12785
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport",
|
|
3
|
-
"version": "1.2.2-alpha.
|
|
3
|
+
"version": "1.2.2-alpha.100",
|
|
4
4
|
"description": "Transport layer abstractions and utilities for OneKey hardware SDK.",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"long": "^4.0.0",
|
|
29
29
|
"protobufjs": "^6.11.2"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "c40dad085297b0e3cc2020bd218c146dff6ed3e1"
|
|
32
32
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ProtocolV2SequenceCursor } from './sequence-cursor';
|
|
2
2
|
import { ProtocolV2LinkError } from './errors';
|
|
3
3
|
import { ProtocolV2Session, getErrorMessage } from './session';
|
|
4
|
-
import { PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS } from '../../constants';
|
|
5
4
|
|
|
6
5
|
import type { MessageFromOneKey, TransportCallOptions } from '../../types';
|
|
7
6
|
import type { ProtocolV2CallContext, ProtocolV2Schemas, ProtocolV2SessionOptions } from './session';
|
|
@@ -62,45 +61,15 @@ export class ProtocolV2LinkManager<Key> {
|
|
|
62
61
|
options?: TransportCallOptions
|
|
63
62
|
): Promise<MessageFromOneKey> {
|
|
64
63
|
const generation = this.generations.get(key) ?? 0;
|
|
65
|
-
const previousQueue = this.callQueues.get(key);
|
|
66
|
-
const timeoutMs =
|
|
67
|
-
options?.timeoutMs && options.timeoutMs > 0
|
|
68
|
-
? options.timeoutMs
|
|
69
|
-
: PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS;
|
|
70
|
-
const queuedAt = Date.now();
|
|
71
|
-
let queueTimeout: ReturnType<typeof setTimeout> | undefined;
|
|
72
|
-
let queueTimeoutError: Error | undefined;
|
|
73
|
-
const timeoutWhileQueued = new Promise<never>((_, reject) => {
|
|
74
|
-
queueTimeout = setTimeout(() => {
|
|
75
|
-
queueTimeout = undefined;
|
|
76
|
-
queueTimeoutError = this.createQueuedCallTimeoutError(key, name, timeoutMs);
|
|
77
|
-
reject(queueTimeoutError);
|
|
78
|
-
}, timeoutMs);
|
|
79
|
-
});
|
|
80
64
|
const run = () => {
|
|
81
|
-
if (queueTimeout) {
|
|
82
|
-
clearTimeout(queueTimeout);
|
|
83
|
-
queueTimeout = undefined;
|
|
84
|
-
}
|
|
85
|
-
if (queueTimeoutError) {
|
|
86
|
-
throw queueTimeoutError;
|
|
87
|
-
}
|
|
88
65
|
this.assertCallGeneration(key, generation);
|
|
89
|
-
|
|
90
|
-
if (remainingTimeoutMs <= 0) {
|
|
91
|
-
throw this.createQueuedCallTimeoutError(key, name, timeoutMs);
|
|
92
|
-
}
|
|
93
|
-
return this.executeCall(key, createAdapter, name, data, {
|
|
94
|
-
...options,
|
|
95
|
-
timeoutMs: remainingTimeoutMs,
|
|
96
|
-
});
|
|
66
|
+
return this.executeCall(key, createAdapter, name, data, options);
|
|
97
67
|
};
|
|
98
|
-
const previous =
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
const queue = execution.catch(() => undefined);
|
|
68
|
+
const previous = this.callQueues.get(key) ?? Promise.resolve();
|
|
69
|
+
const result = previous.then(run, run);
|
|
70
|
+
const queue = result.catch(() => undefined);
|
|
102
71
|
this.callQueues.set(key, queue);
|
|
103
|
-
|
|
72
|
+
result
|
|
104
73
|
.then(
|
|
105
74
|
() => this.clearSettledCallQueue(key, queue),
|
|
106
75
|
() => this.clearSettledCallQueue(key, queue)
|
|
@@ -237,16 +206,6 @@ export class ProtocolV2LinkManager<Key> {
|
|
|
237
206
|
}
|
|
238
207
|
}
|
|
239
208
|
|
|
240
|
-
private createQueuedCallTimeoutError(key: Key, name: string, timeoutMs: number): Error {
|
|
241
|
-
const adapterTimeoutError = this.links.get(key)?.adapter.createTimeoutError;
|
|
242
|
-
return adapterTimeoutError
|
|
243
|
-
? adapterTimeoutError(name, timeoutMs)
|
|
244
|
-
: new ProtocolV2LinkError(
|
|
245
|
-
'response-timeout',
|
|
246
|
-
`Protocol V2 call timeout after ${timeoutMs}ms while queued for ${name}`
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
209
|
private assertCallGeneration(key: Key, generation: number) {
|
|
251
210
|
const currentGeneration = this.generations.get(key) ?? 0;
|
|
252
211
|
if (currentGeneration === generation) return;
|
|
@@ -60,7 +60,6 @@ export type ProtocolV2CallOptions = {
|
|
|
60
60
|
onIntermediateResponse?: (response: MessageFromOneKey) => void;
|
|
61
61
|
onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
|
|
62
62
|
returnAfterWrite?: boolean;
|
|
63
|
-
onResponseAfterWrite?: (response: MessageFromOneKey) => void;
|
|
64
63
|
writeWithResponse?: boolean;
|
|
65
64
|
};
|
|
66
65
|
|
|
@@ -82,33 +81,6 @@ export function hexToBytes(hex: string): Uint8Array {
|
|
|
82
81
|
return bytes;
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
export function detectProtocolV2LinkDisabledError({
|
|
86
|
-
schemas,
|
|
87
|
-
assembler,
|
|
88
|
-
bytes,
|
|
89
|
-
}: {
|
|
90
|
-
schemas: ProtocolV2Schemas;
|
|
91
|
-
assembler: ProtocolV2FrameAssembler;
|
|
92
|
-
bytes: Uint8Array;
|
|
93
|
-
}) {
|
|
94
|
-
try {
|
|
95
|
-
for (const frame of assembler.drain(bytes)) {
|
|
96
|
-
const response = check.call(ProtocolV2.decodeFrame(schemas, frame));
|
|
97
|
-
if (response.type === 'Failure') {
|
|
98
|
-
const failureCode = response.message?.code;
|
|
99
|
-
const firmwareMessage = response.message?.message;
|
|
100
|
-
if (isProtocolV2LinkDisabledFailure(failureCode, firmwareMessage)) {
|
|
101
|
-
return createProtocolV2LinkDisabledError(failureCode, firmwareMessage);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
} catch {
|
|
106
|
-
// Cross-protocol detection may receive a normal Protocol V1 notification.
|
|
107
|
-
assembler.reset();
|
|
108
|
-
}
|
|
109
|
-
return undefined;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
84
|
export function bytesToHex(bytes: Uint8Array): string {
|
|
113
85
|
return Array.from(bytes)
|
|
114
86
|
.map(b => b.toString(16).padStart(2, '0'))
|
|
@@ -227,11 +199,6 @@ export class ProtocolV2Session {
|
|
|
227
199
|
// response, but their frames must never interleave with the active request write.
|
|
228
200
|
private pendingWrite: Promise<unknown> = Promise.resolve();
|
|
229
201
|
|
|
230
|
-
private pendingResponseAfterWrite?: {
|
|
231
|
-
expectedTypes: Set<string>;
|
|
232
|
-
onResponse?: (response: MessageFromOneKey) => void;
|
|
233
|
-
};
|
|
234
|
-
|
|
235
202
|
private lastResponseSequence?: number;
|
|
236
203
|
|
|
237
204
|
constructor(options: ProtocolV2SessionOptions) {
|
|
@@ -330,11 +297,7 @@ export class ProtocolV2Session {
|
|
|
330
297
|
};
|
|
331
298
|
|
|
332
299
|
const runCall = async (): Promise<MessageFromOneKey> => {
|
|
333
|
-
|
|
334
|
-
// the continuous receive queue until the next call consumes that response.
|
|
335
|
-
if (!this.pendingResponseAfterWrite) {
|
|
336
|
-
await prepareCall?.(baseCallContext);
|
|
337
|
-
}
|
|
300
|
+
await prepareCall?.(baseCallContext);
|
|
338
301
|
const protoSeq = this.sequenceCursor.next();
|
|
339
302
|
const frame = ProtocolV2.encodeFrame(schemas, name, data, {
|
|
340
303
|
packetSrc,
|
|
@@ -360,12 +323,6 @@ export class ProtocolV2Session {
|
|
|
360
323
|
}
|
|
361
324
|
|
|
362
325
|
if (callOptions.returnAfterWrite) {
|
|
363
|
-
if (callOptions.expectedTypes?.length) {
|
|
364
|
-
this.pendingResponseAfterWrite = {
|
|
365
|
-
expectedTypes: new Set(callOptions.expectedTypes),
|
|
366
|
-
onResponse: callOptions.onResponseAfterWrite,
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
326
|
return { type: 'WriteCompleted', message: {} };
|
|
370
327
|
}
|
|
371
328
|
|
|
@@ -438,26 +395,7 @@ export class ProtocolV2Session {
|
|
|
438
395
|
this.lastResponseSequence = decoded.seq;
|
|
439
396
|
|
|
440
397
|
const response = check.call(decoded);
|
|
441
|
-
|
|
442
|
-
let belongsToWriteOnlyCall = false;
|
|
443
|
-
if (pendingResponseAfterWrite) {
|
|
444
|
-
belongsToWriteOnlyCall = pendingResponseAfterWrite.expectedTypes.has(response.type);
|
|
445
|
-
if (belongsToWriteOnlyCall || COMMON_TERMINAL_RESPONSE_TYPES.has(response.type)) {
|
|
446
|
-
this.pendingResponseAfterWrite = undefined;
|
|
447
|
-
if (belongsToWriteOnlyCall) {
|
|
448
|
-
try {
|
|
449
|
-
pendingResponseAfterWrite.onResponse?.(response);
|
|
450
|
-
} catch (error) {
|
|
451
|
-
logger?.error?.(
|
|
452
|
-
`${logPrefix} delayed response callback failed: ${String(error)}`
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
if (belongsToWriteOnlyCall) {
|
|
459
|
-
// The delayed response belongs to the preceding write-only call.
|
|
460
|
-
} else if (callOptions.intermediateTypes?.includes(response.type)) {
|
|
398
|
+
if (callOptions.intermediateTypes?.includes(response.type)) {
|
|
461
399
|
callOptions.onIntermediateResponse?.(response);
|
|
462
400
|
} else if (isExpectedTerminalResponse(response, callOptions.expectedTypes)) {
|
|
463
401
|
return response;
|
|
@@ -495,7 +433,6 @@ export async function probeProtocolV2({
|
|
|
495
433
|
logPrefix = 'ProtocolV2',
|
|
496
434
|
onBeforeProbe,
|
|
497
435
|
onProbeFailed,
|
|
498
|
-
shouldRethrow,
|
|
499
436
|
}: {
|
|
500
437
|
call: (
|
|
501
438
|
name: string,
|
|
@@ -507,7 +444,6 @@ export async function probeProtocolV2({
|
|
|
507
444
|
logPrefix?: string;
|
|
508
445
|
onBeforeProbe?: () => Promise<void> | void;
|
|
509
446
|
onProbeFailed?: (error: unknown) => Promise<void> | void;
|
|
510
|
-
shouldRethrow?: (error: unknown) => boolean;
|
|
511
447
|
}) {
|
|
512
448
|
let probeError: unknown;
|
|
513
449
|
try {
|
|
@@ -532,7 +468,7 @@ export async function probeProtocolV2({
|
|
|
532
468
|
}
|
|
533
469
|
probeError = new Error(`unexpected response type ${response.type}`);
|
|
534
470
|
} catch (error) {
|
|
535
|
-
if (isProtocolV2LinkDisabledError(error)
|
|
471
|
+
if (isProtocolV2LinkDisabledError(error)) {
|
|
536
472
|
throw error;
|
|
537
473
|
}
|
|
538
474
|
probeError = error;
|
package/src/types/messages.ts
CHANGED
|
@@ -1950,8 +1950,6 @@ export type EthereumSignTxOneKey = {
|
|
|
1950
1950
|
data_length?: number;
|
|
1951
1951
|
chain_id: number;
|
|
1952
1952
|
tx_type?: number;
|
|
1953
|
-
expected_address?: string;
|
|
1954
|
-
source_fingerprint?: number;
|
|
1955
1953
|
};
|
|
1956
1954
|
|
|
1957
1955
|
// EthereumAccessListOneKey
|
|
@@ -1973,8 +1971,6 @@ export type EthereumSignTxEIP1559OneKey = {
|
|
|
1973
1971
|
data_length: number;
|
|
1974
1972
|
chain_id: number;
|
|
1975
1973
|
access_list: EthereumAccessListOneKey[];
|
|
1976
|
-
expected_address?: string;
|
|
1977
|
-
source_fingerprint?: number;
|
|
1978
1974
|
};
|
|
1979
1975
|
|
|
1980
1976
|
// EthereumAuthorizationSignature
|
|
@@ -2027,7 +2023,6 @@ export type EthereumSignMessageOneKey = {
|
|
|
2027
2023
|
address_n: number[];
|
|
2028
2024
|
message: string;
|
|
2029
2025
|
chain_id?: number;
|
|
2030
|
-
source_fingerprint?: number;
|
|
2031
2026
|
};
|
|
2032
2027
|
|
|
2033
2028
|
// EthereumMessageSignatureOneKey
|
|
@@ -3820,7 +3815,6 @@ export type SolanaSignTx = {
|
|
|
3820
3815
|
address_n: number[];
|
|
3821
3816
|
raw_tx: string;
|
|
3822
3817
|
extra_info?: SolanaTxExtraInfo;
|
|
3823
|
-
source_fingerprint?: number;
|
|
3824
3818
|
};
|
|
3825
3819
|
|
|
3826
3820
|
// SolanaSignedTx
|
|
@@ -3844,14 +3838,12 @@ export type SolanaSignOffChainMessage = {
|
|
|
3844
3838
|
message_version?: SolanaOffChainMessageVersion;
|
|
3845
3839
|
message_format?: SolanaOffChainMessageFormat;
|
|
3846
3840
|
application_domain?: string;
|
|
3847
|
-
source_fingerprint?: number;
|
|
3848
3841
|
};
|
|
3849
3842
|
|
|
3850
3843
|
// SolanaSignUnsafeMessage
|
|
3851
3844
|
export type SolanaSignUnsafeMessage = {
|
|
3852
3845
|
address_n: number[];
|
|
3853
3846
|
message: string;
|
|
3854
|
-
source_fingerprint?: number;
|
|
3855
3847
|
};
|
|
3856
3848
|
|
|
3857
3849
|
// SolanaMessageSignature
|
|
@@ -4602,7 +4594,6 @@ export type EthereumSignTypedDataQR = {
|
|
|
4602
4594
|
chain_id?: number;
|
|
4603
4595
|
metamask_v4_compat?: boolean;
|
|
4604
4596
|
request_id?: string;
|
|
4605
|
-
source_fingerprint?: number;
|
|
4606
4597
|
};
|
|
4607
4598
|
|
|
4608
4599
|
// SetBusy
|
|
@@ -4775,19 +4766,6 @@ export type DeviceMiscUsbMscControl = {
|
|
|
4775
4766
|
enable: boolean;
|
|
4776
4767
|
};
|
|
4777
4768
|
|
|
4778
|
-
// DeviceFindMyTokenUpdate
|
|
4779
|
-
export type DeviceFindMyTokenUpdate = {
|
|
4780
|
-
token: string;
|
|
4781
|
-
};
|
|
4782
|
-
|
|
4783
|
-
// DeviceFindMyTokenStateGet
|
|
4784
|
-
export type DeviceFindMyTokenStateGet = {};
|
|
4785
|
-
|
|
4786
|
-
// DeviceFindMyTokenState
|
|
4787
|
-
export type DeviceFindMyTokenState = {
|
|
4788
|
-
burned: boolean;
|
|
4789
|
-
};
|
|
4790
|
-
|
|
4791
4769
|
export enum DeviceFactoryAck {
|
|
4792
4770
|
FACTORY_ACK_SUCCESS = 0,
|
|
4793
4771
|
FACTORY_ACK_FAIL = 1,
|
|
@@ -4859,12 +4837,6 @@ export enum DeviceFirmwareUpdateTaskStatus {
|
|
|
4859
4837
|
FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS = 10,
|
|
4860
4838
|
}
|
|
4861
4839
|
|
|
4862
|
-
export enum DeviceFirmwareUpdatePhase {
|
|
4863
|
-
FW_MGMT_UPDATER_PHASE_PREPARE = 0,
|
|
4864
|
-
FW_MGMT_UPDATER_PHASE_INSTALL = 1,
|
|
4865
|
-
FW_MGMT_UPDATER_PHASE_VERIFY = 2,
|
|
4866
|
-
}
|
|
4867
|
-
|
|
4868
4840
|
// DeviceFirmwareTarget
|
|
4869
4841
|
export type DeviceFirmwareTarget = {
|
|
4870
4842
|
target_id: DeviceFirmwareTargetType;
|
|
@@ -4877,22 +4849,12 @@ export type DeviceFirmwareUpdateStage = {
|
|
|
4877
4849
|
};
|
|
4878
4850
|
|
|
4879
4851
|
// DeviceFirmwareUpdateRequest
|
|
4880
|
-
export type DeviceFirmwareUpdateRequest = {
|
|
4881
|
-
reboot_after_update?: boolean;
|
|
4882
|
-
};
|
|
4883
|
-
|
|
4884
|
-
// DeviceFirmwareUpdatePhaseInfo
|
|
4885
|
-
export type DeviceFirmwareUpdatePhaseInfo = {
|
|
4886
|
-
phase: DeviceFirmwareUpdatePhase;
|
|
4887
|
-
progress_percent: number;
|
|
4888
|
-
};
|
|
4852
|
+
export type DeviceFirmwareUpdateRequest = {};
|
|
4889
4853
|
|
|
4890
4854
|
// DeviceFirmwareUpdateRecord
|
|
4891
4855
|
export type DeviceFirmwareUpdateRecord = {
|
|
4892
4856
|
target_id: DeviceFirmwareTargetType;
|
|
4893
4857
|
status?: DeviceFirmwareUpdateTaskStatus;
|
|
4894
|
-
progress_percent?: number;
|
|
4895
|
-
phase_info?: DeviceFirmwareUpdatePhaseInfo;
|
|
4896
4858
|
payload_version?: number;
|
|
4897
4859
|
path?: string;
|
|
4898
4860
|
};
|
|
@@ -4900,8 +4862,6 @@ export type DeviceFirmwareUpdateRecord = {
|
|
|
4900
4862
|
// DeviceFirmwareUpdateRecordFields
|
|
4901
4863
|
export type DeviceFirmwareUpdateRecordFields = {
|
|
4902
4864
|
status?: boolean;
|
|
4903
|
-
progress_percent?: boolean;
|
|
4904
|
-
phase_info?: boolean;
|
|
4905
4865
|
payload_version?: boolean;
|
|
4906
4866
|
path?: boolean;
|
|
4907
4867
|
};
|
|
@@ -5260,7 +5220,6 @@ export type ViewTip = {
|
|
|
5260
5220
|
type: ViewTipType;
|
|
5261
5221
|
text?: string;
|
|
5262
5222
|
text_id?: number;
|
|
5263
|
-
text_arg?: string;
|
|
5264
5223
|
};
|
|
5265
5224
|
|
|
5266
5225
|
// ViewRawData
|
|
@@ -5288,7 +5247,6 @@ export type ViewSignPage = {
|
|
|
5288
5247
|
slide_to_confirm?: boolean;
|
|
5289
5248
|
layout?: ViewSignLayout;
|
|
5290
5249
|
title_id?: number;
|
|
5291
|
-
title_arg?: string;
|
|
5292
5250
|
};
|
|
5293
5251
|
|
|
5294
5252
|
// ViewVerifyPage
|
|
@@ -5930,9 +5888,6 @@ export type MessageType = {
|
|
|
5930
5888
|
DeviceCertificateSignature: DeviceCertificateSignature;
|
|
5931
5889
|
DeviceCertificateSign: DeviceCertificateSign;
|
|
5932
5890
|
DeviceMiscUsbMscControl: DeviceMiscUsbMscControl;
|
|
5933
|
-
DeviceFindMyTokenUpdate: DeviceFindMyTokenUpdate;
|
|
5934
|
-
DeviceFindMyTokenStateGet: DeviceFindMyTokenStateGet;
|
|
5935
|
-
DeviceFindMyTokenState: DeviceFindMyTokenState;
|
|
5936
5891
|
DeviceFactoryInfoManufactureTime: DeviceFactoryInfoManufactureTime;
|
|
5937
5892
|
DeviceFactoryInfo: DeviceFactoryInfo;
|
|
5938
5893
|
DeviceFactoryInfoSet: DeviceFactoryInfoSet;
|
|
@@ -5942,7 +5897,6 @@ export type MessageType = {
|
|
|
5942
5897
|
DeviceFirmwareTarget: DeviceFirmwareTarget;
|
|
5943
5898
|
DeviceFirmwareUpdateStage: DeviceFirmwareUpdateStage;
|
|
5944
5899
|
DeviceFirmwareUpdateRequest: DeviceFirmwareUpdateRequest;
|
|
5945
|
-
DeviceFirmwareUpdatePhaseInfo: DeviceFirmwareUpdatePhaseInfo;
|
|
5946
5900
|
DeviceFirmwareUpdateRecord: DeviceFirmwareUpdateRecord;
|
|
5947
5901
|
DeviceFirmwareUpdateRecordFields: DeviceFirmwareUpdateRecordFields;
|
|
5948
5902
|
DeviceFirmwareUpdateStatusGet: DeviceFirmwareUpdateStatusGet;
|
package/src/types/transport.ts
CHANGED
|
@@ -59,8 +59,6 @@ export type AcquireInput = {
|
|
|
59
59
|
* transport must probe the protocol on the wire, bypassing any cached result.
|
|
60
60
|
*/
|
|
61
61
|
forceProtocolDetection?: boolean;
|
|
62
|
-
/** Reuse expectedProtocol only when this transport previously confirmed it for the same endpoint. */
|
|
63
|
-
skipProtocolProbe?: boolean;
|
|
64
62
|
};
|
|
65
63
|
|
|
66
64
|
export type MessageFromOneKey = { type: string; message: Record<string, any> };
|
|
@@ -79,8 +77,6 @@ export type TransportCallOptions = {
|
|
|
79
77
|
onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
|
|
80
78
|
/** Resolve after the complete request frame is written without waiting for a response. */
|
|
81
79
|
returnAfterWrite?: boolean;
|
|
82
|
-
/** Observe the delayed terminal response of a write-only call while a later call is active. */
|
|
83
|
-
onResponseAfterWrite?: (response: MessageFromOneKey) => void;
|
|
84
80
|
/** Prefer acknowledged BLE characteristic writes for this call when supported. */
|
|
85
81
|
writeWithResponse?: boolean;
|
|
86
82
|
};
|