@onekeyfe/hd-transport 1.1.34-alpha.2 → 1.1.34-alpha.3

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 (93) hide show
  1. package/__tests__/build-receive.test.js +6 -8
  2. package/__tests__/decode-features.test.js +3 -2
  3. package/__tests__/messages.test.js +131 -0
  4. package/__tests__/protocol-v2-link-manager.test.js +351 -0
  5. package/__tests__/protocol-v2-usb-transport-base.test.js +296 -0
  6. package/__tests__/protocol-v2.test.js +899 -0
  7. package/dist/constants.d.ts +16 -5
  8. package/dist/constants.d.ts.map +1 -1
  9. package/dist/index.d.ts +1398 -45
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1102 -85
  12. package/dist/protocols/index.d.ts +50 -0
  13. package/dist/protocols/index.d.ts.map +1 -0
  14. package/dist/protocols/v1/decode.d.ts +11 -0
  15. package/dist/protocols/v1/decode.d.ts.map +1 -0
  16. package/dist/protocols/v1/encode.d.ts +11 -0
  17. package/dist/protocols/v1/encode.d.ts.map +1 -0
  18. package/dist/protocols/v1/index.d.ts +5 -0
  19. package/dist/protocols/v1/index.d.ts.map +1 -0
  20. package/dist/protocols/v1/packets.d.ts +7 -0
  21. package/dist/protocols/v1/packets.d.ts.map +1 -0
  22. package/dist/{serialization → protocols/v1}/receive.d.ts +1 -1
  23. package/dist/protocols/v1/receive.d.ts.map +1 -0
  24. package/dist/protocols/v2/constants.d.ts +8 -0
  25. package/dist/protocols/v2/constants.d.ts.map +1 -0
  26. package/dist/protocols/v2/crc8.d.ts +3 -0
  27. package/dist/protocols/v2/crc8.d.ts.map +1 -0
  28. package/dist/protocols/v2/decode.d.ts +8 -0
  29. package/dist/protocols/v2/decode.d.ts.map +1 -0
  30. package/dist/protocols/v2/encode.d.ts +4 -0
  31. package/dist/protocols/v2/encode.d.ts.map +1 -0
  32. package/dist/protocols/v2/frame-assembler.d.ts +12 -0
  33. package/dist/protocols/v2/frame-assembler.d.ts.map +1 -0
  34. package/dist/protocols/v2/index.d.ts +6 -0
  35. package/dist/protocols/v2/index.d.ts.map +1 -0
  36. package/dist/protocols/v2/link-manager.d.ts +36 -0
  37. package/dist/protocols/v2/link-manager.d.ts.map +1 -0
  38. package/dist/protocols/v2/sequence-cursor.d.ts +5 -0
  39. package/dist/protocols/v2/sequence-cursor.d.ts.map +1 -0
  40. package/dist/protocols/v2/session.d.ts +63 -0
  41. package/dist/protocols/v2/session.d.ts.map +1 -0
  42. package/dist/protocols/v2/usb-transport-base.d.ts +31 -0
  43. package/dist/protocols/v2/usb-transport-base.d.ts.map +1 -0
  44. package/dist/serialization/index.d.ts +6 -3
  45. package/dist/serialization/index.d.ts.map +1 -1
  46. package/dist/serialization/protobuf/decode.d.ts.map +1 -1
  47. package/dist/serialization/protobuf/messages.d.ts +1 -1
  48. package/dist/serialization/protobuf/messages.d.ts.map +1 -1
  49. package/dist/types/messages.d.ts +707 -12
  50. package/dist/types/messages.d.ts.map +1 -1
  51. package/dist/types/transport.d.ts +19 -5
  52. package/dist/types/transport.d.ts.map +1 -1
  53. package/dist/utils/logBlockCommand.d.ts.map +1 -1
  54. package/messages-protocol-v2.json +13544 -0
  55. package/package.json +3 -3
  56. package/scripts/protobuf-patches/TxInputType.js +1 -0
  57. package/scripts/protobuf-patches/index.js +2 -0
  58. package/scripts/protobuf-types.js +233 -18
  59. package/src/constants.ts +48 -6
  60. package/src/index.ts +47 -11
  61. package/src/protocols/index.ts +124 -0
  62. package/src/{serialization/protocol → protocols/v1}/decode.ts +4 -4
  63. package/src/{serialization/protocol → protocols/v1}/encode.ts +18 -13
  64. package/src/protocols/v1/index.ts +4 -0
  65. package/src/protocols/v1/packets.ts +53 -0
  66. package/src/{serialization → protocols/v1}/receive.ts +5 -5
  67. package/src/protocols/v2/constants.ts +7 -0
  68. package/src/protocols/v2/crc8.ts +34 -0
  69. package/src/protocols/v2/decode.ts +89 -0
  70. package/src/protocols/v2/encode.ts +90 -0
  71. package/src/protocols/v2/frame-assembler.ts +98 -0
  72. package/src/protocols/v2/index.ts +5 -0
  73. package/src/protocols/v2/link-manager.ts +162 -0
  74. package/src/protocols/v2/sequence-cursor.ts +10 -0
  75. package/src/protocols/v2/session.ts +339 -0
  76. package/src/protocols/v2/usb-transport-base.ts +194 -0
  77. package/src/serialization/index.ts +6 -5
  78. package/src/serialization/protobuf/decode.ts +7 -0
  79. package/src/serialization/protobuf/messages.ts +14 -5
  80. package/src/types/messages.ts +903 -13
  81. package/src/types/transport.ts +29 -5
  82. package/src/utils/logBlockCommand.ts +9 -1
  83. package/dist/serialization/protocol/decode.d.ts +0 -11
  84. package/dist/serialization/protocol/decode.d.ts.map +0 -1
  85. package/dist/serialization/protocol/encode.d.ts +0 -11
  86. package/dist/serialization/protocol/encode.d.ts.map +0 -1
  87. package/dist/serialization/protocol/index.d.ts +0 -3
  88. package/dist/serialization/protocol/index.d.ts.map +0 -1
  89. package/dist/serialization/receive.d.ts.map +0 -1
  90. package/dist/serialization/send.d.ts +0 -7
  91. package/dist/serialization/send.d.ts.map +0 -1
  92. package/src/serialization/protocol/index.ts +0 -2
  93. package/src/serialization/send.ts +0 -58
@@ -275,6 +275,7 @@ export type GetAddress = {
275
275
  };
276
276
  export type Address = {
277
277
  address: string;
278
+ mac?: string;
278
279
  };
279
280
  export type GetOwnershipId = {
280
281
  address_n: number[];
@@ -303,6 +304,13 @@ export type VerifyMessage = {
303
304
  message: string;
304
305
  coin_name?: string;
305
306
  };
307
+ export type CoinJoinRequest = {
308
+ fee_rate: number;
309
+ no_fee_threshold: number;
310
+ min_registrable_amount: number;
311
+ mask_public_key: string;
312
+ signature: string;
313
+ };
306
314
  export type SignTx = {
307
315
  outputs_count: number;
308
316
  inputs_count: number;
@@ -316,6 +324,8 @@ export type SignTx = {
316
324
  branch_id?: number;
317
325
  amount_unit?: AmountUnit;
318
326
  decred_staking_ticket?: boolean;
327
+ serialize?: boolean;
328
+ coinjoin_request?: CoinJoinRequest;
319
329
  };
320
330
  export declare enum Enum_RequestType {
321
331
  TXINPUT = 0,
@@ -324,7 +334,8 @@ export declare enum Enum_RequestType {
324
334
  TXFINISHED = 3,
325
335
  TXEXTRADATA = 4,
326
336
  TXORIGINPUT = 5,
327
- TXORIGOUTPUT = 6
337
+ TXORIGOUTPUT = 6,
338
+ TXPAYMENTREQ = 7
328
339
  }
329
340
  export type RequestType = keyof typeof Enum_RequestType;
330
341
  export type TxRequestDetailsType = {
@@ -359,6 +370,7 @@ type CommonTxInputType = {
359
370
  witness?: string;
360
371
  ownership_proof?: string;
361
372
  commitment_data?: string;
373
+ coinjoin_flags?: number;
362
374
  };
363
375
  export type TxInputType = (CommonTxInputType & {
364
376
  address_n: number[];
@@ -498,12 +510,15 @@ export type OwnershipProof = {
498
510
  };
499
511
  export type AuthorizeCoinJoin = {
500
512
  coordinator: string;
501
- max_total_fee: number;
513
+ max_total_fee?: number;
502
514
  fee_per_anonymity?: number;
503
515
  address_n: number[];
504
516
  coin_name?: string;
505
517
  script_type?: InputScriptType;
506
518
  amount_unit?: AmountUnit;
519
+ max_rounds?: number;
520
+ max_coordinator_fee_rate?: number;
521
+ max_fee_per_kvbyte?: number;
507
522
  };
508
523
  export type BIP32Address = {
509
524
  address_n: number[];
@@ -867,11 +882,15 @@ export declare enum FailureType {
867
882
  Failure_PinMismatch = 12,
868
883
  Failure_WipeCodeMismatch = 13,
869
884
  Failure_InvalidSession = 14,
870
- Failure_FirmwareError = 99
885
+ Failure_FirmwareError = 99,
886
+ Failure_InvalidMessage = 1,
887
+ Failure_UndefinedError = 2,
888
+ Failure_UsageError = 3
871
889
  }
872
890
  export type Failure = {
873
891
  code?: FailureType;
874
892
  message?: string;
893
+ subcode?: number;
875
894
  };
876
895
  export declare enum Enum_ButtonRequestType {
877
896
  ButtonRequest_Other = 1,
@@ -1735,7 +1754,10 @@ export type LnurlAuthResp = {
1735
1754
  export declare enum Enum_BackupType {
1736
1755
  Bip39 = 0,
1737
1756
  Slip39_Basic = 1,
1738
- Slip39_Advanced = 2
1757
+ Slip39_Advanced = 2,
1758
+ Slip39_Single_Extendable = 3,
1759
+ Slip39_Basic_Extendable = 4,
1760
+ Slip39_Advanced_Extendable = 5
1739
1761
  }
1740
1762
  export type BackupType = keyof typeof Enum_BackupType;
1741
1763
  export declare enum Enum_SafetyCheckLevel {
@@ -1882,6 +1904,19 @@ export type Features = {
1882
1904
  onekey_se04_state?: string | null;
1883
1905
  attach_to_pin_user?: boolean;
1884
1906
  unlocked_attach_pin?: boolean;
1907
+ coprocessor_bt_name?: string;
1908
+ coprocessor_version?: string;
1909
+ coprocessor_bt_enable?: boolean;
1910
+ romloader_version?: string;
1911
+ onekey_romloader_version?: string;
1912
+ onekey_romloader_hash?: string;
1913
+ onekey_bootloader_version?: string;
1914
+ onekey_bootloader_hash?: string;
1915
+ onekey_bootloader_build_id?: string;
1916
+ onekey_coprocessor_bt_name?: string;
1917
+ onekey_coprocessor_version?: string;
1918
+ onekey_coprocessor_build_id?: string;
1919
+ onekey_coprocessor_hash?: string;
1885
1920
  };
1886
1921
  export type OnekeyFeatures = {
1887
1922
  onekey_device_type?: OneKeyDeviceType;
@@ -1928,6 +1963,28 @@ export type OnekeyFeatures = {
1928
1963
  onekey_se02_boot_build_id?: string;
1929
1964
  onekey_se03_boot_build_id?: string;
1930
1965
  onekey_se04_boot_build_id?: string;
1966
+ onekey_romloader_version?: string;
1967
+ onekey_bootloader_version?: string;
1968
+ onekey_romloader_hash?: string;
1969
+ onekey_bootloader_hash?: string;
1970
+ onekey_romloader_build_id?: string;
1971
+ onekey_bootloader_build_id?: string;
1972
+ onekey_coprocessor_bt_name?: string;
1973
+ onekey_coprocessor_version?: string;
1974
+ onekey_coprocessor_build_id?: string;
1975
+ onekey_coprocessor_hash?: string;
1976
+ onekey_se01_bootloader_version?: string;
1977
+ onekey_se02_bootloader_version?: string;
1978
+ onekey_se03_bootloader_version?: string;
1979
+ onekey_se04_bootloader_version?: string;
1980
+ onekey_se01_bootloader_hash?: string;
1981
+ onekey_se02_bootloader_hash?: string;
1982
+ onekey_se03_bootloader_hash?: string;
1983
+ onekey_se04_bootloader_hash?: string;
1984
+ onekey_se01_bootloader_build_id?: string;
1985
+ onekey_se02_bootloader_build_id?: string;
1986
+ onekey_se03_bootloader_build_id?: string;
1987
+ onekey_se04_bootloader_build_id?: string;
1931
1988
  };
1932
1989
  export type LockDevice = {};
1933
1990
  export type EndSession = {};
@@ -2266,7 +2323,7 @@ export type MoneroTransactionRsigData = {
2266
2323
  export type MoneroGetAddress = {
2267
2324
  address_n: number[];
2268
2325
  show_display?: boolean;
2269
- network_type?: number;
2326
+ network_type?: number | MoneroNetworkType;
2270
2327
  account?: number;
2271
2328
  minor?: number;
2272
2329
  payment_id?: string;
@@ -2276,7 +2333,7 @@ export type MoneroAddress = {
2276
2333
  };
2277
2334
  export type MoneroGetWatchKey = {
2278
2335
  address_n: number[];
2279
- network_type?: number;
2336
+ network_type?: number | MoneroNetworkType;
2280
2337
  };
2281
2338
  export type MoneroWatchKey = {
2282
2339
  watch_key?: string;
@@ -2302,7 +2359,7 @@ export type MoneroTransactionData = {
2302
2359
  export type MoneroTransactionInitRequest = {
2303
2360
  version?: number;
2304
2361
  address_n: number[];
2305
- network_type?: number;
2362
+ network_type?: number | MoneroNetworkType;
2306
2363
  tsx_data?: MoneroTransactionData;
2307
2364
  };
2308
2365
  export type MoneroTransactionInitAck = {
@@ -2394,7 +2451,7 @@ export type MoneroKeyImageExportInitRequest = {
2394
2451
  num?: number;
2395
2452
  hash?: string;
2396
2453
  address_n: number[];
2397
- network_type?: number;
2454
+ network_type?: number | MoneroNetworkType;
2398
2455
  subs: MoneroSubAddressIndicesList[];
2399
2456
  };
2400
2457
  export type MoneroKeyImageExportInitAck = {};
@@ -2422,7 +2479,7 @@ export type MoneroKeyImageSyncFinalAck = {
2422
2479
  };
2423
2480
  export type MoneroGetTxKeyRequest = {
2424
2481
  address_n: number[];
2425
- network_type?: number;
2482
+ network_type?: number | MoneroNetworkType;
2426
2483
  salt1?: string;
2427
2484
  salt2?: string;
2428
2485
  tx_enc_keys?: string;
@@ -2437,7 +2494,7 @@ export type MoneroGetTxKeyAck = {
2437
2494
  };
2438
2495
  export type MoneroLiveRefreshStartRequest = {
2439
2496
  address_n: number[];
2440
- network_type?: number;
2497
+ network_type?: number | MoneroNetworkType;
2441
2498
  };
2442
2499
  export type MoneroLiveRefreshStartAck = {};
2443
2500
  export type MoneroLiveRefreshStepRequest = {
@@ -3201,6 +3258,7 @@ export type TonSignedMessage = {
3201
3258
  signature?: string;
3202
3259
  signning_message?: string;
3203
3260
  init_data_length?: number;
3261
+ signing_message?: string;
3204
3262
  };
3205
3263
  export type TonSignProof = {
3206
3264
  address_n: number[];
@@ -3354,6 +3412,551 @@ export declare enum CommandFlags {
3354
3412
  Default = 0,
3355
3413
  Factory_Only = 1
3356
3414
  }
3415
+ export type experimental_message = {};
3416
+ export type experimental_field = {};
3417
+ export type TextMemo = {
3418
+ text: string;
3419
+ };
3420
+ export type RefundMemo = {
3421
+ address: string;
3422
+ mac: string;
3423
+ };
3424
+ export type CoinPurchaseMemo = {
3425
+ coin_type: number;
3426
+ amount: UintType;
3427
+ address: string;
3428
+ mac: string;
3429
+ };
3430
+ export type PaymentRequestMemo = {
3431
+ text_memo?: TextMemo;
3432
+ refund_memo?: RefundMemo;
3433
+ coin_purchase_memo?: CoinPurchaseMemo;
3434
+ };
3435
+ export type TxAckPaymentRequest = {
3436
+ nonce?: string;
3437
+ recipient_name: string;
3438
+ memos?: PaymentRequestMemo[];
3439
+ amount?: UintType;
3440
+ signature: string;
3441
+ };
3442
+ export type EthereumSignTypedDataQR = {
3443
+ address_n: number[];
3444
+ json_data?: string;
3445
+ chain_id?: number;
3446
+ metamask_v4_compat?: boolean;
3447
+ request_id?: string;
3448
+ };
3449
+ export type InternalMyAddressRequest = {
3450
+ coin_type: number;
3451
+ chain_id: number;
3452
+ account_index: number;
3453
+ derive_type: number;
3454
+ };
3455
+ export type StartSession = {
3456
+ session_id?: string;
3457
+ _skip_passphrase?: boolean;
3458
+ derive_cardano?: boolean;
3459
+ };
3460
+ export type SetBusy = {
3461
+ expiry_ms?: number;
3462
+ };
3463
+ export type GetFirmwareHash = {
3464
+ challenge?: string;
3465
+ };
3466
+ export type FirmwareHash = {
3467
+ hash: string;
3468
+ };
3469
+ export type GetNonce = {};
3470
+ export type Nonce = {
3471
+ nonce: string;
3472
+ };
3473
+ export type WriteSEPrivateKey = {
3474
+ private_key: string;
3475
+ };
3476
+ export declare enum WallpaperTarget {
3477
+ Home = 0,
3478
+ Lock = 1
3479
+ }
3480
+ export type SetWallpaper = {
3481
+ target: WallpaperTarget;
3482
+ path: string;
3483
+ };
3484
+ export type GetWallpaper = {
3485
+ target: WallpaperTarget;
3486
+ };
3487
+ export type Wallpaper = {
3488
+ target: WallpaperTarget;
3489
+ path: string;
3490
+ };
3491
+ export type UnlockPath = {
3492
+ address_n: number[];
3493
+ mac?: string;
3494
+ };
3495
+ export type UnlockedPathRequest = {
3496
+ mac?: string;
3497
+ };
3498
+ export declare enum MoneroNetworkType {
3499
+ MAINNET = 0,
3500
+ TESTNET = 1,
3501
+ STAGENET = 2,
3502
+ FAKECHAIN = 3
3503
+ }
3504
+ export type ViewAmount = {
3505
+ is_unlimited: boolean;
3506
+ num: string;
3507
+ };
3508
+ export type ViewDetail = {
3509
+ key: number;
3510
+ value: string;
3511
+ is_overview: boolean;
3512
+ has_icon: boolean;
3513
+ };
3514
+ export declare enum ViewTipType {
3515
+ Default = 0,
3516
+ Highlight = 1,
3517
+ Recommend = 2,
3518
+ Warning = 3,
3519
+ Danger = 4
3520
+ }
3521
+ export type ViewTip = {
3522
+ type: ViewTipType;
3523
+ text: string;
3524
+ };
3525
+ export type ViewRawData = {
3526
+ initial_data: string;
3527
+ placeholder: number;
3528
+ };
3529
+ export declare enum ViewSignLayout {
3530
+ LayoutDefault = 0,
3531
+ LayoutSafeTxCreate = 1,
3532
+ LayoutFinalConfirm = 2,
3533
+ Layout7702 = 3,
3534
+ LayoutFlat = 4,
3535
+ LayoutEthApprove = 5
3536
+ }
3537
+ export type ViewSignPage = {
3538
+ title: string;
3539
+ amount?: UintType;
3540
+ general: ViewDetail[];
3541
+ tip?: ViewTip;
3542
+ raw_data?: ViewRawData;
3543
+ slide_to_confirm?: boolean;
3544
+ layout?: ViewSignLayout;
3545
+ };
3546
+ export type ViewVerifyPage = {
3547
+ title: string;
3548
+ address: string;
3549
+ path: string;
3550
+ network?: string;
3551
+ derive_type?: string;
3552
+ value_key?: number;
3553
+ };
3554
+ export type ProtocolInfoRequest = {};
3555
+ export type ProtocolInfo = {
3556
+ version: number;
3557
+ supported_messages: number[];
3558
+ protobuf_definition?: string;
3559
+ };
3560
+ export declare enum DeviceErrorCode {
3561
+ DeviceError_None = 0,
3562
+ DeviceError_Busy = 1,
3563
+ DeviceError_NotInitialized = 2,
3564
+ DeviceError_ActionCancelled = 3,
3565
+ DeviceError_PinAlreadyUsed = 4,
3566
+ DeviceError_PersistFailed = 5,
3567
+ DeviceError_SeError = 6,
3568
+ DeviceError_InvalidLanguage = 7,
3569
+ DeviceError_WallpaperNotUsable = 8,
3570
+ DeviceError_DeviceLocked = 9
3571
+ }
3572
+ export declare enum DeviceRebootType {
3573
+ Normal = 0,
3574
+ Romloader = 1,
3575
+ Bootloader = 2
3576
+ }
3577
+ export type DeviceReboot = {
3578
+ reboot_type: DeviceRebootType;
3579
+ };
3580
+ export type DeviceSettings = {
3581
+ label?: string;
3582
+ bt_enable?: boolean;
3583
+ language?: string;
3584
+ wallpaper_path?: string;
3585
+ brightness?: number;
3586
+ autolock_delay_ms?: number;
3587
+ autoshutdown_delay_ms?: number;
3588
+ animation_enable?: boolean;
3589
+ tap_to_wake?: boolean;
3590
+ haptic_feedback?: boolean;
3591
+ device_name_display_enabled?: boolean;
3592
+ airgap_mode?: boolean;
3593
+ usb_lock_enable?: boolean;
3594
+ random_keypad?: boolean;
3595
+ passphrase_enable?: boolean;
3596
+ fido_enabled?: boolean;
3597
+ };
3598
+ export type DeviceSettingsGet = {};
3599
+ export type DeviceSettingsSet = {
3600
+ settings: DeviceSettings;
3601
+ };
3602
+ export declare enum DeviceSettingsPage {
3603
+ DeviceReset = 0,
3604
+ DevicePinChange = 1,
3605
+ DevicePassphrase = 2,
3606
+ DeviceAirgap = 3
3607
+ }
3608
+ export type DeviceSettingsPageShow = {
3609
+ page: DeviceSettingsPage;
3610
+ field_name?: string;
3611
+ };
3612
+ export type DeviceCertificate = {
3613
+ cert_and_pubkey: string;
3614
+ private_key?: string;
3615
+ };
3616
+ export type DeviceCertificateWrite = {
3617
+ cert: DeviceCertificate;
3618
+ };
3619
+ export type DeviceCertificateRead = {};
3620
+ export type DeviceCertificateSignature = {
3621
+ data: string;
3622
+ };
3623
+ export type DeviceCertificateSign = {
3624
+ data: string;
3625
+ };
3626
+ export declare enum DeviceFirmwareTargetType {
3627
+ FW_MGMT_TARGET_INVALID = 0,
3628
+ FW_MGMT_TARGET_CRATE = 1,
3629
+ FW_MGMT_TARGET_ROMLOADER = 2,
3630
+ FW_MGMT_TARGET_BOOTLOADER = 3,
3631
+ FW_MGMT_TARGET_APPLICATION_P1 = 4,
3632
+ FW_MGMT_TARGET_APPLICATION_P2 = 5,
3633
+ FW_MGMT_TARGET_COPROCESSOR = 6,
3634
+ FW_MGMT_TARGET_SE01 = 7,
3635
+ FW_MGMT_TARGET_SE02 = 8,
3636
+ FW_MGMT_TARGET_SE03 = 9,
3637
+ FW_MGMT_TARGET_SE04 = 10
3638
+ }
3639
+ export declare enum DeviceFirmwareUpdateTaskStatus {
3640
+ FW_MGMT_UPDATER_TASK_STATUS_PENDING = 0,
3641
+ FW_MGMT_UPDATER_TASK_STATUS_IN_PROGRESS = 1,
3642
+ FW_MGMT_UPDATER_TASK_STATUS_FINISHED = 2,
3643
+ FW_MGMT_UPDATER_TASK_STATUS_FAILED_FILE_NOT_FOUND = 3,
3644
+ FW_MGMT_UPDATER_TASK_STATUS_FAILED_FILE_READ = 4,
3645
+ FW_MGMT_UPDATER_TASK_STATUS_FAILED_FILE_WRITE = 5,
3646
+ FW_MGMT_UPDATER_TASK_STATUS_FAILED_VERIFY = 6,
3647
+ FW_MGMT_UPDATER_TASK_STATUS_FAILED_INSTALL = 7,
3648
+ FW_MGMT_UPDATER_TASK_STATUS_FAILED_ABORT = 8,
3649
+ FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY = 9,
3650
+ FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS = 10
3651
+ }
3652
+ export type DeviceFirmwareTarget = {
3653
+ target_id: DeviceFirmwareTargetType;
3654
+ path: string;
3655
+ };
3656
+ export type DeviceFirmwareUpdateRequest = {
3657
+ targets: DeviceFirmwareTarget[];
3658
+ };
3659
+ export type DeviceFirmwareUpdateRecord = {
3660
+ target_id: DeviceFirmwareTargetType;
3661
+ status?: DeviceFirmwareUpdateTaskStatus;
3662
+ payload_version?: number;
3663
+ path?: string;
3664
+ };
3665
+ export type DeviceFirmwareUpdateRecordFields = {
3666
+ status?: boolean;
3667
+ payload_version?: boolean;
3668
+ path?: boolean;
3669
+ };
3670
+ export type DeviceFirmwareUpdateStatusGet = {
3671
+ fields?: DeviceFirmwareUpdateRecordFields;
3672
+ };
3673
+ export type DeviceFirmwareUpdateStatus = {
3674
+ records: DeviceFirmwareUpdateRecord[];
3675
+ };
3676
+ export declare enum DeviceFactoryAck {
3677
+ FACTORY_ACK_SUCCESS = 0,
3678
+ FACTORY_ACK_FAIL = 1
3679
+ }
3680
+ export type DeviceFactoryInfoManufactureTime = {
3681
+ year: number;
3682
+ month: number;
3683
+ day: number;
3684
+ hour: number;
3685
+ minute: number;
3686
+ second: number;
3687
+ };
3688
+ export type DeviceFactoryInfo = {
3689
+ version?: number;
3690
+ serial_number?: string;
3691
+ burn_in_completed?: boolean;
3692
+ factory_test_completed?: boolean;
3693
+ manufacture_time?: DeviceFactoryInfoManufactureTime;
3694
+ };
3695
+ export type DeviceFactoryInfoSet = {
3696
+ info: DeviceFactoryInfo;
3697
+ };
3698
+ export type DeviceFactoryInfoGet = {};
3699
+ export type DeviceFactoryPermanentLock = {
3700
+ check_a: string;
3701
+ check_b: string;
3702
+ };
3703
+ export type DeviceFactoryTest = {
3704
+ burn_in_test: boolean;
3705
+ };
3706
+ export declare enum DeviceType {
3707
+ CLASSIC1 = 0,
3708
+ CLASSIC1S = 1,
3709
+ MINI = 2,
3710
+ TOUCH = 3,
3711
+ PRO = 5,
3712
+ CLASSIC1S_PURE = 6,
3713
+ PRO2 = 7,
3714
+ NEO = 8
3715
+ }
3716
+ export declare enum DeviceSeType {
3717
+ THD89 = 0,
3718
+ SE608A = 1
3719
+ }
3720
+ export declare enum DeviceSEState {
3721
+ BOOT = 0,
3722
+ APP_FACTORY = 51,
3723
+ APP = 85
3724
+ }
3725
+ export type DeviceFirmwareImageInfo = {
3726
+ version?: string;
3727
+ build_id?: string;
3728
+ hash?: string;
3729
+ };
3730
+ export type DeviceHardwareInfo = {
3731
+ Device_type?: DeviceType;
3732
+ serial_no?: string;
3733
+ hardware_version?: string;
3734
+ hardware_version_raw_adc?: number;
3735
+ };
3736
+ export type DeviceMainMcuInfo = {
3737
+ romloader?: DeviceFirmwareImageInfo;
3738
+ bootloader?: DeviceFirmwareImageInfo;
3739
+ application?: DeviceFirmwareImageInfo;
3740
+ application_data?: DeviceFirmwareImageInfo;
3741
+ };
3742
+ export type DeviceCoprocessorInfo = {
3743
+ bootloader?: DeviceFirmwareImageInfo;
3744
+ application?: DeviceFirmwareImageInfo;
3745
+ bt_adv_name?: string;
3746
+ bt_mac?: string;
3747
+ };
3748
+ export type DeviceSEInfo = {
3749
+ bootloader?: DeviceFirmwareImageInfo;
3750
+ application?: DeviceFirmwareImageInfo;
3751
+ type?: DeviceSeType;
3752
+ state?: DeviceSEState;
3753
+ };
3754
+ export type DeviceInfoTargets = {
3755
+ hw?: boolean;
3756
+ fw?: boolean;
3757
+ coprocessor?: boolean;
3758
+ se1?: boolean;
3759
+ se2?: boolean;
3760
+ se3?: boolean;
3761
+ se4?: boolean;
3762
+ status?: boolean;
3763
+ };
3764
+ export type DeviceInfoTypes = {
3765
+ version?: boolean;
3766
+ build_id?: boolean;
3767
+ hash?: boolean;
3768
+ specific?: boolean;
3769
+ };
3770
+ export type DeviceInfoGet = {
3771
+ targets?: DeviceInfoTargets;
3772
+ types?: DeviceInfoTypes;
3773
+ };
3774
+ export type ProtocolV2DeviceInfo = {
3775
+ protocol_version: number;
3776
+ hw?: DeviceHardwareInfo;
3777
+ fw?: DeviceMainMcuInfo;
3778
+ coprocessor?: DeviceCoprocessorInfo;
3779
+ se1?: DeviceSEInfo;
3780
+ se2?: DeviceSEInfo;
3781
+ se3?: DeviceSEInfo;
3782
+ se4?: DeviceSEInfo;
3783
+ status?: DeviceStatus;
3784
+ };
3785
+ export type DeviceSessionResume = {
3786
+ session_id: string;
3787
+ };
3788
+ export type DeviceHostPassphrase = {
3789
+ passphrase: string;
3790
+ };
3791
+ export type DevicePassphraseOnDevice = {};
3792
+ export type DeviceAttachPinOnDevice = {};
3793
+ export type DeviceWalletSelect = {
3794
+ host_passphrase?: DeviceHostPassphrase;
3795
+ passphrase_on_device?: DevicePassphraseOnDevice;
3796
+ attach_pin_on_device?: DeviceAttachPinOnDevice;
3797
+ };
3798
+ export type DeviceSessionOpen = {
3799
+ resume?: DeviceSessionResume;
3800
+ select?: DeviceWalletSelect;
3801
+ };
3802
+ export declare enum DeviceSessionOpen_FailureSubCodes {
3803
+ InvalidSession = 1
3804
+ }
3805
+ export type DeviceSession = {
3806
+ session_id?: string;
3807
+ btc_test_address?: string;
3808
+ };
3809
+ export type DeviceSessionAskPin = {};
3810
+ export declare enum DeviceSessionAskPin_FailureSubCodes {
3811
+ UserCancel = 1
3812
+ }
3813
+ export type DeviceStatus = {
3814
+ device_id?: string;
3815
+ unlocked?: boolean;
3816
+ init_states?: boolean;
3817
+ backup_required?: boolean;
3818
+ passphrase_enabled?: boolean;
3819
+ attach_to_pin_enabled?: boolean;
3820
+ unlocked_by_attach_to_pin?: boolean;
3821
+ };
3822
+ export type DeviceStatusGet = {};
3823
+ export declare enum DevOnboardingStep {
3824
+ DEV_ONBOARDING_STEP_UNKNOWN = 0,
3825
+ DEV_ONBOARDING_STEP_CHECKING = 1,
3826
+ DEV_ONBOARDING_STEP_PERSONALIZATION = 2,
3827
+ DEV_ONBOARDING_STEP_PIN = 3,
3828
+ DEV_ONBOARDING_STEP_SETUP = 4,
3829
+ DEV_ONBOARDING_STEP_DONE = 5
3830
+ }
3831
+ export declare enum DevOnboardingPhase {
3832
+ DEV_ONBOARDING_PHASE_UNKNOWN = 0,
3833
+ DEV_ONBOARDING_PHASE_SAFETY_CHECK = 1,
3834
+ DEV_ONBOARDING_PHASE_PIN_SETUP = 2,
3835
+ DEV_ONBOARDING_PHASE_FINGERPRINT_SETUP = 3,
3836
+ DEV_ONBOARDING_PHASE_SETUP_CHOICE = 4,
3837
+ DEV_ONBOARDING_PHASE_WALLET_CREATE_START = 5,
3838
+ DEV_ONBOARDING_PHASE_RECOVERY_PHRASE_VIEW = 6,
3839
+ DEV_ONBOARDING_PHASE_RECOVERY_PHRASE_CONFIRM = 7,
3840
+ DEV_ONBOARDING_PHASE_RESTORE_METHOD_CHOICE = 8,
3841
+ DEV_ONBOARDING_PHASE_RECOVERY_PHRASE_RESTORE = 9,
3842
+ DEV_ONBOARDING_PHASE_SEEDCARD_RESTORE = 10,
3843
+ DEV_ONBOARDING_PHASE_WALLET_READY = 11,
3844
+ DEV_ONBOARDING_PHASE_SEEDCARD_BACKUP_PROMPT = 12,
3845
+ DEV_ONBOARDING_PHASE_SEEDCARD_BACKUP = 13
3846
+ }
3847
+ export declare enum DevOnboardingSetupKind {
3848
+ DEV_ONBOARDING_SETUP_KIND_UNKNOWN = 0,
3849
+ DEV_ONBOARDING_SETUP_KIND_CHOICE = 1,
3850
+ DEV_ONBOARDING_SETUP_KIND_CREATE = 2,
3851
+ DEV_ONBOARDING_SETUP_KIND_RESTORE = 3
3852
+ }
3853
+ export declare enum DevOnboardingSetupMethod {
3854
+ DEV_ONBOARDING_SETUP_METHOD_UNKNOWN = 0,
3855
+ DEV_ONBOARDING_SETUP_METHOD_RECOVERY_PHRASE = 1,
3856
+ DEV_ONBOARDING_SETUP_METHOD_SEEDCARD = 2
3857
+ }
3858
+ export type DevOnboardingSetupStatus = {
3859
+ kind?: DevOnboardingSetupKind;
3860
+ method?: DevOnboardingSetupMethod;
3861
+ };
3862
+ export type DevGetOnboardingStatus = {};
3863
+ export type DevOnboardingStatus = {
3864
+ step?: DevOnboardingStep;
3865
+ phase?: DevOnboardingPhase;
3866
+ setup?: DevOnboardingSetupStatus;
3867
+ pin_set?: boolean;
3868
+ wallet_initialized?: boolean;
3869
+ };
3870
+ export type FilesystemPermissionFix = {};
3871
+ export type FilesystemPathInfo = {
3872
+ exist: boolean;
3873
+ size: number;
3874
+ year: number;
3875
+ month: number;
3876
+ day: number;
3877
+ hour: number;
3878
+ minute: number;
3879
+ second: number;
3880
+ readonly: boolean;
3881
+ hidden: boolean;
3882
+ system: boolean;
3883
+ archive: boolean;
3884
+ directory: boolean;
3885
+ };
3886
+ export type FilesystemPathInfoQuery = {
3887
+ path: string;
3888
+ };
3889
+ export type FilesystemFile = {
3890
+ path: string;
3891
+ offset: number;
3892
+ total_size: number;
3893
+ data?: Buffer | ArrayBuffer | Uint8Array | string;
3894
+ data_hash?: number;
3895
+ processed_byte?: number;
3896
+ };
3897
+ export type FilesystemFileRead = {
3898
+ file: FilesystemFile;
3899
+ chunk_len?: number;
3900
+ ui_percentage?: number;
3901
+ };
3902
+ export type FilesystemFileWrite = {
3903
+ file: FilesystemFile;
3904
+ overwrite: boolean;
3905
+ append: boolean;
3906
+ ui_percentage?: number;
3907
+ };
3908
+ export type FilesystemFileDelete = {
3909
+ path: string;
3910
+ };
3911
+ export type FilesystemDir = {
3912
+ path: string;
3913
+ child_dirs?: string;
3914
+ child_files?: string;
3915
+ };
3916
+ export type FilesystemDirList = {
3917
+ path: string;
3918
+ depth?: number;
3919
+ };
3920
+ export type FilesystemDirMake = {
3921
+ path: string;
3922
+ };
3923
+ export type FilesystemDirRemove = {
3924
+ path: string;
3925
+ };
3926
+ export type FilesystemFormat = {
3927
+ data: boolean;
3928
+ user: boolean;
3929
+ };
3930
+ export type PortfolioUpdate = {};
3931
+ export declare enum ProtocolV2FailureType {
3932
+ Failure_InvalidMessage = 1,
3933
+ Failure_UndefinedError = 2,
3934
+ Failure_UsageError = 3,
3935
+ Failure_DataError = 4,
3936
+ Failure_ProcessError = 5
3937
+ }
3938
+ export declare enum Enum_ProtocolV2Capability {
3939
+ Capability_Bitcoin = 1,
3940
+ Capability_Bitcoin_like = 2,
3941
+ Capability_Binance = 3,
3942
+ Capability_Cardano = 4,
3943
+ Capability_Crypto = 5,
3944
+ Capability_EOS = 6,
3945
+ Capability_Ethereum = 7,
3946
+ Capability_Lisk = 8,
3947
+ Capability_Monero = 9,
3948
+ Capability_NEM = 10,
3949
+ Capability_Ripple = 11,
3950
+ Capability_Stellar = 12,
3951
+ Capability_Tezos = 13,
3952
+ Capability_U2F = 14,
3953
+ Capability_Shamir = 15,
3954
+ Capability_ShamirGroups = 16,
3955
+ Capability_PassphraseEntry = 17,
3956
+ Capability_AttachToPin = 18,
3957
+ Capability_EthereumTypedData = 1000
3958
+ }
3959
+ export type ProtocolV2Capability = keyof typeof Enum_ProtocolV2Capability;
3357
3960
  export type MessageType = {
3358
3961
  AlephiumGetAddress: AlephiumGetAddress;
3359
3962
  AlephiumAddress: AlephiumAddress;
@@ -3409,6 +4012,7 @@ export type MessageType = {
3409
4012
  SignMessage: SignMessage;
3410
4013
  MessageSignature: MessageSignature;
3411
4014
  VerifyMessage: VerifyMessage;
4015
+ CoinJoinRequest: CoinJoinRequest;
3412
4016
  SignTx: SignTx;
3413
4017
  TxRequestDetailsType: TxRequestDetailsType;
3414
4018
  TxRequestSerializedType: TxRequestSerializedType;
@@ -3686,7 +4290,7 @@ export type MessageType = {
3686
4290
  BixinBackupDeviceAck: BixinBackupDeviceAck;
3687
4291
  DeviceInfoSettings: DeviceInfoSettings;
3688
4292
  GetDeviceInfo: GetDeviceInfo;
3689
- DeviceInfo: DeviceInfo;
4293
+ DeviceInfo: DeviceInfo | ProtocolV2DeviceInfo;
3690
4294
  ReadSEPublicKey: ReadSEPublicKey;
3691
4295
  SEPublicKey: SEPublicKey;
3692
4296
  WriteSEPublicCert: WriteSEPublicCert;
@@ -3918,12 +4522,103 @@ export type MessageType = {
3918
4522
  TronSignMessage: TronSignMessage;
3919
4523
  TronMessageSignature: TronMessageSignature;
3920
4524
  facotry: facotry;
4525
+ experimental_message: experimental_message;
4526
+ experimental_field: experimental_field;
4527
+ TextMemo: TextMemo;
4528
+ RefundMemo: RefundMemo;
4529
+ CoinPurchaseMemo: CoinPurchaseMemo;
4530
+ PaymentRequestMemo: PaymentRequestMemo;
4531
+ TxAckPaymentRequest: TxAckPaymentRequest;
4532
+ EthereumSignTypedDataQR: EthereumSignTypedDataQR;
4533
+ InternalMyAddressRequest: InternalMyAddressRequest;
4534
+ StartSession: StartSession;
4535
+ SetBusy: SetBusy;
4536
+ GetFirmwareHash: GetFirmwareHash;
4537
+ FirmwareHash: FirmwareHash;
4538
+ GetNonce: GetNonce;
4539
+ Nonce: Nonce;
4540
+ WriteSEPrivateKey: WriteSEPrivateKey;
4541
+ SetWallpaper: SetWallpaper;
4542
+ GetWallpaper: GetWallpaper;
4543
+ Wallpaper: Wallpaper;
4544
+ UnlockPath: UnlockPath;
4545
+ UnlockedPathRequest: UnlockedPathRequest;
4546
+ ViewAmount: ViewAmount;
4547
+ ViewDetail: ViewDetail;
4548
+ ViewTip: ViewTip;
4549
+ ViewRawData: ViewRawData;
4550
+ ViewSignPage: ViewSignPage;
4551
+ ViewVerifyPage: ViewVerifyPage;
4552
+ ProtocolInfoRequest: ProtocolInfoRequest;
4553
+ ProtocolInfo: ProtocolInfo;
4554
+ DeviceReboot: DeviceReboot;
4555
+ DeviceSettings: DeviceSettings;
4556
+ DeviceSettingsGet: DeviceSettingsGet;
4557
+ DeviceSettingsSet: DeviceSettingsSet;
4558
+ DeviceSettingsPageShow: DeviceSettingsPageShow;
4559
+ DeviceCertificate: DeviceCertificate;
4560
+ DeviceCertificateWrite: DeviceCertificateWrite;
4561
+ DeviceCertificateRead: DeviceCertificateRead;
4562
+ DeviceCertificateSignature: DeviceCertificateSignature;
4563
+ DeviceCertificateSign: DeviceCertificateSign;
4564
+ DeviceFirmwareTarget: DeviceFirmwareTarget;
4565
+ DeviceFirmwareUpdateRequest: DeviceFirmwareUpdateRequest;
4566
+ DeviceFirmwareUpdateRecord: DeviceFirmwareUpdateRecord;
4567
+ DeviceFirmwareUpdateRecordFields: DeviceFirmwareUpdateRecordFields;
4568
+ DeviceFirmwareUpdateStatusGet: DeviceFirmwareUpdateStatusGet;
4569
+ DeviceFirmwareUpdateStatus: DeviceFirmwareUpdateStatus;
4570
+ DeviceFactoryInfoManufactureTime: DeviceFactoryInfoManufactureTime;
4571
+ DeviceFactoryInfo: DeviceFactoryInfo;
4572
+ DeviceFactoryInfoSet: DeviceFactoryInfoSet;
4573
+ DeviceFactoryInfoGet: DeviceFactoryInfoGet;
4574
+ DeviceFactoryPermanentLock: DeviceFactoryPermanentLock;
4575
+ DeviceFactoryTest: DeviceFactoryTest;
4576
+ DeviceFirmwareImageInfo: DeviceFirmwareImageInfo;
4577
+ DeviceHardwareInfo: DeviceHardwareInfo;
4578
+ DeviceMainMcuInfo: DeviceMainMcuInfo;
4579
+ DeviceCoprocessorInfo: DeviceCoprocessorInfo;
4580
+ DeviceSEInfo: DeviceSEInfo;
4581
+ DeviceInfoTargets: DeviceInfoTargets;
4582
+ DeviceInfoTypes: DeviceInfoTypes;
4583
+ DeviceInfoGet: DeviceInfoGet;
4584
+ DeviceSessionResume: DeviceSessionResume;
4585
+ DeviceHostPassphrase: DeviceHostPassphrase;
4586
+ DevicePassphraseOnDevice: DevicePassphraseOnDevice;
4587
+ DeviceAttachPinOnDevice: DeviceAttachPinOnDevice;
4588
+ DeviceWalletSelect: DeviceWalletSelect;
4589
+ DeviceSessionOpen: DeviceSessionOpen;
4590
+ DeviceSession: DeviceSession;
4591
+ DeviceSessionAskPin: DeviceSessionAskPin;
4592
+ DeviceStatus: DeviceStatus;
4593
+ DeviceStatusGet: DeviceStatusGet;
4594
+ DevOnboardingSetupStatus: DevOnboardingSetupStatus;
4595
+ DevGetOnboardingStatus: DevGetOnboardingStatus;
4596
+ DevOnboardingStatus: DevOnboardingStatus;
4597
+ FilesystemPermissionFix: FilesystemPermissionFix;
4598
+ FilesystemPathInfo: FilesystemPathInfo;
4599
+ FilesystemPathInfoQuery: FilesystemPathInfoQuery;
4600
+ FilesystemFile: FilesystemFile;
4601
+ FilesystemFileRead: FilesystemFileRead;
4602
+ FilesystemFileWrite: FilesystemFileWrite;
4603
+ FilesystemFileDelete: FilesystemFileDelete;
4604
+ FilesystemDir: FilesystemDir;
4605
+ FilesystemDirList: FilesystemDirList;
4606
+ FilesystemDirMake: FilesystemDirMake;
4607
+ FilesystemDirRemove: FilesystemDirRemove;
4608
+ FilesystemFormat: FilesystemFormat;
4609
+ PortfolioUpdate: PortfolioUpdate;
3921
4610
  };
3922
4611
  export type MessageKey = keyof MessageType;
3923
4612
  export type MessageResponse<T extends MessageKey> = {
3924
4613
  type: T;
3925
4614
  message: MessageType[T];
3926
4615
  };
3927
- export type TypedCall = <T extends MessageKey, R extends MessageKey>(type: T, resType: R, message?: MessageType[T]) => Promise<MessageResponse<R>>;
4616
+ export type MessageResponseMap = {
4617
+ [K in MessageKey]: MessageResponse<K>;
4618
+ };
4619
+ export type TypedCall = {
4620
+ <T extends MessageKey, R extends readonly MessageKey[]>(type: T, resType: R, message?: MessageType[T]): Promise<MessageResponseMap[R[number]]>;
4621
+ <T extends MessageKey, R extends MessageKey>(type: T, resType: R, message?: MessageType[T]): Promise<MessageResponse<R>>;
4622
+ };
3928
4623
  export {};
3929
4624
  //# sourceMappingURL=messages.d.ts.map