@onekeyfe/hd-transport 1.2.2-alpha.0 → 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
package/dist/index.js
CHANGED
|
@@ -995,25 +995,6 @@ function hexToBytes(hex) {
|
|
|
995
995
|
}
|
|
996
996
|
return bytes;
|
|
997
997
|
}
|
|
998
|
-
function detectProtocolV2LinkDisabledError({ schemas, assembler, bytes, }) {
|
|
999
|
-
var _a, _b;
|
|
1000
|
-
try {
|
|
1001
|
-
for (const frame of assembler.drain(bytes)) {
|
|
1002
|
-
const response = call(ProtocolV2.decodeFrame(schemas, frame));
|
|
1003
|
-
if (response.type === 'Failure') {
|
|
1004
|
-
const failureCode = (_a = response.message) === null || _a === void 0 ? void 0 : _a.code;
|
|
1005
|
-
const firmwareMessage = (_b = response.message) === null || _b === void 0 ? void 0 : _b.message;
|
|
1006
|
-
if (isProtocolV2LinkDisabledFailure(failureCode, firmwareMessage)) {
|
|
1007
|
-
return createProtocolV2LinkDisabledError(failureCode, firmwareMessage);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
catch (_c) {
|
|
1013
|
-
assembler.reset();
|
|
1014
|
-
}
|
|
1015
|
-
return undefined;
|
|
1016
|
-
}
|
|
1017
998
|
function bytesToHex(bytes) {
|
|
1018
999
|
return Array.from(bytes)
|
|
1019
1000
|
.map(b => b.toString(16).padStart(2, '0'))
|
|
@@ -1160,10 +1141,8 @@ class ProtocolV2Session {
|
|
|
1160
1141
|
? {}
|
|
1161
1142
|
: { writeWithResponse: callOptions.writeWithResponse })), { generation, signal: abortController.signal });
|
|
1162
1143
|
const runCall = () => __awaiter(this, void 0, void 0, function* () {
|
|
1163
|
-
var _a, _b, _c, _d, _e, _f
|
|
1164
|
-
|
|
1165
|
-
yield (prepareCall === null || prepareCall === void 0 ? void 0 : prepareCall(baseCallContext));
|
|
1166
|
-
}
|
|
1144
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1145
|
+
yield (prepareCall === null || prepareCall === void 0 ? void 0 : prepareCall(baseCallContext));
|
|
1167
1146
|
const protoSeq = this.sequenceCursor.next();
|
|
1168
1147
|
const frame = ProtocolV2.encodeFrame(schemas, name, data, {
|
|
1169
1148
|
packetSrc,
|
|
@@ -1185,12 +1164,6 @@ class ProtocolV2Session {
|
|
|
1185
1164
|
(_b = logger === null || logger === void 0 ? void 0 : logger.error) === null || _b === void 0 ? void 0 : _b.call(logger, `${logPrefix} write metrics callback failed: ${String(error)}`);
|
|
1186
1165
|
}
|
|
1187
1166
|
if (callOptions.returnAfterWrite) {
|
|
1188
|
-
if ((_c = callOptions.expectedTypes) === null || _c === void 0 ? void 0 : _c.length) {
|
|
1189
|
-
this.pendingResponseAfterWrite = {
|
|
1190
|
-
expectedTypes: new Set(callOptions.expectedTypes),
|
|
1191
|
-
onResponse: callOptions.onResponseAfterWrite,
|
|
1192
|
-
};
|
|
1193
|
-
}
|
|
1194
1167
|
return { type: 'WriteCompleted', message: {} };
|
|
1195
1168
|
}
|
|
1196
1169
|
while (!abortController.signal.aborted) {
|
|
@@ -1235,31 +1208,14 @@ class ProtocolV2Session {
|
|
|
1235
1208
|
}
|
|
1236
1209
|
this.lastResponseSequence = decoded.seq;
|
|
1237
1210
|
const response = call(decoded);
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
if (pendingResponseAfterWrite) {
|
|
1241
|
-
belongsToWriteOnlyCall = pendingResponseAfterWrite.expectedTypes.has(response.type);
|
|
1242
|
-
if (belongsToWriteOnlyCall || COMMON_TERMINAL_RESPONSE_TYPES.has(response.type)) {
|
|
1243
|
-
this.pendingResponseAfterWrite = undefined;
|
|
1244
|
-
if (belongsToWriteOnlyCall) {
|
|
1245
|
-
try {
|
|
1246
|
-
(_d = pendingResponseAfterWrite.onResponse) === null || _d === void 0 ? void 0 : _d.call(pendingResponseAfterWrite, response);
|
|
1247
|
-
}
|
|
1248
|
-
catch (error) {
|
|
1249
|
-
(_e = logger === null || logger === void 0 ? void 0 : logger.error) === null || _e === void 0 ? void 0 : _e.call(logger, `${logPrefix} delayed response callback failed: ${String(error)}`);
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
if (belongsToWriteOnlyCall) ;
|
|
1255
|
-
else if ((_f = callOptions.intermediateTypes) === null || _f === void 0 ? void 0 : _f.includes(response.type)) {
|
|
1256
|
-
(_g = callOptions.onIntermediateResponse) === null || _g === void 0 ? void 0 : _g.call(callOptions, response);
|
|
1211
|
+
if ((_c = callOptions.intermediateTypes) === null || _c === void 0 ? void 0 : _c.includes(response.type)) {
|
|
1212
|
+
(_d = callOptions.onIntermediateResponse) === null || _d === void 0 ? void 0 : _d.call(callOptions, response);
|
|
1257
1213
|
}
|
|
1258
1214
|
else if (isExpectedTerminalResponse(response, callOptions.expectedTypes)) {
|
|
1259
1215
|
return response;
|
|
1260
1216
|
}
|
|
1261
1217
|
else if (!shouldReduceDebug) {
|
|
1262
|
-
(
|
|
1218
|
+
(_e = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _e === void 0 ? void 0 : _e.call(logger, `[${logPrefix}] skip unexpected response for ${name}: expected=${(_f = callOptions.expectedTypes) === null || _f === void 0 ? void 0 : _f.join('|')} got=${response.type}`);
|
|
1263
1219
|
}
|
|
1264
1220
|
}
|
|
1265
1221
|
}
|
|
@@ -1272,7 +1228,7 @@ class ProtocolV2Session {
|
|
|
1272
1228
|
});
|
|
1273
1229
|
}
|
|
1274
1230
|
}
|
|
1275
|
-
function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', onBeforeProbe, onProbeFailed,
|
|
1231
|
+
function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', onBeforeProbe, onProbeFailed, }) {
|
|
1276
1232
|
var _a, _b, _c;
|
|
1277
1233
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1278
1234
|
let probeError;
|
|
@@ -1295,7 +1251,7 @@ function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', on
|
|
|
1295
1251
|
probeError = new Error(`unexpected response type ${response.type}`);
|
|
1296
1252
|
}
|
|
1297
1253
|
catch (error) {
|
|
1298
|
-
if (isProtocolV2LinkDisabledError(error)
|
|
1254
|
+
if (isProtocolV2LinkDisabledError(error)) {
|
|
1299
1255
|
throw error;
|
|
1300
1256
|
}
|
|
1301
1257
|
probeError = error;
|
|
@@ -1317,43 +1273,17 @@ class ProtocolV2LinkManager {
|
|
|
1317
1273
|
this.options = options;
|
|
1318
1274
|
}
|
|
1319
1275
|
call(key, createAdapter, name, data, options) {
|
|
1320
|
-
var _a;
|
|
1276
|
+
var _a, _b;
|
|
1321
1277
|
const generation = (_a = this.generations.get(key)) !== null && _a !== void 0 ? _a : 0;
|
|
1322
|
-
const previousQueue = this.callQueues.get(key);
|
|
1323
|
-
const timeoutMs = (options === null || options === void 0 ? void 0 : options.timeoutMs) && options.timeoutMs > 0
|
|
1324
|
-
? options.timeoutMs
|
|
1325
|
-
: PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS;
|
|
1326
|
-
const queuedAt = Date.now();
|
|
1327
|
-
let queueTimeout;
|
|
1328
|
-
let queueTimeoutError;
|
|
1329
|
-
const timeoutWhileQueued = new Promise((_, reject) => {
|
|
1330
|
-
queueTimeout = setTimeout(() => {
|
|
1331
|
-
queueTimeout = undefined;
|
|
1332
|
-
queueTimeoutError = this.createQueuedCallTimeoutError(key, name, timeoutMs);
|
|
1333
|
-
reject(queueTimeoutError);
|
|
1334
|
-
}, timeoutMs);
|
|
1335
|
-
});
|
|
1336
1278
|
const run = () => {
|
|
1337
|
-
if (queueTimeout) {
|
|
1338
|
-
clearTimeout(queueTimeout);
|
|
1339
|
-
queueTimeout = undefined;
|
|
1340
|
-
}
|
|
1341
|
-
if (queueTimeoutError) {
|
|
1342
|
-
throw queueTimeoutError;
|
|
1343
|
-
}
|
|
1344
1279
|
this.assertCallGeneration(key, generation);
|
|
1345
|
-
|
|
1346
|
-
if (remainingTimeoutMs <= 0) {
|
|
1347
|
-
throw this.createQueuedCallTimeoutError(key, name, timeoutMs);
|
|
1348
|
-
}
|
|
1349
|
-
return this.executeCall(key, createAdapter, name, data, Object.assign(Object.assign({}, options), { timeoutMs: remainingTimeoutMs }));
|
|
1280
|
+
return this.executeCall(key, createAdapter, name, data, options);
|
|
1350
1281
|
};
|
|
1351
|
-
const previous =
|
|
1352
|
-
const
|
|
1353
|
-
const
|
|
1354
|
-
const queue = execution.catch(() => undefined);
|
|
1282
|
+
const previous = (_b = this.callQueues.get(key)) !== null && _b !== void 0 ? _b : Promise.resolve();
|
|
1283
|
+
const result = previous.then(run, run);
|
|
1284
|
+
const queue = result.catch(() => undefined);
|
|
1355
1285
|
this.callQueues.set(key, queue);
|
|
1356
|
-
|
|
1286
|
+
result
|
|
1357
1287
|
.then(() => this.clearSettledCallQueue(key, queue), () => this.clearSettledCallQueue(key, queue))
|
|
1358
1288
|
.catch(() => undefined);
|
|
1359
1289
|
return result;
|
|
@@ -1478,13 +1408,6 @@ class ProtocolV2LinkManager {
|
|
|
1478
1408
|
this.callQueues.delete(key);
|
|
1479
1409
|
}
|
|
1480
1410
|
}
|
|
1481
|
-
createQueuedCallTimeoutError(key, name, timeoutMs) {
|
|
1482
|
-
var _a;
|
|
1483
|
-
const adapterTimeoutError = (_a = this.links.get(key)) === null || _a === void 0 ? void 0 : _a.adapter.createTimeoutError;
|
|
1484
|
-
return adapterTimeoutError
|
|
1485
|
-
? adapterTimeoutError(name, timeoutMs)
|
|
1486
|
-
: new ProtocolV2LinkError('response-timeout', `Protocol V2 call timeout after ${timeoutMs}ms while queued for ${name}`);
|
|
1487
|
-
}
|
|
1488
1411
|
assertCallGeneration(key, generation) {
|
|
1489
1412
|
var _a;
|
|
1490
1413
|
const currentGeneration = (_a = this.generations.get(key)) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -2182,12 +2105,6 @@ exports.DeviceFirmwareUpdateTaskStatus = void 0;
|
|
|
2182
2105
|
DeviceFirmwareUpdateTaskStatus[DeviceFirmwareUpdateTaskStatus["FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY"] = 9] = "FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY";
|
|
2183
2106
|
DeviceFirmwareUpdateTaskStatus[DeviceFirmwareUpdateTaskStatus["FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS"] = 10] = "FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS";
|
|
2184
2107
|
})(exports.DeviceFirmwareUpdateTaskStatus || (exports.DeviceFirmwareUpdateTaskStatus = {}));
|
|
2185
|
-
exports.DeviceFirmwareUpdatePhase = void 0;
|
|
2186
|
-
(function (DeviceFirmwareUpdatePhase) {
|
|
2187
|
-
DeviceFirmwareUpdatePhase[DeviceFirmwareUpdatePhase["FW_MGMT_UPDATER_PHASE_PREPARE"] = 0] = "FW_MGMT_UPDATER_PHASE_PREPARE";
|
|
2188
|
-
DeviceFirmwareUpdatePhase[DeviceFirmwareUpdatePhase["FW_MGMT_UPDATER_PHASE_INSTALL"] = 1] = "FW_MGMT_UPDATER_PHASE_INSTALL";
|
|
2189
|
-
DeviceFirmwareUpdatePhase[DeviceFirmwareUpdatePhase["FW_MGMT_UPDATER_PHASE_VERIFY"] = 2] = "FW_MGMT_UPDATER_PHASE_VERIFY";
|
|
2190
|
-
})(exports.DeviceFirmwareUpdatePhase || (exports.DeviceFirmwareUpdatePhase = {}));
|
|
2191
2108
|
exports.DeviceType = void 0;
|
|
2192
2109
|
(function (DeviceType) {
|
|
2193
2110
|
DeviceType[DeviceType["CLASSIC1"] = 0] = "CLASSIC1";
|
|
@@ -2395,7 +2312,6 @@ var messages = /*#__PURE__*/Object.freeze({
|
|
|
2395
2312
|
get DeviceFactoryAck () { return exports.DeviceFactoryAck; },
|
|
2396
2313
|
get DeviceFirmwareTargetType () { return exports.DeviceFirmwareTargetType; },
|
|
2397
2314
|
get DeviceFirmwareUpdateTaskStatus () { return exports.DeviceFirmwareUpdateTaskStatus; },
|
|
2398
|
-
get DeviceFirmwareUpdatePhase () { return exports.DeviceFirmwareUpdatePhase; },
|
|
2399
2315
|
get DeviceType () { return exports.DeviceType; },
|
|
2400
2316
|
get DeviceSeType () { return exports.DeviceSeType; },
|
|
2401
2317
|
get DeviceSEState () { return exports.DeviceSEState; },
|
|
@@ -2556,7 +2472,6 @@ exports.concatUint8Arrays = concatUint8Arrays;
|
|
|
2556
2472
|
exports.createProtocolV2LinkDisabledError = createProtocolV2LinkDisabledError;
|
|
2557
2473
|
exports.createTransportCallLog = createTransportCallLog;
|
|
2558
2474
|
exports["default"] = index;
|
|
2559
|
-
exports.detectProtocolV2LinkDisabledError = detectProtocolV2LinkDisabledError;
|
|
2560
2475
|
exports.getErrorMessage = getErrorMessage;
|
|
2561
2476
|
exports.getSafeTransportLogPayload = getSafeTransportLogPayload;
|
|
2562
2477
|
exports.hexToBytes = hexToBytes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-manager.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/link-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"link-manager.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/link-manager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAEpG,MAAM,MAAM,iCAAiC,GAAG,YAAY,GAAG,aAAa,CAAC;AAE7E,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAClE,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E,SAAS,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/D,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5C,MAAM,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,wBAAwB,CAAC,oBAAoB,CAAC,CAAC;CACrE;AAED,MAAM,MAAM,4BAA4B,CAAC,GAAG,IAAI;IAC9C,UAAU,EAAE,MAAM,iBAAiB,CAAC;IACpC,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,iCAAiC,CAAC;IACrE,iBAAiB,CAAC,EAAE,CAAC,GAAG,E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-40,17 +40,11 @@ export type ProtocolV2CallOptions = {
|
|
|
40
40
|
onIntermediateResponse?: (response: MessageFromOneKey) => void;
|
|
41
41
|
onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
|
|
42
42
|
returnAfterWrite?: boolean;
|
|
43
|
-
onResponseAfterWrite?: (response: MessageFromOneKey) => void;
|
|
44
43
|
writeWithResponse?: boolean;
|
|
45
44
|
};
|
|
46
45
|
export { concatUint8Arrays, ProtocolV2FrameAssembler };
|
|
47
46
|
export { ProtocolV2SequenceCursor };
|
|
48
47
|
export declare function hexToBytes(hex: string): Uint8Array;
|
|
49
|
-
export declare function detectProtocolV2LinkDisabledError({ schemas, assembler, bytes, }: {
|
|
50
|
-
schemas: ProtocolV2Schemas;
|
|
51
|
-
assembler: ProtocolV2FrameAssembler;
|
|
52
|
-
bytes: Uint8Array;
|
|
53
|
-
}): import("./errors").ProtocolV2LinkDisabledError | undefined;
|
|
54
48
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
55
49
|
export declare function isProtocolV2HighThroughputCall(name: string): boolean;
|
|
56
50
|
export declare function getErrorMessage(error: unknown): string;
|
|
@@ -60,7 +54,6 @@ export declare class ProtocolV2Session {
|
|
|
60
54
|
private readonly sequenceCursor;
|
|
61
55
|
private pendingCall;
|
|
62
56
|
private pendingWrite;
|
|
63
|
-
private pendingResponseAfterWrite?;
|
|
64
57
|
private lastResponseSequence?;
|
|
65
58
|
constructor(options: ProtocolV2SessionOptions);
|
|
66
59
|
call(name: string, data: Record<string, unknown>, callOptions?: ProtocolV2CallOptions): Promise<MessageFromOneKey>;
|
|
@@ -68,13 +61,12 @@ export declare class ProtocolV2Session {
|
|
|
68
61
|
private serializeWrite;
|
|
69
62
|
private executeCall;
|
|
70
63
|
}
|
|
71
|
-
export declare function probeProtocolV2({ call, timeoutMs, logger, logPrefix, onBeforeProbe, onProbeFailed,
|
|
64
|
+
export declare function probeProtocolV2({ call, timeoutMs, logger, logPrefix, onBeforeProbe, onProbeFailed, }: {
|
|
72
65
|
call: (name: string, data: Record<string, unknown>, options?: ProtocolV2CallOptions) => Promise<MessageFromOneKey>;
|
|
73
66
|
timeoutMs: number;
|
|
74
67
|
logger?: ProtocolLogger;
|
|
75
68
|
logPrefix?: string;
|
|
76
69
|
onBeforeProbe?: () => Promise<void> | void;
|
|
77
70
|
onProbeFailed?: (error: unknown) => Promise<void> | void;
|
|
78
|
-
shouldRethrow?: (error: unknown) => boolean;
|
|
79
71
|
}): Promise<boolean>;
|
|
80
72
|
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAW7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,cAAc,UAAU,CAAC;AAEzB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,K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1457
1457
|
tx_type?: number;
|
|
1458
|
-
expected_address?: string;
|
|
1459
|
-
source_fingerprint?: number;
|
|
1460
1458
|
};
|
|
1461
1459
|
export type EthereumAccessListOneKey = {
|
|
1462
1460
|
address: string;
|
|
@@ -1474,8 +1472,6 @@ export type EthereumSignTxEIP1559OneKey = {
|
|
|
1474
1472
|
data_length: number;
|
|
1475
1473
|
chain_id: number;
|
|
1476
1474
|
access_list: EthereumAccessListOneKey[];
|
|
1477
|
-
expected_address?: string;
|
|
1478
|
-
source_fingerprint?: number;
|
|
1479
1475
|
};
|
|
1480
1476
|
export type EthereumAuthorizationSignature = {
|
|
1481
1477
|
y_parity: number;
|
|
@@ -1517,7 +1513,6 @@ export type EthereumSignMessageOneKey = {
|
|
|
1517
1513
|
address_n: number[];
|
|
1518
1514
|
message: string;
|
|
1519
1515
|
chain_id?: number;
|
|
1520
|
-
source_fingerprint?: number;
|
|
1521
1516
|
};
|
|
1522
1517
|
export type EthereumMessageSignatureOneKey = {
|
|
1523
1518
|
signature: string;
|
|
@@ -2850,7 +2845,6 @@ export type SolanaSignTx = {
|
|
|
2850
2845
|
address_n: number[];
|
|
2851
2846
|
raw_tx: string;
|
|
2852
2847
|
extra_info?: SolanaTxExtraInfo;
|
|
2853
|
-
source_fingerprint?: number;
|
|
2854
2848
|
};
|
|
2855
2849
|
export type SolanaSignedTx = {
|
|
2856
2850
|
signature?: string;
|
|
@@ -2868,12 +2862,10 @@ export type SolanaSignOffChainMessage = {
|
|
|
2868
2862
|
message_version?: SolanaOffChainMessageVersion;
|
|
2869
2863
|
message_format?: SolanaOffChainMessageFormat;
|
|
2870
2864
|
application_domain?: string;
|
|
2871
|
-
source_fingerprint?: number;
|
|
2872
2865
|
};
|
|
2873
2866
|
export type SolanaSignUnsafeMessage = {
|
|
2874
2867
|
address_n: number[];
|
|
2875
2868
|
message: string;
|
|
2876
|
-
source_fingerprint?: number;
|
|
2877
2869
|
};
|
|
2878
2870
|
export type SolanaMessageSignature = {
|
|
2879
2871
|
signature: string;
|
|
@@ -3453,7 +3445,6 @@ export type EthereumSignTypedDataQR = {
|
|
|
3453
3445
|
chain_id?: number;
|
|
3454
3446
|
metamask_v4_compat?: boolean;
|
|
3455
3447
|
request_id?: string;
|
|
3456
|
-
source_fingerprint?: number;
|
|
3457
3448
|
};
|
|
3458
3449
|
export type SetBusy = {
|
|
3459
3450
|
expiry_ms?: number;
|
|
@@ -3575,13 +3566,6 @@ export type DeviceCertificateSign = {
|
|
|
3575
3566
|
export type DeviceMiscUsbMscControl = {
|
|
3576
3567
|
enable: boolean;
|
|
3577
3568
|
};
|
|
3578
|
-
export type DeviceFindMyTokenUpdate = {
|
|
3579
|
-
token: string;
|
|
3580
|
-
};
|
|
3581
|
-
export type DeviceFindMyTokenStateGet = {};
|
|
3582
|
-
export type DeviceFindMyTokenState = {
|
|
3583
|
-
burned: boolean;
|
|
3584
|
-
};
|
|
3585
3569
|
export declare enum DeviceFactoryAck {
|
|
3586
3570
|
FACTORY_ACK_SUCCESS = 0,
|
|
3587
3571
|
FACTORY_ACK_FAIL = 1
|
|
@@ -3638,11 +3622,6 @@ export declare enum DeviceFirmwareUpdateTaskStatus {
|
|
|
3638
3622
|
FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY = 9,
|
|
3639
3623
|
FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS = 10
|
|
3640
3624
|
}
|
|
3641
|
-
export declare enum DeviceFirmwareUpdatePhase {
|
|
3642
|
-
FW_MGMT_UPDATER_PHASE_PREPARE = 0,
|
|
3643
|
-
FW_MGMT_UPDATER_PHASE_INSTALL = 1,
|
|
3644
|
-
FW_MGMT_UPDATER_PHASE_VERIFY = 2
|
|
3645
|
-
}
|
|
3646
3625
|
export type DeviceFirmwareTarget = {
|
|
3647
3626
|
target_id: DeviceFirmwareTargetType;
|
|
3648
3627
|
path: string;
|
|
@@ -3650,25 +3629,15 @@ export type DeviceFirmwareTarget = {
|
|
|
3650
3629
|
export type DeviceFirmwareUpdateStage = {
|
|
3651
3630
|
targets: DeviceFirmwareTarget[];
|
|
3652
3631
|
};
|
|
3653
|
-
export type DeviceFirmwareUpdateRequest = {
|
|
3654
|
-
reboot_after_update?: boolean;
|
|
3655
|
-
};
|
|
3656
|
-
export type DeviceFirmwareUpdatePhaseInfo = {
|
|
3657
|
-
phase: DeviceFirmwareUpdatePhase;
|
|
3658
|
-
progress_percent: number;
|
|
3659
|
-
};
|
|
3632
|
+
export type DeviceFirmwareUpdateRequest = {};
|
|
3660
3633
|
export type DeviceFirmwareUpdateRecord = {
|
|
3661
3634
|
target_id: DeviceFirmwareTargetType;
|
|
3662
3635
|
status?: DeviceFirmwareUpdateTaskStatus;
|
|
3663
|
-
progress_percent?: number;
|
|
3664
|
-
phase_info?: DeviceFirmwareUpdatePhaseInfo;
|
|
3665
3636
|
payload_version?: number;
|
|
3666
3637
|
path?: string;
|
|
3667
3638
|
};
|
|
3668
3639
|
export type DeviceFirmwareUpdateRecordFields = {
|
|
3669
3640
|
status?: boolean;
|
|
3670
|
-
progress_percent?: boolean;
|
|
3671
|
-
phase_info?: boolean;
|
|
3672
3641
|
payload_version?: boolean;
|
|
3673
3642
|
path?: boolean;
|
|
3674
3643
|
};
|
|
@@ -3939,7 +3908,6 @@ export type ViewTip = {
|
|
|
3939
3908
|
type: ViewTipType;
|
|
3940
3909
|
text?: string;
|
|
3941
3910
|
text_id?: number;
|
|
3942
|
-
text_arg?: string;
|
|
3943
3911
|
};
|
|
3944
3912
|
export type ViewRawData = {
|
|
3945
3913
|
initial_data: string;
|
|
@@ -3962,7 +3930,6 @@ export type ViewSignPage = {
|
|
|
3962
3930
|
slide_to_confirm?: boolean;
|
|
3963
3931
|
layout?: ViewSignLayout;
|
|
3964
3932
|
title_id?: number;
|
|
3965
|
-
title_arg?: string;
|
|
3966
3933
|
};
|
|
3967
3934
|
export type ViewVerifyPage = {
|
|
3968
3935
|
title?: string;
|
|
@@ -4598,9 +4565,6 @@ export type MessageType = {
|
|
|
4598
4565
|
DeviceCertificateSignature: DeviceCertificateSignature;
|
|
4599
4566
|
DeviceCertificateSign: DeviceCertificateSign;
|
|
4600
4567
|
DeviceMiscUsbMscControl: DeviceMiscUsbMscControl;
|
|
4601
|
-
DeviceFindMyTokenUpdate: DeviceFindMyTokenUpdate;
|
|
4602
|
-
DeviceFindMyTokenStateGet: DeviceFindMyTokenStateGet;
|
|
4603
|
-
DeviceFindMyTokenState: DeviceFindMyTokenState;
|
|
4604
4568
|
DeviceFactoryInfoManufactureTime: DeviceFactoryInfoManufactureTime;
|
|
4605
4569
|
DeviceFactoryInfo: DeviceFactoryInfo;
|
|
4606
4570
|
DeviceFactoryInfoSet: DeviceFactoryInfoSet;
|
|
@@ -4610,7 +4574,6 @@ export type MessageType = {
|
|
|
4610
4574
|
DeviceFirmwareTarget: DeviceFirmwareTarget;
|
|
4611
4575
|
DeviceFirmwareUpdateStage: DeviceFirmwareUpdateStage;
|
|
4612
4576
|
DeviceFirmwareUpdateRequest: DeviceFirmwareUpdateRequest;
|
|
4613
|
-
DeviceFirmwareUpdatePhaseInfo: DeviceFirmwareUpdatePhaseInfo;
|
|
4614
4577
|
DeviceFirmwareUpdateRecord: DeviceFirmwareUpdateRecord;
|
|
4615
4578
|
DeviceFirmwareUpdateRecordFields: DeviceFirmwareUpdateRecordFields;
|
|
4616
4579
|
DeviceFirmwareUpdateStatusGet: DeviceFirmwareUpdateStatusGet;
|