@onekeyfe/hd-core 1.2.2-alpha.0 → 1.2.2-alpha.10

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.
Files changed (38) hide show
  1. package/__tests__/AllNetworkGetAddressBase.tracing.test.ts +2 -2
  2. package/__tests__/device-lifecycle-events.test.ts +67 -0
  3. package/__tests__/deviceUploadNft.test.ts +27 -0
  4. package/__tests__/firmware-update/firmware-update-v4-install-poll.test.ts +322 -21
  5. package/__tests__/open-wallet-session.test.ts +613 -80
  6. package/__tests__/pro2HostAssetPackage.test.ts +108 -1
  7. package/__tests__/protocol-v2.test.ts +231 -49
  8. package/__tests__/protocolV2FileWrite.test.ts +40 -0
  9. package/dist/api/FirmwareUpdateV4.d.ts +2 -0
  10. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  11. package/dist/api/OpenWalletSession.d.ts.map +1 -1
  12. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
  13. package/dist/api/helpers/protocolV2FileWrite.d.ts +1 -0
  14. package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -1
  15. package/dist/api/protocol-v2/DeviceUploadNft.d.ts.map +1 -1
  16. package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts.map +1 -1
  17. package/dist/core/RequestQueue.d.ts +2 -0
  18. package/dist/core/RequestQueue.d.ts.map +1 -1
  19. package/dist/core/index.d.ts +2 -1
  20. package/dist/core/index.d.ts.map +1 -1
  21. package/dist/index.d.ts +12 -1
  22. package/dist/index.js +1454 -1144
  23. package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
  24. package/dist/utils/patch.d.ts +1 -1
  25. package/dist/utils/patch.d.ts.map +1 -1
  26. package/dist/utils/pro2HostAssetPackage.d.ts.map +1 -1
  27. package/package.json +4 -4
  28. package/src/api/FirmwareUpdateV4.ts +73 -23
  29. package/src/api/OpenWalletSession.ts +0 -3
  30. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +3 -1
  31. package/src/api/helpers/protocolV2FileWrite.ts +11 -5
  32. package/src/api/protocol-v2/DeviceUploadNft.ts +4 -1
  33. package/src/api/protocol-v2/DeviceUploadWallpaper.ts +17 -3
  34. package/src/core/RequestQueue.ts +16 -1
  35. package/src/core/index.ts +48 -21
  36. package/src/data/messages/messages-protocol-v2.json +1471 -1367
  37. package/src/protocols/protocol-v2/walletSession.ts +157 -38
  38. package/src/utils/pro2HostAssetPackage.ts +143 -58
package/dist/index.js CHANGED
@@ -27030,503 +27030,6 @@ var MessagesLegacyV1JSON = {
27030
27030
  };
27031
27031
 
27032
27032
  var nested = {
27033
- wire_in: {
27034
- type: "bool",
27035
- id: 50002,
27036
- extend: "google.protobuf.EnumValueOptions"
27037
- },
27038
- wire_out: {
27039
- type: "bool",
27040
- id: 50003,
27041
- extend: "google.protobuf.EnumValueOptions"
27042
- },
27043
- wire_debug_in: {
27044
- type: "bool",
27045
- id: 50004,
27046
- extend: "google.protobuf.EnumValueOptions"
27047
- },
27048
- wire_debug_out: {
27049
- type: "bool",
27050
- id: 50005,
27051
- extend: "google.protobuf.EnumValueOptions"
27052
- },
27053
- wire_tiny: {
27054
- type: "bool",
27055
- id: 50006,
27056
- extend: "google.protobuf.EnumValueOptions"
27057
- },
27058
- wire_bootloader: {
27059
- type: "bool",
27060
- id: 50007,
27061
- extend: "google.protobuf.EnumValueOptions"
27062
- },
27063
- wire_no_fsm: {
27064
- type: "bool",
27065
- id: 50008,
27066
- extend: "google.protobuf.EnumValueOptions"
27067
- },
27068
- bitcoin_only: {
27069
- type: "bool",
27070
- id: 60000,
27071
- extend: "google.protobuf.EnumValueOptions"
27072
- },
27073
- has_bitcoin_only_values: {
27074
- type: "bool",
27075
- id: 51001,
27076
- extend: "google.protobuf.EnumOptions"
27077
- },
27078
- experimental_message: {
27079
- type: "bool",
27080
- id: 52001,
27081
- extend: "google.protobuf.MessageOptions"
27082
- },
27083
- wire_type: {
27084
- type: "uint32",
27085
- id: 52002,
27086
- extend: "google.protobuf.MessageOptions"
27087
- },
27088
- experimental_field: {
27089
- type: "bool",
27090
- id: 53001,
27091
- extend: "google.protobuf.FieldOptions"
27092
- },
27093
- include_in_bitcoin_only: {
27094
- type: "bool",
27095
- id: 60000,
27096
- extend: "google.protobuf.FileOptions"
27097
- },
27098
- MessageType: {
27099
- options: {
27100
- "(has_bitcoin_only_values)": true
27101
- },
27102
- values: {
27103
- MessageType_Initialize: 0,
27104
- MessageType_ChangePin: 4,
27105
- MessageType_WipeDevice: 5,
27106
- MessageType_GetEntropy: 9,
27107
- MessageType_Entropy: 10,
27108
- MessageType_LoadDevice: 13,
27109
- MessageType_ResetDevice: 14,
27110
- MessageType_SetBusy: 16,
27111
- MessageType_Features: 17,
27112
- MessageType_Cancel: 20,
27113
- MessageType_LockDevice: 24,
27114
- MessageType_ApplySettings: 25,
27115
- MessageType_ButtonRequest: 26,
27116
- MessageType_ButtonAck: 27,
27117
- MessageType_ApplyFlags: 28,
27118
- MessageType_GetNonce: 31,
27119
- MessageType_Nonce: 33,
27120
- MessageType_BackupDevice: 34,
27121
- MessageType_EntropyRequest: 35,
27122
- MessageType_EntropyAck: 36,
27123
- MessageType_PassphraseRequest: 41,
27124
- MessageType_PassphraseAck: 42,
27125
- MessageType_RecoveryDevice: 45,
27126
- MessageType_WordRequest: 46,
27127
- MessageType_WordAck: 47,
27128
- MessageType_GetFeatures: 55,
27129
- MessageType_SdProtect: 79,
27130
- MessageType_ChangeWipeCode: 82,
27131
- MessageType_DoPreauthorized: 84,
27132
- MessageType_PreauthorizedRequest: 85,
27133
- MessageType_CancelAuthorization: 86,
27134
- MessageType_GetFirmwareHash: 88,
27135
- MessageType_FirmwareHash: 89,
27136
- MessageType_UnlockPath: 93,
27137
- MessageType_UnlockedPathRequest: 94,
27138
- MessageType_SetU2FCounter: 63,
27139
- MessageType_GetNextU2FCounter: 80,
27140
- MessageType_NextU2FCounter: 81,
27141
- MessageType_Deprecated_PassphraseStateRequest: 77,
27142
- MessageType_Deprecated_PassphraseStateAck: 78,
27143
- MessageType_GetPublicKey: 11,
27144
- MessageType_PublicKey: 12,
27145
- MessageType_SignTx: 15,
27146
- MessageType_TxRequest: 21,
27147
- MessageType_TxAck: 22,
27148
- MessageType_GetAddress: 29,
27149
- MessageType_Address: 30,
27150
- MessageType_TxAckPaymentRequest: 37,
27151
- MessageType_SignMessage: 38,
27152
- MessageType_VerifyMessage: 39,
27153
- MessageType_MessageSignature: 40,
27154
- MessageType_GetOwnershipId: 43,
27155
- MessageType_OwnershipId: 44,
27156
- MessageType_GetOwnershipProof: 49,
27157
- MessageType_OwnershipProof: 50,
27158
- MessageType_AuthorizeCoinJoin: 51,
27159
- MessageType_SignPsbt: 10052,
27160
- MessageType_SignedPsbt: 10053,
27161
- MessageType_CipherKeyValue: 23,
27162
- MessageType_CipheredKeyValue: 48,
27163
- MessageType_SignIdentity: 53,
27164
- MessageType_SignedIdentity: 54,
27165
- MessageType_GetECDHSessionKey: 61,
27166
- MessageType_ECDHSessionKey: 62,
27167
- MessageType_CosiCommit: 71,
27168
- MessageType_CosiCommitment: 72,
27169
- MessageType_CosiSign: 73,
27170
- MessageType_CosiSignature: 74,
27171
- MessageType_BatchGetPublickeys: 10016,
27172
- MessageType_EcdsaPublicKeys: 10017,
27173
- MessageType_EthereumGetPublicKey: 450,
27174
- MessageType_EthereumPublicKey: 451,
27175
- MessageType_EthereumGetAddress: 56,
27176
- MessageType_EthereumAddress: 57,
27177
- MessageType_EthereumSignTx: 58,
27178
- MessageType_EthereumSignTxEIP1559: 452,
27179
- MessageType_EthereumTxRequest: 59,
27180
- MessageType_EthereumTxAck: 60,
27181
- MessageType_EthereumSignMessage: 64,
27182
- MessageType_EthereumVerifyMessage: 65,
27183
- MessageType_EthereumMessageSignature: 66,
27184
- MessageType_EthereumSignTypedData: 464,
27185
- MessageType_EthereumTypedDataStructRequest: 465,
27186
- MessageType_EthereumTypedDataStructAck: 466,
27187
- MessageType_EthereumTypedDataValueRequest: 467,
27188
- MessageType_EthereumTypedDataValueAck: 468,
27189
- MessageType_EthereumTypedDataSignature: 469,
27190
- MessageType_EthereumSignTypedHash: 470,
27191
- MessageType_EthereumGetPublicKeyOneKey: 20100,
27192
- MessageType_EthereumPublicKeyOneKey: 20101,
27193
- MessageType_EthereumGetAddressOneKey: 20102,
27194
- MessageType_EthereumAddressOneKey: 20103,
27195
- MessageType_EthereumSignTxOneKey: 20104,
27196
- MessageType_EthereumSignTxEIP1559OneKey: 20105,
27197
- MessageType_EthereumTxRequestOneKey: 20106,
27198
- MessageType_EthereumTxAckOneKey: 20107,
27199
- MessageType_EthereumSignMessageOneKey: 20108,
27200
- MessageType_EthereumVerifyMessageOneKey: 20109,
27201
- MessageType_EthereumMessageSignatureOneKey: 20110,
27202
- MessageType_EthereumSignTypedDataOneKey: 20111,
27203
- MessageType_EthereumTypedDataStructRequestOneKey: 20112,
27204
- MessageType_EthereumTypedDataStructAckOneKey: 20113,
27205
- MessageType_EthereumTypedDataValueRequestOneKey: 20114,
27206
- MessageType_EthereumTypedDataValueAckOneKey: 20115,
27207
- MessageType_EthereumTypedDataSignatureOneKey: 20116,
27208
- MessageType_EthereumSignTypedHashOneKey: 20117,
27209
- MessageType_EthereumGnosisSafeTxAck: 20118,
27210
- MessageType_EthereumGnosisSafeTxRequest: 20119,
27211
- MessageType_EthereumSignTxEIP7702OneKey: 20120,
27212
- MessageType_EthereumSignTypedDataQR: 20121,
27213
- MessageType_NEMGetAddress: 67,
27214
- MessageType_NEMAddress: 68,
27215
- MessageType_NEMSignTx: 69,
27216
- MessageType_NEMSignedTx: 70,
27217
- MessageType_NEMDecryptMessage: 75,
27218
- MessageType_NEMDecryptedMessage: 76,
27219
- MessageType_TezosGetAddress: 150,
27220
- MessageType_TezosAddress: 151,
27221
- MessageType_TezosSignTx: 152,
27222
- MessageType_TezosSignedTx: 153,
27223
- MessageType_TezosGetPublicKey: 154,
27224
- MessageType_TezosPublicKey: 155,
27225
- MessageType_StellarSignTx: 202,
27226
- MessageType_StellarTxOpRequest: 203,
27227
- MessageType_StellarGetAddress: 207,
27228
- MessageType_StellarAddress: 208,
27229
- MessageType_StellarCreateAccountOp: 210,
27230
- MessageType_StellarPaymentOp: 211,
27231
- MessageType_StellarPathPaymentStrictReceiveOp: 212,
27232
- MessageType_StellarManageSellOfferOp: 213,
27233
- MessageType_StellarCreatePassiveSellOfferOp: 214,
27234
- MessageType_StellarSetOptionsOp: 215,
27235
- MessageType_StellarChangeTrustOp: 216,
27236
- MessageType_StellarAllowTrustOp: 217,
27237
- MessageType_StellarAccountMergeOp: 218,
27238
- MessageType_StellarManageDataOp: 220,
27239
- MessageType_StellarBumpSequenceOp: 221,
27240
- MessageType_StellarManageBuyOfferOp: 222,
27241
- MessageType_StellarPathPaymentStrictSendOp: 223,
27242
- MessageType_StellarSignedTx: 230,
27243
- MessageType_CardanoGetPublicKey: 305,
27244
- MessageType_CardanoPublicKey: 306,
27245
- MessageType_CardanoGetAddress: 307,
27246
- MessageType_CardanoAddress: 308,
27247
- MessageType_CardanoTxItemAck: 313,
27248
- MessageType_CardanoTxAuxiliaryDataSupplement: 314,
27249
- MessageType_CardanoTxWitnessRequest: 315,
27250
- MessageType_CardanoTxWitnessResponse: 316,
27251
- MessageType_CardanoTxHostAck: 317,
27252
- MessageType_CardanoTxBodyHash: 318,
27253
- MessageType_CardanoSignTxFinished: 319,
27254
- MessageType_CardanoSignTxInit: 320,
27255
- MessageType_CardanoTxInput: 321,
27256
- MessageType_CardanoTxOutput: 322,
27257
- MessageType_CardanoAssetGroup: 323,
27258
- MessageType_CardanoToken: 324,
27259
- MessageType_CardanoTxCertificate: 325,
27260
- MessageType_CardanoTxWithdrawal: 326,
27261
- MessageType_CardanoTxAuxiliaryData: 327,
27262
- MessageType_CardanoPoolOwner: 328,
27263
- MessageType_CardanoPoolRelayParameters: 329,
27264
- MessageType_CardanoGetNativeScriptHash: 330,
27265
- MessageType_CardanoNativeScriptHash: 331,
27266
- MessageType_CardanoTxMint: 332,
27267
- MessageType_CardanoTxCollateralInput: 333,
27268
- MessageType_CardanoTxRequiredSigner: 334,
27269
- MessageType_CardanoTxInlineDatumChunk: 335,
27270
- MessageType_CardanoTxReferenceScriptChunk: 336,
27271
- MessageType_CardanoTxReferenceInput: 337,
27272
- MessageType_CardanoSignMessage: 350,
27273
- MessageType_CardanoMessageSignature: 351,
27274
- MessageType_RippleGetAddress: 400,
27275
- MessageType_RippleAddress: 401,
27276
- MessageType_RippleSignTx: 402,
27277
- MessageType_RippleSignedTx: 403,
27278
- MessageType_MoneroTransactionInitRequest: 501,
27279
- MessageType_MoneroTransactionInitAck: 502,
27280
- MessageType_MoneroTransactionSetInputRequest: 503,
27281
- MessageType_MoneroTransactionSetInputAck: 504,
27282
- MessageType_MoneroTransactionInputViniRequest: 507,
27283
- MessageType_MoneroTransactionInputViniAck: 508,
27284
- MessageType_MoneroTransactionAllInputsSetRequest: 509,
27285
- MessageType_MoneroTransactionAllInputsSetAck: 510,
27286
- MessageType_MoneroTransactionSetOutputRequest: 511,
27287
- MessageType_MoneroTransactionSetOutputAck: 512,
27288
- MessageType_MoneroTransactionAllOutSetRequest: 513,
27289
- MessageType_MoneroTransactionAllOutSetAck: 514,
27290
- MessageType_MoneroTransactionSignInputRequest: 515,
27291
- MessageType_MoneroTransactionSignInputAck: 516,
27292
- MessageType_MoneroTransactionFinalRequest: 517,
27293
- MessageType_MoneroTransactionFinalAck: 518,
27294
- MessageType_MoneroKeyImageExportInitRequest: 530,
27295
- MessageType_MoneroKeyImageExportInitAck: 531,
27296
- MessageType_MoneroKeyImageSyncStepRequest: 532,
27297
- MessageType_MoneroKeyImageSyncStepAck: 533,
27298
- MessageType_MoneroKeyImageSyncFinalRequest: 534,
27299
- MessageType_MoneroKeyImageSyncFinalAck: 535,
27300
- MessageType_MoneroGetAddress: 540,
27301
- MessageType_MoneroAddress: 541,
27302
- MessageType_MoneroGetWatchKey: 542,
27303
- MessageType_MoneroWatchKey: 543,
27304
- MessageType_DebugMoneroDiagRequest: 546,
27305
- MessageType_DebugMoneroDiagAck: 547,
27306
- MessageType_MoneroGetTxKeyRequest: 550,
27307
- MessageType_MoneroGetTxKeyAck: 551,
27308
- MessageType_MoneroLiveRefreshStartRequest: 552,
27309
- MessageType_MoneroLiveRefreshStartAck: 553,
27310
- MessageType_MoneroLiveRefreshStepRequest: 554,
27311
- MessageType_MoneroLiveRefreshStepAck: 555,
27312
- MessageType_MoneroLiveRefreshFinalRequest: 556,
27313
- MessageType_MoneroLiveRefreshFinalAck: 557,
27314
- MessageType_EosGetPublicKey: 600,
27315
- MessageType_EosPublicKey: 601,
27316
- MessageType_EosSignTx: 602,
27317
- MessageType_EosTxActionRequest: 603,
27318
- MessageType_EosTxActionAck: 604,
27319
- MessageType_EosSignedTx: 605,
27320
- MessageType_BinanceGetAddress: 700,
27321
- MessageType_BinanceAddress: 701,
27322
- MessageType_BinanceGetPublicKey: 702,
27323
- MessageType_BinancePublicKey: 703,
27324
- MessageType_BinanceSignTx: 704,
27325
- MessageType_BinanceTxRequest: 705,
27326
- MessageType_BinanceTransferMsg: 706,
27327
- MessageType_BinanceOrderMsg: 707,
27328
- MessageType_BinanceCancelMsg: 708,
27329
- MessageType_BinanceSignedTx: 709,
27330
- MessageType_StarcoinGetAddress: 10300,
27331
- MessageType_StarcoinAddress: 10301,
27332
- MessageType_StarcoinGetPublicKey: 10302,
27333
- MessageType_StarcoinPublicKey: 10303,
27334
- MessageType_StarcoinSignTx: 10304,
27335
- MessageType_StarcoinSignedTx: 10305,
27336
- MessageType_StarcoinSignMessage: 10306,
27337
- MessageType_StarcoinMessageSignature: 10307,
27338
- MessageType_StarcoinVerifyMessage: 10308,
27339
- MessageType_ConfluxGetAddress: 10112,
27340
- MessageType_ConfluxAddress: 10113,
27341
- MessageType_ConfluxSignTx: 10114,
27342
- MessageType_ConfluxTxRequest: 10115,
27343
- MessageType_ConfluxTxAck: 10116,
27344
- MessageType_ConfluxSignMessage: 10117,
27345
- MessageType_ConfluxSignMessageCIP23: 10118,
27346
- MessageType_ConfluxMessageSignature: 10119,
27347
- MessageType_TronGetAddress: 10501,
27348
- MessageType_TronAddress: 10502,
27349
- MessageType_TronSignTx: 10503,
27350
- MessageType_TronSignedTx: 10504,
27351
- MessageType_TronSignMessage: 10505,
27352
- MessageType_TronMessageSignature: 10506,
27353
- MessageType_NearGetAddress: 10701,
27354
- MessageType_NearAddress: 10702,
27355
- MessageType_NearSignTx: 10703,
27356
- MessageType_NearSignedTx: 10704,
27357
- MessageType_AptosGetAddress: 10600,
27358
- MessageType_AptosAddress: 10601,
27359
- MessageType_AptosSignTx: 10602,
27360
- MessageType_AptosSignedTx: 10603,
27361
- MessageType_AptosSignMessage: 10604,
27362
- MessageType_AptosMessageSignature: 10605,
27363
- MessageType_AptosSignSIWAMessage: 10606,
27364
- MessageType_WebAuthnListResidentCredentials: 800,
27365
- MessageType_WebAuthnCredentials: 801,
27366
- MessageType_WebAuthnAddResidentCredential: 802,
27367
- MessageType_WebAuthnRemoveResidentCredential: 803,
27368
- MessageType_SolanaGetAddress: 10100,
27369
- MessageType_SolanaAddress: 10101,
27370
- MessageType_SolanaSignTx: 10102,
27371
- MessageType_SolanaSignedTx: 10103,
27372
- MessageType_SolanaSignOffChainMessage: 10104,
27373
- MessageType_SolanaMessageSignature: 10105,
27374
- MessageType_SolanaSignUnsafeMessage: 10106,
27375
- MessageType_CosmosGetAddress: 10800,
27376
- MessageType_CosmosAddress: 10801,
27377
- MessageType_CosmosSignTx: 10802,
27378
- MessageType_CosmosSignedTx: 10803,
27379
- MessageType_AlgorandGetAddress: 10900,
27380
- MessageType_AlgorandAddress: 10901,
27381
- MessageType_AlgorandSignTx: 10902,
27382
- MessageType_AlgorandSignedTx: 10903,
27383
- MessageType_PolkadotGetAddress: 11000,
27384
- MessageType_PolkadotAddress: 11001,
27385
- MessageType_PolkadotSignTx: 11002,
27386
- MessageType_PolkadotSignedTx: 11003,
27387
- MessageType_SuiGetAddress: 11100,
27388
- MessageType_SuiAddress: 11101,
27389
- MessageType_SuiSignTx: 11102,
27390
- MessageType_SuiSignedTx: 11103,
27391
- MessageType_SuiSignMessage: 11104,
27392
- MessageType_SuiMessageSignature: 11105,
27393
- MessageType_SuiTxRequest: 11106,
27394
- MessageType_SuiTxAck: 11107,
27395
- MessageType_FilecoinGetAddress: 11200,
27396
- MessageType_FilecoinAddress: 11201,
27397
- MessageType_FilecoinSignTx: 11202,
27398
- MessageType_FilecoinSignedTx: 11203,
27399
- MessageType_KaspaGetAddress: 11300,
27400
- MessageType_KaspaAddress: 11301,
27401
- MessageType_KaspaSignTx: 11302,
27402
- MessageType_KaspaSignedTx: 11303,
27403
- MessageType_KaspaTxInputRequest: 11304,
27404
- MessageType_KaspaTxInputAck: 11305,
27405
- MessageType_NexaGetAddress: 11400,
27406
- MessageType_NexaAddress: 11401,
27407
- MessageType_NexaSignTx: 11402,
27408
- MessageType_NexaSignedTx: 11403,
27409
- MessageType_NexaTxInputRequest: 11404,
27410
- MessageType_NexaTxInputAck: 11405,
27411
- MessageType_NostrGetPublicKey: 11500,
27412
- MessageType_NostrPublicKey: 11501,
27413
- MessageType_NostrSignEvent: 11502,
27414
- MessageType_NostrSignedEvent: 11503,
27415
- MessageType_NostrEncryptMessage: 11504,
27416
- MessageType_NostrEncryptedMessage: 11505,
27417
- MessageType_NostrDecryptMessage: 11506,
27418
- MessageType_NostrDecryptedMessage: 11507,
27419
- MessageType_NostrSignSchnorr: 11508,
27420
- MessageType_NostrSignedSchnorr: 11509,
27421
- MessageType_LnurlAuth: 11600,
27422
- MessageType_LnurlAuthResp: 11601,
27423
- MessageType_NervosGetAddress: 11701,
27424
- MessageType_NervosAddress: 11702,
27425
- MessageType_NervosSignTx: 11703,
27426
- MessageType_NervosSignedTx: 11704,
27427
- MessageType_NervosTxRequest: 11705,
27428
- MessageType_NervosTxAck: 11706,
27429
- MessageType_TonGetAddress: 11901,
27430
- MessageType_TonAddress: 11902,
27431
- MessageType_TonSignMessage: 11903,
27432
- MessageType_TonSignedMessage: 11904,
27433
- MessageType_TonSignProof: 11905,
27434
- MessageType_TonSignedProof: 11906,
27435
- MessageType_TonTxAck: 11907,
27436
- MessageType_AlephiumGetAddress: 12101,
27437
- MessageType_AlephiumAddress: 12102,
27438
- MessageType_AlephiumSignTx: 12103,
27439
- MessageType_AlephiumSignedTx: 12104,
27440
- MessageType_AlephiumTxRequest: 12105,
27441
- MessageType_AlephiumTxAck: 12106,
27442
- MessageType_AlephiumBytecodeRequest: 12107,
27443
- MessageType_AlephiumBytecodeAck: 12108,
27444
- MessageType_AlephiumSignMessage: 12109,
27445
- MessageType_AlephiumMessageSignature: 12110,
27446
- MessageType_BenfenGetAddress: 12201,
27447
- MessageType_BenfenAddress: 12202,
27448
- MessageType_BenfenSignTx: 12203,
27449
- MessageType_BenfenSignedTx: 12204,
27450
- MessageType_BenfenSignMessage: 12205,
27451
- MessageType_BenfenMessageSignature: 12206,
27452
- MessageType_BenfenTxRequest: 12207,
27453
- MessageType_BenfenTxAck: 12208,
27454
- MessageType_NeoGetAddress: 12301,
27455
- MessageType_NeoAddress: 12302,
27456
- MessageType_NeoSignTx: 12303,
27457
- MessageType_NeoSignedTx: 12304,
27458
- MessageType_DeviceFactoryInfoSet: 60000,
27459
- MessageType_DeviceFactoryInfoGet: 60001,
27460
- MessageType_DeviceFactoryInfo: 60002,
27461
- MessageType_DeviceFactoryPermanentLock: 60003,
27462
- MessageType_DeviceFactoryTest: 60004,
27463
- MessageType_ProtocolInfoRequest: 60200,
27464
- MessageType_ProtocolInfo: 60201,
27465
- MessageType_Ping: 60206,
27466
- MessageType_Success: 60207,
27467
- MessageType_Failure: 60208,
27468
- MessageType_DeviceReboot: 60400,
27469
- MessageType_DeviceSettings: 60410,
27470
- MessageType_DeviceSettingsGet: 60411,
27471
- MessageType_DeviceSettingsSet: 60412,
27472
- MessageType_DeviceSettingsPageShow: 60413,
27473
- MessageType_DeviceCertificate: 60420,
27474
- MessageType_DeviceCertificateWrite: 60421,
27475
- MessageType_DeviceCertificateRead: 60422,
27476
- MessageType_DeviceCertificateSignature: 60423,
27477
- MessageType_DeviceCertificateSign: 60424,
27478
- MessageType_DeviceMiscUsbMscControl: 60440,
27479
- MessageType_DeviceFindMyTokenState: 60450,
27480
- MessageType_DeviceFindMyTokenUpdate: 60451,
27481
- MessageType_DeviceFindMyTokenStateGet: 60452,
27482
- MessageType_DeviceInfoGet: 60600,
27483
- MessageType_DeviceInfo: 60601,
27484
- MessageType_DeviceStatusGet: 60602,
27485
- MessageType_DeviceStatus: 60603,
27486
- MessageType_FilesystemPermissionFix: 60800,
27487
- MessageType_FilesystemPathInfo: 60801,
27488
- MessageType_FilesystemPathInfoQuery: 60802,
27489
- MessageType_FilesystemFile: 60803,
27490
- MessageType_FilesystemFileRead: 60804,
27491
- MessageType_FilesystemFileWrite: 60805,
27492
- MessageType_FilesystemFileDelete: 60806,
27493
- MessageType_FilesystemDir: 60807,
27494
- MessageType_FilesystemDirList: 60808,
27495
- MessageType_FilesystemDirMake: 60809,
27496
- MessageType_FilesystemDirRemove: 60810,
27497
- MessageType_FilesystemFormat: 60811,
27498
- MessageType_DeviceFirmwareUpdateStage: 61000,
27499
- MessageType_DeviceFirmwareUpdateRequest: 61001,
27500
- MessageType_DeviceFirmwareUpdateStatusGet: 61002,
27501
- MessageType_DeviceFirmwareUpdateStatus: 61003,
27502
- MessageType_DeviceSessionGet: 61200,
27503
- MessageType_DeviceSession: 61201,
27504
- MessageType_DeviceSessionAskPin: 61202,
27505
- MessageType_DeviceSessionAskPassphrase: 61203,
27506
- MessageType_PortfolioUpdate: 61400,
27507
- MessageType_NftUpdate: 61500,
27508
- MessageType_OnboardingStatusGet: 61600,
27509
- MessageType_OnboardingStatus: 61601
27510
- },
27511
- reserved: [
27512
- [
27513
- 90,
27514
- 92
27515
- ],
27516
- [
27517
- 114,
27518
- 122
27519
- ],
27520
- [
27521
- 300,
27522
- 304
27523
- ],
27524
- [
27525
- 309,
27526
- 312
27527
- ]
27528
- ]
27529
- },
27530
27033
  AlephiumGetAddress: {
27531
27034
  fields: {
27532
27035
  address_n: {
@@ -31700,349 +31203,6 @@ var nested = {
31700
31203
  }
31701
31204
  }
31702
31205
  },
31703
- EthereumGetPublicKey: {
31704
- fields: {
31705
- address_n: {
31706
- rule: "repeated",
31707
- type: "uint32",
31708
- id: 1,
31709
- options: {
31710
- packed: false
31711
- }
31712
- },
31713
- show_display: {
31714
- type: "bool",
31715
- id: 2
31716
- }
31717
- }
31718
- },
31719
- EthereumPublicKey: {
31720
- fields: {
31721
- node: {
31722
- rule: "required",
31723
- type: "HDNodeType",
31724
- id: 1
31725
- },
31726
- xpub: {
31727
- rule: "required",
31728
- type: "string",
31729
- id: 2
31730
- }
31731
- }
31732
- },
31733
- EthereumGetAddress: {
31734
- fields: {
31735
- address_n: {
31736
- rule: "repeated",
31737
- type: "uint32",
31738
- id: 1,
31739
- options: {
31740
- packed: false
31741
- }
31742
- },
31743
- show_display: {
31744
- type: "bool",
31745
- id: 2
31746
- },
31747
- encoded_network: {
31748
- type: "bytes",
31749
- id: 3
31750
- }
31751
- }
31752
- },
31753
- EthereumAddress: {
31754
- fields: {
31755
- _old_address: {
31756
- type: "bytes",
31757
- id: 1,
31758
- options: {
31759
- deprecated: true
31760
- }
31761
- },
31762
- address: {
31763
- type: "string",
31764
- id: 2
31765
- }
31766
- }
31767
- },
31768
- EthereumSignTx: {
31769
- fields: {
31770
- address_n: {
31771
- rule: "repeated",
31772
- type: "uint32",
31773
- id: 1,
31774
- options: {
31775
- packed: false
31776
- }
31777
- },
31778
- nonce: {
31779
- type: "bytes",
31780
- id: 2,
31781
- options: {
31782
- "default": ""
31783
- }
31784
- },
31785
- gas_price: {
31786
- rule: "required",
31787
- type: "bytes",
31788
- id: 3
31789
- },
31790
- gas_limit: {
31791
- rule: "required",
31792
- type: "bytes",
31793
- id: 4
31794
- },
31795
- to: {
31796
- type: "string",
31797
- id: 11,
31798
- options: {
31799
- "default": ""
31800
- }
31801
- },
31802
- value: {
31803
- type: "bytes",
31804
- id: 6,
31805
- options: {
31806
- "default": ""
31807
- }
31808
- },
31809
- data_initial_chunk: {
31810
- type: "bytes",
31811
- id: 7,
31812
- options: {
31813
- "default": ""
31814
- }
31815
- },
31816
- data_length: {
31817
- type: "uint32",
31818
- id: 8,
31819
- options: {
31820
- "default": 0
31821
- }
31822
- },
31823
- chain_id: {
31824
- rule: "required",
31825
- type: "uint64",
31826
- id: 9
31827
- },
31828
- tx_type: {
31829
- type: "uint32",
31830
- id: 10
31831
- },
31832
- definitions: {
31833
- type: "EthereumDefinitions",
31834
- id: 12
31835
- }
31836
- }
31837
- },
31838
- EthereumSignTxEIP1559: {
31839
- fields: {
31840
- address_n: {
31841
- rule: "repeated",
31842
- type: "uint32",
31843
- id: 1,
31844
- options: {
31845
- packed: false
31846
- }
31847
- },
31848
- nonce: {
31849
- rule: "required",
31850
- type: "bytes",
31851
- id: 2
31852
- },
31853
- max_gas_fee: {
31854
- rule: "required",
31855
- type: "bytes",
31856
- id: 3
31857
- },
31858
- max_priority_fee: {
31859
- rule: "required",
31860
- type: "bytes",
31861
- id: 4
31862
- },
31863
- gas_limit: {
31864
- rule: "required",
31865
- type: "bytes",
31866
- id: 5
31867
- },
31868
- to: {
31869
- type: "string",
31870
- id: 6,
31871
- options: {
31872
- "default": ""
31873
- }
31874
- },
31875
- value: {
31876
- rule: "required",
31877
- type: "bytes",
31878
- id: 7
31879
- },
31880
- data_initial_chunk: {
31881
- type: "bytes",
31882
- id: 8,
31883
- options: {
31884
- "default": ""
31885
- }
31886
- },
31887
- data_length: {
31888
- rule: "required",
31889
- type: "uint32",
31890
- id: 9
31891
- },
31892
- chain_id: {
31893
- rule: "required",
31894
- type: "uint64",
31895
- id: 10
31896
- },
31897
- access_list: {
31898
- rule: "repeated",
31899
- type: "EthereumAccessList",
31900
- id: 11
31901
- },
31902
- definitions: {
31903
- type: "EthereumDefinitions",
31904
- id: 12
31905
- }
31906
- },
31907
- nested: {
31908
- EthereumAccessList: {
31909
- fields: {
31910
- address: {
31911
- rule: "required",
31912
- type: "string",
31913
- id: 1
31914
- },
31915
- storage_keys: {
31916
- rule: "repeated",
31917
- type: "bytes",
31918
- id: 2
31919
- }
31920
- }
31921
- }
31922
- }
31923
- },
31924
- EthereumTxRequest: {
31925
- fields: {
31926
- data_length: {
31927
- type: "uint32",
31928
- id: 1
31929
- },
31930
- signature_v: {
31931
- type: "uint32",
31932
- id: 2
31933
- },
31934
- signature_r: {
31935
- type: "bytes",
31936
- id: 3
31937
- },
31938
- signature_s: {
31939
- type: "bytes",
31940
- id: 4
31941
- }
31942
- }
31943
- },
31944
- EthereumTxAck: {
31945
- fields: {
31946
- data_chunk: {
31947
- rule: "required",
31948
- type: "bytes",
31949
- id: 1
31950
- }
31951
- }
31952
- },
31953
- EthereumSignMessage: {
31954
- fields: {
31955
- address_n: {
31956
- rule: "repeated",
31957
- type: "uint32",
31958
- id: 1,
31959
- options: {
31960
- packed: false
31961
- }
31962
- },
31963
- message: {
31964
- rule: "required",
31965
- type: "bytes",
31966
- id: 2
31967
- },
31968
- encoded_network: {
31969
- type: "bytes",
31970
- id: 3
31971
- }
31972
- }
31973
- },
31974
- EthereumMessageSignature: {
31975
- fields: {
31976
- signature: {
31977
- rule: "required",
31978
- type: "bytes",
31979
- id: 2
31980
- },
31981
- address: {
31982
- rule: "required",
31983
- type: "string",
31984
- id: 3
31985
- }
31986
- }
31987
- },
31988
- EthereumVerifyMessage: {
31989
- fields: {
31990
- signature: {
31991
- rule: "required",
31992
- type: "bytes",
31993
- id: 2
31994
- },
31995
- message: {
31996
- rule: "required",
31997
- type: "bytes",
31998
- id: 3
31999
- },
32000
- address: {
32001
- rule: "required",
32002
- type: "string",
32003
- id: 4
32004
- }
32005
- }
32006
- },
32007
- EthereumSignTypedHash: {
32008
- fields: {
32009
- address_n: {
32010
- rule: "repeated",
32011
- type: "uint32",
32012
- id: 1,
32013
- options: {
32014
- packed: false
32015
- }
32016
- },
32017
- domain_separator_hash: {
32018
- rule: "required",
32019
- type: "bytes",
32020
- id: 2
32021
- },
32022
- message_hash: {
32023
- type: "bytes",
32024
- id: 3
32025
- },
32026
- encoded_network: {
32027
- type: "bytes",
32028
- id: 4
32029
- }
32030
- }
32031
- },
32032
- EthereumTypedDataSignature: {
32033
- fields: {
32034
- signature: {
32035
- rule: "required",
32036
- type: "bytes",
32037
- id: 1
32038
- },
32039
- address: {
32040
- rule: "required",
32041
- type: "string",
32042
- id: 2
32043
- }
32044
- }
32045
- },
32046
31206
  EthereumDefinitionType: {
32047
31207
  values: {
32048
31208
  NETWORK: 0,
@@ -32122,122 +31282,6 @@ var nested = {
32122
31282
  }
32123
31283
  }
32124
31284
  },
32125
- EthereumSignTypedData: {
32126
- fields: {
32127
- address_n: {
32128
- rule: "repeated",
32129
- type: "uint32",
32130
- id: 1,
32131
- options: {
32132
- packed: false
32133
- }
32134
- },
32135
- primary_type: {
32136
- rule: "required",
32137
- type: "string",
32138
- id: 2
32139
- },
32140
- metamask_v4_compat: {
32141
- type: "bool",
32142
- id: 3,
32143
- options: {
32144
- "default": true
32145
- }
32146
- },
32147
- definitions: {
32148
- type: "EthereumDefinitions",
32149
- id: 4
32150
- }
32151
- }
32152
- },
32153
- EthereumTypedDataStructRequest: {
32154
- fields: {
32155
- name: {
32156
- rule: "required",
32157
- type: "string",
32158
- id: 1
32159
- }
32160
- }
32161
- },
32162
- EthereumTypedDataStructAck: {
32163
- fields: {
32164
- members: {
32165
- rule: "repeated",
32166
- type: "EthereumStructMember",
32167
- id: 1
32168
- }
32169
- },
32170
- nested: {
32171
- EthereumStructMember: {
32172
- fields: {
32173
- type: {
32174
- rule: "required",
32175
- type: "EthereumFieldType",
32176
- id: 1
32177
- },
32178
- name: {
32179
- rule: "required",
32180
- type: "string",
32181
- id: 2
32182
- }
32183
- }
32184
- },
32185
- EthereumFieldType: {
32186
- fields: {
32187
- data_type: {
32188
- rule: "required",
32189
- type: "EthereumDataType",
32190
- id: 1
32191
- },
32192
- size: {
32193
- type: "uint32",
32194
- id: 2
32195
- },
32196
- entry_type: {
32197
- type: "EthereumFieldType",
32198
- id: 3
32199
- },
32200
- struct_name: {
32201
- type: "string",
32202
- id: 4
32203
- }
32204
- }
32205
- },
32206
- EthereumDataType: {
32207
- values: {
32208
- UINT: 1,
32209
- INT: 2,
32210
- BYTES: 3,
32211
- STRING: 4,
32212
- BOOL: 5,
32213
- ADDRESS: 6,
32214
- ARRAY: 7,
32215
- STRUCT: 8
32216
- }
32217
- }
32218
- }
32219
- },
32220
- EthereumTypedDataValueRequest: {
32221
- fields: {
32222
- member_path: {
32223
- rule: "repeated",
32224
- type: "uint32",
32225
- id: 1,
32226
- options: {
32227
- packed: false
32228
- }
32229
- }
32230
- }
32231
- },
32232
- EthereumTypedDataValueAck: {
32233
- fields: {
32234
- value: {
32235
- rule: "required",
32236
- type: "bytes",
32237
- id: 1
32238
- }
32239
- }
32240
- },
32241
31285
  EthereumSignTypedDataOneKey: {
32242
31286
  fields: {
32243
31287
  address_n: {
@@ -32462,6 +31506,122 @@ var nested = {
32462
31506
  }
32463
31507
  }
32464
31508
  },
31509
+ EthereumSignTypedData: {
31510
+ fields: {
31511
+ address_n: {
31512
+ rule: "repeated",
31513
+ type: "uint32",
31514
+ id: 1,
31515
+ options: {
31516
+ packed: false
31517
+ }
31518
+ },
31519
+ primary_type: {
31520
+ rule: "required",
31521
+ type: "string",
31522
+ id: 2
31523
+ },
31524
+ metamask_v4_compat: {
31525
+ type: "bool",
31526
+ id: 3,
31527
+ options: {
31528
+ "default": true
31529
+ }
31530
+ },
31531
+ definitions: {
31532
+ type: "EthereumDefinitions",
31533
+ id: 4
31534
+ }
31535
+ }
31536
+ },
31537
+ EthereumTypedDataStructRequest: {
31538
+ fields: {
31539
+ name: {
31540
+ rule: "required",
31541
+ type: "string",
31542
+ id: 1
31543
+ }
31544
+ }
31545
+ },
31546
+ EthereumTypedDataStructAck: {
31547
+ fields: {
31548
+ members: {
31549
+ rule: "repeated",
31550
+ type: "EthereumStructMember",
31551
+ id: 1
31552
+ }
31553
+ },
31554
+ nested: {
31555
+ EthereumStructMember: {
31556
+ fields: {
31557
+ type: {
31558
+ rule: "required",
31559
+ type: "EthereumFieldType",
31560
+ id: 1
31561
+ },
31562
+ name: {
31563
+ rule: "required",
31564
+ type: "string",
31565
+ id: 2
31566
+ }
31567
+ }
31568
+ },
31569
+ EthereumFieldType: {
31570
+ fields: {
31571
+ data_type: {
31572
+ rule: "required",
31573
+ type: "EthereumDataType",
31574
+ id: 1
31575
+ },
31576
+ size: {
31577
+ type: "uint32",
31578
+ id: 2
31579
+ },
31580
+ entry_type: {
31581
+ type: "EthereumFieldType",
31582
+ id: 3
31583
+ },
31584
+ struct_name: {
31585
+ type: "string",
31586
+ id: 4
31587
+ }
31588
+ }
31589
+ },
31590
+ EthereumDataType: {
31591
+ values: {
31592
+ UINT: 1,
31593
+ INT: 2,
31594
+ BYTES: 3,
31595
+ STRING: 4,
31596
+ BOOL: 5,
31597
+ ADDRESS: 6,
31598
+ ARRAY: 7,
31599
+ STRUCT: 8
31600
+ }
31601
+ }
31602
+ }
31603
+ },
31604
+ EthereumTypedDataValueRequest: {
31605
+ fields: {
31606
+ member_path: {
31607
+ rule: "repeated",
31608
+ type: "uint32",
31609
+ id: 1,
31610
+ options: {
31611
+ packed: false
31612
+ }
31613
+ }
31614
+ }
31615
+ },
31616
+ EthereumTypedDataValueAck: {
31617
+ fields: {
31618
+ value: {
31619
+ rule: "required",
31620
+ type: "bytes",
31621
+ id: 1
31622
+ }
31623
+ }
31624
+ },
32465
31625
  EthereumGetPublicKeyOneKey: {
32466
31626
  fields: {
32467
31627
  address_n: {
@@ -32949,6 +32109,349 @@ var nested = {
32949
32109
  }
32950
32110
  }
32951
32111
  },
32112
+ EthereumGetPublicKey: {
32113
+ fields: {
32114
+ address_n: {
32115
+ rule: "repeated",
32116
+ type: "uint32",
32117
+ id: 1,
32118
+ options: {
32119
+ packed: false
32120
+ }
32121
+ },
32122
+ show_display: {
32123
+ type: "bool",
32124
+ id: 2
32125
+ }
32126
+ }
32127
+ },
32128
+ EthereumPublicKey: {
32129
+ fields: {
32130
+ node: {
32131
+ rule: "required",
32132
+ type: "HDNodeType",
32133
+ id: 1
32134
+ },
32135
+ xpub: {
32136
+ rule: "required",
32137
+ type: "string",
32138
+ id: 2
32139
+ }
32140
+ }
32141
+ },
32142
+ EthereumGetAddress: {
32143
+ fields: {
32144
+ address_n: {
32145
+ rule: "repeated",
32146
+ type: "uint32",
32147
+ id: 1,
32148
+ options: {
32149
+ packed: false
32150
+ }
32151
+ },
32152
+ show_display: {
32153
+ type: "bool",
32154
+ id: 2
32155
+ },
32156
+ encoded_network: {
32157
+ type: "bytes",
32158
+ id: 3
32159
+ }
32160
+ }
32161
+ },
32162
+ EthereumAddress: {
32163
+ fields: {
32164
+ _old_address: {
32165
+ type: "bytes",
32166
+ id: 1,
32167
+ options: {
32168
+ deprecated: true
32169
+ }
32170
+ },
32171
+ address: {
32172
+ type: "string",
32173
+ id: 2
32174
+ }
32175
+ }
32176
+ },
32177
+ EthereumSignTx: {
32178
+ fields: {
32179
+ address_n: {
32180
+ rule: "repeated",
32181
+ type: "uint32",
32182
+ id: 1,
32183
+ options: {
32184
+ packed: false
32185
+ }
32186
+ },
32187
+ nonce: {
32188
+ type: "bytes",
32189
+ id: 2,
32190
+ options: {
32191
+ "default": ""
32192
+ }
32193
+ },
32194
+ gas_price: {
32195
+ rule: "required",
32196
+ type: "bytes",
32197
+ id: 3
32198
+ },
32199
+ gas_limit: {
32200
+ rule: "required",
32201
+ type: "bytes",
32202
+ id: 4
32203
+ },
32204
+ to: {
32205
+ type: "string",
32206
+ id: 11,
32207
+ options: {
32208
+ "default": ""
32209
+ }
32210
+ },
32211
+ value: {
32212
+ type: "bytes",
32213
+ id: 6,
32214
+ options: {
32215
+ "default": ""
32216
+ }
32217
+ },
32218
+ data_initial_chunk: {
32219
+ type: "bytes",
32220
+ id: 7,
32221
+ options: {
32222
+ "default": ""
32223
+ }
32224
+ },
32225
+ data_length: {
32226
+ type: "uint32",
32227
+ id: 8,
32228
+ options: {
32229
+ "default": 0
32230
+ }
32231
+ },
32232
+ chain_id: {
32233
+ rule: "required",
32234
+ type: "uint64",
32235
+ id: 9
32236
+ },
32237
+ tx_type: {
32238
+ type: "uint32",
32239
+ id: 10
32240
+ },
32241
+ definitions: {
32242
+ type: "EthereumDefinitions",
32243
+ id: 12
32244
+ }
32245
+ }
32246
+ },
32247
+ EthereumSignTxEIP1559: {
32248
+ fields: {
32249
+ address_n: {
32250
+ rule: "repeated",
32251
+ type: "uint32",
32252
+ id: 1,
32253
+ options: {
32254
+ packed: false
32255
+ }
32256
+ },
32257
+ nonce: {
32258
+ rule: "required",
32259
+ type: "bytes",
32260
+ id: 2
32261
+ },
32262
+ max_gas_fee: {
32263
+ rule: "required",
32264
+ type: "bytes",
32265
+ id: 3
32266
+ },
32267
+ max_priority_fee: {
32268
+ rule: "required",
32269
+ type: "bytes",
32270
+ id: 4
32271
+ },
32272
+ gas_limit: {
32273
+ rule: "required",
32274
+ type: "bytes",
32275
+ id: 5
32276
+ },
32277
+ to: {
32278
+ type: "string",
32279
+ id: 6,
32280
+ options: {
32281
+ "default": ""
32282
+ }
32283
+ },
32284
+ value: {
32285
+ rule: "required",
32286
+ type: "bytes",
32287
+ id: 7
32288
+ },
32289
+ data_initial_chunk: {
32290
+ type: "bytes",
32291
+ id: 8,
32292
+ options: {
32293
+ "default": ""
32294
+ }
32295
+ },
32296
+ data_length: {
32297
+ rule: "required",
32298
+ type: "uint32",
32299
+ id: 9
32300
+ },
32301
+ chain_id: {
32302
+ rule: "required",
32303
+ type: "uint64",
32304
+ id: 10
32305
+ },
32306
+ access_list: {
32307
+ rule: "repeated",
32308
+ type: "EthereumAccessList",
32309
+ id: 11
32310
+ },
32311
+ definitions: {
32312
+ type: "EthereumDefinitions",
32313
+ id: 12
32314
+ }
32315
+ },
32316
+ nested: {
32317
+ EthereumAccessList: {
32318
+ fields: {
32319
+ address: {
32320
+ rule: "required",
32321
+ type: "string",
32322
+ id: 1
32323
+ },
32324
+ storage_keys: {
32325
+ rule: "repeated",
32326
+ type: "bytes",
32327
+ id: 2
32328
+ }
32329
+ }
32330
+ }
32331
+ }
32332
+ },
32333
+ EthereumTxRequest: {
32334
+ fields: {
32335
+ data_length: {
32336
+ type: "uint32",
32337
+ id: 1
32338
+ },
32339
+ signature_v: {
32340
+ type: "uint32",
32341
+ id: 2
32342
+ },
32343
+ signature_r: {
32344
+ type: "bytes",
32345
+ id: 3
32346
+ },
32347
+ signature_s: {
32348
+ type: "bytes",
32349
+ id: 4
32350
+ }
32351
+ }
32352
+ },
32353
+ EthereumTxAck: {
32354
+ fields: {
32355
+ data_chunk: {
32356
+ rule: "required",
32357
+ type: "bytes",
32358
+ id: 1
32359
+ }
32360
+ }
32361
+ },
32362
+ EthereumSignMessage: {
32363
+ fields: {
32364
+ address_n: {
32365
+ rule: "repeated",
32366
+ type: "uint32",
32367
+ id: 1,
32368
+ options: {
32369
+ packed: false
32370
+ }
32371
+ },
32372
+ message: {
32373
+ rule: "required",
32374
+ type: "bytes",
32375
+ id: 2
32376
+ },
32377
+ encoded_network: {
32378
+ type: "bytes",
32379
+ id: 3
32380
+ }
32381
+ }
32382
+ },
32383
+ EthereumMessageSignature: {
32384
+ fields: {
32385
+ signature: {
32386
+ rule: "required",
32387
+ type: "bytes",
32388
+ id: 2
32389
+ },
32390
+ address: {
32391
+ rule: "required",
32392
+ type: "string",
32393
+ id: 3
32394
+ }
32395
+ }
32396
+ },
32397
+ EthereumVerifyMessage: {
32398
+ fields: {
32399
+ signature: {
32400
+ rule: "required",
32401
+ type: "bytes",
32402
+ id: 2
32403
+ },
32404
+ message: {
32405
+ rule: "required",
32406
+ type: "bytes",
32407
+ id: 3
32408
+ },
32409
+ address: {
32410
+ rule: "required",
32411
+ type: "string",
32412
+ id: 4
32413
+ }
32414
+ }
32415
+ },
32416
+ EthereumSignTypedHash: {
32417
+ fields: {
32418
+ address_n: {
32419
+ rule: "repeated",
32420
+ type: "uint32",
32421
+ id: 1,
32422
+ options: {
32423
+ packed: false
32424
+ }
32425
+ },
32426
+ domain_separator_hash: {
32427
+ rule: "required",
32428
+ type: "bytes",
32429
+ id: 2
32430
+ },
32431
+ message_hash: {
32432
+ type: "bytes",
32433
+ id: 3
32434
+ },
32435
+ encoded_network: {
32436
+ type: "bytes",
32437
+ id: 4
32438
+ }
32439
+ }
32440
+ },
32441
+ EthereumTypedDataSignature: {
32442
+ fields: {
32443
+ signature: {
32444
+ rule: "required",
32445
+ type: "bytes",
32446
+ id: 1
32447
+ },
32448
+ address: {
32449
+ rule: "required",
32450
+ type: "string",
32451
+ id: 2
32452
+ }
32453
+ }
32454
+ },
32952
32455
  FilecoinGetAddress: {
32953
32456
  fields: {
32954
32457
  address_n: {
@@ -38557,60 +38060,557 @@ var nested = {
38557
38060
  id: 1
38558
38061
  }
38559
38062
  },
38560
- nested: {
38561
- WebAuthnCredential: {
38562
- fields: {
38563
- index: {
38564
- type: "uint32",
38565
- id: 1
38566
- },
38567
- id: {
38568
- type: "bytes",
38569
- id: 2
38570
- },
38571
- rp_id: {
38572
- type: "string",
38573
- id: 3
38574
- },
38575
- rp_name: {
38576
- type: "string",
38577
- id: 4
38578
- },
38579
- user_id: {
38580
- type: "bytes",
38581
- id: 5
38582
- },
38583
- user_name: {
38584
- type: "string",
38585
- id: 6
38586
- },
38587
- user_display_name: {
38588
- type: "string",
38589
- id: 7
38590
- },
38591
- creation_time: {
38592
- type: "uint32",
38593
- id: 8
38594
- },
38595
- hmac_secret: {
38596
- type: "bool",
38597
- id: 9
38598
- },
38599
- use_sign_count: {
38600
- type: "bool",
38601
- id: 10
38602
- },
38603
- algorithm: {
38604
- type: "sint32",
38605
- id: 11
38606
- },
38607
- curve: {
38608
- type: "sint32",
38609
- id: 12
38610
- }
38611
- }
38612
- }
38613
- }
38063
+ nested: {
38064
+ WebAuthnCredential: {
38065
+ fields: {
38066
+ index: {
38067
+ type: "uint32",
38068
+ id: 1
38069
+ },
38070
+ id: {
38071
+ type: "bytes",
38072
+ id: 2
38073
+ },
38074
+ rp_id: {
38075
+ type: "string",
38076
+ id: 3
38077
+ },
38078
+ rp_name: {
38079
+ type: "string",
38080
+ id: 4
38081
+ },
38082
+ user_id: {
38083
+ type: "bytes",
38084
+ id: 5
38085
+ },
38086
+ user_name: {
38087
+ type: "string",
38088
+ id: 6
38089
+ },
38090
+ user_display_name: {
38091
+ type: "string",
38092
+ id: 7
38093
+ },
38094
+ creation_time: {
38095
+ type: "uint32",
38096
+ id: 8
38097
+ },
38098
+ hmac_secret: {
38099
+ type: "bool",
38100
+ id: 9
38101
+ },
38102
+ use_sign_count: {
38103
+ type: "bool",
38104
+ id: 10
38105
+ },
38106
+ algorithm: {
38107
+ type: "sint32",
38108
+ id: 11
38109
+ },
38110
+ curve: {
38111
+ type: "sint32",
38112
+ id: 12
38113
+ }
38114
+ }
38115
+ }
38116
+ }
38117
+ },
38118
+ wire_in: {
38119
+ type: "bool",
38120
+ id: 50002,
38121
+ extend: "google.protobuf.EnumValueOptions"
38122
+ },
38123
+ wire_out: {
38124
+ type: "bool",
38125
+ id: 50003,
38126
+ extend: "google.protobuf.EnumValueOptions"
38127
+ },
38128
+ wire_debug_in: {
38129
+ type: "bool",
38130
+ id: 50004,
38131
+ extend: "google.protobuf.EnumValueOptions"
38132
+ },
38133
+ wire_debug_out: {
38134
+ type: "bool",
38135
+ id: 50005,
38136
+ extend: "google.protobuf.EnumValueOptions"
38137
+ },
38138
+ wire_tiny: {
38139
+ type: "bool",
38140
+ id: 50006,
38141
+ extend: "google.protobuf.EnumValueOptions"
38142
+ },
38143
+ wire_bootloader: {
38144
+ type: "bool",
38145
+ id: 50007,
38146
+ extend: "google.protobuf.EnumValueOptions"
38147
+ },
38148
+ wire_no_fsm: {
38149
+ type: "bool",
38150
+ id: 50008,
38151
+ extend: "google.protobuf.EnumValueOptions"
38152
+ },
38153
+ bitcoin_only: {
38154
+ type: "bool",
38155
+ id: 60000,
38156
+ extend: "google.protobuf.EnumValueOptions"
38157
+ },
38158
+ has_bitcoin_only_values: {
38159
+ type: "bool",
38160
+ id: 51001,
38161
+ extend: "google.protobuf.EnumOptions"
38162
+ },
38163
+ experimental_message: {
38164
+ type: "bool",
38165
+ id: 52001,
38166
+ extend: "google.protobuf.MessageOptions"
38167
+ },
38168
+ wire_type: {
38169
+ type: "uint32",
38170
+ id: 52002,
38171
+ extend: "google.protobuf.MessageOptions"
38172
+ },
38173
+ experimental_field: {
38174
+ type: "bool",
38175
+ id: 53001,
38176
+ extend: "google.protobuf.FieldOptions"
38177
+ },
38178
+ include_in_bitcoin_only: {
38179
+ type: "bool",
38180
+ id: 60000,
38181
+ extend: "google.protobuf.FileOptions"
38182
+ },
38183
+ MessageType: {
38184
+ options: {
38185
+ "(has_bitcoin_only_values)": true
38186
+ },
38187
+ values: {
38188
+ MessageType_Initialize: 0,
38189
+ MessageType_ChangePin: 4,
38190
+ MessageType_WipeDevice: 5,
38191
+ MessageType_GetEntropy: 9,
38192
+ MessageType_Entropy: 10,
38193
+ MessageType_LoadDevice: 13,
38194
+ MessageType_ResetDevice: 14,
38195
+ MessageType_SetBusy: 16,
38196
+ MessageType_Features: 17,
38197
+ MessageType_Cancel: 20,
38198
+ MessageType_LockDevice: 24,
38199
+ MessageType_ApplySettings: 25,
38200
+ MessageType_ButtonRequest: 26,
38201
+ MessageType_ButtonAck: 27,
38202
+ MessageType_ApplyFlags: 28,
38203
+ MessageType_GetNonce: 31,
38204
+ MessageType_Nonce: 33,
38205
+ MessageType_BackupDevice: 34,
38206
+ MessageType_EntropyRequest: 35,
38207
+ MessageType_EntropyAck: 36,
38208
+ MessageType_PassphraseRequest: 41,
38209
+ MessageType_PassphraseAck: 42,
38210
+ MessageType_RecoveryDevice: 45,
38211
+ MessageType_WordRequest: 46,
38212
+ MessageType_WordAck: 47,
38213
+ MessageType_GetFeatures: 55,
38214
+ MessageType_SdProtect: 79,
38215
+ MessageType_ChangeWipeCode: 82,
38216
+ MessageType_DoPreauthorized: 84,
38217
+ MessageType_PreauthorizedRequest: 85,
38218
+ MessageType_CancelAuthorization: 86,
38219
+ MessageType_GetFirmwareHash: 88,
38220
+ MessageType_FirmwareHash: 89,
38221
+ MessageType_UnlockPath: 93,
38222
+ MessageType_UnlockedPathRequest: 94,
38223
+ MessageType_SetU2FCounter: 63,
38224
+ MessageType_GetNextU2FCounter: 80,
38225
+ MessageType_NextU2FCounter: 81,
38226
+ MessageType_Deprecated_PassphraseStateRequest: 77,
38227
+ MessageType_Deprecated_PassphraseStateAck: 78,
38228
+ MessageType_GetPublicKey: 11,
38229
+ MessageType_PublicKey: 12,
38230
+ MessageType_SignTx: 15,
38231
+ MessageType_TxRequest: 21,
38232
+ MessageType_TxAck: 22,
38233
+ MessageType_GetAddress: 29,
38234
+ MessageType_Address: 30,
38235
+ MessageType_TxAckPaymentRequest: 37,
38236
+ MessageType_SignMessage: 38,
38237
+ MessageType_VerifyMessage: 39,
38238
+ MessageType_MessageSignature: 40,
38239
+ MessageType_GetOwnershipId: 43,
38240
+ MessageType_OwnershipId: 44,
38241
+ MessageType_GetOwnershipProof: 49,
38242
+ MessageType_OwnershipProof: 50,
38243
+ MessageType_AuthorizeCoinJoin: 51,
38244
+ MessageType_SignPsbt: 10052,
38245
+ MessageType_SignedPsbt: 10053,
38246
+ MessageType_CipherKeyValue: 23,
38247
+ MessageType_CipheredKeyValue: 48,
38248
+ MessageType_SignIdentity: 53,
38249
+ MessageType_SignedIdentity: 54,
38250
+ MessageType_GetECDHSessionKey: 61,
38251
+ MessageType_ECDHSessionKey: 62,
38252
+ MessageType_CosiCommit: 71,
38253
+ MessageType_CosiCommitment: 72,
38254
+ MessageType_CosiSign: 73,
38255
+ MessageType_CosiSignature: 74,
38256
+ MessageType_BatchGetPublickeys: 10016,
38257
+ MessageType_EcdsaPublicKeys: 10017,
38258
+ MessageType_EthereumGetPublicKey: 450,
38259
+ MessageType_EthereumPublicKey: 451,
38260
+ MessageType_EthereumGetAddress: 56,
38261
+ MessageType_EthereumAddress: 57,
38262
+ MessageType_EthereumSignTx: 58,
38263
+ MessageType_EthereumSignTxEIP1559: 452,
38264
+ MessageType_EthereumTxRequest: 59,
38265
+ MessageType_EthereumTxAck: 60,
38266
+ MessageType_EthereumSignMessage: 64,
38267
+ MessageType_EthereumVerifyMessage: 65,
38268
+ MessageType_EthereumMessageSignature: 66,
38269
+ MessageType_EthereumSignTypedData: 464,
38270
+ MessageType_EthereumTypedDataStructRequest: 465,
38271
+ MessageType_EthereumTypedDataStructAck: 466,
38272
+ MessageType_EthereumTypedDataValueRequest: 467,
38273
+ MessageType_EthereumTypedDataValueAck: 468,
38274
+ MessageType_EthereumTypedDataSignature: 469,
38275
+ MessageType_EthereumSignTypedHash: 470,
38276
+ MessageType_EthereumGetPublicKeyOneKey: 20100,
38277
+ MessageType_EthereumPublicKeyOneKey: 20101,
38278
+ MessageType_EthereumGetAddressOneKey: 20102,
38279
+ MessageType_EthereumAddressOneKey: 20103,
38280
+ MessageType_EthereumSignTxOneKey: 20104,
38281
+ MessageType_EthereumSignTxEIP1559OneKey: 20105,
38282
+ MessageType_EthereumTxRequestOneKey: 20106,
38283
+ MessageType_EthereumTxAckOneKey: 20107,
38284
+ MessageType_EthereumSignMessageOneKey: 20108,
38285
+ MessageType_EthereumVerifyMessageOneKey: 20109,
38286
+ MessageType_EthereumMessageSignatureOneKey: 20110,
38287
+ MessageType_EthereumSignTypedDataOneKey: 20111,
38288
+ MessageType_EthereumTypedDataStructRequestOneKey: 20112,
38289
+ MessageType_EthereumTypedDataStructAckOneKey: 20113,
38290
+ MessageType_EthereumTypedDataValueRequestOneKey: 20114,
38291
+ MessageType_EthereumTypedDataValueAckOneKey: 20115,
38292
+ MessageType_EthereumTypedDataSignatureOneKey: 20116,
38293
+ MessageType_EthereumSignTypedHashOneKey: 20117,
38294
+ MessageType_EthereumGnosisSafeTxAck: 20118,
38295
+ MessageType_EthereumGnosisSafeTxRequest: 20119,
38296
+ MessageType_EthereumSignTxEIP7702OneKey: 20120,
38297
+ MessageType_EthereumSignTypedDataQR: 20121,
38298
+ MessageType_NEMGetAddress: 67,
38299
+ MessageType_NEMAddress: 68,
38300
+ MessageType_NEMSignTx: 69,
38301
+ MessageType_NEMSignedTx: 70,
38302
+ MessageType_NEMDecryptMessage: 75,
38303
+ MessageType_NEMDecryptedMessage: 76,
38304
+ MessageType_TezosGetAddress: 150,
38305
+ MessageType_TezosAddress: 151,
38306
+ MessageType_TezosSignTx: 152,
38307
+ MessageType_TezosSignedTx: 153,
38308
+ MessageType_TezosGetPublicKey: 154,
38309
+ MessageType_TezosPublicKey: 155,
38310
+ MessageType_StellarSignTx: 202,
38311
+ MessageType_StellarTxOpRequest: 203,
38312
+ MessageType_StellarGetAddress: 207,
38313
+ MessageType_StellarAddress: 208,
38314
+ MessageType_StellarCreateAccountOp: 210,
38315
+ MessageType_StellarPaymentOp: 211,
38316
+ MessageType_StellarPathPaymentStrictReceiveOp: 212,
38317
+ MessageType_StellarManageSellOfferOp: 213,
38318
+ MessageType_StellarCreatePassiveSellOfferOp: 214,
38319
+ MessageType_StellarSetOptionsOp: 215,
38320
+ MessageType_StellarChangeTrustOp: 216,
38321
+ MessageType_StellarAllowTrustOp: 217,
38322
+ MessageType_StellarAccountMergeOp: 218,
38323
+ MessageType_StellarManageDataOp: 220,
38324
+ MessageType_StellarBumpSequenceOp: 221,
38325
+ MessageType_StellarManageBuyOfferOp: 222,
38326
+ MessageType_StellarPathPaymentStrictSendOp: 223,
38327
+ MessageType_StellarSignedTx: 230,
38328
+ MessageType_CardanoGetPublicKey: 305,
38329
+ MessageType_CardanoPublicKey: 306,
38330
+ MessageType_CardanoGetAddress: 307,
38331
+ MessageType_CardanoAddress: 308,
38332
+ MessageType_CardanoTxItemAck: 313,
38333
+ MessageType_CardanoTxAuxiliaryDataSupplement: 314,
38334
+ MessageType_CardanoTxWitnessRequest: 315,
38335
+ MessageType_CardanoTxWitnessResponse: 316,
38336
+ MessageType_CardanoTxHostAck: 317,
38337
+ MessageType_CardanoTxBodyHash: 318,
38338
+ MessageType_CardanoSignTxFinished: 319,
38339
+ MessageType_CardanoSignTxInit: 320,
38340
+ MessageType_CardanoTxInput: 321,
38341
+ MessageType_CardanoTxOutput: 322,
38342
+ MessageType_CardanoAssetGroup: 323,
38343
+ MessageType_CardanoToken: 324,
38344
+ MessageType_CardanoTxCertificate: 325,
38345
+ MessageType_CardanoTxWithdrawal: 326,
38346
+ MessageType_CardanoTxAuxiliaryData: 327,
38347
+ MessageType_CardanoPoolOwner: 328,
38348
+ MessageType_CardanoPoolRelayParameters: 329,
38349
+ MessageType_CardanoGetNativeScriptHash: 330,
38350
+ MessageType_CardanoNativeScriptHash: 331,
38351
+ MessageType_CardanoTxMint: 332,
38352
+ MessageType_CardanoTxCollateralInput: 333,
38353
+ MessageType_CardanoTxRequiredSigner: 334,
38354
+ MessageType_CardanoTxInlineDatumChunk: 335,
38355
+ MessageType_CardanoTxReferenceScriptChunk: 336,
38356
+ MessageType_CardanoTxReferenceInput: 337,
38357
+ MessageType_CardanoSignMessage: 350,
38358
+ MessageType_CardanoMessageSignature: 351,
38359
+ MessageType_RippleGetAddress: 400,
38360
+ MessageType_RippleAddress: 401,
38361
+ MessageType_RippleSignTx: 402,
38362
+ MessageType_RippleSignedTx: 403,
38363
+ MessageType_MoneroTransactionInitRequest: 501,
38364
+ MessageType_MoneroTransactionInitAck: 502,
38365
+ MessageType_MoneroTransactionSetInputRequest: 503,
38366
+ MessageType_MoneroTransactionSetInputAck: 504,
38367
+ MessageType_MoneroTransactionInputViniRequest: 507,
38368
+ MessageType_MoneroTransactionInputViniAck: 508,
38369
+ MessageType_MoneroTransactionAllInputsSetRequest: 509,
38370
+ MessageType_MoneroTransactionAllInputsSetAck: 510,
38371
+ MessageType_MoneroTransactionSetOutputRequest: 511,
38372
+ MessageType_MoneroTransactionSetOutputAck: 512,
38373
+ MessageType_MoneroTransactionAllOutSetRequest: 513,
38374
+ MessageType_MoneroTransactionAllOutSetAck: 514,
38375
+ MessageType_MoneroTransactionSignInputRequest: 515,
38376
+ MessageType_MoneroTransactionSignInputAck: 516,
38377
+ MessageType_MoneroTransactionFinalRequest: 517,
38378
+ MessageType_MoneroTransactionFinalAck: 518,
38379
+ MessageType_MoneroKeyImageExportInitRequest: 530,
38380
+ MessageType_MoneroKeyImageExportInitAck: 531,
38381
+ MessageType_MoneroKeyImageSyncStepRequest: 532,
38382
+ MessageType_MoneroKeyImageSyncStepAck: 533,
38383
+ MessageType_MoneroKeyImageSyncFinalRequest: 534,
38384
+ MessageType_MoneroKeyImageSyncFinalAck: 535,
38385
+ MessageType_MoneroGetAddress: 540,
38386
+ MessageType_MoneroAddress: 541,
38387
+ MessageType_MoneroGetWatchKey: 542,
38388
+ MessageType_MoneroWatchKey: 543,
38389
+ MessageType_DebugMoneroDiagRequest: 546,
38390
+ MessageType_DebugMoneroDiagAck: 547,
38391
+ MessageType_MoneroGetTxKeyRequest: 550,
38392
+ MessageType_MoneroGetTxKeyAck: 551,
38393
+ MessageType_MoneroLiveRefreshStartRequest: 552,
38394
+ MessageType_MoneroLiveRefreshStartAck: 553,
38395
+ MessageType_MoneroLiveRefreshStepRequest: 554,
38396
+ MessageType_MoneroLiveRefreshStepAck: 555,
38397
+ MessageType_MoneroLiveRefreshFinalRequest: 556,
38398
+ MessageType_MoneroLiveRefreshFinalAck: 557,
38399
+ MessageType_EosGetPublicKey: 600,
38400
+ MessageType_EosPublicKey: 601,
38401
+ MessageType_EosSignTx: 602,
38402
+ MessageType_EosTxActionRequest: 603,
38403
+ MessageType_EosTxActionAck: 604,
38404
+ MessageType_EosSignedTx: 605,
38405
+ MessageType_BinanceGetAddress: 700,
38406
+ MessageType_BinanceAddress: 701,
38407
+ MessageType_BinanceGetPublicKey: 702,
38408
+ MessageType_BinancePublicKey: 703,
38409
+ MessageType_BinanceSignTx: 704,
38410
+ MessageType_BinanceTxRequest: 705,
38411
+ MessageType_BinanceTransferMsg: 706,
38412
+ MessageType_BinanceOrderMsg: 707,
38413
+ MessageType_BinanceCancelMsg: 708,
38414
+ MessageType_BinanceSignedTx: 709,
38415
+ MessageType_StarcoinGetAddress: 10300,
38416
+ MessageType_StarcoinAddress: 10301,
38417
+ MessageType_StarcoinGetPublicKey: 10302,
38418
+ MessageType_StarcoinPublicKey: 10303,
38419
+ MessageType_StarcoinSignTx: 10304,
38420
+ MessageType_StarcoinSignedTx: 10305,
38421
+ MessageType_StarcoinSignMessage: 10306,
38422
+ MessageType_StarcoinMessageSignature: 10307,
38423
+ MessageType_StarcoinVerifyMessage: 10308,
38424
+ MessageType_ConfluxGetAddress: 10112,
38425
+ MessageType_ConfluxAddress: 10113,
38426
+ MessageType_ConfluxSignTx: 10114,
38427
+ MessageType_ConfluxTxRequest: 10115,
38428
+ MessageType_ConfluxTxAck: 10116,
38429
+ MessageType_ConfluxSignMessage: 10117,
38430
+ MessageType_ConfluxSignMessageCIP23: 10118,
38431
+ MessageType_ConfluxMessageSignature: 10119,
38432
+ MessageType_TronGetAddress: 10501,
38433
+ MessageType_TronAddress: 10502,
38434
+ MessageType_TronSignTx: 10503,
38435
+ MessageType_TronSignedTx: 10504,
38436
+ MessageType_TronSignMessage: 10505,
38437
+ MessageType_TronMessageSignature: 10506,
38438
+ MessageType_NearGetAddress: 10701,
38439
+ MessageType_NearAddress: 10702,
38440
+ MessageType_NearSignTx: 10703,
38441
+ MessageType_NearSignedTx: 10704,
38442
+ MessageType_AptosGetAddress: 10600,
38443
+ MessageType_AptosAddress: 10601,
38444
+ MessageType_AptosSignTx: 10602,
38445
+ MessageType_AptosSignedTx: 10603,
38446
+ MessageType_AptosSignMessage: 10604,
38447
+ MessageType_AptosMessageSignature: 10605,
38448
+ MessageType_AptosSignSIWAMessage: 10606,
38449
+ MessageType_WebAuthnListResidentCredentials: 800,
38450
+ MessageType_WebAuthnCredentials: 801,
38451
+ MessageType_WebAuthnAddResidentCredential: 802,
38452
+ MessageType_WebAuthnRemoveResidentCredential: 803,
38453
+ MessageType_SolanaGetAddress: 10100,
38454
+ MessageType_SolanaAddress: 10101,
38455
+ MessageType_SolanaSignTx: 10102,
38456
+ MessageType_SolanaSignedTx: 10103,
38457
+ MessageType_SolanaSignOffChainMessage: 10104,
38458
+ MessageType_SolanaMessageSignature: 10105,
38459
+ MessageType_SolanaSignUnsafeMessage: 10106,
38460
+ MessageType_CosmosGetAddress: 10800,
38461
+ MessageType_CosmosAddress: 10801,
38462
+ MessageType_CosmosSignTx: 10802,
38463
+ MessageType_CosmosSignedTx: 10803,
38464
+ MessageType_AlgorandGetAddress: 10900,
38465
+ MessageType_AlgorandAddress: 10901,
38466
+ MessageType_AlgorandSignTx: 10902,
38467
+ MessageType_AlgorandSignedTx: 10903,
38468
+ MessageType_PolkadotGetAddress: 11000,
38469
+ MessageType_PolkadotAddress: 11001,
38470
+ MessageType_PolkadotSignTx: 11002,
38471
+ MessageType_PolkadotSignedTx: 11003,
38472
+ MessageType_SuiGetAddress: 11100,
38473
+ MessageType_SuiAddress: 11101,
38474
+ MessageType_SuiSignTx: 11102,
38475
+ MessageType_SuiSignedTx: 11103,
38476
+ MessageType_SuiSignMessage: 11104,
38477
+ MessageType_SuiMessageSignature: 11105,
38478
+ MessageType_SuiTxRequest: 11106,
38479
+ MessageType_SuiTxAck: 11107,
38480
+ MessageType_FilecoinGetAddress: 11200,
38481
+ MessageType_FilecoinAddress: 11201,
38482
+ MessageType_FilecoinSignTx: 11202,
38483
+ MessageType_FilecoinSignedTx: 11203,
38484
+ MessageType_KaspaGetAddress: 11300,
38485
+ MessageType_KaspaAddress: 11301,
38486
+ MessageType_KaspaSignTx: 11302,
38487
+ MessageType_KaspaSignedTx: 11303,
38488
+ MessageType_KaspaTxInputRequest: 11304,
38489
+ MessageType_KaspaTxInputAck: 11305,
38490
+ MessageType_NexaGetAddress: 11400,
38491
+ MessageType_NexaAddress: 11401,
38492
+ MessageType_NexaSignTx: 11402,
38493
+ MessageType_NexaSignedTx: 11403,
38494
+ MessageType_NexaTxInputRequest: 11404,
38495
+ MessageType_NexaTxInputAck: 11405,
38496
+ MessageType_NostrGetPublicKey: 11500,
38497
+ MessageType_NostrPublicKey: 11501,
38498
+ MessageType_NostrSignEvent: 11502,
38499
+ MessageType_NostrSignedEvent: 11503,
38500
+ MessageType_NostrEncryptMessage: 11504,
38501
+ MessageType_NostrEncryptedMessage: 11505,
38502
+ MessageType_NostrDecryptMessage: 11506,
38503
+ MessageType_NostrDecryptedMessage: 11507,
38504
+ MessageType_NostrSignSchnorr: 11508,
38505
+ MessageType_NostrSignedSchnorr: 11509,
38506
+ MessageType_LnurlAuth: 11600,
38507
+ MessageType_LnurlAuthResp: 11601,
38508
+ MessageType_NervosGetAddress: 11701,
38509
+ MessageType_NervosAddress: 11702,
38510
+ MessageType_NervosSignTx: 11703,
38511
+ MessageType_NervosSignedTx: 11704,
38512
+ MessageType_NervosTxRequest: 11705,
38513
+ MessageType_NervosTxAck: 11706,
38514
+ MessageType_TonGetAddress: 11901,
38515
+ MessageType_TonAddress: 11902,
38516
+ MessageType_TonSignMessage: 11903,
38517
+ MessageType_TonSignedMessage: 11904,
38518
+ MessageType_TonSignProof: 11905,
38519
+ MessageType_TonSignedProof: 11906,
38520
+ MessageType_TonTxAck: 11907,
38521
+ MessageType_AlephiumGetAddress: 12101,
38522
+ MessageType_AlephiumAddress: 12102,
38523
+ MessageType_AlephiumSignTx: 12103,
38524
+ MessageType_AlephiumSignedTx: 12104,
38525
+ MessageType_AlephiumTxRequest: 12105,
38526
+ MessageType_AlephiumTxAck: 12106,
38527
+ MessageType_AlephiumBytecodeRequest: 12107,
38528
+ MessageType_AlephiumBytecodeAck: 12108,
38529
+ MessageType_AlephiumSignMessage: 12109,
38530
+ MessageType_AlephiumMessageSignature: 12110,
38531
+ MessageType_BenfenGetAddress: 12201,
38532
+ MessageType_BenfenAddress: 12202,
38533
+ MessageType_BenfenSignTx: 12203,
38534
+ MessageType_BenfenSignedTx: 12204,
38535
+ MessageType_BenfenSignMessage: 12205,
38536
+ MessageType_BenfenMessageSignature: 12206,
38537
+ MessageType_BenfenTxRequest: 12207,
38538
+ MessageType_BenfenTxAck: 12208,
38539
+ MessageType_NeoGetAddress: 12301,
38540
+ MessageType_NeoAddress: 12302,
38541
+ MessageType_NeoSignTx: 12303,
38542
+ MessageType_NeoSignedTx: 12304,
38543
+ MessageType_DeviceFactoryInfoSet: 60000,
38544
+ MessageType_DeviceFactoryInfoGet: 60001,
38545
+ MessageType_DeviceFactoryInfo: 60002,
38546
+ MessageType_DeviceFactoryPermanentLock: 60003,
38547
+ MessageType_DeviceFactoryTest: 60004,
38548
+ MessageType_ProtocolInfoRequest: 60200,
38549
+ MessageType_ProtocolInfo: 60201,
38550
+ MessageType_Ping: 60206,
38551
+ MessageType_Success: 60207,
38552
+ MessageType_Failure: 60208,
38553
+ MessageType_DeviceReboot: 60400,
38554
+ MessageType_DeviceSettings: 60410,
38555
+ MessageType_DeviceSettingsGet: 60411,
38556
+ MessageType_DeviceSettingsSet: 60412,
38557
+ MessageType_DeviceSettingsPageShow: 60413,
38558
+ MessageType_DeviceCertificate: 60420,
38559
+ MessageType_DeviceCertificateWrite: 60421,
38560
+ MessageType_DeviceCertificateRead: 60422,
38561
+ MessageType_DeviceCertificateSignature: 60423,
38562
+ MessageType_DeviceCertificateSign: 60424,
38563
+ MessageType_DeviceMiscUsbMscControl: 60440,
38564
+ MessageType_DeviceFindMyTokenState: 60450,
38565
+ MessageType_DeviceFindMyTokenUpdate: 60451,
38566
+ MessageType_DeviceFindMyTokenStateGet: 60452,
38567
+ MessageType_DeviceInfoGet: 60600,
38568
+ MessageType_DeviceInfo: 60601,
38569
+ MessageType_DeviceStatusGet: 60602,
38570
+ MessageType_DeviceStatus: 60603,
38571
+ MessageType_FilesystemPermissionFix: 60800,
38572
+ MessageType_FilesystemPathInfo: 60801,
38573
+ MessageType_FilesystemPathInfoQuery: 60802,
38574
+ MessageType_FilesystemFile: 60803,
38575
+ MessageType_FilesystemFileRead: 60804,
38576
+ MessageType_FilesystemFileWrite: 60805,
38577
+ MessageType_FilesystemFileDelete: 60806,
38578
+ MessageType_FilesystemDir: 60807,
38579
+ MessageType_FilesystemDirList: 60808,
38580
+ MessageType_FilesystemDirMake: 60809,
38581
+ MessageType_FilesystemDirRemove: 60810,
38582
+ MessageType_FilesystemFormat: 60811,
38583
+ MessageType_DeviceFirmwareUpdateStage: 61000,
38584
+ MessageType_DeviceFirmwareUpdateRequest: 61001,
38585
+ MessageType_DeviceFirmwareUpdateStatusGet: 61002,
38586
+ MessageType_DeviceFirmwareUpdateStatus: 61003,
38587
+ MessageType_DeviceSessionGet: 61200,
38588
+ MessageType_DeviceSession: 61201,
38589
+ MessageType_DeviceSessionAskPin: 61202,
38590
+ MessageType_DeviceSessionAskPassphrase: 61203,
38591
+ MessageType_PortfolioUpdate: 61400,
38592
+ MessageType_NftUpdate: 61500,
38593
+ MessageType_OnboardingStatusGet: 61600,
38594
+ MessageType_OnboardingStatus: 61601
38595
+ },
38596
+ reserved: [
38597
+ [
38598
+ 90,
38599
+ 92
38600
+ ],
38601
+ [
38602
+ 114,
38603
+ 122
38604
+ ],
38605
+ [
38606
+ 300,
38607
+ 304
38608
+ ],
38609
+ [
38610
+ 309,
38611
+ 312
38612
+ ]
38613
+ ]
38614
38614
  },
38615
38615
  ProtocolInfoRequest: {
38616
38616
  fields: {
@@ -39401,11 +39401,6 @@ var nested = {
39401
39401
  btc_test_address: {
39402
39402
  type: "string",
39403
39403
  id: 2
39404
- },
39405
- seed_domains: {
39406
- rule: "repeated",
39407
- type: "DeviceSessionSeedDomain",
39408
- id: 3
39409
39404
  }
39410
39405
  }
39411
39406
  },
@@ -39418,6 +39413,11 @@ var nested = {
39418
39413
  btc_test_address: {
39419
39414
  type: "string",
39420
39415
  id: 2
39416
+ },
39417
+ seed_domains: {
39418
+ rule: "repeated",
39419
+ type: "DeviceSessionSeedDomain",
39420
+ id: 3
39421
39421
  }
39422
39422
  }
39423
39423
  },
@@ -39446,6 +39446,11 @@ var nested = {
39446
39446
  rule: "required",
39447
39447
  type: "bool",
39448
39448
  id: 2
39449
+ },
39450
+ seed_domains: {
39451
+ rule: "repeated",
39452
+ type: "DeviceSessionSeedDomain",
39453
+ id: 3
39449
39454
  }
39450
39455
  }
39451
39456
  },
@@ -39849,7 +39854,14 @@ var nested = {
39849
39854
  type: "string",
39850
39855
  id: 2
39851
39856
  }
39852
- }
39857
+ },
39858
+ reserved: [
39859
+ [
39860
+ 3,
39861
+ 3
39862
+ ],
39863
+ "symbol"
39864
+ ]
39853
39865
  },
39854
39866
  ViewDetail: {
39855
39867
  fields: {
@@ -39875,6 +39887,20 @@ var nested = {
39875
39887
  }
39876
39888
  }
39877
39889
  },
39890
+ ViewCustomField: {
39891
+ fields: {
39892
+ key: {
39893
+ rule: "required",
39894
+ type: "string",
39895
+ id: 1
39896
+ },
39897
+ value: {
39898
+ rule: "required",
39899
+ type: "string",
39900
+ id: 2
39901
+ }
39902
+ }
39903
+ },
39878
39904
  ViewTipType: {
39879
39905
  values: {
39880
39906
  Default: 0,
@@ -39905,17 +39931,73 @@ var nested = {
39905
39931
  }
39906
39932
  }
39907
39933
  },
39908
- ViewRawData: {
39934
+ ViewActionCard: {
39909
39935
  fields: {
39910
39936
  initial_data: {
39911
39937
  rule: "required",
39912
39938
  type: "string",
39913
39939
  id: 1
39940
+ }
39941
+ },
39942
+ reserved: [
39943
+ [
39944
+ 2,
39945
+ 2
39946
+ ],
39947
+ "placeholder"
39948
+ ]
39949
+ },
39950
+ ViewContentPreview: {
39951
+ fields: {
39952
+ content_key: {
39953
+ rule: "required",
39954
+ type: "uint32",
39955
+ id: 1
39956
+ },
39957
+ preview: {
39958
+ rule: "required",
39959
+ type: "bytes",
39960
+ id: 2
39961
+ },
39962
+ total_bytes: {
39963
+ type: "uint32",
39964
+ id: 3
39965
+ }
39966
+ }
39967
+ },
39968
+ ViewContentEntry: {
39969
+ fields: {
39970
+ entry_key: {
39971
+ rule: "required",
39972
+ type: "uint32",
39973
+ id: 1
39974
+ },
39975
+ value: {
39976
+ rule: "required",
39977
+ type: "bytes",
39978
+ id: 2
39979
+ }
39980
+ }
39981
+ },
39982
+ ViewContentPage: {
39983
+ fields: {
39984
+ page_index: {
39985
+ rule: "required",
39986
+ type: "uint32",
39987
+ id: 1
39914
39988
  },
39915
- placeholder: {
39989
+ page_count: {
39916
39990
  rule: "required",
39917
39991
  type: "uint32",
39918
39992
  id: 2
39993
+ },
39994
+ chunk: {
39995
+ type: "bytes",
39996
+ id: 3
39997
+ },
39998
+ entry: {
39999
+ type: "ViewContentEntry",
40000
+ id: 4
39919
40001
  }
39920
40002
  }
39921
40003
  },
@@ -39948,8 +40030,8 @@ var nested = {
39948
40030
  type: "ViewTip",
39949
40031
  id: 4
39950
40032
  },
39951
- raw_data: {
39952
- type: "ViewRawData",
40033
+ action_card: {
40034
+ type: "ViewActionCard",
39953
40035
  id: 5
39954
40036
  },
39955
40037
  slide_to_confirm: {
@@ -39973,6 +40055,36 @@ var nested = {
39973
40055
  title_arg: {
39974
40056
  type: "string",
39975
40057
  id: 9
40058
+ },
40059
+ content: {
40060
+ type: "ViewContentPreview",
40061
+ id: 10
40062
+ },
40063
+ custom_field: {
40064
+ type: "ViewCustomField",
40065
+ id: 11
40066
+ }
40067
+ }
40068
+ },
40069
+ ViewWarningPage: {
40070
+ fields: {
40071
+ title_id: {
40072
+ rule: "required",
40073
+ type: "uint32",
40074
+ id: 1
40075
+ },
40076
+ text_id: {
40077
+ rule: "required",
40078
+ type: "uint32",
40079
+ id: 2
40080
+ },
40081
+ text_arg: {
40082
+ type: "string",
40083
+ id: 3
40084
+ },
40085
+ cancellable: {
40086
+ type: "bool",
40087
+ id: 4
39976
40088
  }
39977
40089
  }
39978
40090
  },
@@ -40011,6 +40123,10 @@ var nested = {
40011
40123
  chain_id: {
40012
40124
  type: "uint32",
40013
40125
  id: 8
40126
+ },
40127
+ content: {
40128
+ type: "ViewContentPreview",
40129
+ id: 9
40014
40130
  }
40015
40131
  }
40016
40132
  },
@@ -41683,14 +41799,17 @@ const negotiateEventlessWalletSession = (device) => __awaiter(void 0, void 0, vo
41683
41799
  yield device.ensureProtocolV2RuntimeContext();
41684
41800
  });
41685
41801
  const getDeviceSession = (device, request) => __awaiter(void 0, void 0, void 0, function* () { return device.commands.typedCall('DeviceSessionGet', 'DeviceSession', request); });
41686
- const buildDeviceSessionGetRequest = ({ sessionId, expectedPassphraseState, deriveCardano, } = {}) => (Object.assign(Object.assign(Object.assign({}, (sessionId ? { session_id: sessionId } : {})), (expectedPassphraseState ? { btc_test_address: expectedPassphraseState } : {})), { seed_domains: deriveCardano === undefined
41687
- ? []
41688
- : [
41689
- hdTransport.DeviceSessionSeedDomain.SeedDomain_Standard,
41690
- ...(deriveCardano ? [hdTransport.DeviceSessionSeedDomain.SeedDomain_Cardano] : []),
41691
- ] }));
41692
- const askDevicePassphrase = (device, requestPayload, onStatusRefreshed) => __awaiter(void 0, void 0, void 0, function* () {
41693
- yield device.commands.typedCall('DeviceSessionAskPassphrase', 'Success', requestPayload);
41802
+ const STANDARD_SEED_DOMAINS = [hdTransport.DeviceSessionSeedDomain.SeedDomain_Standard];
41803
+ const CARDANO_SEED_DOMAINS = [
41804
+ hdTransport.DeviceSessionSeedDomain.SeedDomain_Standard,
41805
+ hdTransport.DeviceSessionSeedDomain.SeedDomain_Cardano,
41806
+ ];
41807
+ const buildDeviceSessionSeedDomains = (deriveCardano) => deriveCardano === true ? CARDANO_SEED_DOMAINS : STANDARD_SEED_DOMAINS;
41808
+ const deviceSessionHasCardano = (message) => Array.isArray(message.seed_domains) &&
41809
+ message.seed_domains.includes(hdTransport.DeviceSessionSeedDomain.SeedDomain_Cardano);
41810
+ const buildDeviceSessionGetRequest = ({ sessionId, expectedPassphraseState, } = {}) => (Object.assign(Object.assign({}, (sessionId ? { session_id: sessionId } : {})), (expectedPassphraseState ? { btc_test_address: expectedPassphraseState } : {})));
41811
+ const askDevicePassphrase = (device, requestPayload, deriveCardano, onStatusRefreshed) => __awaiter(void 0, void 0, void 0, function* () {
41812
+ yield device.commands.typedCall('DeviceSessionAskPassphrase', 'Success', Object.assign(Object.assign({}, requestPayload), { seed_domains: buildDeviceSessionSeedDomains(deriveCardano) }));
41694
41813
  yield refreshProtocolV2DeviceStatus(device);
41695
41814
  onStatusRefreshed === null || onStatusRefreshed === void 0 ? void 0 : onStatusRefreshed();
41696
41815
  });
@@ -41728,25 +41847,38 @@ const selectDeviceSession = (device, expectedPassphraseState, deriveCardano, onS
41728
41847
  interaction: attachPinInteraction,
41729
41848
  });
41730
41849
  onStatusRefreshed === null || onStatusRefreshed === void 0 ? void 0 : onStatusRefreshed();
41731
- return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
41850
+ if (deriveCardano === true) {
41851
+ yield askDevicePassphrase(device, { passphrase: '', on_device: false }, true, onStatusRefreshed);
41852
+ if (device.features) {
41853
+ device.features.unlockedAttachPin = true;
41854
+ }
41855
+ }
41856
+ const attachPinSession = yield getDeviceSession(device, buildDeviceSessionGetRequest());
41857
+ return Object.assign(attachPinSession, { viaAttachPin: true });
41732
41858
  }
41733
41859
  if (hasHostPassphrase) {
41734
41860
  yield askDevicePassphrase(device, {
41735
41861
  passphrase: hostPassphrase,
41736
41862
  on_device: false,
41737
- }, onStatusRefreshed);
41738
- return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
41863
+ }, deriveCardano, onStatusRefreshed);
41864
+ return getDeviceSession(device, buildDeviceSessionGetRequest());
41739
41865
  }
41740
41866
  const passphraseOnDeviceInteraction = (_d = device.createProtocolV2UiPhaseMetadata) === null || _d === void 0 ? void 0 : _d.call(device, 'passphrase-on-device', 'start');
41741
41867
  device.emit(DEVICE.PASSPHRASE_ON_DEVICE, device, Object.assign(Object.assign({}, metadata), (passphraseOnDeviceInteraction ? { interaction: passphraseOnDeviceInteraction } : {})));
41742
- yield askDevicePassphrase(device, { on_device: true }, onStatusRefreshed);
41743
- return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
41868
+ yield askDevicePassphrase(device, { on_device: true }, deriveCardano, onStatusRefreshed);
41869
+ return getDeviceSession(device, buildDeviceSessionGetRequest());
41744
41870
  });
41745
41871
  function getProtocolV2WalletSession(device, options) {
41746
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
41872
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
41747
41873
  return __awaiter(this, void 0, void 0, function* () {
41748
41874
  const forceWalletSelection = (options === null || options === void 0 ? void 0 : options.forceWalletSelection) === true || (options === null || options === void 0 ? void 0 : options.initSession) === true;
41749
41875
  const readCurrentAttachPinSession = (options === null || options === void 0 ? void 0 : options.readCurrentAttachPinSession) === true;
41876
+ const sessionIsAttachPinWallet = (session) => {
41877
+ var _a;
41878
+ return readCurrentAttachPinSession ||
41879
+ (session === null || session === void 0 ? void 0 : session.viaAttachPin) === true ||
41880
+ ((_a = device.features) === null || _a === void 0 ? void 0 : _a.unlockedAttachPin) === true;
41881
+ };
41750
41882
  if (forceWalletSelection) {
41751
41883
  if (options.onlyMainPin) {
41752
41884
  (_a = device.clearStandardInternalState) === null || _a === void 0 ? void 0 : _a.call(device);
@@ -41777,6 +41909,10 @@ function getProtocolV2WalletSession(device, options) {
41777
41909
  const markWalletStatusRefreshed = () => {
41778
41910
  walletStatusRefreshed = true;
41779
41911
  };
41912
+ if ((options === null || options === void 0 ? void 0 : options.onlyMainPin) && options.mainPinSelected !== true) {
41913
+ yield refreshProtocolV2DeviceStatus(device);
41914
+ markWalletStatusRefreshed();
41915
+ }
41780
41916
  let mainPinAuthenticated = (options === null || options === void 0 ? void 0 : options.mainPinSelected) === true ||
41781
41917
  ((options === null || options === void 0 ? void 0 : options.onlyMainPin) === true &&
41782
41918
  ((_d = device.features) === null || _d === void 0 ? void 0 : _d.unlocked) === true &&
@@ -41791,8 +41927,20 @@ function getProtocolV2WalletSession(device, options) {
41791
41927
  device.clearInternalState();
41792
41928
  }
41793
41929
  };
41930
+ const sessionGetRequest = ({ sessionId, expectedPassphraseState: passphraseState, } = {}) => buildDeviceSessionGetRequest({
41931
+ sessionId,
41932
+ expectedPassphraseState: passphraseState,
41933
+ });
41934
+ const askEmptyPassphraseAndGet = ({ deriveCardano, keepAttachPin, } = {}) => __awaiter(this, void 0, void 0, function* () {
41935
+ yield askDevicePassphrase(device, { passphrase: '', on_device: false }, deriveCardano, markWalletStatusRefreshed);
41936
+ if (keepAttachPin && device.features) {
41937
+ device.features.unlockedAttachPin = true;
41938
+ }
41939
+ const session = yield getDeviceSession(device, buildDeviceSessionGetRequest());
41940
+ return keepAttachPin ? Object.assign(session, { viaAttachPin: true }) : session;
41941
+ });
41794
41942
  const rejectMismatchedAttachPinWallet = () => __awaiter(this, void 0, void 0, function* () {
41795
- var _k;
41943
+ var _m;
41796
41944
  const features = yield refreshProtocolV2DeviceStatus(device);
41797
41945
  markWalletStatusRefreshed();
41798
41946
  if (features.unlockedAttachPin !== true) {
@@ -41801,10 +41949,10 @@ function getProtocolV2WalletSession(device, options) {
41801
41949
  try {
41802
41950
  yield device.lockDevice();
41803
41951
  }
41804
- catch (_l) {
41952
+ catch (_o) {
41805
41953
  }
41806
41954
  if (options === null || options === void 0 ? void 0 : options.rejectAttachPinForMainWallet) {
41807
- (_k = device.clearStandardInternalState) === null || _k === void 0 ? void 0 : _k.call(device);
41955
+ (_m = device.clearStandardInternalState) === null || _m === void 0 ? void 0 : _m.call(device);
41808
41956
  device.clearInternalState();
41809
41957
  }
41810
41958
  else {
@@ -41812,6 +41960,16 @@ function getProtocolV2WalletSession(device, options) {
41812
41960
  }
41813
41961
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckUnlockTypeError);
41814
41962
  });
41963
+ const lockAttachPinBeforePassphraseSelection = () => __awaiter(this, void 0, void 0, function* () {
41964
+ var _p;
41965
+ if (readCurrentAttachPinSession || (options === null || options === void 0 ? void 0 : options.onlyMainPin)) {
41966
+ return;
41967
+ }
41968
+ if (((_p = device.features) === null || _p === void 0 ? void 0 : _p.unlockedAttachPin) !== true) {
41969
+ return;
41970
+ }
41971
+ yield rejectMismatchedAttachPinWallet();
41972
+ });
41815
41973
  if ((options === null || options === void 0 ? void 0 : options.onlyMainPin) && options.rejectAttachPinForMainWallet) {
41816
41974
  yield rejectMismatchedAttachPinWallet();
41817
41975
  }
@@ -41827,18 +41985,19 @@ function getProtocolV2WalletSession(device, options) {
41827
41985
  standardWalletSelected = true;
41828
41986
  }
41829
41987
  });
41830
- const selectStandardWallet = () => __awaiter(this, void 0, void 0, function* () {
41831
- var _m;
41832
- if (((_m = device.features) === null || _m === void 0 ? void 0 : _m.passphraseProtection) === true) {
41988
+ const selectStandardWallet = (forceMainPin = false) => __awaiter(this, void 0, void 0, function* () {
41989
+ var _q;
41990
+ if (((_q = device.features) === null || _q === void 0 ? void 0 : _q.passphraseProtection) === true) {
41833
41991
  yield selectMainPin();
41834
41992
  yield askDevicePassphrase(device, {
41835
41993
  passphrase: '',
41836
41994
  on_device: false,
41837
- }, markWalletStatusRefreshed);
41995
+ }, options === null || options === void 0 ? void 0 : options.deriveCardano, markWalletStatusRefreshed);
41838
41996
  standardWalletSelected = true;
41839
41997
  }
41840
41998
  else if (!standardWalletSelected) {
41841
- yield selectMainPin(true);
41999
+ yield selectMainPin(forceMainPin);
42000
+ standardWalletSelected = true;
41842
42001
  }
41843
42002
  });
41844
42003
  if (readCurrentAttachPinSession) {
@@ -41851,7 +42010,7 @@ function getProtocolV2WalletSession(device, options) {
41851
42010
  device.clearInternalState();
41852
42011
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckUnlockTypeError);
41853
42012
  }
41854
- response = yield getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano: options === null || options === void 0 ? void 0 : options.deriveCardano }));
42013
+ response = yield getDeviceSession(device, sessionGetRequest());
41855
42014
  }
41856
42015
  else if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
41857
42016
  expectedPassphraseState = cachedStandardSession === null || cachedStandardSession === void 0 ? void 0 : cachedStandardSession.passphraseState;
@@ -41860,10 +42019,9 @@ function getProtocolV2WalletSession(device, options) {
41860
42019
  if (options === null || options === void 0 ? void 0 : options.selectMainWalletBeforeRestore) {
41861
42020
  yield selectMainPin();
41862
42021
  }
41863
- response = yield getDeviceSession(device, buildDeviceSessionGetRequest({
42022
+ response = yield getDeviceSession(device, sessionGetRequest({
41864
42023
  sessionId: cachedStandardSession.sessionId,
41865
42024
  expectedPassphraseState,
41866
- deriveCardano: options === null || options === void 0 ? void 0 : options.deriveCardano,
41867
42025
  }));
41868
42026
  resumed = true;
41869
42027
  }
@@ -41877,15 +42035,14 @@ function getProtocolV2WalletSession(device, options) {
41877
42035
  }
41878
42036
  if (!response) {
41879
42037
  yield selectStandardWallet();
41880
- response = yield getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano: options === null || options === void 0 ? void 0 : options.deriveCardano }));
42038
+ response = yield getDeviceSession(device, sessionGetRequest());
41881
42039
  }
41882
42040
  }
41883
42041
  else if (cachedSessionId && expectedPassphraseState) {
41884
42042
  try {
41885
- response = yield getDeviceSession(device, buildDeviceSessionGetRequest({
42043
+ response = yield getDeviceSession(device, sessionGetRequest({
41886
42044
  sessionId: cachedSessionId,
41887
42045
  expectedPassphraseState,
41888
- deriveCardano: options === null || options === void 0 ? void 0 : options.deriveCardano,
41889
42046
  }));
41890
42047
  resumed = true;
41891
42048
  }
@@ -41899,9 +42056,8 @@ function getProtocolV2WalletSession(device, options) {
41899
42056
  }
41900
42057
  else if (expectedPassphraseState) {
41901
42058
  try {
41902
- response = yield getDeviceSession(device, buildDeviceSessionGetRequest({
42059
+ response = yield getDeviceSession(device, sessionGetRequest({
41903
42060
  expectedPassphraseState,
41904
- deriveCardano: options === null || options === void 0 ? void 0 : options.deriveCardano,
41905
42061
  }));
41906
42062
  }
41907
42063
  catch (error) {
@@ -41915,6 +42071,7 @@ function getProtocolV2WalletSession(device, options) {
41915
42071
  device.clearInternalState();
41916
42072
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.WalletSessionInvalid);
41917
42073
  }
42074
+ yield lockAttachPinBeforePassphraseSelection();
41918
42075
  response = yield selectDeviceSession(device, expectedPassphraseState, options === null || options === void 0 ? void 0 : options.deriveCardano, markWalletStatusRefreshed);
41919
42076
  }
41920
42077
  let { message } = response;
@@ -41939,11 +42096,12 @@ function getProtocolV2WalletSession(device, options) {
41939
42096
  }
41940
42097
  if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
41941
42098
  (_h = device.clearStandardInternalState) === null || _h === void 0 ? void 0 : _h.call(device);
41942
- yield selectStandardWallet();
41943
- response = yield getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano: options === null || options === void 0 ? void 0 : options.deriveCardano }));
42099
+ yield selectStandardWallet(true);
42100
+ response = yield getDeviceSession(device, sessionGetRequest());
41944
42101
  }
41945
42102
  else {
41946
42103
  device.clearInternalState();
42104
+ yield lockAttachPinBeforePassphraseSelection();
41947
42105
  response = yield selectDeviceSession(device, expectedPassphraseState, options === null || options === void 0 ? void 0 : options.deriveCardano, markWalletStatusRefreshed);
41948
42106
  }
41949
42107
  message = response.message;
@@ -41965,6 +42123,50 @@ function getProtocolV2WalletSession(device, options) {
41965
42123
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckPassphraseStateError);
41966
42124
  }
41967
42125
  }
42126
+ if ((options === null || options === void 0 ? void 0 : options.deriveCardano) === true && !deviceSessionHasCardano(message)) {
42127
+ if (options === null || options === void 0 ? void 0 : options.resumeOnly) {
42128
+ device.clearInternalState();
42129
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.WalletSessionInvalid);
42130
+ }
42131
+ resumed = false;
42132
+ const previousAddress = message.btc_test_address;
42133
+ if (sessionIsAttachPinWallet(response)) {
42134
+ response = yield askEmptyPassphraseAndGet({ deriveCardano: true, keepAttachPin: true });
42135
+ }
42136
+ else if (((_k = device.features) === null || _k === void 0 ? void 0 : _k.passphraseProtection) === false) {
42137
+ response = yield getDeviceSession(device, buildDeviceSessionGetRequest());
42138
+ }
42139
+ else if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
42140
+ yield selectMainPin();
42141
+ response = yield askEmptyPassphraseAndGet({ deriveCardano: true });
42142
+ }
42143
+ else {
42144
+ yield lockAttachPinBeforePassphraseSelection();
42145
+ response = yield selectDeviceSession(device, expectedPassphraseState, true, markWalletStatusRefreshed);
42146
+ }
42147
+ message = response.message;
42148
+ try {
42149
+ assertCompleteDeviceSession(message);
42150
+ }
42151
+ catch (error) {
42152
+ if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
42153
+ (_l = device.clearStandardInternalState) === null || _l === void 0 ? void 0 : _l.call(device);
42154
+ }
42155
+ else {
42156
+ device.clearInternalState();
42157
+ }
42158
+ throw error;
42159
+ }
42160
+ if (previousAddress && previousAddress !== message.btc_test_address) {
42161
+ yield rejectMismatchedAttachPinWallet();
42162
+ clearCurrentWalletSession();
42163
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckPassphraseStateError);
42164
+ }
42165
+ if (!deviceSessionHasCardano(message)) {
42166
+ clearCurrentWalletSession();
42167
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.WalletSessionInvalid);
42168
+ }
42169
+ }
41968
42170
  const internalStateArgs = [
41969
42171
  true,
41970
42172
  message.btc_test_address,
@@ -41979,7 +42181,7 @@ function getProtocolV2WalletSession(device, options) {
41979
42181
  device.updateInternalState(...internalStateArgs);
41980
42182
  }
41981
42183
  let unlockedAttachPin;
41982
- if (readCurrentAttachPinSession) {
42184
+ if (readCurrentAttachPinSession || sessionIsAttachPinWallet(response)) {
41983
42185
  unlockedAttachPin = true;
41984
42186
  }
41985
42187
  else if (mainPinAuthenticated) {
@@ -47532,7 +47734,6 @@ class OpenWalletSession extends BaseMethod {
47532
47734
  const session = isProtocolV2
47533
47735
  ? yield getProtocolV2WalletSession(this.device, {
47534
47736
  onlyMainPin: true,
47535
- deriveCardano: this.payload.deriveCardano,
47536
47737
  selectMainWalletBeforeRestore: !hasAuthoritativeProtocolV2WalletStatus(state) ||
47537
47738
  state.status.unlockedAttachPin === true,
47538
47739
  mainPinSelected: (_b = this.protocolV2UnlockContext) === null || _b === void 0 ? void 0 : _b.preflightMainPinSelected,
@@ -47589,7 +47790,6 @@ class OpenWalletSession extends BaseMethod {
47589
47790
  const session = isProtocolV2
47590
47791
  ? yield getProtocolV2WalletSession(this.device, {
47591
47792
  expectedPassphraseState: this.params.passphraseState,
47592
- deriveCardano: this.payload.deriveCardano,
47593
47793
  })
47594
47794
  : yield getPassphraseStateWithRefreshDeviceInfo(this.device, {
47595
47795
  expectPassphraseState: this.params.passphraseState,
@@ -47609,9 +47809,9 @@ class OpenWalletSession extends BaseMethod {
47609
47809
  }
47610
47810
  const readCurrentAttachPinSession = isProtocolV2 && walletStatus.status.unlockedAttachPin === true;
47611
47811
  const session = isProtocolV2
47612
- ? yield getProtocolV2WalletSession(this.device, Object.assign(Object.assign({}, (readCurrentAttachPinSession
47812
+ ? yield getProtocolV2WalletSession(this.device, Object.assign({}, (readCurrentAttachPinSession
47613
47813
  ? { readCurrentAttachPinSession: true }
47614
- : { forceWalletSelection: true })), { deriveCardano: this.payload.deriveCardano }))
47814
+ : { forceWalletSelection: true })))
47615
47815
  : yield getPassphraseStateWithRefreshDeviceInfo(this.device, { initSession: true });
47616
47816
  const refreshedState = isProtocolV2
47617
47817
  ? requireAuthoritativeProtocolV2WalletStatus(yield resolveProtocolV2DeviceStateAfterSession(session))
@@ -51899,11 +52099,15 @@ function isProtocolV2ResponseTimeout(error) {
51899
52099
  code === 'response-timeout' ||
51900
52100
  /(?:BLE|Lowlevel|Protocol V2) response timeout/i.test((_b = candidate.message) !== null && _b !== void 0 ? _b : ''));
51901
52101
  }
51902
- function getProtocolV2FileChunkLimit() {
52102
+ function getProtocolV2FileChunkLimit(bleChunkSizeLimit) {
51903
52103
  const env = DataManager.getSettings('env');
51904
- return env && DataManager.isBleConnect(env)
51905
- ? hdTransport.PROTOCOL_V2_BLE_FILE_CHUNK_SIZE
51906
- : hdTransport.PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE;
52104
+ if (env && DataManager.isBleConnect(env)) {
52105
+ const configuredLimit = Number(bleChunkSizeLimit);
52106
+ return Number.isFinite(configuredLimit) && configuredLimit > 0
52107
+ ? Math.floor(configuredLimit)
52108
+ : hdTransport.PROTOCOL_V2_BLE_FILE_CHUNK_SIZE;
52109
+ }
52110
+ return hdTransport.PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE;
51907
52111
  }
51908
52112
  function dataToUint8Array(data) {
51909
52113
  return __awaiter(this, void 0, void 0, function* () {
@@ -51958,7 +52162,7 @@ function writeProtocolV2File(options) {
51958
52162
  if (totalSize < startOffset + dataLength) {
51959
52163
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `FilesystemFileWrite totalSize ${totalSize} is smaller than offset + data length ${startOffset + dataLength}`);
51960
52164
  }
51961
- const defaultChunkSizeLimit = getProtocolV2FileChunkLimit();
52165
+ const defaultChunkSizeLimit = getProtocolV2FileChunkLimit(options.bleChunkSizeLimit);
51962
52166
  const configuredChunkSizeLimit = Number(options.chunkSizeLimit);
51963
52167
  const chunkSizeLimit = Number.isFinite(configuredChunkSizeLimit) && configuredChunkSizeLimit > 0
51964
52168
  ? Math.floor(configuredChunkSizeLimit)
@@ -52302,6 +52506,20 @@ const isProtocolV2FirmwareStatusEndpointUnavailable = (error) => {
52302
52506
  message.includes('message handler not found') ||
52303
52507
  message.includes('unsupported message'));
52304
52508
  };
52509
+ const isProtocolV2InstallResponseTimeout = (error) => {
52510
+ if (!error || typeof error !== 'object')
52511
+ return false;
52512
+ const { code } = error;
52513
+ return (code === 'response-timeout' ||
52514
+ /\bresponse timeout\b/i.test(getProtocolV2UnknownErrorText(error)));
52515
+ };
52516
+ const getProtocolV2ErrorCode = (error) => {
52517
+ if (!error || typeof error !== 'object')
52518
+ return undefined;
52519
+ const { errorCode, code } = error;
52520
+ const causeCode = errorCode !== null && errorCode !== void 0 ? errorCode : code;
52521
+ return typeof causeCode === 'number' || typeof causeCode === 'string' ? causeCode : undefined;
52522
+ };
52305
52523
  const isProtocolV2TerminalInstallStatusError = (error) => {
52306
52524
  var _a;
52307
52525
  return hdShared.isBleStaleBondHardwareError(error) ||
@@ -52429,8 +52647,10 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52429
52647
  this.protocolV2CompletedTargetIds = new Set();
52430
52648
  this.protocolV2InstallBaselineVersions = new Map();
52431
52649
  this.protocolV2InstallNeedsReconnect = false;
52650
+ this.protocolV2InstallDisconnectObserved = false;
52432
52651
  this.protocolV2InstallTerminalSuccessObserved = false;
52433
52652
  this.protocolV2LastTransferProgressAt = 0;
52653
+ this.protocolV2LastTransferredBytes = 0;
52434
52654
  }
52435
52655
  getSupportedProtocols() {
52436
52656
  return ['V2'];
@@ -53593,6 +53813,8 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
53593
53813
  this.postTipMessage(exports.FirmwareUpdateTipMessage.StartTransferData);
53594
53814
  this.protocolV2LastTransferProgress = undefined;
53595
53815
  this.protocolV2LastTransferProgressAt = 0;
53816
+ this.protocolV2LastTransferredBytes = 0;
53817
+ const transferStartedAt = Date.now();
53596
53818
  let processedSize = 0;
53597
53819
  for (const resource of resourcesToSync) {
53598
53820
  const writePath = resource.devicePath;
@@ -53601,6 +53823,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
53601
53823
  filePath: writePath,
53602
53824
  processedSize,
53603
53825
  totalSize,
53826
+ transferStartedAt,
53604
53827
  });
53605
53828
  yield this.verifyProtocolV2StagedFile(writePath, resource.source.size);
53606
53829
  if (isProtocolV2BootResourcePackagePath(resource.devicePath)) {
@@ -53615,6 +53838,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
53615
53838
  filePath,
53616
53839
  processedSize,
53617
53840
  totalSize,
53841
+ transferStartedAt,
53618
53842
  });
53619
53843
  yield this.verifyProtocolV2StagedFile(filePath, item.source.size);
53620
53844
  stagedInstallTargets.push({
@@ -53623,7 +53847,13 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
53623
53847
  });
53624
53848
  }
53625
53849
  if (totalSize > 0) {
53626
- this.postProgressMessage(100, 'transferData');
53850
+ const elapsedMs = Math.max(Date.now() - transferStartedAt, 0);
53851
+ this.postProgressMessage(100, 'transferData', {
53852
+ transferredBytes: totalSize,
53853
+ totalBytes: totalSize,
53854
+ rateBytesPerSecond: elapsedMs > 0 ? Math.round((totalSize / elapsedMs) * 1000) : undefined,
53855
+ elapsedMs,
53856
+ });
53627
53857
  }
53628
53858
  if (stagedInstallTargets.length === 0) {
53629
53859
  return;
@@ -53643,16 +53873,17 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
53643
53873
  }
53644
53874
  });
53645
53875
  }
53646
- protocolV2SourceUpdateProcess({ source, filePath, processedSize, totalSize, }) {
53876
+ protocolV2SourceUpdateProcess({ source, filePath, processedSize, totalSize, transferStartedAt = Date.now(), }) {
53647
53877
  return __awaiter(this, void 0, void 0, function* () {
53648
53878
  let lastError;
53649
53879
  for (let attempt = 1; attempt <= PROTOCOL_V2_FILE_TRANSFER_RETRY_COUNT; attempt += 1) {
53880
+ this.throwIfAborted();
53650
53881
  try {
53651
- const transferStartedAt = Date.now();
53652
53882
  yield writeFirmwareByteSource({
53653
53883
  source,
53654
53884
  chunkSize: this.getProtocolV2FirmwareChunkSize('write', filePath),
53655
53885
  write: ({ data, sourceOffset, length, first }) => __awaiter(this, void 0, void 0, function* () {
53886
+ this.throwIfAborted();
53656
53887
  const chunkEnd = sourceOffset + length;
53657
53888
  const deviceProgress = getProtocolV2DeviceTransferProgress(processedSize + sourceOffset, processedSize + chunkEnd, totalSize);
53658
53889
  const response = yield this.fileWriteChunk(filePath, source.size, sourceOffset, data, first, deviceProgress);
@@ -53665,17 +53896,19 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
53665
53896
  const now = Date.now();
53666
53897
  const elapsedMs = Math.max(now - transferStartedAt, 0);
53667
53898
  const progress = Math.min(Math.ceil((transferredBytes / totalSize) * 100), 99);
53668
- const shouldPostProgress = progress !== this.protocolV2LastTransferProgress ||
53669
- now - this.protocolV2LastTransferProgressAt >=
53670
- PROTOCOL_V2_TRANSFER_PROGRESS_HEARTBEAT_MS ||
53671
- chunkEnd === source.size;
53899
+ const shouldPostProgress = transferredBytes >= this.protocolV2LastTransferredBytes &&
53900
+ (progress !== this.protocolV2LastTransferProgress ||
53901
+ now - this.protocolV2LastTransferProgressAt >=
53902
+ PROTOCOL_V2_TRANSFER_PROGRESS_HEARTBEAT_MS ||
53903
+ chunkEnd === source.size);
53672
53904
  if (shouldPostProgress) {
53673
53905
  this.protocolV2LastTransferProgress = progress;
53674
53906
  this.protocolV2LastTransferProgressAt = now;
53907
+ this.protocolV2LastTransferredBytes = transferredBytes;
53675
53908
  this.postProgressMessage(progress, 'transferData', {
53676
53909
  transferredBytes,
53677
53910
  totalBytes: totalSize,
53678
- rateBytesPerSecond: elapsedMs > 0 ? Math.round((chunkEnd / elapsedMs) * 1000) : undefined,
53911
+ rateBytesPerSecond: elapsedMs > 0 ? Math.round((transferredBytes / elapsedMs) * 1000) : undefined,
53679
53912
  elapsedMs,
53680
53913
  });
53681
53914
  }
@@ -53685,16 +53918,19 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
53685
53918
  return processedSize + source.size;
53686
53919
  }
53687
53920
  catch (error) {
53921
+ this.throwIfAborted();
53688
53922
  if (hdShared.isBleStaleBondHardwareError(error)) {
53689
53923
  throw error;
53690
53924
  }
53691
53925
  lastError = error;
53692
53926
  if (attempt < PROTOCOL_V2_FILE_TRANSFER_RETRY_COUNT) {
53693
53927
  yield this.recoverProtocolV2FileTransfer();
53928
+ this.throwIfAborted();
53694
53929
  }
53695
53930
  }
53696
53931
  }
53697
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.EmmcFileWriteFirmwareError, `transfer data error: ${getProtocolV2UnknownErrorText(lastError)}`);
53932
+ const causeCode = getProtocolV2ErrorCode(lastError);
53933
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.EmmcFileWriteFirmwareError, `transfer data error: ${getProtocolV2UnknownErrorText(lastError)}`, causeCode === undefined ? undefined : { causeCode });
53698
53934
  });
53699
53935
  }
53700
53936
  getProtocolV2InstallItemStagingPath(item) {
@@ -53899,15 +54135,15 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
53899
54135
  return __awaiter(this, void 0, void 0, function* () {
53900
54136
  const expectedTargetIds = new Set(targets.map(target => target.target_id));
53901
54137
  const expectedPaths = new Map(targets.map(target => [target.target_id, target.path]));
53902
- const isBleCoprocessorInstall = this.isBleReconnect() &&
53903
- expectedTargetIds.has(ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_COPROCESSOR);
54138
+ const isBleInstall = this.isBleReconnect();
53904
54139
  const startTime = Date.now();
53905
54140
  let lastError;
53906
54141
  let shouldReconnect = this.protocolV2InstallNeedsReconnect;
53907
54142
  this.protocolV2InstallNeedsReconnect = false;
53908
54143
  let deviceInfo;
53909
54144
  let bleInstallLinkReady = false;
53910
- let installStatusDisconnectObserved = false;
54145
+ let installStatusDisconnectObserved = isBleInstall && this.protocolV2InstallDisconnectObserved;
54146
+ this.protocolV2InstallDisconnectObserved = false;
53911
54147
  let installReconnectObserved = false;
53912
54148
  let finishedStatusSnapshotKey;
53913
54149
  let finishedStatusSnapshotPolls = 0;
@@ -53915,6 +54151,17 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
53915
54151
  let installEvidenceObserved = this.protocolV2InstallTerminalSuccessObserved;
53916
54152
  let currentInstallStatusObserved = false;
53917
54153
  const liveTargetIds = new Set();
54154
+ const recordBleInstallDisconnect = (error) => {
54155
+ if (!isBleInstall ||
54156
+ !isProtocolV2DeviceDisconnectedError(error) ||
54157
+ isProtocolV2InstallResponseTimeout(error)) {
54158
+ return;
54159
+ }
54160
+ installStatusDisconnectObserved = true;
54161
+ installReconnectObserved = false;
54162
+ finishedStatusSnapshotKey = undefined;
54163
+ finishedStatusSnapshotPolls = 0;
54164
+ };
53918
54165
  while (Date.now() - startTime < PROTOCOL_V2_INSTALL_TIMEOUT) {
53919
54166
  this.throwIfAborted();
53920
54167
  try {
@@ -54030,7 +54277,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
54030
54277
  return;
54031
54278
  }
54032
54279
  if (!hasCurrentInstallEvidence) {
54033
- this.device.setCancelableAction(() => this.device.getCommands().cancelDevice());
54280
+ this.device.setCancelableAction(() => Promise.resolve());
54034
54281
  }
54035
54282
  if (requireCurrentInstallStatus &&
54036
54283
  !hasCurrentInstallEvidence &&
@@ -54101,13 +54348,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
54101
54348
  }
54102
54349
  }
54103
54350
  else {
54104
- if (isBleCoprocessorInstall &&
54105
- isProtocolV2DeviceDisconnectedError(error) &&
54106
- !isProtocolV2ResponseTimeout(error)) {
54107
- installStatusDisconnectObserved = true;
54108
- finishedStatusSnapshotKey = undefined;
54109
- finishedStatusSnapshotPolls = 0;
54110
- }
54351
+ recordBleInstallDisconnect(error);
54111
54352
  shouldReconnect = true;
54112
54353
  deviceInfo = undefined;
54113
54354
  bleInstallLinkReady = false;
@@ -54128,6 +54369,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
54128
54369
  ((_b = error.params) === null || _b === void 0 ? void 0 : _b.firmwareUpdateCode) === 'FirmwareInstallStatusUnavailable') {
54129
54370
  throw error;
54130
54371
  }
54372
+ recordBleInstallDisconnect(error);
54131
54373
  shouldReconnect = true;
54132
54374
  deviceInfo = undefined;
54133
54375
  bleInstallLinkReady = false;
@@ -54377,10 +54619,11 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
54377
54619
  return __awaiter(this, void 0, void 0, function* () {
54378
54620
  this.protocolV2LastRuntimeProbeFeatures = undefined;
54379
54621
  this.protocolV2InstallNeedsReconnect = false;
54622
+ this.protocolV2InstallDisconnectObserved = false;
54380
54623
  this.protocolV2InstallTerminalSuccessObserved = false;
54381
54624
  const commands = this.device.getCommands();
54382
54625
  yield commands.typedCall('DeviceFirmwareUpdateStage', 'Success', { targets });
54383
- this.device.setCancelableAction(() => this.device.getCommands().cancelDevice());
54626
+ this.device.setCancelableAction(() => Promise.resolve());
54384
54627
  const interaction = this.device.createProtocolV2UiPhaseMetadata('button', 'start');
54385
54628
  this.postMessage(createUiMessage(UI_REQUEST.REQUEST_BUTTON, Object.assign({ device: this.device.toMessageObject(), source: 'method-lifecycle', reason: 'firmware-update', completion: 'operation-completed', deviceOnly: true, operation: this.name }, (interaction ? { interaction } : {}))));
54386
54629
  try {
@@ -54404,6 +54647,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
54404
54647
  }
54405
54648
  Log$6.log('[FirmwareUpdateV4] transport released while writing install request; continue status polling');
54406
54649
  this.protocolV2InstallNeedsReconnect = true;
54650
+ this.protocolV2InstallDisconnectObserved = !isProtocolV2InstallResponseTimeout(error);
54407
54651
  }
54408
54652
  });
54409
54653
  }
@@ -54605,6 +54849,7 @@ const CONTAINER_HEADER_MAGIC = 0x50504b4f;
54605
54849
  const CONTAINER_HEADER_VERSION = 1;
54606
54850
  const CONTAINER_RESOURCE_TYPE_MAGIC = 0x43534552;
54607
54851
  const CONTAINER_ED25519_SIGNATURE_ALGORITHM = 0x71717171;
54852
+ const HOST_ASSET_PACKAGE_MAX_SIZE = 4 * 1024 * 1024;
54608
54853
  const ARCHIVE_MAGIC = 0x52414b4f;
54609
54854
  const ARCHIVE_VERSION = 1;
54610
54855
  const ARCHIVE_HEADER_SIZE = 42;
@@ -54612,24 +54857,14 @@ const ARCHIVE_ENTRY_SIZE = 296;
54612
54857
  const ARCHIVE_ENTRY_NAME_MAX_LENGTH = 255;
54613
54858
  const ARCHIVE_COMPRESS_LZ4_BLOCKED = 1;
54614
54859
  const ARCHIVE_ALIGNMENT = 4;
54615
- const LZ4_BLOCK_SIZE_LOG2 = 12;
54616
- const LZ4_MIN_MATCH = 4;
54617
- const LZ4_LAST_LITERALS = 5;
54618
- const LZ4_MATCH_FIND_LIMIT = 12;
54619
- const LZ4_MAX_OFFSET = 0xffff;
54620
- const LZ4_LENGTH_MASK = 15;
54621
- const LZ4_HASH_LOG = 16;
54622
- const LZ4_HASH_MULTIPLIER = 2654435761;
54623
- const LZ4_SKIP_TRIGGER = 6;
54624
- const HOST_ASSET_PACKAGE_MAX_SIZE = 4 * 1024 * 1024;
54860
+ const LZ4_PREFERRED_BLOCK_SIZE_LOG2 = 14;
54861
+ const LZ4_FALLBACK_BLOCK_SIZE_LOG2 = 13;
54862
+ const LZ4_COMPRESSED_BLOCK_SIZE_MAX = 1 << 14;
54625
54863
  function supportsPro2HostAssetPackage(firmwareVersion) {
54626
54864
  return Boolean(firmwareVersion &&
54627
54865
  semver__default["default"].valid(firmwareVersion) &&
54628
54866
  semver__default["default"].gte(firmwareVersion, PRO2_HOST_ASSET_PACKAGE_MIN_VERSION));
54629
54867
  }
54630
- function align(value) {
54631
- return (value + ARCHIVE_ALIGNMENT - 1) & ~(ARCHIVE_ALIGNMENT - 1);
54632
- }
54633
54868
  function concatBytes(parts) {
54634
54869
  const output = new Uint8Array(parts.reduce((length, part) => length + part.byteLength, 0));
54635
54870
  let offset = 0;
@@ -54639,6 +54874,14 @@ function concatBytes(parts) {
54639
54874
  }
54640
54875
  return output;
54641
54876
  }
54877
+ const LZ4_MIN_MATCH = 4;
54878
+ const LZ4_LAST_LITERALS = 5;
54879
+ const LZ4_MATCH_FIND_LIMIT = 12;
54880
+ const LZ4_MAX_OFFSET = 0xffff;
54881
+ const LZ4_LENGTH_MASK = 15;
54882
+ const LZ4_HASH_LOG = 16;
54883
+ const LZ4_HASH_MULTIPLIER = 2654435761;
54884
+ const LZ4_MAX_SEARCH_DEPTH = 64;
54642
54885
  function writeExtendedLength(output, offset, length) {
54643
54886
  let remaining = length;
54644
54887
  let nextOffset = offset;
@@ -54691,7 +54934,7 @@ function emitLastLiterals(output, outputOffset, input, anchor, literalLength) {
54691
54934
  }
54692
54935
  return copyBytes(output, nextOffset, input, anchor, literalLength);
54693
54936
  }
54694
- function compressRawLz4Block(input, hashTable) {
54937
+ function compressRawLz4Block(input, hashTable, matchChain) {
54695
54938
  const output = new Uint8Array(input.byteLength + Math.floor(input.byteLength / 255) + 16);
54696
54939
  const inputView = new DataView(input.buffer, input.byteOffset, input.byteLength);
54697
54940
  const matchFindLimit = input.byteLength - LZ4_MATCH_FIND_LIMIT;
@@ -54699,52 +54942,82 @@ function compressRawLz4Block(input, hashTable) {
54699
54942
  let anchor = 0;
54700
54943
  let inputOffset = 0;
54701
54944
  let outputOffset = 0;
54702
- let searchMatchCount = 1 << LZ4_SKIP_TRIGGER;
54703
54945
  hashTable.fill(0);
54704
54946
  while (inputOffset < matchFindLimit) {
54705
54947
  const sequence = inputView.getUint32(inputOffset, true);
54706
54948
  const hash = Math.imul(sequence, LZ4_HASH_MULTIPLIER) >>> (32 - LZ4_HASH_LOG);
54707
- const candidate = hashTable[hash] - 1;
54949
+ let candidate = hashTable[hash] - 1;
54950
+ matchChain[inputOffset] = candidate;
54708
54951
  hashTable[hash] = inputOffset + 1;
54709
- const hasMatch = !(candidate < 0 ||
54710
- inputOffset - candidate > LZ4_MAX_OFFSET ||
54711
- inputView.getUint32(candidate, true) !== sequence);
54712
- if (!hasMatch) {
54713
- inputOffset += searchMatchCount >> LZ4_SKIP_TRIGGER;
54714
- searchMatchCount += 1;
54952
+ let bestCandidate = -1;
54953
+ let bestMatchEnd = inputOffset;
54954
+ let searchDepth = 0;
54955
+ while (candidate >= 0 &&
54956
+ inputOffset - candidate <= LZ4_MAX_OFFSET &&
54957
+ searchDepth < LZ4_MAX_SEARCH_DEPTH) {
54958
+ if (inputView.getUint32(candidate, true) === sequence) {
54959
+ let matchEnd = inputOffset + LZ4_MIN_MATCH;
54960
+ let reference = candidate + LZ4_MIN_MATCH;
54961
+ while (matchEnd < matchExtendLimit && input[matchEnd] === input[reference]) {
54962
+ matchEnd += 1;
54963
+ reference += 1;
54964
+ }
54965
+ if (matchEnd > bestMatchEnd) {
54966
+ bestCandidate = candidate;
54967
+ bestMatchEnd = matchEnd;
54968
+ }
54969
+ }
54970
+ candidate = matchChain[candidate];
54971
+ searchDepth += 1;
54972
+ }
54973
+ if (bestCandidate < 0) {
54974
+ inputOffset += 1;
54715
54975
  }
54716
54976
  else {
54717
- searchMatchCount = 1 << LZ4_SKIP_TRIGGER;
54718
- let matchEnd = inputOffset + LZ4_MIN_MATCH;
54719
- let reference = candidate + LZ4_MIN_MATCH;
54720
- while (matchEnd < matchExtendLimit && input[matchEnd] === input[reference]) {
54721
- matchEnd += 1;
54722
- reference += 1;
54723
- }
54724
- outputOffset = emitSequence(output, outputOffset, input, anchor, inputOffset - anchor, inputOffset - candidate, matchEnd - inputOffset - LZ4_MIN_MATCH);
54725
- inputOffset = matchEnd;
54977
+ const matchStart = inputOffset;
54978
+ outputOffset = emitSequence(output, outputOffset, input, anchor, inputOffset - anchor, inputOffset - bestCandidate, bestMatchEnd - inputOffset - LZ4_MIN_MATCH);
54979
+ inputOffset = bestMatchEnd;
54726
54980
  anchor = inputOffset;
54981
+ for (let skippedOffset = matchStart + 1; skippedOffset < inputOffset && skippedOffset < matchFindLimit; skippedOffset += 1) {
54982
+ const skippedSequence = inputView.getUint32(skippedOffset, true);
54983
+ const skippedHash = Math.imul(skippedSequence, LZ4_HASH_MULTIPLIER) >>> (32 - LZ4_HASH_LOG);
54984
+ matchChain[skippedOffset] = hashTable[skippedHash] - 1;
54985
+ hashTable[skippedHash] = skippedOffset + 1;
54986
+ }
54727
54987
  }
54728
54988
  }
54729
54989
  outputOffset = emitLastLiterals(output, outputOffset, input, anchor, input.byteLength - anchor);
54730
54990
  return output.slice(0, outputOffset);
54731
54991
  }
54732
- function encodeLz4Blocked(data) {
54733
- const blockSize = 1 << LZ4_BLOCK_SIZE_LOG2;
54992
+ function encodeLz4BlockedWithBlockSize(data, blockSizeLog2) {
54993
+ const blockSize = 1 << blockSizeLog2;
54734
54994
  const blockCount = Math.ceil(data.byteLength / blockSize);
54735
54995
  const hashTable = new Uint32Array(1 << LZ4_HASH_LOG);
54996
+ const matchChain = new Int32Array(blockSize);
54736
54997
  const blocks = [];
54737
54998
  const header = new Uint8Array(8 + blockCount * 4);
54738
54999
  const headerView = new DataView(header.buffer);
54739
55000
  headerView.setUint16(0, blockCount, true);
54740
- headerView.setUint16(2, LZ4_BLOCK_SIZE_LOG2, true);
55001
+ headerView.setUint16(2, blockSizeLog2, true);
54741
55002
  for (let index = 0; index < blockCount; index += 1) {
54742
- const block = compressRawLz4Block(data.subarray(index * blockSize, Math.min((index + 1) * blockSize, data.byteLength)), hashTable);
55003
+ const block = compressRawLz4Block(data.subarray(index * blockSize, Math.min((index + 1) * blockSize, data.byteLength)), hashTable, matchChain);
55004
+ if (block.byteLength > LZ4_COMPRESSED_BLOCK_SIZE_MAX)
55005
+ return undefined;
54743
55006
  headerView.setUint32(8 + index * 4, block.byteLength, true);
54744
55007
  blocks.push(block);
54745
55008
  }
54746
55009
  return concatBytes([header, ...blocks]);
54747
55010
  }
55011
+ function encodeLz4Blocked(data) {
55012
+ const preferred = encodeLz4BlockedWithBlockSize(data, LZ4_PREFERRED_BLOCK_SIZE_LOG2);
55013
+ if (preferred)
55014
+ return preferred;
55015
+ const fallback = encodeLz4BlockedWithBlockSize(data, LZ4_FALLBACK_BLOCK_SIZE_LOG2);
55016
+ if (!fallback) {
55017
+ throw new Error('Pro2 host asset package LZ4 block exceeds the firmware buffer limit.');
55018
+ }
55019
+ return fallback;
55020
+ }
54748
55021
  const CRC32_TABLE = (() => {
54749
55022
  const table = new Uint32Array(256);
54750
55023
  for (let index = 0; index < table.length; index += 1) {
@@ -54763,6 +55036,9 @@ function crc32(data) {
54763
55036
  }
54764
55037
  return (value ^ 0xffffffff) >>> 0;
54765
55038
  }
55039
+ function align(value) {
55040
+ return (value + ARCHIVE_ALIGNMENT - 1) & ~(ARCHIVE_ALIGNMENT - 1);
55041
+ }
54766
55042
  function buildArchive(entries) {
54767
55043
  const textEncoder = new TextEncoder();
54768
55044
  let dataOffset = ARCHIVE_HEADER_SIZE + entries.length * ARCHIVE_ENTRY_SIZE;
@@ -54828,6 +55104,7 @@ const SAFE_FILE_NAME = /^[A-Za-z0-9_-]+(?:\.bin)?$/;
54828
55104
  const DEVICE_SETTINGS_SET_MESSAGE_TYPE = 60412;
54829
55105
  const FILESYSTEM_FILE_WRITE_MESSAGE_TYPE$2 = 60805;
54830
55106
  const FILESYSTEM_DIR_MAKE_MESSAGE_TYPE = 60809;
55107
+ const WALLPAPER_PACKAGE_BLE_CHUNK_SIZE = 1960;
54831
55108
  const Log$4 = getLogger(exports.LoggerNames.Method);
54832
55109
  function normalizeFileName(fileName, data) {
54833
55110
  if (fileName !== undefined && (!fileName || !SAFE_FILE_NAME.test(fileName))) {
@@ -54899,7 +55176,7 @@ class DeviceUploadWallpaper extends BaseMethod {
54899
55176
  this.directoryReady = true;
54900
55177
  });
54901
55178
  }
54902
- upload(path, data) {
55179
+ upload(path, data, bleChunkSizeLimit) {
54903
55180
  return __awaiter(this, void 0, void 0, function* () {
54904
55181
  if (this.uploaded)
54905
55182
  return;
@@ -54909,6 +55186,7 @@ class DeviceUploadWallpaper extends BaseMethod {
54909
55186
  data,
54910
55187
  totalSize: data.byteLength,
54911
55188
  chunkSize: this.params.chunkSize,
55189
+ bleChunkSizeLimit,
54912
55190
  maxChunkRetries: 3,
54913
55191
  overwrite: true,
54914
55192
  append: false,
@@ -54923,20 +55201,20 @@ class DeviceUploadWallpaper extends BaseMethod {
54923
55201
  });
54924
55202
  }
54925
55203
  run() {
54926
- var _a;
55204
+ var _a, _b, _c;
54927
55205
  return __awaiter(this, void 0, void 0, function* () {
54928
55206
  const { encoded } = this;
54929
55207
  if (!encoded)
54930
55208
  throw invalidParameter$1('Wallpaper data has not been initialized.');
54931
55209
  yield this.assertCapabilities();
54932
55210
  yield this.ensureDirectory();
54933
- const useHostAssetPackage = supportsPro2HostAssetPackage(this.device.getCurrentFirmwareVersionString());
55211
+ const useHostAssetPackage = supportsPro2HostAssetPackage((_b = (_a = this.device.state) === null || _a === void 0 ? void 0 : _a.versions.firmware) !== null && _b !== void 0 ? _b : undefined);
54934
55212
  const data = useHostAssetPackage
54935
55213
  ? buildPro2HostAssetPackage([{ name: WALLPAPER_PACKAGE_ENTRY, data: encoded.data }])
54936
55214
  : encoded.data;
54937
55215
  if (useHostAssetPackage)
54938
55216
  this.path = WALLPAPER_PACKAGE_PATH;
54939
- yield this.upload(this.path, data);
55217
+ yield this.upload(this.path, data, useHostAssetPackage ? WALLPAPER_PACKAGE_BLE_CHUNK_SIZE : undefined);
54940
55218
  const response = yield this.device.commands.typedCall('DeviceSettingsSet', 'Success', {
54941
55219
  settings: { wallpaper_path: this.path },
54942
55220
  });
@@ -54952,7 +55230,7 @@ class DeviceUploadWallpaper extends BaseMethod {
54952
55230
  path: this.path,
54953
55231
  size: data.byteLength,
54954
55232
  colorFormat: encoded.colorFormat,
54955
- message: (_a = response.message) === null || _a === void 0 ? void 0 : _a.message,
55233
+ message: (_c = response.message) === null || _c === void 0 ? void 0 : _c.message,
54956
55234
  };
54957
55235
  });
54958
55236
  }
@@ -55062,12 +55340,12 @@ class DeviceUploadNft extends BaseMethod {
55062
55340
  });
55063
55341
  }
55064
55342
  run() {
55065
- var _a;
55343
+ var _a, _b, _c;
55066
55344
  return __awaiter(this, void 0, void 0, function* () {
55067
55345
  const { bundle } = this;
55068
55346
  if (!bundle)
55069
55347
  throw invalidParameter$1('NFT data has not been initialized.');
55070
- const useHostAssetPackage = supportsPro2HostAssetPackage(this.device.getCurrentFirmwareVersionString());
55348
+ const useHostAssetPackage = supportsPro2HostAssetPackage((_b = (_a = this.device.state) === null || _a === void 0 ? void 0 : _a.versions.firmware) !== null && _b !== void 0 ? _b : undefined);
55071
55349
  yield this.assertCapabilities(useHostAssetPackage);
55072
55350
  this.throwIfAborted();
55073
55351
  if (!useHostAssetPackage)
@@ -55122,7 +55400,7 @@ class DeviceUploadNft extends BaseMethod {
55122
55400
  metadataPath: extractedFiles[2].path,
55123
55401
  totalSize,
55124
55402
  nftUpdated: true,
55125
- message: (_a = response.message) === null || _a === void 0 ? void 0 : _a.message,
55403
+ message: (_c = response.message) === null || _c === void 0 ? void 0 : _c.message,
55126
55404
  };
55127
55405
  });
55128
55406
  }
@@ -55750,7 +56028,7 @@ class AllNetworkGetAddressBase extends BaseMethod {
55750
56028
  }
55751
56029
  }
55752
56030
  const useEmptyPassphrase = this.payload.useEmptyPassphrase === true;
55753
- const deriveCardano = method.name.startsWith('cardano');
56031
+ const deriveCardano = method.name.startsWith('cardano') ? true : undefined;
55754
56032
  const shouldResumeWalletSession = useEmptyPassphrase || !!this.payload.passphraseState;
55755
56033
  if (this.device.isProtocolV2() && shouldResumeWalletSession) {
55756
56034
  const passphraseStateSafety = yield this.device.checkPassphraseStateSafety(this.payload.passphraseState, useEmptyPassphrase, this.payload.skipPassphraseCheck, deriveCardano, (_d = this.protocolV2UnlockContext) === null || _d === void 0 ? void 0 : _d.preflightMainPinSelected);
@@ -65321,10 +65599,17 @@ class RequestQueue {
65321
65599
  }
65322
65600
  return false;
65323
65601
  }
65602
+ isRequestForConnectId(request, connectId) {
65603
+ var _a, _b;
65604
+ const { method } = request;
65605
+ return (method.connectId === connectId ||
65606
+ ((_a = method.device) === null || _a === void 0 ? void 0 : _a.mainId) === connectId ||
65607
+ ((_b = method.device) === null || _b === void 0 ? void 0 : _b.getConnectId()) === connectId);
65608
+ }
65324
65609
  abortRequestsByConnectId(connectId) {
65325
65610
  let count = 0;
65326
65611
  this.requestQueue.forEach((request, _) => {
65327
- if (request.abortController && request.method.connectId === connectId) {
65612
+ if (request.abortController && this.isRequestForConnectId(request, connectId)) {
65328
65613
  request.abortController.abort();
65329
65614
  request.abortController = undefined;
65330
65615
  count++;
@@ -65332,6 +65617,11 @@ class RequestQueue {
65332
65617
  });
65333
65618
  return count;
65334
65619
  }
65620
+ getRequestTasksIdByConnectId(connectId) {
65621
+ return Array.from(this.requestQueue.values())
65622
+ .filter(request => this.isRequestForConnectId(request, connectId))
65623
+ .map(request => request.id);
65624
+ }
65335
65625
  abortAllRequests() {
65336
65626
  let count = 0;
65337
65627
  this.requestQueue.forEach(request => {
@@ -65498,7 +65788,7 @@ const PRE_INITIALIZE_TTL_MS = 60 * 1000;
65498
65788
  const PRE_PENDING_CALL_TIMEOUT_MS = 15 * 1000;
65499
65789
  const preWarmInflight = new Map();
65500
65790
  const preWarmDoneAt = new Map();
65501
- function hasDeriveCardano(method) {
65791
+ function resolveDeriveCardano(method) {
65502
65792
  var _a;
65503
65793
  if (method.name.startsWith('allNetworkGetAddress') &&
65504
65794
  method.payload &&
@@ -65506,13 +65796,19 @@ function hasDeriveCardano(method) {
65506
65796
  method.payload.bundle.some(net => net && net.network === 'ada')) {
65507
65797
  return true;
65508
65798
  }
65509
- return method.name.startsWith('cardano') || ((_a = method.payload) === null || _a === void 0 ? void 0 : _a.deriveCardano);
65799
+ if (method.name.startsWith('cardano')) {
65800
+ return true;
65801
+ }
65802
+ if (((_a = method.payload) === null || _a === void 0 ? void 0 : _a.deriveCardano) === true) {
65803
+ return true;
65804
+ }
65805
+ return undefined;
65510
65806
  }
65511
65807
  const parseInitOptions = (method) => ({
65512
65808
  initSession: method === null || method === void 0 ? void 0 : method.payload.initSession,
65513
65809
  passphraseState: (method === null || method === void 0 ? void 0 : method.payload.useEmptyPassphrase) ? undefined : method === null || method === void 0 ? void 0 : method.payload.passphraseState,
65514
65810
  deviceId: method === null || method === void 0 ? void 0 : method.payload.deviceId,
65515
- deriveCardano: method && hasDeriveCardano(method),
65811
+ deriveCardano: method ? resolveDeriveCardano(method) : undefined,
65516
65812
  connectProtocol: method === null || method === void 0 ? void 0 : method.payload.connectProtocol,
65517
65813
  forceProtocolDetection: method === null || method === void 0 ? void 0 : method.payload.forceProtocolDetection,
65518
65814
  protocolV2DeviceInfoTimeoutMs: method === null || method === void 0 ? void 0 : method.payload.protocolV2DeviceInfoTimeoutMs,
@@ -65871,7 +66167,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
65871
66167
  require: support.require,
65872
66168
  });
65873
66169
  }
65874
- const passphraseStateSafety = yield device.checkPassphraseStateSafety((_o = method.payload) === null || _o === void 0 ? void 0 : _o.passphraseState, (_p = method.payload) === null || _p === void 0 ? void 0 : _p.useEmptyPassphrase, (_q = method.payload) === null || _q === void 0 ? void 0 : _q.skipPassphraseCheck, hasDeriveCardano(method), (_r = method.protocolV2UnlockContext) === null || _r === void 0 ? void 0 : _r.preflightMainPinSelected);
66170
+ const passphraseStateSafety = yield device.checkPassphraseStateSafety((_o = method.payload) === null || _o === void 0 ? void 0 : _o.passphraseState, (_p = method.payload) === null || _p === void 0 ? void 0 : _p.useEmptyPassphrase, (_q = method.payload) === null || _q === void 0 ? void 0 : _q.skipPassphraseCheck, resolveDeriveCardano(method), (_r = method.protocolV2UnlockContext) === null || _r === void 0 ? void 0 : _r.preflightMainPinSelected);
65875
66171
  checkPassphraseEnableState(method, device.features);
65876
66172
  if (!passphraseStateSafety) {
65877
66173
  DevicePool.clearDeviceCache(method.payload.connectId);
@@ -66149,18 +66445,19 @@ function connectDeviceForBle(method, device, abortSignal, retryCount = 0) {
66149
66445
  !device.commands ||
66150
66446
  device.commands.disposed;
66151
66447
  if (shouldAcquire) {
66448
+ const connectProtocol = resolveBleConnectProtocol(method);
66152
66449
  const useAcquireGuards = DataManager.getSettings('env') === 'desktop-web-ble';
66153
66450
  if (useAcquireGuards && (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted)) {
66154
66451
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallQueueActionCancelled);
66155
66452
  }
66156
66453
  if (!useAcquireGuards) {
66157
- yield device.acquire(method.payload.connectProtocol, {
66454
+ yield device.acquire(connectProtocol, {
66158
66455
  forceProtocolDetection: method.payload.forceProtocolDetection,
66159
66456
  });
66160
66457
  }
66161
66458
  else {
66162
66459
  try {
66163
- yield raceBleAcquire(device.acquire(method.payload.connectProtocol, {
66460
+ yield raceBleAcquire(device.acquire(connectProtocol, {
66164
66461
  forceProtocolDetection: method.payload.forceProtocolDetection,
66165
66462
  }), abortSignal);
66166
66463
  }
@@ -66212,6 +66509,13 @@ function connectDeviceForBle(method, device, abortSignal, retryCount = 0) {
66212
66509
  }
66213
66510
  });
66214
66511
  }
66512
+ function resolveBleConnectProtocol(method) {
66513
+ if (method.payload.connectProtocol === 'V1' || method.payload.connectProtocol === 'V2') {
66514
+ return method.payload.connectProtocol;
66515
+ }
66516
+ const supportedProtocols = method.getSupportedProtocols();
66517
+ return supportedProtocols.length === 1 && supportedProtocols[0] === 'V2' ? 'V2' : undefined;
66518
+ }
66215
66519
  const ensureConnected = (_context, method, connectId, pollingId, abortSignal) => __awaiter(void 0, void 0, void 0, function* () {
66216
66520
  let tryCount = 0;
66217
66521
  const MAX_RETRY_COUNT = method.payload && typeof method.payload.retryCount === 'number' ? method.payload.retryCount : 5;
@@ -66360,12 +66664,12 @@ const ensureConnected = (_context, method, connectId, pollingId, abortSignal) =>
66360
66664
  return poll();
66361
66665
  });
66362
66666
  const cancel = (context, connectId) => {
66363
- var _a, _b, _c;
66667
+ var _a, _b;
66364
66668
  const { requestQueue, setPrePendingCallPromise } = context;
66365
66669
  if (connectId) {
66366
66670
  try {
66367
66671
  requestQueue.cancelCallbackTasks(connectId);
66368
- const requestIds = requestQueue.getRequestTasksId();
66672
+ const requestIds = requestQueue.getRequestTasksIdByConnectId(connectId);
66369
66673
  Log.debug(`Cancel Api connect requestQueues: length:${requestIds.length} requestIds:${requestIds.join(',')}`);
66370
66674
  requestQueue.abortRequestsByConnectId(connectId);
66371
66675
  const canceledDevices = [];
@@ -66380,7 +66684,7 @@ const cancel = (context, connectId) => {
66380
66684
  const task = requestQueue.getTask(requestId);
66381
66685
  Log.debug('Cancel Api connect task: ', task);
66382
66686
  if (task) {
66383
- interruptDevice((_a = task.method) === null || _a === void 0 ? void 0 : _a.device, (_b = task.method.connectId) !== null && _b !== void 0 ? _b : connectId);
66687
+ interruptDevice((_a = task.method) === null || _a === void 0 ? void 0 : _a.device, connectId);
66384
66688
  interruptDevice(deviceCacheMap.get(connectId), connectId);
66385
66689
  requestQueue.rejectRequest(requestId, hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallQueueActionCancelled));
66386
66690
  }
@@ -66394,9 +66698,9 @@ const cancel = (context, connectId) => {
66394
66698
  }
66395
66699
  else {
66396
66700
  const env = DataManager.getSettings('env');
66701
+ requestQueue.abortAllRequests();
66397
66702
  if (DataManager.isBleConnect(env)) {
66398
66703
  Log.debug('Cancel Api all _deviceList: ');
66399
- requestQueue.abortAllRequests();
66400
66704
  const canceledDevices = [];
66401
66705
  const interruptDevice = (device) => {
66402
66706
  if (!device || canceledDevices.includes(device)) {
@@ -66409,7 +66713,7 @@ const cancel = (context, connectId) => {
66409
66713
  const task = requestQueue.getTask(requestId);
66410
66714
  Log.debug('Cancel Api connect task: ', task);
66411
66715
  if (task) {
66412
- interruptDevice((_c = task.method) === null || _c === void 0 ? void 0 : _c.device);
66716
+ interruptDevice((_b = task.method) === null || _b === void 0 ? void 0 : _b.device);
66413
66717
  if (task.method.connectId) {
66414
66718
  interruptDevice(deviceCacheMap.get(task.method.connectId));
66415
66719
  pollingManager.stop(task.method.connectId);
@@ -66432,8 +66736,10 @@ const cancel = (context, connectId) => {
66432
66736
  });
66433
66737
  }
66434
66738
  }
66435
- cleanup();
66436
- closePopup();
66739
+ cleanup(connectId);
66740
+ if (!connectId || _uiPromises.length === 0) {
66741
+ closePopup();
66742
+ }
66437
66743
  };
66438
66744
  const checkPassphraseEnableState = (method, features) => {
66439
66745
  if (!method.useDevicePassphraseState)
@@ -66463,9 +66769,13 @@ const shouldCheckPassphraseState = (method, device) => {
66463
66769
  }
66464
66770
  return device.hasUsePassphrase();
66465
66771
  };
66466
- const cleanup = () => {
66467
- const pendingUiPromises = _uiPromises;
66468
- _uiPromises = [];
66772
+ const cleanup = (connectId) => {
66773
+ const pendingUiPromises = connectId
66774
+ ? _uiPromises.filter(uiPromise => { var _a, _b; return ((_a = uiPromise.data) === null || _a === void 0 ? void 0 : _a.mainId) === connectId || ((_b = uiPromise.data) === null || _b === void 0 ? void 0 : _b.getConnectId()) === connectId; })
66775
+ : _uiPromises;
66776
+ _uiPromises = connectId
66777
+ ? _uiPromises.filter(uiPromise => !pendingUiPromises.includes(uiPromise))
66778
+ : [];
66469
66779
  rejectUiPromises(pendingUiPromises, hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.ActionCancelled, 'UI request was cancelled'));
66470
66780
  };
66471
66781
  const removeDeviceListener = (device) => {