@onekeyfe/hd-transport 1.2.2-alpha.100 → 1.2.2-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -995,6 +995,25 @@ 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
+ }
998
1017
  function bytesToHex(bytes) {
999
1018
  return Array.from(bytes)
1000
1019
  .map(b => b.toString(16).padStart(2, '0'))
@@ -1141,8 +1160,10 @@ class ProtocolV2Session {
1141
1160
  ? {}
1142
1161
  : { writeWithResponse: callOptions.writeWithResponse })), { generation, signal: abortController.signal });
1143
1162
  const runCall = () => __awaiter(this, void 0, void 0, function* () {
1144
- var _a, _b, _c, _d, _e, _f;
1145
- yield (prepareCall === null || prepareCall === void 0 ? void 0 : prepareCall(baseCallContext));
1163
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1164
+ if (!this.pendingResponseAfterWrite) {
1165
+ yield (prepareCall === null || prepareCall === void 0 ? void 0 : prepareCall(baseCallContext));
1166
+ }
1146
1167
  const protoSeq = this.sequenceCursor.next();
1147
1168
  const frame = ProtocolV2.encodeFrame(schemas, name, data, {
1148
1169
  packetSrc,
@@ -1164,6 +1185,12 @@ class ProtocolV2Session {
1164
1185
  (_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)}`);
1165
1186
  }
1166
1187
  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
+ }
1167
1194
  return { type: 'WriteCompleted', message: {} };
1168
1195
  }
1169
1196
  while (!abortController.signal.aborted) {
@@ -1208,14 +1235,31 @@ class ProtocolV2Session {
1208
1235
  }
1209
1236
  this.lastResponseSequence = decoded.seq;
1210
1237
  const response = call(decoded);
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);
1238
+ const { pendingResponseAfterWrite } = this;
1239
+ let belongsToWriteOnlyCall = false;
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);
1213
1257
  }
1214
1258
  else if (isExpectedTerminalResponse(response, callOptions.expectedTypes)) {
1215
1259
  return response;
1216
1260
  }
1217
1261
  else if (!shouldReduceDebug) {
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}`);
1262
+ (_h = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _h === void 0 ? void 0 : _h.call(logger, `[${logPrefix}] skip unexpected response for ${name}: expected=${(_j = callOptions.expectedTypes) === null || _j === void 0 ? void 0 : _j.join('|')} got=${response.type}`);
1219
1263
  }
1220
1264
  }
1221
1265
  }
@@ -1228,7 +1272,7 @@ class ProtocolV2Session {
1228
1272
  });
1229
1273
  }
1230
1274
  }
1231
- function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', onBeforeProbe, onProbeFailed, }) {
1275
+ function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', onBeforeProbe, onProbeFailed, shouldRethrow, }) {
1232
1276
  var _a, _b, _c;
1233
1277
  return __awaiter(this, void 0, void 0, function* () {
1234
1278
  let probeError;
@@ -1251,7 +1295,7 @@ function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', on
1251
1295
  probeError = new Error(`unexpected response type ${response.type}`);
1252
1296
  }
1253
1297
  catch (error) {
1254
- if (isProtocolV2LinkDisabledError(error)) {
1298
+ if (isProtocolV2LinkDisabledError(error) || (shouldRethrow === null || shouldRethrow === void 0 ? void 0 : shouldRethrow(error))) {
1255
1299
  throw error;
1256
1300
  }
1257
1301
  probeError = error;
@@ -1273,17 +1317,43 @@ class ProtocolV2LinkManager {
1273
1317
  this.options = options;
1274
1318
  }
1275
1319
  call(key, createAdapter, name, data, options) {
1276
- var _a, _b;
1320
+ var _a;
1277
1321
  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
+ });
1278
1336
  const run = () => {
1337
+ if (queueTimeout) {
1338
+ clearTimeout(queueTimeout);
1339
+ queueTimeout = undefined;
1340
+ }
1341
+ if (queueTimeoutError) {
1342
+ throw queueTimeoutError;
1343
+ }
1279
1344
  this.assertCallGeneration(key, generation);
1280
- return this.executeCall(key, createAdapter, name, data, options);
1345
+ const remainingTimeoutMs = previousQueue ? timeoutMs - (Date.now() - queuedAt) : timeoutMs;
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 }));
1281
1350
  };
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);
1351
+ const previous = previousQueue !== null && previousQueue !== void 0 ? previousQueue : Promise.resolve();
1352
+ const execution = previous.then(run, run);
1353
+ const result = Promise.race([execution, timeoutWhileQueued]);
1354
+ const queue = execution.catch(() => undefined);
1285
1355
  this.callQueues.set(key, queue);
1286
- result
1356
+ execution
1287
1357
  .then(() => this.clearSettledCallQueue(key, queue), () => this.clearSettledCallQueue(key, queue))
1288
1358
  .catch(() => undefined);
1289
1359
  return result;
@@ -1408,6 +1478,13 @@ class ProtocolV2LinkManager {
1408
1478
  this.callQueues.delete(key);
1409
1479
  }
1410
1480
  }
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
+ }
1411
1488
  assertCallGeneration(key, generation) {
1412
1489
  var _a;
1413
1490
  const currentGeneration = (_a = this.generations.get(key)) !== null && _a !== void 0 ? _a : 0;
@@ -2105,6 +2182,12 @@ exports.DeviceFirmwareUpdateTaskStatus = void 0;
2105
2182
  DeviceFirmwareUpdateTaskStatus[DeviceFirmwareUpdateTaskStatus["FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY"] = 9] = "FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY";
2106
2183
  DeviceFirmwareUpdateTaskStatus[DeviceFirmwareUpdateTaskStatus["FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS"] = 10] = "FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS";
2107
2184
  })(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 = {}));
2108
2191
  exports.DeviceType = void 0;
2109
2192
  (function (DeviceType) {
2110
2193
  DeviceType[DeviceType["CLASSIC1"] = 0] = "CLASSIC1";
@@ -2312,6 +2395,7 @@ var messages = /*#__PURE__*/Object.freeze({
2312
2395
  get DeviceFactoryAck () { return exports.DeviceFactoryAck; },
2313
2396
  get DeviceFirmwareTargetType () { return exports.DeviceFirmwareTargetType; },
2314
2397
  get DeviceFirmwareUpdateTaskStatus () { return exports.DeviceFirmwareUpdateTaskStatus; },
2398
+ get DeviceFirmwareUpdatePhase () { return exports.DeviceFirmwareUpdatePhase; },
2315
2399
  get DeviceType () { return exports.DeviceType; },
2316
2400
  get DeviceSeType () { return exports.DeviceSeType; },
2317
2401
  get DeviceSEState () { return exports.DeviceSEState; },
@@ -2472,6 +2556,7 @@ exports.concatUint8Arrays = concatUint8Arrays;
2472
2556
  exports.createProtocolV2LinkDisabledError = createProtocolV2LinkDisabledError;
2473
2557
  exports.createTransportCallLog = createTransportCallLog;
2474
2558
  exports["default"] = index;
2559
+ exports.detectProtocolV2LinkDisabledError = detectProtocolV2LinkDisabledError;
2475
2560
  exports.getErrorMessage = getErrorMessage;
2476
2561
  exports.getSafeTransportLogPayload = getSafeTransportLogPayload;
2477
2562
  exports.hexToBytes = hexToBytes;
@@ -35,6 +35,7 @@ export declare class ProtocolV2LinkManager<Key> {
35
35
  private getOrCreateLink;
36
36
  private executeCall;
37
37
  private clearSettledCallQueue;
38
+ private createQueuedCallTimeoutError;
38
39
  private assertCallGeneration;
39
40
  }
40
41
  //# sourceMappingURL=link-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"link-manager.d.ts","s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,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0B;IAEtD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA0D;IAE9F,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiC;IAE/D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;gBAEhD,OAAO,EAAE,4BAA4B,CAAC,GAAG,CAAC;IAItD,IAAI,CACF,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,MAAM,qBAAqB,EAC1C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,iBAAiB,CAAC;IAiD7B,eAAe,CACb,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,MAAM,qBAAqB,EAC1C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,iBAAiB,CAAC;IAMvB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BvD,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASjD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5C,OAAO,CAAC,eAAe;YA+CT,WAAW;IAkBzB,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,oBAAoB;CAW7B"}
@@ -40,11 +40,17 @@ export type ProtocolV2CallOptions = {
40
40
  onIntermediateResponse?: (response: MessageFromOneKey) => void;
41
41
  onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
42
42
  returnAfterWrite?: boolean;
43
+ onResponseAfterWrite?: (response: MessageFromOneKey) => void;
43
44
  writeWithResponse?: boolean;
44
45
  };
45
46
  export { concatUint8Arrays, ProtocolV2FrameAssembler };
46
47
  export { ProtocolV2SequenceCursor };
47
48
  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;
48
54
  export declare function bytesToHex(bytes: Uint8Array): string;
49
55
  export declare function isProtocolV2HighThroughputCall(name: string): boolean;
50
56
  export declare function getErrorMessage(error: unknown): string;
@@ -54,6 +60,7 @@ export declare class ProtocolV2Session {
54
60
  private readonly sequenceCursor;
55
61
  private pendingCall;
56
62
  private pendingWrite;
63
+ private pendingResponseAfterWrite?;
57
64
  private lastResponseSequence?;
58
65
  constructor(options: ProtocolV2SessionOptions);
59
66
  call(name: string, data: Record<string, unknown>, callOptions?: ProtocolV2CallOptions): Promise<MessageFromOneKey>;
@@ -61,12 +68,13 @@ export declare class ProtocolV2Session {
61
68
  private serializeWrite;
62
69
  private executeCall;
63
70
  }
64
- export declare function probeProtocolV2({ call, timeoutMs, logger, logPrefix, onBeforeProbe, onProbeFailed, }: {
71
+ export declare function probeProtocolV2({ call, timeoutMs, logger, logPrefix, onBeforeProbe, onProbeFailed, shouldRethrow, }: {
65
72
  call: (name: string, data: Record<string, unknown>, options?: ProtocolV2CallOptions) => Promise<MessageFromOneKey>;
66
73
  timeoutMs: number;
67
74
  logger?: ProtocolLogger;
68
75
  logPrefix?: string;
69
76
  onBeforeProbe?: () => Promise<void> | void;
70
77
  onProbeFailed?: (error: unknown) => Promise<void> | void;
78
+ shouldRethrow?: (error: unknown) => boolean;
71
79
  }): Promise<boolean>;
72
80
  //# 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,C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AAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACzD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CAC7C,oBAiCA"}
@@ -1455,6 +1455,8 @@ export type EthereumSignTxOneKey = {
1455
1455
  data_length?: number;
1456
1456
  chain_id: number;
1457
1457
  tx_type?: number;
1458
+ expected_address?: string;
1459
+ source_fingerprint?: number;
1458
1460
  };
1459
1461
  export type EthereumAccessListOneKey = {
1460
1462
  address: string;
@@ -1472,6 +1474,8 @@ export type EthereumSignTxEIP1559OneKey = {
1472
1474
  data_length: number;
1473
1475
  chain_id: number;
1474
1476
  access_list: EthereumAccessListOneKey[];
1477
+ expected_address?: string;
1478
+ source_fingerprint?: number;
1475
1479
  };
1476
1480
  export type EthereumAuthorizationSignature = {
1477
1481
  y_parity: number;
@@ -1513,6 +1517,7 @@ export type EthereumSignMessageOneKey = {
1513
1517
  address_n: number[];
1514
1518
  message: string;
1515
1519
  chain_id?: number;
1520
+ source_fingerprint?: number;
1516
1521
  };
1517
1522
  export type EthereumMessageSignatureOneKey = {
1518
1523
  signature: string;
@@ -2845,6 +2850,7 @@ export type SolanaSignTx = {
2845
2850
  address_n: number[];
2846
2851
  raw_tx: string;
2847
2852
  extra_info?: SolanaTxExtraInfo;
2853
+ source_fingerprint?: number;
2848
2854
  };
2849
2855
  export type SolanaSignedTx = {
2850
2856
  signature?: string;
@@ -2862,10 +2868,12 @@ export type SolanaSignOffChainMessage = {
2862
2868
  message_version?: SolanaOffChainMessageVersion;
2863
2869
  message_format?: SolanaOffChainMessageFormat;
2864
2870
  application_domain?: string;
2871
+ source_fingerprint?: number;
2865
2872
  };
2866
2873
  export type SolanaSignUnsafeMessage = {
2867
2874
  address_n: number[];
2868
2875
  message: string;
2876
+ source_fingerprint?: number;
2869
2877
  };
2870
2878
  export type SolanaMessageSignature = {
2871
2879
  signature: string;
@@ -3412,8 +3420,6 @@ export declare enum CommandFlags {
3412
3420
  Default = 0,
3413
3421
  Factory_Only = 1
3414
3422
  }
3415
- export type experimental_message = {};
3416
- export type experimental_field = {};
3417
3423
  export type TextMemo = {
3418
3424
  text: string;
3419
3425
  };
@@ -3445,6 +3451,7 @@ export type EthereumSignTypedDataQR = {
3445
3451
  chain_id?: number;
3446
3452
  metamask_v4_compat?: boolean;
3447
3453
  request_id?: string;
3454
+ source_fingerprint?: number;
3448
3455
  };
3449
3456
  export type SetBusy = {
3450
3457
  expiry_ms?: number;
@@ -3489,6 +3496,8 @@ export type UiAnimationRequest = {
3489
3496
  command: UiAnimationCommand;
3490
3497
  type?: UiAnimationType;
3491
3498
  };
3499
+ export type experimental_message = {};
3500
+ export type experimental_field = {};
3492
3501
  export type ProtocolInfoRequest = {
3493
3502
  eventless_wallet_session?: boolean;
3494
3503
  };
@@ -3566,6 +3575,13 @@ export type DeviceCertificateSign = {
3566
3575
  export type DeviceMiscUsbMscControl = {
3567
3576
  enable: boolean;
3568
3577
  };
3578
+ export type DeviceFindMyTokenUpdate = {
3579
+ token: string;
3580
+ };
3581
+ export type DeviceFindMyTokenStateGet = {};
3582
+ export type DeviceFindMyTokenState = {
3583
+ burned: boolean;
3584
+ };
3569
3585
  export declare enum DeviceFactoryAck {
3570
3586
  FACTORY_ACK_SUCCESS = 0,
3571
3587
  FACTORY_ACK_FAIL = 1
@@ -3622,6 +3638,11 @@ export declare enum DeviceFirmwareUpdateTaskStatus {
3622
3638
  FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY = 9,
3623
3639
  FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS = 10
3624
3640
  }
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
+ }
3625
3646
  export type DeviceFirmwareTarget = {
3626
3647
  target_id: DeviceFirmwareTargetType;
3627
3648
  path: string;
@@ -3629,15 +3650,25 @@ export type DeviceFirmwareTarget = {
3629
3650
  export type DeviceFirmwareUpdateStage = {
3630
3651
  targets: DeviceFirmwareTarget[];
3631
3652
  };
3632
- export type DeviceFirmwareUpdateRequest = {};
3653
+ export type DeviceFirmwareUpdateRequest = {
3654
+ reboot_after_update?: boolean;
3655
+ };
3656
+ export type DeviceFirmwareUpdatePhaseInfo = {
3657
+ phase: DeviceFirmwareUpdatePhase;
3658
+ progress_percent: number;
3659
+ };
3633
3660
  export type DeviceFirmwareUpdateRecord = {
3634
3661
  target_id: DeviceFirmwareTargetType;
3635
3662
  status?: DeviceFirmwareUpdateTaskStatus;
3663
+ progress_percent?: number;
3664
+ phase_info?: DeviceFirmwareUpdatePhaseInfo;
3636
3665
  payload_version?: number;
3637
3666
  path?: string;
3638
3667
  };
3639
3668
  export type DeviceFirmwareUpdateRecordFields = {
3640
3669
  status?: boolean;
3670
+ progress_percent?: boolean;
3671
+ phase_info?: boolean;
3641
3672
  payload_version?: boolean;
3642
3673
  path?: boolean;
3643
3674
  };
@@ -3739,7 +3770,6 @@ export declare enum DeviceSessionSeedDomain {
3739
3770
  export type DeviceSessionGet = {
3740
3771
  session_id?: string;
3741
3772
  btc_test_address?: string;
3742
- seed_domains: DeviceSessionSeedDomain[];
3743
3773
  };
3744
3774
  export type DeviceSession = {
3745
3775
  session_id?: string;
@@ -3756,6 +3786,7 @@ export type DeviceSessionAskPin = {
3756
3786
  export type DeviceSessionAskPassphrase = {
3757
3787
  passphrase?: string;
3758
3788
  on_device: boolean;
3789
+ seed_domains: DeviceSessionSeedDomain[];
3759
3790
  };
3760
3791
  export declare enum DeviceSessionAskPin_FailureSubCodes {
3761
3792
  UserCancel = 1
@@ -3897,6 +3928,10 @@ export type ViewDetail = {
3897
3928
  is_overview: boolean;
3898
3929
  has_icon: boolean;
3899
3930
  };
3931
+ export type ViewCustomField = {
3932
+ key: string;
3933
+ value: string;
3934
+ };
3900
3935
  export declare enum ViewTipType {
3901
3936
  Default = 0,
3902
3937
  Highlight = 1,
@@ -3908,10 +3943,25 @@ export type ViewTip = {
3908
3943
  type: ViewTipType;
3909
3944
  text?: string;
3910
3945
  text_id?: number;
3946
+ text_arg?: string;
3911
3947
  };
3912
- export type ViewRawData = {
3948
+ export type ViewActionCard = {
3913
3949
  initial_data: string;
3914
- placeholder: number;
3950
+ };
3951
+ export type ViewContentPreview = {
3952
+ content_key: number;
3953
+ preview: string;
3954
+ total_bytes?: number;
3955
+ };
3956
+ export type ViewContentEntry = {
3957
+ entry_key: number;
3958
+ value: string;
3959
+ };
3960
+ export type ViewContentPage = {
3961
+ page_index: number;
3962
+ page_count: number;
3963
+ chunk?: string;
3964
+ entry?: ViewContentEntry;
3915
3965
  };
3916
3966
  export declare enum ViewSignLayout {
3917
3967
  LayoutDefault = 0,
@@ -3926,10 +3976,19 @@ export type ViewSignPage = {
3926
3976
  amount?: UintType;
3927
3977
  general: ViewDetail[];
3928
3978
  tip?: ViewTip;
3929
- raw_data?: ViewRawData;
3979
+ action_card?: ViewActionCard;
3930
3980
  slide_to_confirm?: boolean;
3931
3981
  layout?: ViewSignLayout;
3932
3982
  title_id?: number;
3983
+ title_arg?: string;
3984
+ content?: ViewContentPreview;
3985
+ custom_field?: ViewCustomField;
3986
+ };
3987
+ export type ViewWarningPage = {
3988
+ title_id: number;
3989
+ text_id: number;
3990
+ text_arg?: string;
3991
+ cancellable?: boolean;
3933
3992
  };
3934
3993
  export type ViewVerifyPage = {
3935
3994
  title?: string;
@@ -3940,6 +3999,7 @@ export type ViewVerifyPage = {
3940
3999
  value_key?: number;
3941
4000
  title_id?: number;
3942
4001
  chain_id?: number;
4002
+ content?: ViewContentPreview;
3943
4003
  };
3944
4004
  export declare enum ProtocolV2FailureType {
3945
4005
  Failure_InvalidMessage = 1,
@@ -4535,8 +4595,6 @@ export type MessageType = {
4535
4595
  TronSignMessage: TronSignMessage;
4536
4596
  TronMessageSignature: TronMessageSignature;
4537
4597
  facotry: facotry;
4538
- experimental_message: experimental_message;
4539
- experimental_field: experimental_field;
4540
4598
  TextMemo: TextMemo;
4541
4599
  RefundMemo: RefundMemo;
4542
4600
  CoinPurchaseMemo: CoinPurchaseMemo;
@@ -4552,6 +4610,8 @@ export type MessageType = {
4552
4610
  UnlockPath: UnlockPath;
4553
4611
  UnlockedPathRequest: UnlockedPathRequest;
4554
4612
  UiAnimationRequest: UiAnimationRequest;
4613
+ experimental_message: experimental_message;
4614
+ experimental_field: experimental_field;
4555
4615
  ProtocolInfoRequest: ProtocolInfoRequest;
4556
4616
  ProtocolInfo: ProtocolInfo;
4557
4617
  DeviceReboot: DeviceReboot;
@@ -4565,6 +4625,9 @@ export type MessageType = {
4565
4625
  DeviceCertificateSignature: DeviceCertificateSignature;
4566
4626
  DeviceCertificateSign: DeviceCertificateSign;
4567
4627
  DeviceMiscUsbMscControl: DeviceMiscUsbMscControl;
4628
+ DeviceFindMyTokenUpdate: DeviceFindMyTokenUpdate;
4629
+ DeviceFindMyTokenStateGet: DeviceFindMyTokenStateGet;
4630
+ DeviceFindMyTokenState: DeviceFindMyTokenState;
4568
4631
  DeviceFactoryInfoManufactureTime: DeviceFactoryInfoManufactureTime;
4569
4632
  DeviceFactoryInfo: DeviceFactoryInfo;
4570
4633
  DeviceFactoryInfoSet: DeviceFactoryInfoSet;
@@ -4574,6 +4637,7 @@ export type MessageType = {
4574
4637
  DeviceFirmwareTarget: DeviceFirmwareTarget;
4575
4638
  DeviceFirmwareUpdateStage: DeviceFirmwareUpdateStage;
4576
4639
  DeviceFirmwareUpdateRequest: DeviceFirmwareUpdateRequest;
4640
+ DeviceFirmwareUpdatePhaseInfo: DeviceFirmwareUpdatePhaseInfo;
4577
4641
  DeviceFirmwareUpdateRecord: DeviceFirmwareUpdateRecord;
4578
4642
  DeviceFirmwareUpdateRecordFields: DeviceFirmwareUpdateRecordFields;
4579
4643
  DeviceFirmwareUpdateStatusGet: DeviceFirmwareUpdateStatusGet;
@@ -4612,9 +4676,14 @@ export type MessageType = {
4612
4676
  PortfolioUpdate: PortfolioUpdate;
4613
4677
  ViewAmount: ViewAmount;
4614
4678
  ViewDetail: ViewDetail;
4679
+ ViewCustomField: ViewCustomField;
4615
4680
  ViewTip: ViewTip;
4616
- ViewRawData: ViewRawData;
4681
+ ViewActionCard: ViewActionCard;
4682
+ ViewContentPreview: ViewContentPreview;
4683
+ ViewContentEntry: ViewContentEntry;
4684
+ ViewContentPage: ViewContentPage;
4617
4685
  ViewSignPage: ViewSignPage;
4686
+ ViewWarningPage: ViewWarningPage;
4618
4687
  ViewVerifyPage: ViewVerifyPage;
4619
4688
  };
4620
4689
  export type MessageKey = keyof MessageType;