@onekeyfe/hd-transport 1.2.0-alpha.70 → 1.2.0-alpha.72

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.
@@ -117,7 +117,7 @@ describe('ProtocolV2LinkManager', () => {
117
117
  expect.objectContaining({
118
118
  messageName: 'Ping',
119
119
  timeoutMs: 123,
120
- highVolume: false,
120
+ highThroughput: false,
121
121
  generation: 1,
122
122
  signal: expect.any(AbortSignal),
123
123
  })
@@ -6,14 +6,23 @@ const {
6
6
  ProtocolV2SequenceCursor,
7
7
  ProtocolV2Session,
8
8
  hexToBytes,
9
+ isProtocolV2HighThroughputCall,
9
10
  probeProtocolV2,
10
11
  } = require('../src/protocols/v2/session');
11
12
  const protocolV2 = require('../src/protocols/v2');
12
13
  const {
14
+ PROTOCOL_V2_BLE_FIRMWARE_FILE_CHUNK_SIZE,
15
+ PROTOCOL_V2_BLE_FRAME_MAX_BYTES,
13
16
  PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS,
14
17
  PROTOCOL_V2_FRAME_MAX_BYTES,
15
18
  } = require('../src/constants');
16
19
 
20
+ test('keeps sensitive acknowledgements separate from high-throughput calls', () => {
21
+ expect(isProtocolV2HighThroughputCall('PassphraseAck')).toBe(false);
22
+ expect(isProtocolV2HighThroughputCall('PinMatrixAck')).toBe(false);
23
+ expect(isProtocolV2HighThroughputCall('FilesystemFileWrite')).toBe(true);
24
+ });
25
+
17
26
  const protocolV1Messages = parseConfigure({
18
27
  nested: {
19
28
  Success: {
@@ -222,6 +231,7 @@ const schemas = {
222
231
  protocolV1: protocolV1Messages,
223
232
  protocolV2: protocolV2Messages,
224
233
  };
234
+ const productionProtocolV2Messages = parseConfigure(require('../messages-protocol-v2.json'));
225
235
 
226
236
  const rewriteSeq = (frame, seq) => {
227
237
  const copy = new Uint8Array(frame);
@@ -352,6 +362,39 @@ describe('Protocol V2 framing and session', () => {
352
362
  ).toThrow('Protocol V2 frame too large: 4201 > 4200');
353
363
  });
354
364
 
365
+ test('keeps optimized BLE firmware chunks inside the transport frame boundary', () => {
366
+ const productionSchemas = {
367
+ protocolV1: protocolV1Messages,
368
+ protocolV2: productionProtocolV2Messages,
369
+ };
370
+ const stagingPaths = [
371
+ 'vol0:/bootloader.bin',
372
+ 'vol0:/application_p1.bin',
373
+ 'vol0:/application_p2.bin',
374
+ 'vol0:/coprocessor.bin',
375
+ 'vol0:/se01.bin',
376
+ 'vol0:/se02.bin',
377
+ 'vol0:/se03.bin',
378
+ 'vol0:/se04.bin',
379
+ ];
380
+
381
+ for (const path of stagingPaths) {
382
+ const frame = ProtocolV2.encodeFrame(productionSchemas, 'FilesystemFileWrite', {
383
+ file: {
384
+ path,
385
+ offset: 0xffffffff,
386
+ total_size: 0xffffffff,
387
+ data: new Uint8Array(PROTOCOL_V2_BLE_FIRMWARE_FILE_CHUNK_SIZE),
388
+ },
389
+ overwrite: true,
390
+ append: false,
391
+ ui_percentage: 100,
392
+ });
393
+
394
+ expect(frame.length).toBeLessThanOrEqual(PROTOCOL_V2_BLE_FRAME_MAX_BYTES);
395
+ }
396
+ });
397
+
355
398
  test('keeps bytes after the first complete frame for the next read', () => {
356
399
  const first = ProtocolV2.encodeFrame(schemas, 'ProtocolInfo', {
357
400
  version: 1,
@@ -741,6 +784,34 @@ describe('Protocol V2 framing and session', () => {
741
784
  expect(logger.debug).not.toHaveBeenCalled();
742
785
  });
743
786
 
787
+ test('session reports when the complete request frame has been written', async () => {
788
+ const response = ProtocolV2.encodeFrame(schemas, 'Success', {
789
+ message: 'ok',
790
+ });
791
+ const events = [];
792
+ const onWriteCompleted = jest.fn(metrics => events.push(['written', metrics]));
793
+ const session = new ProtocolV2Session({
794
+ schemas,
795
+ router: 1,
796
+ writeFrame: frame => {
797
+ events.push(['write', frame.byteLength]);
798
+ return Promise.resolve();
799
+ },
800
+ readFrame: () => {
801
+ events.push(['read']);
802
+ return Promise.resolve(rewriteSeq(response, 1));
803
+ },
804
+ });
805
+
806
+ await session.call('Ping', { message: 'metrics' }, { onWriteCompleted });
807
+
808
+ expect(events.map(event => event[0])).toEqual(['write', 'written', 'read']);
809
+ expect(onWriteCompleted).toHaveBeenCalledWith({
810
+ elapsedMs: expect.any(Number),
811
+ frameBytes: expect.any(Number),
812
+ });
813
+ });
814
+
744
815
  test('session skips unrelated terminal frames when expected response types are provided', async () => {
745
816
  const stale = ProtocolV2.encodeFrame(schemas, 'Success', {
746
817
  message: 'stale response',
@@ -1068,14 +1139,14 @@ describe('Protocol V2 framing and session', () => {
1068
1139
  {
1069
1140
  messageName: 'Ping',
1070
1141
  timeoutMs: 123,
1071
- highVolume: false,
1142
+ highThroughput: false,
1072
1143
  generation: 7,
1073
1144
  signalAborted: false,
1074
1145
  },
1075
1146
  {
1076
1147
  messageName: 'FileWrite',
1077
1148
  timeoutMs: 456,
1078
- highVolume: true,
1149
+ highThroughput: true,
1079
1150
  writeWithResponse: true,
1080
1151
  generation: 7,
1081
1152
  signalAborted: false,
@@ -1083,7 +1154,7 @@ describe('Protocol V2 framing and session', () => {
1083
1154
  {
1084
1155
  messageName: 'Ping',
1085
1156
  timeoutMs: PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS,
1086
- highVolume: false,
1157
+ highThroughput: false,
1087
1158
  generation: 7,
1088
1159
  signalAborted: false,
1089
1160
  },
@@ -1092,14 +1163,14 @@ describe('Protocol V2 framing and session', () => {
1092
1163
  {
1093
1164
  messageName: 'Ping',
1094
1165
  timeoutMs: 123,
1095
- highVolume: false,
1166
+ highThroughput: false,
1096
1167
  generation: 7,
1097
1168
  signalAborted: false,
1098
1169
  },
1099
1170
  {
1100
1171
  messageName: 'FileWrite',
1101
1172
  timeoutMs: 456,
1102
- highVolume: true,
1173
+ highThroughput: true,
1103
1174
  writeWithResponse: true,
1104
1175
  generation: 7,
1105
1176
  signalAborted: false,
@@ -1107,7 +1178,7 @@ describe('Protocol V2 framing and session', () => {
1107
1178
  {
1108
1179
  messageName: 'Ping',
1109
1180
  timeoutMs: PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS,
1110
- highVolume: false,
1181
+ highThroughput: false,
1111
1182
  generation: 7,
1112
1183
  signalAborted: false,
1113
1184
  },
@@ -7,6 +7,7 @@ export declare const PROTOCOL_V1_ENVELOPE_HEADER_SIZE: number;
7
7
  export declare const PROTOCOL_V2_FRAME_MAX_BYTES = 4200;
8
8
  export declare const PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE = 4000;
9
9
  export declare const PROTOCOL_V2_BLE_FILE_CHUNK_SIZE = 1800;
10
+ export declare const PROTOCOL_V2_BLE_FIRMWARE_FILE_CHUNK_SIZE = 1960;
10
11
  export declare const PROTOCOL_V2_BLE_FILE_READ_CHUNK_SIZE = 900;
11
12
  export declare const PROTOCOL_V2_BLE_FRAME_MAX_BYTES = 2048;
12
13
  export declare const PROTOCOL_V2_FILE_CHUNK_SIZE = 4000;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,KAAO,CAAC;AAG1C,eAAO,MAAM,uBAAuB,KAAO,CAAC;AAG5C,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAGjD,eAAO,MAAM,2BAA2B,QAAqC,CAAC;AAG9E,eAAO,MAAM,+BAA+B,QAAQ,CAAC;AAGrD,eAAO,MAAM,gCAAgC,QAA0C,CAAC;AAKxF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAGhD,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAGvD,eAAO,MAAM,+BAA+B,OAAO,CAAC;AAGpD,eAAO,MAAM,oCAAoC,MAAM,CAAC;AAGxD,eAAO,MAAM,+BAA+B,OAAO,CAAC;AAGpD,eAAO,MAAM,2BAA2B,OAAqC,CAAC;AAM9E,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAG5C,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAQhD,eAAO,MAAM,uCAAuC,QAAgB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,KAAO,CAAC;AAG1C,eAAO,MAAM,uBAAuB,KAAO,CAAC;AAG5C,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAGjD,eAAO,MAAM,2BAA2B,QAAqC,CAAC;AAG9E,eAAO,MAAM,+BAA+B,QAAQ,CAAC;AAGrD,eAAO,MAAM,gCAAgC,QAA0C,CAAC;AAKxF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAGhD,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAGvD,eAAO,MAAM,+BAA+B,OAAO,CAAC;AAMpD,eAAO,MAAM,wCAAwC,OAAO,CAAC;AAG7D,eAAO,MAAM,oCAAoC,MAAM,CAAC;AAGxD,eAAO,MAAM,+BAA+B,OAAO,CAAC;AAGpD,eAAO,MAAM,2BAA2B,OAAqC,CAAC;AAM9E,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAG5C,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAQhD,eAAO,MAAM,uCAAuC,QAAgB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -314,11 +314,17 @@ type MessageFromOneKey = {
314
314
  type: string;
315
315
  message: Record<string, any>;
316
316
  };
317
+ type TransportWriteMetrics = {
318
+ elapsedMs: number;
319
+ frameBytes: number;
320
+ };
317
321
  type TransportCallOptions = {
318
322
  timeoutMs?: number;
319
323
  expectedTypes?: string[];
320
324
  intermediateTypes?: string[];
321
325
  onIntermediateResponse?: (response: MessageFromOneKey) => void;
326
+ /** Called after the complete request frame has been submitted to the transport. */
327
+ onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
322
328
  /** Prefer acknowledged BLE characteristic writes for this call when supported. */
323
329
  writeWithResponse?: boolean;
324
330
  };
@@ -6602,7 +6608,7 @@ type ProtocolV2Schemas = {
6602
6608
  type ProtocolV2CallContext = {
6603
6609
  messageName: string;
6604
6610
  timeoutMs?: number;
6605
- highVolume: boolean;
6611
+ highThroughput: boolean;
6606
6612
  writeWithResponse?: boolean;
6607
6613
  generation: number;
6608
6614
  signal: AbortSignal;
@@ -6630,11 +6636,13 @@ type ProtocolV2CallOptions = {
6630
6636
  expectedTypes?: string[];
6631
6637
  intermediateTypes?: string[];
6632
6638
  onIntermediateResponse?: (response: MessageFromOneKey) => void;
6639
+ onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
6633
6640
  writeWithResponse?: boolean;
6634
6641
  };
6635
6642
 
6636
6643
  declare function hexToBytes(hex: string): Uint8Array;
6637
6644
  declare function bytesToHex(bytes: Uint8Array): string;
6645
+ declare function isProtocolV2HighThroughputCall(name: string): boolean;
6638
6646
  declare function getErrorMessage(error: unknown): string;
6639
6647
  declare function withProtocolTimeout<T>(promise: Promise<T>, timeoutMs: number | undefined, createTimeoutError: () => Error, onTimeout?: () => void, abortSignal?: AbortSignal): Promise<T>;
6640
6648
  declare class ProtocolV2Session {
@@ -6774,6 +6782,11 @@ declare const PROTOCOL_V2_FRAME_MAX_BYTES = 4200;
6774
6782
  declare const PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE = 4000;
6775
6783
  /** FilesystemFileWrite chunk size over BLE. */
6776
6784
  declare const PROTOCOL_V2_BLE_FILE_CHUNK_SIZE = 1800;
6785
+ /**
6786
+ * FirmwareUpdateV4 chunk size for its fixed BLE staging paths.
6787
+ * The longest current path still leaves 28 bytes below the 2048-byte BLE frame limit.
6788
+ */
6789
+ declare const PROTOCOL_V2_BLE_FIRMWARE_FILE_CHUNK_SIZE = 1960;
6777
6790
  /** BLE FilesystemFileRead chunk size, limited by the Pro2 1024-byte UART TX buffer. */
6778
6791
  declare const PROTOCOL_V2_BLE_FILE_READ_CHUNK_SIZE = 900;
6779
6792
  /** Pro2 BLE/UART RX FIFO must hold a complete Proto Link frame. */
@@ -6876,4 +6889,4 @@ declare const _default: {
6876
6889
  withProtocolTimeout: typeof withProtocolTimeout;
6877
6890
  };
6878
6891
 
6879
- export { AcquireInput, Address, AlephiumAddress, AlephiumBytecodeAck, AlephiumBytecodeRequest, AlephiumGetAddress, AlephiumMessageSignature, AlephiumSignMessage, AlephiumSignTx, AlephiumSignedTx, AlephiumTxAck, AlephiumTxRequest, AlgorandAddress, AlgorandGetAddress, AlgorandSignTx, AlgorandSignedTx, AmountUnit, ApplyFlags, ApplySettings, AptosAddress, AptosGetAddress, AptosMessagePayload, AptosMessageSignature, AptosSignMessage, AptosSignSIWAMessage, AptosSignTx, AptosSignedTx, AptosTransactionType, AuthorizeCoinJoin, BIP32Address, BackupDevice, BackupType, BatchGetPublickeys, BenfenAddress, BenfenGetAddress, BenfenMessageSignature, BenfenSignMessage, BenfenSignTx, BenfenSignedTx, BenfenTxAck, BenfenTxRequest, BinanceAddress, BinanceCancelMsg, BinanceCoin, BinanceGetAddress, BinanceGetPublicKey, BinanceInputOutput, BinanceOrderMsg, BinanceOrderSide, BinanceOrderType, BinancePublicKey, BinanceSignTx, BinanceSignedTx, BinanceTimeInForce, BinanceTransferMsg, BinanceTxRequest, BixinBackupAck, BixinBackupDevice, BixinBackupDeviceAck, BixinBackupRequest, BixinLoadDevice, BixinMessageSE, BixinOutMessageSE, BixinPinInputOnDevice, BixinRestoreAck, BixinRestoreRequest, BixinSeedOperate, BixinVerifyDeviceAck, BixinVerifyDeviceRequest, BixinWhiteListAck, BixinWhiteListRequest, BlurRequest, ButtonAck, ButtonRequest, ButtonRequestType, Cancel, CancelAuthorization, Capability, CardanoAddress, CardanoAddressParametersType, CardanoAddressType, CardanoAssetGroup, CardanoBlockchainPointerType, CardanoCVoteRegistrationDelegation, CardanoCVoteRegistrationFormat, CardanoCVoteRegistrationParametersType, CardanoCertificateType, CardanoDRep, CardanoDRepType, CardanoDerivationType, CardanoGetAddress, CardanoGetNativeScriptHash, CardanoGetPublicKey, CardanoMessageSignature, CardanoNativeScript, CardanoNativeScriptHash, CardanoNativeScriptHashDisplayFormat, CardanoNativeScriptType, CardanoPoolMetadataType, CardanoPoolOwner, CardanoPoolParametersType, CardanoPoolRelayParameters, CardanoPoolRelayType, CardanoPublicKey, CardanoSignMessage, CardanoSignTxFinished, CardanoSignTxInit, CardanoToken, CardanoTxAuxiliaryData, CardanoTxAuxiliaryDataSupplement, CardanoTxAuxiliaryDataSupplementType, CardanoTxBodyHash, CardanoTxCertificate, CardanoTxCollateralInput, CardanoTxHostAck, CardanoTxInlineDatumChunk, CardanoTxInput, CardanoTxItemAck, CardanoTxMint, CardanoTxOutput, CardanoTxOutputSerializationFormat, CardanoTxReferenceInput, CardanoTxReferenceScriptChunk, CardanoTxRequiredSigner, CardanoTxSigningMode, CardanoTxWithdrawal, CardanoTxWitnessRequest, CardanoTxWitnessResponse, CardanoTxWitnessType, ChangeOutputScriptType, ChangePin, ChangeWipeCode, CipherKeyValue, CipheredKeyValue, CoinJoinRequest, CoinPurchaseMemo, CommandFlags, ConfluxAddress, ConfluxGetAddress, ConfluxMessageSignature, ConfluxSignMessage, ConfluxSignMessageCIP23, ConfluxSignTx, ConfluxTxAck, ConfluxTxRequest, CosmosAddress, CosmosGetAddress, CosmosSignTx, CosmosSignedTx, DecredStakingSpendType, Deprecated_PassphraseStateAck, Deprecated_PassphraseStateRequest, DeviceBackToBoot, DeviceCertificate, DeviceCertificateRead, DeviceCertificateSign, DeviceCertificateSignature, DeviceCertificateWrite, DeviceCoprocessorInfo, DeviceEraseSector, DeviceErrorCode, DeviceFactoryAck, DeviceFactoryInfo, DeviceFactoryInfoGet, DeviceFactoryInfoManufactureTime, DeviceFactoryInfoSet, DeviceFactoryPermanentLock, DeviceFactoryTest, DeviceFirmwareImageInfo, DeviceFirmwareTarget, DeviceFirmwareTargetType, DeviceFirmwareUpdateRecord, DeviceFirmwareUpdateRecordFields, DeviceFirmwareUpdateRequest, DeviceFirmwareUpdateStatus, DeviceFirmwareUpdateStatusGet, DeviceFirmwareUpdateTaskStatus, DeviceHardwareInfo, DeviceInfo, DeviceInfoGet, DeviceInfoSettings, DeviceInfoTargets, DeviceInfoTypes, DeviceMainMcuInfo, DeviceMiscUsbMscControl, DeviceReboot, DeviceRebootType, DeviceSEInfo, DeviceSEState, DeviceSeType, DeviceSession, DeviceSessionAskPassphrase, DeviceSessionAskPin, DeviceSessionAskPin_FailureSubCodes, DeviceSessionErrorCode, DeviceSessionGet, DeviceSessionPinType, DeviceSessionSeedDomain, DeviceSettings, DeviceSettingsGet, DeviceSettingsPage, DeviceSettingsPageShow, DeviceSettingsSet, DeviceStatus, DeviceStatusGet, DeviceType, DnxAddress, DnxComputedKeyImage, DnxGetAddress, DnxInputAck, DnxInputRequest, DnxRTSigsRequest, DnxSignTx, DnxSignedTx, DnxTxKey, DoPreauthorized, ECDHSessionKey, EcdsaPublicKeys, EmmcDir, EmmcDirList, EmmcDirMake, EmmcDirRemove, EmmcFile, EmmcFileDelete, EmmcFileRead, EmmcFileWrite, EmmcFixPermission, EmmcPath, EmmcPathInfo, EndSession, Entropy, EntropyAck, EntropyRequest, Enum_BackupType, Enum_ButtonRequestType, Enum_Capability, Enum_InputScriptType, Enum_KaspaInputScriptType, Enum_KaspaOutputScriptType, Enum_KaspaRequestType, Enum_OutputScriptType, Enum_PinMatrixRequestType, Enum_ProtocolV2Capability, Enum_RequestType, Enum_SafetyCheckLevel, Enum_WordRequestType, EosActionBuyRam, EosActionBuyRamBytes, EosActionCommon, EosActionDelegate, EosActionDeleteAuth, EosActionLinkAuth, EosActionNewAccount, EosActionRefund, EosActionSellRam, EosActionTransfer, EosActionUndelegate, EosActionUnknown, EosActionUnlinkAuth, EosActionUpdateAuth, EosActionVoteProducer, EosAsset, EosAuthorization, EosAuthorizationAccount, EosAuthorizationKey, EosAuthorizationWait, EosGetPublicKey, EosPermissionLevel, EosPublicKey, EosSignTx, EosSignedTx, EosTxActionAck, EosTxActionRequest, EosTxHeader, EthereumAccessList, EthereumAccessListOneKey, EthereumAddress, EthereumAddressOneKey, EthereumAuthorizationOneKey, EthereumAuthorizationSignature, EthereumDataType, EthereumDataTypeOneKey, EthereumDefinitionType, EthereumDefinitions, EthereumFieldType, EthereumFieldTypeOneKey, EthereumGetAddress, EthereumGetAddressOneKey, EthereumGetPublicKey, EthereumGetPublicKeyOneKey, EthereumGnosisSafeTxAck, EthereumGnosisSafeTxOperation, EthereumGnosisSafeTxRequest, EthereumMessageSignature, EthereumMessageSignatureOneKey, EthereumNetworkInfo, EthereumPublicKey, EthereumPublicKeyOneKey, EthereumSignMessage, EthereumSignMessageEIP712, EthereumSignMessageOneKey, EthereumSignTx, EthereumSignTxEIP1559, EthereumSignTxEIP1559OneKey, EthereumSignTxEIP7702OneKey, EthereumSignTxOneKey, EthereumSignTypedData, EthereumSignTypedDataOneKey, EthereumSignTypedDataQR, EthereumSignTypedHash, EthereumSignTypedHashOneKey, EthereumStructMember, EthereumStructMemberOneKey, EthereumTokenInfo, EthereumTxAck, EthereumTxAckOneKey, EthereumTxRequest, EthereumTxRequestOneKey, EthereumTypedDataSignature, EthereumTypedDataSignatureOneKey, EthereumTypedDataStructAck, EthereumTypedDataStructAckOneKey, EthereumTypedDataStructRequest, EthereumTypedDataStructRequestOneKey, EthereumTypedDataValueAck, EthereumTypedDataValueAckOneKey, EthereumTypedDataValueRequest, EthereumTypedDataValueRequestOneKey, EthereumVerifyMessage, EthereumVerifyMessageOneKey, ExportType, Failure, FailureType, Features, FileInfo, FileInfoList, FilecoinAddress, FilecoinGetAddress, FilecoinSignTx, FilecoinSignedTx, FilesystemDir, FilesystemDirList, FilesystemDirMake, FilesystemDirRemove, FilesystemFile, FilesystemFileDelete, FilesystemFileRead, FilesystemFileWrite, FilesystemFormat, FilesystemPathInfo, FilesystemPathInfoQuery, FilesystemPermissionFix, FirmwareErase, FirmwareErase_ex, FirmwareHash, FirmwareRequest, FirmwareUpdateEmmc, FirmwareUpload, GetAddress, GetDeviceInfo, GetECDHSessionKey, GetEntropy, GetFeatures, GetFirmwareHash, GetNextU2FCounter, GetNonce, GetOwnershipId, GetOwnershipProof, GetPassphraseState, GetPublicKey, GetPublicKeyMultiple, HDNodePathType, HDNodeType, IdentityType, Initialize, InputScriptType, InternalInputScriptType, InternalMyAddressRequest, KaspaAddress, KaspaGetAddress, KaspaInputScriptType, KaspaOutpoint, KaspaOutputScriptType, KaspaRequestType, KaspaSignTx, KaspaSignedTx, KaspaTxAckInput, KaspaTxAckOutput, KaspaTxAckPayloadChunk, KaspaTxAckPrevInput, KaspaTxAckPrevMeta, KaspaTxAckPrevOutput, KaspaTxInputAck, KaspaTxInputRequest, KaspaTxRequest, KaspaTxRequestSignature, ListResDir, LnurlAuth, LnurlAuthResp, LockDevice, LogBlockCommand, LowLevelDevice, LowlevelTransportSharedPlugin, MessageFromOneKey, MessageKey, MessageResponse, MessageResponseMap, MessageSignature, MessageType, messages as Messages, MoneroAccountPublicAddress, MoneroAddress, MoneroExportedKeyImage, MoneroGetAddress, MoneroGetTxKeyAck, MoneroGetTxKeyRequest, MoneroGetWatchKey, MoneroKeyImageExportInitAck, MoneroKeyImageExportInitRequest, MoneroKeyImageSyncFinalAck, MoneroKeyImageSyncFinalRequest, MoneroKeyImageSyncStepAck, MoneroKeyImageSyncStepRequest, MoneroLiveRefreshFinalAck, MoneroLiveRefreshFinalRequest, MoneroLiveRefreshStartAck, MoneroLiveRefreshStartRequest, MoneroLiveRefreshStepAck, MoneroLiveRefreshStepRequest, MoneroMultisigKLRki, MoneroNetworkType, MoneroOutputEntry, MoneroRctKeyPublic, MoneroRingCtSig, MoneroSubAddressIndicesList, MoneroTransactionAllInputsSetAck, MoneroTransactionAllInputsSetRequest, MoneroTransactionAllOutSetAck, MoneroTransactionAllOutSetRequest, MoneroTransactionData, MoneroTransactionDestinationEntry, MoneroTransactionFinalAck, MoneroTransactionFinalRequest, MoneroTransactionInitAck, MoneroTransactionInitRequest, MoneroTransactionInputViniAck, MoneroTransactionInputViniRequest, MoneroTransactionInputsPermutationAck, MoneroTransactionInputsPermutationRequest, MoneroTransactionRsigData, MoneroTransactionSetInputAck, MoneroTransactionSetInputRequest, MoneroTransactionSetOutputAck, MoneroTransactionSetOutputRequest, MoneroTransactionSignInputAck, MoneroTransactionSignInputRequest, MoneroTransactionSourceEntry, MoneroTransferDetails, MoneroWatchKey, MultisigRedeemScriptType, NEMAddress, NEMAggregateModification, NEMCosignatoryModification, NEMDecryptMessage, NEMDecryptedMessage, NEMGetAddress, NEMImportanceTransfer, NEMImportanceTransferMode, NEMModificationType, NEMMosaic, NEMMosaicCreation, NEMMosaicDefinition, NEMMosaicLevy, NEMMosaicSupplyChange, NEMProvisionNamespace, NEMSignTx, NEMSignedTx, NEMSupplyChangeType, NEMTransactionCommon, NEMTransfer, NFTWriteData, NFTWriteInfo, NearAddress, NearGetAddress, NearSignTx, NearSignedTx, NeoAddress, NeoGetAddress, NeoSignTx, NeoSignedTx, NervosAddress, NervosGetAddress, NervosSignTx, NervosSignedTx, NervosTxAck, NervosTxRequest, NexaAddress, NexaGetAddress, NexaSignTx, NexaSignedTx, NexaTxInputAck, NexaTxInputRequest, NextU2FCounter, NftUpdate, Nonce, NostrDecryptMessage, NostrDecryptedMessage, NostrEncryptMessage, NostrEncryptedMessage, NostrGetPublicKey, NostrPublicKey, NostrSignEvent, NostrSignSchnorr, NostrSignedEvent, NostrSignedSchnorr, OnboardingPhase, OnboardingSetupKind, OnboardingSetupMethod, OnboardingSetupStatus, OnboardingStatus, OnboardingStatusGet, OnboardingStep, OneKeyDeviceCommType, OneKeyDeviceInfo, OneKeyDeviceInfoBase, OneKeyDeviceInfoWithSession, OneKeyDeviceType, OneKeyMobileDeviceInfo, OneKeySEState, OneKeySeType, OnekeyFeatures, OnekeyGetFeatures, OutputScriptType, OwnershipId, OwnershipProof, PROTOCOL_V1_CHUNK_PAYLOAD_SIZE, PROTOCOL_V1_ENVELOPE_HEADER_SIZE, PROTOCOL_V1_HEADER_BYTE, PROTOCOL_V1_MESSAGE_HEADER_SIZE, PROTOCOL_V1_REPORT_ID, PROTOCOL_V1_USB_PACKET_SIZE, PROTOCOL_V2_BLE_FILE_CHUNK_SIZE, PROTOCOL_V2_BLE_FILE_READ_CHUNK_SIZE, PROTOCOL_V2_BLE_FRAME_MAX_BYTES, PROTOCOL_V2_CHANNEL_BLE_UART, PROTOCOL_V2_CHANNEL_SOCKET, PROTOCOL_V2_CHANNEL_USB, PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS, PROTOCOL_V2_FILE_CHUNK_SIZE, PROTOCOL_V2_FRAME_MAX_BYTES, PROTOCOL_V2_PACKET_SRC_COMMAND, PROTOCOL_V2_SYS_MESSAGE_THRESHOLD, PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE, PassphraseAck, PassphraseRequest, PassphraseState, Path, PaymentRequestMemo, PinMatrixAck, PinMatrixRequest, PinMatrixRequestType, Ping, PolkadotAddress, PolkadotGetAddress, PolkadotSignTx, PolkadotSignedTx, PortfolioUpdate, PreauthorizedRequest, PrevInput, PrevOutput, PrevTx, ProtocolInfo, ProtocolInfoRequest, ProtocolType, ProtocolV1, ProtocolV2, ProtocolV2BleFrameWriterOptions, ProtocolV2CallContext, ProtocolV2CallOptions, ProtocolV2Capability, ProtocolV2DeviceInfo, ProtocolV2FailureType, ProtocolV2FrameAssembler, ProtocolV2LinkAdapter, ProtocolV2LinkError, ProtocolV2LinkErrorClassification, ProtocolV2LinkErrorCode, ProtocolV2LinkManager, ProtocolV2LinkManagerOptions, ProtocolV2Schemas, ProtocolV2SequenceCursor, ProtocolV2Session, ProtocolV2SessionOptions, ProtocolV2UsbTransportBase, ProtocolV2UsbTransportBaseOptions, PublicKey, PublicKeyMultiple, ReadSEPublicCert, ReadSEPublicKey, Reboot, RebootToBoardloader, RebootToBootloader, RebootType, RecoveryDevice, RecoveryDeviceType, RefundMemo, RequestType, ResetDevice, ResourceAck, ResourceRequest, ResourceType, ResourceUpdate, ResourceUpload, RippleAddress, RippleGetAddress, RipplePayment, RippleSignTx, RippleSignedTx, SEMessageSignature, SEPublicCert, SEPublicKey, SESignMessage, SafetyCheckLevel, ScdoAddress, ScdoGetAddress, ScdoSignMessage, ScdoSignTx, ScdoSignedMessage, ScdoSignedTx, ScdoTxAck, SdProtect, SdProtectOperationType, SeedRequestType, SelfTest, SetBusy, SetU2FCounter, SignIdentity, SignMessage, SignPsbt, SignTx, SignedIdentity, SignedPsbt, SolanaAddress, SolanaGetAddress, SolanaMessageSignature, SolanaOffChainMessageFormat, SolanaOffChainMessageVersion, SolanaSignOffChainMessage, SolanaSignTx, SolanaSignUnsafeMessage, SolanaSignedTx, SolanaTxATADetails, SolanaTxExtraInfo, SpiFlashData, SpiFlashRead, SpiFlashWrite, StarcoinAddress, StarcoinGetAddress, StarcoinGetPublicKey, StarcoinMessageSignature, StarcoinPublicKey, StarcoinSignMessage, StarcoinSignTx, StarcoinSignedTx, StarcoinVerifyMessage, StellarAccountMergeOp, StellarAddress, StellarAllowTrustOp, StellarAsset, StellarAssetType, StellarBumpSequenceOp, StellarChangeTrustOp, StellarCreateAccountOp, StellarCreatePassiveSellOfferOp, StellarGetAddress, StellarInvokeHostFunctionOp, StellarManageBuyOfferOp, StellarManageDataOp, StellarManageSellOfferOp, StellarMemoType, StellarPathPaymentStrictReceiveOp, StellarPathPaymentStrictSendOp, StellarPaymentOp, StellarRequestType, StellarSetOptionsOp, StellarSignTx, StellarSignedTx, StellarSignerType, StellarSorobanDataAck, StellarSorobanDataRequest, StellarTxOpRequest, Success, SuiAddress, SuiGetAddress, SuiMessageSignature, SuiSignMessage, SuiSignTx, SuiSignedTx, SuiTxAck, SuiTxRequest, TRANSPORT_EVENT, TextMemo, TezosAddress, TezosBallotOp, TezosBallotType, TezosContractID, TezosContractType, TezosDelegationOp, TezosGetAddress, TezosGetPublicKey, TezosManagerTransfer, TezosOriginationOp, TezosParametersManager, TezosProposalOp, TezosPublicKey, TezosRevealOp, TezosSignTx, TezosSignedTx, TezosTransactionOp, TonAddress, TonGetAddress, TonSignData, TonSignDataType, TonSignMessage, TonSignProof, TonSignedData, TonSignedMessage, TonSignedProof, TonTxAck, TonWalletVersion, TonWorkChain, Transport, TransportCallOptions, TransportDeviceDisconnectEvent, TronAddress, TronCancelAllUnfreezeV2Contract, TronContract, TronDelegateResourceContract, TronFreezeBalanceContract, TronFreezeBalanceV2Contract, TronGetAddress, TronMessageSignature, TronMessageType, TronResourceCode, TronSignMessage, TronSignTx, TronSignedTx, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceContract, TronUnfreezeBalanceV2Contract, TronVoteWitnessContract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, TxAck, TxAckInput, TxAckInputWrapper, TxAckOutput, TxAckOutputWrapper, TxAckPaymentRequest, TxAckPrevExtraData, TxAckPrevExtraDataWrapper, TxAckPrevInput, TxAckPrevInputWrapper, TxAckPrevMeta, TxAckPrevOutput, TxAckPrevOutputWrapper, TxAckResponse, TxInput, TxInputType, TxOutput, TxOutputBinType, TxOutputType, TxRequest, TxRequestDetailsType, TxRequestSerializedType, TypedCall, UiAnimationCommand, UiAnimationRequest, UiAnimationType, UintType, UnLockDevice, UnLockDeviceResponse, UnlockPath, UnlockedPathRequest, UpgradeFileHeader, VerifyMessage, ViewAmount, ViewDetail, ViewRawData, ViewSignLayout, ViewSignPage, ViewTip, ViewTipType, ViewVerifyPage, Vote, WL_OperationType, WipeDevice, WordAck, WordRequest, WordRequestType, WriteSEPrivateKey, WriteSEPublicCert, ZoomRequest, bytesToHex, concatUint8Arrays, createTransportCallLog, _default as default, experimental_field, experimental_message, facotry, getErrorMessage, getSafeTransportLogPayload, hexToBytes, isProtocolV2LinkError, probeProtocolV2, index as protocolV1, protocolV2Codec as protocolV2, shouldSuppressHighVolumeCallLog, withProtocolTimeout, writeProtocolV2BleFrame };
6892
+ export { AcquireInput, Address, AlephiumAddress, AlephiumBytecodeAck, AlephiumBytecodeRequest, AlephiumGetAddress, AlephiumMessageSignature, AlephiumSignMessage, AlephiumSignTx, AlephiumSignedTx, AlephiumTxAck, AlephiumTxRequest, AlgorandAddress, AlgorandGetAddress, AlgorandSignTx, AlgorandSignedTx, AmountUnit, ApplyFlags, ApplySettings, AptosAddress, AptosGetAddress, AptosMessagePayload, AptosMessageSignature, AptosSignMessage, AptosSignSIWAMessage, AptosSignTx, AptosSignedTx, AptosTransactionType, AuthorizeCoinJoin, BIP32Address, BackupDevice, BackupType, BatchGetPublickeys, BenfenAddress, BenfenGetAddress, BenfenMessageSignature, BenfenSignMessage, BenfenSignTx, BenfenSignedTx, BenfenTxAck, BenfenTxRequest, BinanceAddress, BinanceCancelMsg, BinanceCoin, BinanceGetAddress, BinanceGetPublicKey, BinanceInputOutput, BinanceOrderMsg, BinanceOrderSide, BinanceOrderType, BinancePublicKey, BinanceSignTx, BinanceSignedTx, BinanceTimeInForce, BinanceTransferMsg, BinanceTxRequest, BixinBackupAck, BixinBackupDevice, BixinBackupDeviceAck, BixinBackupRequest, BixinLoadDevice, BixinMessageSE, BixinOutMessageSE, BixinPinInputOnDevice, BixinRestoreAck, BixinRestoreRequest, BixinSeedOperate, BixinVerifyDeviceAck, BixinVerifyDeviceRequest, BixinWhiteListAck, BixinWhiteListRequest, BlurRequest, ButtonAck, ButtonRequest, ButtonRequestType, Cancel, CancelAuthorization, Capability, CardanoAddress, CardanoAddressParametersType, CardanoAddressType, CardanoAssetGroup, CardanoBlockchainPointerType, CardanoCVoteRegistrationDelegation, CardanoCVoteRegistrationFormat, CardanoCVoteRegistrationParametersType, CardanoCertificateType, CardanoDRep, CardanoDRepType, CardanoDerivationType, CardanoGetAddress, CardanoGetNativeScriptHash, CardanoGetPublicKey, CardanoMessageSignature, CardanoNativeScript, CardanoNativeScriptHash, CardanoNativeScriptHashDisplayFormat, CardanoNativeScriptType, CardanoPoolMetadataType, CardanoPoolOwner, CardanoPoolParametersType, CardanoPoolRelayParameters, CardanoPoolRelayType, CardanoPublicKey, CardanoSignMessage, CardanoSignTxFinished, CardanoSignTxInit, CardanoToken, CardanoTxAuxiliaryData, CardanoTxAuxiliaryDataSupplement, CardanoTxAuxiliaryDataSupplementType, CardanoTxBodyHash, CardanoTxCertificate, CardanoTxCollateralInput, CardanoTxHostAck, CardanoTxInlineDatumChunk, CardanoTxInput, CardanoTxItemAck, CardanoTxMint, CardanoTxOutput, CardanoTxOutputSerializationFormat, CardanoTxReferenceInput, CardanoTxReferenceScriptChunk, CardanoTxRequiredSigner, CardanoTxSigningMode, CardanoTxWithdrawal, CardanoTxWitnessRequest, CardanoTxWitnessResponse, CardanoTxWitnessType, ChangeOutputScriptType, ChangePin, ChangeWipeCode, CipherKeyValue, CipheredKeyValue, CoinJoinRequest, CoinPurchaseMemo, CommandFlags, ConfluxAddress, ConfluxGetAddress, ConfluxMessageSignature, ConfluxSignMessage, ConfluxSignMessageCIP23, ConfluxSignTx, ConfluxTxAck, ConfluxTxRequest, CosmosAddress, CosmosGetAddress, CosmosSignTx, CosmosSignedTx, DecredStakingSpendType, Deprecated_PassphraseStateAck, Deprecated_PassphraseStateRequest, DeviceBackToBoot, DeviceCertificate, DeviceCertificateRead, DeviceCertificateSign, DeviceCertificateSignature, DeviceCertificateWrite, DeviceCoprocessorInfo, DeviceEraseSector, DeviceErrorCode, DeviceFactoryAck, DeviceFactoryInfo, DeviceFactoryInfoGet, DeviceFactoryInfoManufactureTime, DeviceFactoryInfoSet, DeviceFactoryPermanentLock, DeviceFactoryTest, DeviceFirmwareImageInfo, DeviceFirmwareTarget, DeviceFirmwareTargetType, DeviceFirmwareUpdateRecord, DeviceFirmwareUpdateRecordFields, DeviceFirmwareUpdateRequest, DeviceFirmwareUpdateStatus, DeviceFirmwareUpdateStatusGet, DeviceFirmwareUpdateTaskStatus, DeviceHardwareInfo, DeviceInfo, DeviceInfoGet, DeviceInfoSettings, DeviceInfoTargets, DeviceInfoTypes, DeviceMainMcuInfo, DeviceMiscUsbMscControl, DeviceReboot, DeviceRebootType, DeviceSEInfo, DeviceSEState, DeviceSeType, DeviceSession, DeviceSessionAskPassphrase, DeviceSessionAskPin, DeviceSessionAskPin_FailureSubCodes, DeviceSessionErrorCode, DeviceSessionGet, DeviceSessionPinType, DeviceSessionSeedDomain, DeviceSettings, DeviceSettingsGet, DeviceSettingsPage, DeviceSettingsPageShow, DeviceSettingsSet, DeviceStatus, DeviceStatusGet, DeviceType, DnxAddress, DnxComputedKeyImage, DnxGetAddress, DnxInputAck, DnxInputRequest, DnxRTSigsRequest, DnxSignTx, DnxSignedTx, DnxTxKey, DoPreauthorized, ECDHSessionKey, EcdsaPublicKeys, EmmcDir, EmmcDirList, EmmcDirMake, EmmcDirRemove, EmmcFile, EmmcFileDelete, EmmcFileRead, EmmcFileWrite, EmmcFixPermission, EmmcPath, EmmcPathInfo, EndSession, Entropy, EntropyAck, EntropyRequest, Enum_BackupType, Enum_ButtonRequestType, Enum_Capability, Enum_InputScriptType, Enum_KaspaInputScriptType, Enum_KaspaOutputScriptType, Enum_KaspaRequestType, Enum_OutputScriptType, Enum_PinMatrixRequestType, Enum_ProtocolV2Capability, Enum_RequestType, Enum_SafetyCheckLevel, Enum_WordRequestType, EosActionBuyRam, EosActionBuyRamBytes, EosActionCommon, EosActionDelegate, EosActionDeleteAuth, EosActionLinkAuth, EosActionNewAccount, EosActionRefund, EosActionSellRam, EosActionTransfer, EosActionUndelegate, EosActionUnknown, EosActionUnlinkAuth, EosActionUpdateAuth, EosActionVoteProducer, EosAsset, EosAuthorization, EosAuthorizationAccount, EosAuthorizationKey, EosAuthorizationWait, EosGetPublicKey, EosPermissionLevel, EosPublicKey, EosSignTx, EosSignedTx, EosTxActionAck, EosTxActionRequest, EosTxHeader, EthereumAccessList, EthereumAccessListOneKey, EthereumAddress, EthereumAddressOneKey, EthereumAuthorizationOneKey, EthereumAuthorizationSignature, EthereumDataType, EthereumDataTypeOneKey, EthereumDefinitionType, EthereumDefinitions, EthereumFieldType, EthereumFieldTypeOneKey, EthereumGetAddress, EthereumGetAddressOneKey, EthereumGetPublicKey, EthereumGetPublicKeyOneKey, EthereumGnosisSafeTxAck, EthereumGnosisSafeTxOperation, EthereumGnosisSafeTxRequest, EthereumMessageSignature, EthereumMessageSignatureOneKey, EthereumNetworkInfo, EthereumPublicKey, EthereumPublicKeyOneKey, EthereumSignMessage, EthereumSignMessageEIP712, EthereumSignMessageOneKey, EthereumSignTx, EthereumSignTxEIP1559, EthereumSignTxEIP1559OneKey, EthereumSignTxEIP7702OneKey, EthereumSignTxOneKey, EthereumSignTypedData, EthereumSignTypedDataOneKey, EthereumSignTypedDataQR, EthereumSignTypedHash, EthereumSignTypedHashOneKey, EthereumStructMember, EthereumStructMemberOneKey, EthereumTokenInfo, EthereumTxAck, EthereumTxAckOneKey, EthereumTxRequest, EthereumTxRequestOneKey, EthereumTypedDataSignature, EthereumTypedDataSignatureOneKey, EthereumTypedDataStructAck, EthereumTypedDataStructAckOneKey, EthereumTypedDataStructRequest, EthereumTypedDataStructRequestOneKey, EthereumTypedDataValueAck, EthereumTypedDataValueAckOneKey, EthereumTypedDataValueRequest, EthereumTypedDataValueRequestOneKey, EthereumVerifyMessage, EthereumVerifyMessageOneKey, ExportType, Failure, FailureType, Features, FileInfo, FileInfoList, FilecoinAddress, FilecoinGetAddress, FilecoinSignTx, FilecoinSignedTx, FilesystemDir, FilesystemDirList, FilesystemDirMake, FilesystemDirRemove, FilesystemFile, FilesystemFileDelete, FilesystemFileRead, FilesystemFileWrite, FilesystemFormat, FilesystemPathInfo, FilesystemPathInfoQuery, FilesystemPermissionFix, FirmwareErase, FirmwareErase_ex, FirmwareHash, FirmwareRequest, FirmwareUpdateEmmc, FirmwareUpload, GetAddress, GetDeviceInfo, GetECDHSessionKey, GetEntropy, GetFeatures, GetFirmwareHash, GetNextU2FCounter, GetNonce, GetOwnershipId, GetOwnershipProof, GetPassphraseState, GetPublicKey, GetPublicKeyMultiple, HDNodePathType, HDNodeType, IdentityType, Initialize, InputScriptType, InternalInputScriptType, InternalMyAddressRequest, KaspaAddress, KaspaGetAddress, KaspaInputScriptType, KaspaOutpoint, KaspaOutputScriptType, KaspaRequestType, KaspaSignTx, KaspaSignedTx, KaspaTxAckInput, KaspaTxAckOutput, KaspaTxAckPayloadChunk, KaspaTxAckPrevInput, KaspaTxAckPrevMeta, KaspaTxAckPrevOutput, KaspaTxInputAck, KaspaTxInputRequest, KaspaTxRequest, KaspaTxRequestSignature, ListResDir, LnurlAuth, LnurlAuthResp, LockDevice, LogBlockCommand, LowLevelDevice, LowlevelTransportSharedPlugin, MessageFromOneKey, MessageKey, MessageResponse, MessageResponseMap, MessageSignature, MessageType, messages as Messages, MoneroAccountPublicAddress, MoneroAddress, MoneroExportedKeyImage, MoneroGetAddress, MoneroGetTxKeyAck, MoneroGetTxKeyRequest, MoneroGetWatchKey, MoneroKeyImageExportInitAck, MoneroKeyImageExportInitRequest, MoneroKeyImageSyncFinalAck, MoneroKeyImageSyncFinalRequest, MoneroKeyImageSyncStepAck, MoneroKeyImageSyncStepRequest, MoneroLiveRefreshFinalAck, MoneroLiveRefreshFinalRequest, MoneroLiveRefreshStartAck, MoneroLiveRefreshStartRequest, MoneroLiveRefreshStepAck, MoneroLiveRefreshStepRequest, MoneroMultisigKLRki, MoneroNetworkType, MoneroOutputEntry, MoneroRctKeyPublic, MoneroRingCtSig, MoneroSubAddressIndicesList, MoneroTransactionAllInputsSetAck, MoneroTransactionAllInputsSetRequest, MoneroTransactionAllOutSetAck, MoneroTransactionAllOutSetRequest, MoneroTransactionData, MoneroTransactionDestinationEntry, MoneroTransactionFinalAck, MoneroTransactionFinalRequest, MoneroTransactionInitAck, MoneroTransactionInitRequest, MoneroTransactionInputViniAck, MoneroTransactionInputViniRequest, MoneroTransactionInputsPermutationAck, MoneroTransactionInputsPermutationRequest, MoneroTransactionRsigData, MoneroTransactionSetInputAck, MoneroTransactionSetInputRequest, MoneroTransactionSetOutputAck, MoneroTransactionSetOutputRequest, MoneroTransactionSignInputAck, MoneroTransactionSignInputRequest, MoneroTransactionSourceEntry, MoneroTransferDetails, MoneroWatchKey, MultisigRedeemScriptType, NEMAddress, NEMAggregateModification, NEMCosignatoryModification, NEMDecryptMessage, NEMDecryptedMessage, NEMGetAddress, NEMImportanceTransfer, NEMImportanceTransferMode, NEMModificationType, NEMMosaic, NEMMosaicCreation, NEMMosaicDefinition, NEMMosaicLevy, NEMMosaicSupplyChange, NEMProvisionNamespace, NEMSignTx, NEMSignedTx, NEMSupplyChangeType, NEMTransactionCommon, NEMTransfer, NFTWriteData, NFTWriteInfo, NearAddress, NearGetAddress, NearSignTx, NearSignedTx, NeoAddress, NeoGetAddress, NeoSignTx, NeoSignedTx, NervosAddress, NervosGetAddress, NervosSignTx, NervosSignedTx, NervosTxAck, NervosTxRequest, NexaAddress, NexaGetAddress, NexaSignTx, NexaSignedTx, NexaTxInputAck, NexaTxInputRequest, NextU2FCounter, NftUpdate, Nonce, NostrDecryptMessage, NostrDecryptedMessage, NostrEncryptMessage, NostrEncryptedMessage, NostrGetPublicKey, NostrPublicKey, NostrSignEvent, NostrSignSchnorr, NostrSignedEvent, NostrSignedSchnorr, OnboardingPhase, OnboardingSetupKind, OnboardingSetupMethod, OnboardingSetupStatus, OnboardingStatus, OnboardingStatusGet, OnboardingStep, OneKeyDeviceCommType, OneKeyDeviceInfo, OneKeyDeviceInfoBase, OneKeyDeviceInfoWithSession, OneKeyDeviceType, OneKeyMobileDeviceInfo, OneKeySEState, OneKeySeType, OnekeyFeatures, OnekeyGetFeatures, OutputScriptType, OwnershipId, OwnershipProof, PROTOCOL_V1_CHUNK_PAYLOAD_SIZE, PROTOCOL_V1_ENVELOPE_HEADER_SIZE, PROTOCOL_V1_HEADER_BYTE, PROTOCOL_V1_MESSAGE_HEADER_SIZE, PROTOCOL_V1_REPORT_ID, PROTOCOL_V1_USB_PACKET_SIZE, PROTOCOL_V2_BLE_FILE_CHUNK_SIZE, PROTOCOL_V2_BLE_FILE_READ_CHUNK_SIZE, PROTOCOL_V2_BLE_FIRMWARE_FILE_CHUNK_SIZE, PROTOCOL_V2_BLE_FRAME_MAX_BYTES, PROTOCOL_V2_CHANNEL_BLE_UART, PROTOCOL_V2_CHANNEL_SOCKET, PROTOCOL_V2_CHANNEL_USB, PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS, PROTOCOL_V2_FILE_CHUNK_SIZE, PROTOCOL_V2_FRAME_MAX_BYTES, PROTOCOL_V2_PACKET_SRC_COMMAND, PROTOCOL_V2_SYS_MESSAGE_THRESHOLD, PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE, PassphraseAck, PassphraseRequest, PassphraseState, Path, PaymentRequestMemo, PinMatrixAck, PinMatrixRequest, PinMatrixRequestType, Ping, PolkadotAddress, PolkadotGetAddress, PolkadotSignTx, PolkadotSignedTx, PortfolioUpdate, PreauthorizedRequest, PrevInput, PrevOutput, PrevTx, ProtocolInfo, ProtocolInfoRequest, ProtocolType, ProtocolV1, ProtocolV2, ProtocolV2BleFrameWriterOptions, ProtocolV2CallContext, ProtocolV2CallOptions, ProtocolV2Capability, ProtocolV2DeviceInfo, ProtocolV2FailureType, ProtocolV2FrameAssembler, ProtocolV2LinkAdapter, ProtocolV2LinkError, ProtocolV2LinkErrorClassification, ProtocolV2LinkErrorCode, ProtocolV2LinkManager, ProtocolV2LinkManagerOptions, ProtocolV2Schemas, ProtocolV2SequenceCursor, ProtocolV2Session, ProtocolV2SessionOptions, ProtocolV2UsbTransportBase, ProtocolV2UsbTransportBaseOptions, PublicKey, PublicKeyMultiple, ReadSEPublicCert, ReadSEPublicKey, Reboot, RebootToBoardloader, RebootToBootloader, RebootType, RecoveryDevice, RecoveryDeviceType, RefundMemo, RequestType, ResetDevice, ResourceAck, ResourceRequest, ResourceType, ResourceUpdate, ResourceUpload, RippleAddress, RippleGetAddress, RipplePayment, RippleSignTx, RippleSignedTx, SEMessageSignature, SEPublicCert, SEPublicKey, SESignMessage, SafetyCheckLevel, ScdoAddress, ScdoGetAddress, ScdoSignMessage, ScdoSignTx, ScdoSignedMessage, ScdoSignedTx, ScdoTxAck, SdProtect, SdProtectOperationType, SeedRequestType, SelfTest, SetBusy, SetU2FCounter, SignIdentity, SignMessage, SignPsbt, SignTx, SignedIdentity, SignedPsbt, SolanaAddress, SolanaGetAddress, SolanaMessageSignature, SolanaOffChainMessageFormat, SolanaOffChainMessageVersion, SolanaSignOffChainMessage, SolanaSignTx, SolanaSignUnsafeMessage, SolanaSignedTx, SolanaTxATADetails, SolanaTxExtraInfo, SpiFlashData, SpiFlashRead, SpiFlashWrite, StarcoinAddress, StarcoinGetAddress, StarcoinGetPublicKey, StarcoinMessageSignature, StarcoinPublicKey, StarcoinSignMessage, StarcoinSignTx, StarcoinSignedTx, StarcoinVerifyMessage, StellarAccountMergeOp, StellarAddress, StellarAllowTrustOp, StellarAsset, StellarAssetType, StellarBumpSequenceOp, StellarChangeTrustOp, StellarCreateAccountOp, StellarCreatePassiveSellOfferOp, StellarGetAddress, StellarInvokeHostFunctionOp, StellarManageBuyOfferOp, StellarManageDataOp, StellarManageSellOfferOp, StellarMemoType, StellarPathPaymentStrictReceiveOp, StellarPathPaymentStrictSendOp, StellarPaymentOp, StellarRequestType, StellarSetOptionsOp, StellarSignTx, StellarSignedTx, StellarSignerType, StellarSorobanDataAck, StellarSorobanDataRequest, StellarTxOpRequest, Success, SuiAddress, SuiGetAddress, SuiMessageSignature, SuiSignMessage, SuiSignTx, SuiSignedTx, SuiTxAck, SuiTxRequest, TRANSPORT_EVENT, TextMemo, TezosAddress, TezosBallotOp, TezosBallotType, TezosContractID, TezosContractType, TezosDelegationOp, TezosGetAddress, TezosGetPublicKey, TezosManagerTransfer, TezosOriginationOp, TezosParametersManager, TezosProposalOp, TezosPublicKey, TezosRevealOp, TezosSignTx, TezosSignedTx, TezosTransactionOp, TonAddress, TonGetAddress, TonSignData, TonSignDataType, TonSignMessage, TonSignProof, TonSignedData, TonSignedMessage, TonSignedProof, TonTxAck, TonWalletVersion, TonWorkChain, Transport, TransportCallOptions, TransportDeviceDisconnectEvent, TransportWriteMetrics, TronAddress, TronCancelAllUnfreezeV2Contract, TronContract, TronDelegateResourceContract, TronFreezeBalanceContract, TronFreezeBalanceV2Contract, TronGetAddress, TronMessageSignature, TronMessageType, TronResourceCode, TronSignMessage, TronSignTx, TronSignedTx, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceContract, TronUnfreezeBalanceV2Contract, TronVoteWitnessContract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, TxAck, TxAckInput, TxAckInputWrapper, TxAckOutput, TxAckOutputWrapper, TxAckPaymentRequest, TxAckPrevExtraData, TxAckPrevExtraDataWrapper, TxAckPrevInput, TxAckPrevInputWrapper, TxAckPrevMeta, TxAckPrevOutput, TxAckPrevOutputWrapper, TxAckResponse, TxInput, TxInputType, TxOutput, TxOutputBinType, TxOutputType, TxRequest, TxRequestDetailsType, TxRequestSerializedType, TypedCall, UiAnimationCommand, UiAnimationRequest, UiAnimationType, UintType, UnLockDevice, UnLockDeviceResponse, UnlockPath, UnlockedPathRequest, UpgradeFileHeader, VerifyMessage, ViewAmount, ViewDetail, ViewRawData, ViewSignLayout, ViewSignPage, ViewTip, ViewTipType, ViewVerifyPage, Vote, WL_OperationType, WipeDevice, WordAck, WordRequest, WordRequestType, WriteSEPrivateKey, WriteSEPublicCert, ZoomRequest, bytesToHex, concatUint8Arrays, createTransportCallLog, _default as default, experimental_field, experimental_message, facotry, getErrorMessage, getSafeTransportLogPayload, hexToBytes, isProtocolV2HighThroughputCall, isProtocolV2LinkError, probeProtocolV2, index as protocolV1, protocolV2Codec as protocolV2, shouldSuppressHighVolumeCallLog, withProtocolTimeout, writeProtocolV2BleFrame };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO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const PROTOCOL_V2_FRAME_MAX_BYTES = 4200;
274
274
  const PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE = 4000;
275
275
  const PROTOCOL_V2_BLE_FILE_CHUNK_SIZE = 1800;
276
+ const PROTOCOL_V2_BLE_FIRMWARE_FILE_CHUNK_SIZE = 1960;
276
277
  const PROTOCOL_V2_BLE_FILE_READ_CHUNK_SIZE = 900;
277
278
  const PROTOCOL_V2_BLE_FRAME_MAX_BYTES = 2048;
278
279
  const PROTOCOL_V2_FILE_CHUNK_SIZE = PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE;
@@ -898,14 +899,27 @@ function bytesToHex(bytes) {
898
899
  .map(b => b.toString(16).padStart(2, '0'))
899
900
  .join('');
900
901
  }
901
- const HIGH_VOLUME_PROTOCOL_V2_CALLS = new Set([
902
+ const REDUCED_DEBUG_PROTOCOL_V2_CALLS = new Set([
902
903
  ...LogBlockCommand,
903
904
  'FilesystemFileRead',
904
905
  'FileRead',
905
906
  'EmmcFileRead',
906
907
  ]);
907
908
  function shouldReduceProtocolV2Debug(name) {
908
- return HIGH_VOLUME_PROTOCOL_V2_CALLS.has(name);
909
+ return REDUCED_DEBUG_PROTOCOL_V2_CALLS.has(name);
910
+ }
911
+ const HIGH_THROUGHPUT_PROTOCOL_V2_CALLS = new Set([
912
+ 'FilesystemFileWrite',
913
+ 'FileWrite',
914
+ 'EmmcFileWrite',
915
+ 'FirmwareUpload',
916
+ 'ResourceAck',
917
+ 'FilesystemFileRead',
918
+ 'FileRead',
919
+ 'EmmcFileRead',
920
+ ]);
921
+ function isProtocolV2HighThroughputCall(name) {
922
+ return HIGH_THROUGHPUT_PROTOCOL_V2_CALLS.has(name);
909
923
  }
910
924
  const COMMON_TERMINAL_RESPONSE_TYPES = new Set([
911
925
  'Failure',
@@ -993,11 +1007,11 @@ class ProtocolV2Session {
993
1007
  : PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS;
994
1008
  const abortController = new AbortController();
995
1009
  const shouldReduceDebug = shouldReduceProtocolV2Debug(name);
996
- const baseCallContext = Object.assign(Object.assign({ messageName: name, timeoutMs, highVolume: shouldReduceDebug }, (callOptions.writeWithResponse === undefined
1010
+ const baseCallContext = Object.assign(Object.assign({ messageName: name, timeoutMs, highThroughput: isProtocolV2HighThroughputCall(name) }, (callOptions.writeWithResponse === undefined
997
1011
  ? {}
998
1012
  : { writeWithResponse: callOptions.writeWithResponse })), { generation, signal: abortController.signal });
999
1013
  const runCall = () => __awaiter(this, void 0, void 0, function* () {
1000
- var _a, _b, _c, _d;
1014
+ var _a, _b, _c, _d, _e, _f;
1001
1015
  yield (prepareCall === null || prepareCall === void 0 ? void 0 : prepareCall(baseCallContext));
1002
1016
  const protoSeq = this.sequenceCursor.next();
1003
1017
  const frame = ProtocolV2.encodeFrame(schemas, name, data, {
@@ -1008,7 +1022,17 @@ class ProtocolV2Session {
1008
1022
  if (maxFrameBytes !== undefined && frame.length > maxFrameBytes) {
1009
1023
  throw new Error(`Protocol V2 frame too large for transport: ${frame.length} > ${maxFrameBytes}`);
1010
1024
  }
1025
+ const writeStartedAt = Date.now();
1011
1026
  yield writeFrame(frame, baseCallContext);
1027
+ try {
1028
+ (_a = callOptions.onWriteCompleted) === null || _a === void 0 ? void 0 : _a.call(callOptions, {
1029
+ elapsedMs: Math.max(Date.now() - writeStartedAt, 0),
1030
+ frameBytes: frame.byteLength,
1031
+ });
1032
+ }
1033
+ catch (error) {
1034
+ (_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)}`);
1035
+ }
1012
1036
  while (!abortController.signal.aborted) {
1013
1037
  const rxFrame = yield readFrame(baseCallContext);
1014
1038
  if (abortController.signal.aborted)
@@ -1051,14 +1075,14 @@ class ProtocolV2Session {
1051
1075
  }
1052
1076
  this.lastResponseSequence = decoded.seq;
1053
1077
  const response = call(decoded);
1054
- if ((_a = callOptions.intermediateTypes) === null || _a === void 0 ? void 0 : _a.includes(response.type)) {
1055
- (_b = callOptions.onIntermediateResponse) === null || _b === void 0 ? void 0 : _b.call(callOptions, response);
1078
+ if ((_c = callOptions.intermediateTypes) === null || _c === void 0 ? void 0 : _c.includes(response.type)) {
1079
+ (_d = callOptions.onIntermediateResponse) === null || _d === void 0 ? void 0 : _d.call(callOptions, response);
1056
1080
  }
1057
1081
  else if (isExpectedTerminalResponse(response, callOptions.expectedTypes)) {
1058
1082
  return response;
1059
1083
  }
1060
1084
  else if (!shouldReduceDebug) {
1061
- (_c = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _c === void 0 ? void 0 : _c.call(logger, `[${logPrefix}] skip unexpected response for ${name}: expected=${(_d = callOptions.expectedTypes) === null || _d === void 0 ? void 0 : _d.join('|')} got=${response.type}`);
1085
+ (_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}`);
1062
1086
  }
1063
1087
  }
1064
1088
  }
@@ -2271,6 +2295,7 @@ exports.PROTOCOL_V1_REPORT_ID = PROTOCOL_V1_REPORT_ID;
2271
2295
  exports.PROTOCOL_V1_USB_PACKET_SIZE = PROTOCOL_V1_USB_PACKET_SIZE;
2272
2296
  exports.PROTOCOL_V2_BLE_FILE_CHUNK_SIZE = PROTOCOL_V2_BLE_FILE_CHUNK_SIZE;
2273
2297
  exports.PROTOCOL_V2_BLE_FILE_READ_CHUNK_SIZE = PROTOCOL_V2_BLE_FILE_READ_CHUNK_SIZE;
2298
+ exports.PROTOCOL_V2_BLE_FIRMWARE_FILE_CHUNK_SIZE = PROTOCOL_V2_BLE_FIRMWARE_FILE_CHUNK_SIZE;
2274
2299
  exports.PROTOCOL_V2_BLE_FRAME_MAX_BYTES = PROTOCOL_V2_BLE_FRAME_MAX_BYTES;
2275
2300
  exports.PROTOCOL_V2_CHANNEL_BLE_UART = PROTOCOL_V2_CHANNEL_BLE_UART;
2276
2301
  exports.PROTOCOL_V2_CHANNEL_SOCKET = PROTOCOL_V2_CHANNEL_SOCKET;
@@ -2297,6 +2322,7 @@ exports["default"] = index;
2297
2322
  exports.getErrorMessage = getErrorMessage;
2298
2323
  exports.getSafeTransportLogPayload = getSafeTransportLogPayload;
2299
2324
  exports.hexToBytes = hexToBytes;
2325
+ exports.isProtocolV2HighThroughputCall = isProtocolV2HighThroughputCall;
2300
2326
  exports.isProtocolV2LinkError = isProtocolV2LinkError;
2301
2327
  exports.probeProtocolV2 = probeProtocolV2;
2302
2328
  exports.protocolV1 = index$1;
@@ -1,7 +1,7 @@
1
1
  import { ProtocolV2FrameAssembler, concatUint8Arrays } from './frame-assembler';
2
2
  import { ProtocolV2SequenceCursor } from './sequence-cursor';
3
3
  import type { Root } from 'protobufjs/light';
4
- import type { MessageFromOneKey } from '../../types';
4
+ import type { MessageFromOneKey, TransportWriteMetrics } from '../../types';
5
5
  export * from './errors';
6
6
  export type ProtocolV2Schemas = {
7
7
  protocolV1: Root;
@@ -10,7 +10,7 @@ export type ProtocolV2Schemas = {
10
10
  export type ProtocolV2CallContext = {
11
11
  messageName: string;
12
12
  timeoutMs?: number;
13
- highVolume: boolean;
13
+ highThroughput: boolean;
14
14
  writeWithResponse?: boolean;
15
15
  generation: number;
16
16
  signal: AbortSignal;
@@ -38,12 +38,14 @@ export type ProtocolV2CallOptions = {
38
38
  expectedTypes?: string[];
39
39
  intermediateTypes?: string[];
40
40
  onIntermediateResponse?: (response: MessageFromOneKey) => void;
41
+ onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
41
42
  writeWithResponse?: boolean;
42
43
  };
43
44
  export { concatUint8Arrays, ProtocolV2FrameAssembler };
44
45
  export { ProtocolV2SequenceCursor };
45
46
  export declare function hexToBytes(hex: string): Uint8Array;
46
47
  export declare function bytesToHex(bytes: Uint8Array): string;
48
+ export declare function isProtocolV2HighThroughputCall(name: string): boolean;
47
49
  export declare function getErrorMessage(error: unknown): string;
48
50
  export declare function withProtocolTimeout<T>(promise: Promise<T>, timeoutMs: number | undefined, createTimeoutError: () => Error, onTimeout?: () => void, abortSignal?: AbortSignal): Promise<T>;
49
51
  export declare class ProtocolV2Session {
@@ -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;AAM7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,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,UAAU,EAAE,OAAO,CAAC;IACpB,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,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,C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;IAI1D,OAAO,CAAC,WAAW,CAAuC;IAE1D,OAAO,CAAC,oBAAoB,CAAC,CAAS;gBAE1B,OAAO,EAAE,wBAAwB;IAK7C,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,WAAW,GAAE,qBAA0B,GACtC,OAAO,CAAC,iBAAiB,CAAC;IAS7B,OAAO,CAAC,WAAW;CAgKpB;AAED,wBAAsB,eAAe,CAAC,EACpC,IAAI,EACJ,SAAS,EACT,MAAM,EACN,SAAwB,EACxB,aAAa,EACb,aAAa,GACd,EAAE;IACD,IAAI,EAAE,CACJ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,qBAAqB,KAC5B,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,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;CAC1D,oBAuBA"}
@@ -42,11 +42,16 @@ export type MessageFromOneKey = {
42
42
  type: string;
43
43
  message: Record<string, any>;
44
44
  };
45
+ export type TransportWriteMetrics = {
46
+ elapsedMs: number;
47
+ frameBytes: number;
48
+ };
45
49
  export type TransportCallOptions = {
46
50
  timeoutMs?: number;
47
51
  expectedTypes?: string[];
48
52
  intermediateTypes?: string[];
49
53
  onIntermediateResponse?: (response: MessageFromOneKey) => void;
54
+ onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
50
55
  writeWithResponse?: boolean;
51
56
  };
52
57
  type ITransportInitFn = (logger?: any, emitter?: EventEmitter, plugin?: LowlevelTransportSharedPlugin) => Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/types/transport.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAEvC,eAAO,MAAM,eAAe;;CAElB,CAAC;AAEX,MAAM,MAAM,8BAA8B,GAAG;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAC5B,KAAK,GACL,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,cAAc,GACd,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG;IAC9D,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,oBAAoB,CAAC;CAChC,CAAC;AAGF,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GACjD,2BAA2B,GAC3B,sBAAsB,GAAG;IACvB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEJ,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAA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{
2
2
  "name": "@onekeyfe/hd-transport",
3
- "version": "1.2.0-alpha.70",
3
+ "version": "1.2.0-alpha.72",
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": "d86b033cf970f97e060c49fe4cf618f38b9ce666"
31
+ "gitHead": "76311ccd3753eca8e492b5324f93542bd38525ba"
32
32
  }
package/src/constants.ts CHANGED
@@ -29,6 +29,12 @@ export const PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE = 4000;
29
29
  /** FilesystemFileWrite chunk size over BLE. */
30
30
  export const PROTOCOL_V2_BLE_FILE_CHUNK_SIZE = 1800;
31
31
 
32
+ /**
33
+ * FirmwareUpdateV4 chunk size for its fixed BLE staging paths.
34
+ * The longest current path still leaves 28 bytes below the 2048-byte BLE frame limit.
35
+ */
36
+ export const PROTOCOL_V2_BLE_FIRMWARE_FILE_CHUNK_SIZE = 1960;
37
+
32
38
  /** BLE FilesystemFileRead chunk size, limited by the Pro2 1024-byte UART TX buffer. */
33
39
  export const PROTOCOL_V2_BLE_FILE_READ_CHUNK_SIZE = 900;
34
40
 
package/src/index.ts CHANGED
@@ -36,6 +36,7 @@ export type {
36
36
  OneKeyDeviceInfoWithSession,
37
37
  MessageFromOneKey,
38
38
  TransportCallOptions,
39
+ TransportWriteMetrics,
39
40
  LowlevelTransportSharedPlugin,
40
41
  LowLevelDevice,
41
42
  OneKeyDeviceInfoBase,
@@ -10,7 +10,7 @@ import * as check from '../../utils/highlevel-checks';
10
10
  import { LogBlockCommand } from '../../utils/logBlockCommand';
11
11
 
12
12
  import type { Root } from 'protobufjs/light';
13
- import type { MessageFromOneKey } from '../../types';
13
+ import type { MessageFromOneKey, TransportWriteMetrics } from '../../types';
14
14
 
15
15
  export * from './errors';
16
16
 
@@ -22,7 +22,7 @@ export type ProtocolV2Schemas = {
22
22
  export type ProtocolV2CallContext = {
23
23
  messageName: string;
24
24
  timeoutMs?: number;
25
- highVolume: boolean;
25
+ highThroughput: boolean;
26
26
  writeWithResponse?: boolean;
27
27
  generation: number;
28
28
  signal: AbortSignal;
@@ -53,6 +53,7 @@ export type ProtocolV2CallOptions = {
53
53
  expectedTypes?: string[];
54
54
  intermediateTypes?: string[];
55
55
  onIntermediateResponse?: (response: MessageFromOneKey) => void;
56
+ onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
56
57
  writeWithResponse?: boolean;
57
58
  };
58
59
 
@@ -80,7 +81,7 @@ export function bytesToHex(bytes: Uint8Array): string {
80
81
  .join('');
81
82
  }
82
83
 
83
- const HIGH_VOLUME_PROTOCOL_V2_CALLS = new Set([
84
+ const REDUCED_DEBUG_PROTOCOL_V2_CALLS = new Set([
84
85
  ...LogBlockCommand,
85
86
  'FilesystemFileRead',
86
87
  'FileRead',
@@ -88,7 +89,22 @@ const HIGH_VOLUME_PROTOCOL_V2_CALLS = new Set([
88
89
  ]);
89
90
 
90
91
  function shouldReduceProtocolV2Debug(name: string) {
91
- return HIGH_VOLUME_PROTOCOL_V2_CALLS.has(name);
92
+ return REDUCED_DEBUG_PROTOCOL_V2_CALLS.has(name);
93
+ }
94
+
95
+ const HIGH_THROUGHPUT_PROTOCOL_V2_CALLS = new Set([
96
+ 'FilesystemFileWrite',
97
+ 'FileWrite',
98
+ 'EmmcFileWrite',
99
+ 'FirmwareUpload',
100
+ 'ResourceAck',
101
+ 'FilesystemFileRead',
102
+ 'FileRead',
103
+ 'EmmcFileRead',
104
+ ]);
105
+
106
+ export function isProtocolV2HighThroughputCall(name: string) {
107
+ return HIGH_THROUGHPUT_PROTOCOL_V2_CALLS.has(name);
92
108
  }
93
109
 
94
110
  const COMMON_TERMINAL_RESPONSE_TYPES = new Set([
@@ -221,7 +237,7 @@ export class ProtocolV2Session {
221
237
  const baseCallContext: ProtocolV2CallContext = {
222
238
  messageName: name,
223
239
  timeoutMs,
224
- highVolume: shouldReduceDebug,
240
+ highThroughput: isProtocolV2HighThroughputCall(name),
225
241
  ...(callOptions.writeWithResponse === undefined
226
242
  ? {}
227
243
  : { writeWithResponse: callOptions.writeWithResponse }),
@@ -244,7 +260,16 @@ export class ProtocolV2Session {
244
260
  );
245
261
  }
246
262
 
263
+ const writeStartedAt = Date.now();
247
264
  await writeFrame(frame, baseCallContext);
265
+ try {
266
+ callOptions.onWriteCompleted?.({
267
+ elapsedMs: Math.max(Date.now() - writeStartedAt, 0),
268
+ frameBytes: frame.byteLength,
269
+ });
270
+ } catch (error) {
271
+ logger?.error?.(`${logPrefix} write metrics callback failed: ${String(error)}`);
272
+ }
248
273
 
249
274
  // Some Protocol V2 operations emit progress notifications before the
250
275
  // terminal response. Consume those frames here so callers still see a
@@ -58,11 +58,18 @@ export type AcquireInput = {
58
58
 
59
59
  export type MessageFromOneKey = { type: string; message: Record<string, any> };
60
60
 
61
+ export type TransportWriteMetrics = {
62
+ elapsedMs: number;
63
+ frameBytes: number;
64
+ };
65
+
61
66
  export type TransportCallOptions = {
62
67
  timeoutMs?: number;
63
68
  expectedTypes?: string[];
64
69
  intermediateTypes?: string[];
65
70
  onIntermediateResponse?: (response: MessageFromOneKey) => void;
71
+ /** Called after the complete request frame has been submitted to the transport. */
72
+ onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
66
73
  /** Prefer acknowledged BLE characteristic writes for this call when supported. */
67
74
  writeWithResponse?: boolean;
68
75
  };