@onekeyfe/hd-transport 1.1.27-patch.1 → 1.2.0-alpha.0

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 (87) hide show
  1. package/README.md +2 -4
  2. package/__tests__/build-receive.test.js +6 -8
  3. package/__tests__/decode-features.test.js +3 -2
  4. package/__tests__/messages.test.js +8 -0
  5. package/__tests__/protocol-v2.test.js +754 -0
  6. package/dist/constants.d.ts +14 -5
  7. package/dist/constants.d.ts.map +1 -1
  8. package/dist/index.d.ts +934 -41
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +827 -84
  11. package/dist/protocols/index.d.ts +45 -0
  12. package/dist/protocols/index.d.ts.map +1 -0
  13. package/dist/protocols/v1/decode.d.ts +11 -0
  14. package/dist/protocols/v1/decode.d.ts.map +1 -0
  15. package/dist/protocols/v1/encode.d.ts +11 -0
  16. package/dist/protocols/v1/encode.d.ts.map +1 -0
  17. package/dist/protocols/v1/index.d.ts +5 -0
  18. package/dist/protocols/v1/index.d.ts.map +1 -0
  19. package/dist/protocols/v1/packets.d.ts +7 -0
  20. package/dist/protocols/v1/packets.d.ts.map +1 -0
  21. package/dist/{serialization → protocols/v1}/receive.d.ts +1 -1
  22. package/dist/protocols/v1/receive.d.ts.map +1 -0
  23. package/dist/protocols/v2/constants.d.ts +7 -0
  24. package/dist/protocols/v2/constants.d.ts.map +1 -0
  25. package/dist/protocols/v2/crc8.d.ts +3 -0
  26. package/dist/protocols/v2/crc8.d.ts.map +1 -0
  27. package/dist/protocols/v2/debug.d.ts +13 -0
  28. package/dist/protocols/v2/debug.d.ts.map +1 -0
  29. package/dist/protocols/v2/decode.d.ts +8 -0
  30. package/dist/protocols/v2/decode.d.ts.map +1 -0
  31. package/dist/protocols/v2/encode.d.ts +5 -0
  32. package/dist/protocols/v2/encode.d.ts.map +1 -0
  33. package/dist/protocols/v2/frame-assembler.d.ts +12 -0
  34. package/dist/protocols/v2/frame-assembler.d.ts.map +1 -0
  35. package/dist/protocols/v2/index.d.ts +7 -0
  36. package/dist/protocols/v2/index.d.ts.map +1 -0
  37. package/dist/protocols/v2/session.d.ts +50 -0
  38. package/dist/protocols/v2/session.d.ts.map +1 -0
  39. package/dist/serialization/index.d.ts +6 -3
  40. package/dist/serialization/index.d.ts.map +1 -1
  41. package/dist/serialization/protobuf/decode.d.ts.map +1 -1
  42. package/dist/serialization/protobuf/messages.d.ts +1 -1
  43. package/dist/serialization/protobuf/messages.d.ts.map +1 -1
  44. package/dist/types/messages.d.ts +461 -11
  45. package/dist/types/messages.d.ts.map +1 -1
  46. package/dist/types/transport.d.ts +14 -2
  47. package/dist/types/transport.d.ts.map +1 -1
  48. package/dist/utils/logBlockCommand.d.ts.map +1 -1
  49. package/messages-protocol-v2.json +13369 -0
  50. package/package.json +3 -3
  51. package/scripts/protobuf-build.sh +314 -20
  52. package/scripts/protobuf-patches/TxInputType.js +1 -0
  53. package/scripts/protobuf-patches/index.js +2 -0
  54. package/scripts/protobuf-types.js +224 -18
  55. package/src/constants.ts +42 -6
  56. package/src/index.ts +39 -11
  57. package/src/protocols/index.ts +144 -0
  58. package/src/{serialization/protocol → protocols/v1}/decode.ts +4 -4
  59. package/src/{serialization/protocol → protocols/v1}/encode.ts +18 -13
  60. package/src/protocols/v1/index.ts +4 -0
  61. package/src/protocols/v1/packets.ts +53 -0
  62. package/src/{serialization → protocols/v1}/receive.ts +5 -5
  63. package/src/protocols/v2/constants.ts +6 -0
  64. package/src/protocols/v2/crc8.ts +34 -0
  65. package/src/protocols/v2/debug.ts +26 -0
  66. package/src/protocols/v2/decode.ts +92 -0
  67. package/src/protocols/v2/encode.ts +116 -0
  68. package/src/protocols/v2/frame-assembler.ts +98 -0
  69. package/src/protocols/v2/index.ts +6 -0
  70. package/src/protocols/v2/session.ts +429 -0
  71. package/src/serialization/index.ts +6 -5
  72. package/src/serialization/protobuf/decode.ts +7 -0
  73. package/src/serialization/protobuf/messages.ts +8 -4
  74. package/src/types/messages.ts +606 -13
  75. package/src/types/transport.ts +26 -2
  76. package/src/utils/logBlockCommand.ts +9 -1
  77. package/dist/serialization/protocol/decode.d.ts +0 -11
  78. package/dist/serialization/protocol/decode.d.ts.map +0 -1
  79. package/dist/serialization/protocol/encode.d.ts +0 -11
  80. package/dist/serialization/protocol/encode.d.ts.map +0 -1
  81. package/dist/serialization/protocol/index.d.ts +0 -3
  82. package/dist/serialization/protocol/index.d.ts.map +0 -1
  83. package/dist/serialization/receive.d.ts.map +0 -1
  84. package/dist/serialization/send.d.ts +0 -7
  85. package/dist/serialization/send.d.ts.map +0 -1
  86. package/src/serialization/protocol/index.ts +0 -2
  87. package/src/serialization/send.ts +0 -58
@@ -379,6 +379,7 @@ export type GetAddress = {
379
379
  // Address
380
380
  export type Address = {
381
381
  address: string;
382
+ mac?: string;
382
383
  };
383
384
 
384
385
  // GetOwnershipId
@@ -418,6 +419,14 @@ export type VerifyMessage = {
418
419
  coin_name?: string;
419
420
  };
420
421
 
422
+ export type CoinJoinRequest = {
423
+ fee_rate: number;
424
+ no_fee_threshold: number;
425
+ min_registrable_amount: number;
426
+ mask_public_key: string;
427
+ signature: string;
428
+ };
429
+
421
430
  // SignTx
422
431
  export type SignTx = {
423
432
  outputs_count: number;
@@ -432,6 +441,8 @@ export type SignTx = {
432
441
  branch_id?: number;
433
442
  amount_unit?: AmountUnit;
434
443
  decred_staking_ticket?: boolean;
444
+ serialize?: boolean;
445
+ coinjoin_request?: CoinJoinRequest;
435
446
  };
436
447
 
437
448
  export enum Enum_RequestType {
@@ -442,6 +453,7 @@ export enum Enum_RequestType {
442
453
  TXEXTRADATA = 4,
443
454
  TXORIGINPUT = 5,
444
455
  TXORIGOUTPUT = 6,
456
+ TXPAYMENTREQ = 7,
445
457
  }
446
458
  export type RequestType = keyof typeof Enum_RequestType;
447
459
 
@@ -486,6 +498,7 @@ type CommonTxInputType = {
486
498
  witness?: string; // used by EXTERNAL, depending on script_pubkey
487
499
  ownership_proof?: string; // used by EXTERNAL, depending on script_pubkey
488
500
  commitment_data?: string; // used by EXTERNAL, depending on ownership_proof
501
+ coinjoin_flags?: number; // Protocol V2 only (CoinJoin)
489
502
  };
490
503
 
491
504
  export type TxInputType =
@@ -688,12 +701,15 @@ export type OwnershipProof = {
688
701
  // AuthorizeCoinJoin
689
702
  export type AuthorizeCoinJoin = {
690
703
  coordinator: string;
691
- max_total_fee: number;
704
+ max_total_fee?: number;
692
705
  fee_per_anonymity?: number;
693
706
  address_n: number[];
694
707
  coin_name?: string;
695
708
  script_type?: InputScriptType;
696
709
  amount_unit?: AmountUnit;
710
+ max_rounds?: number;
711
+ max_coordinator_fee_rate?: number;
712
+ max_fee_per_kvbyte?: number;
697
713
  };
698
714
 
699
715
  export type BIP32Address = {
@@ -2230,6 +2246,9 @@ export enum Enum_BackupType {
2230
2246
  Bip39 = 0,
2231
2247
  Slip39_Basic = 1,
2232
2248
  Slip39_Advanced = 2,
2249
+ Slip39_Single_Extendable = 3,
2250
+ Slip39_Basic_Extendable = 4,
2251
+ Slip39_Advanced_Extendable = 5,
2233
2252
  }
2234
2253
  export type BackupType = keyof typeof Enum_BackupType;
2235
2254
 
@@ -2866,6 +2885,8 @@ export type UnLockDeviceResponse = {
2866
2885
  // GetPassphraseState
2867
2886
  export type GetPassphraseState = {
2868
2887
  passphrase_state?: string;
2888
+ _only_main_pin?: boolean;
2889
+ allow_create_attach_pin?: boolean;
2869
2890
  };
2870
2891
 
2871
2892
  // PassphraseState
@@ -2935,7 +2956,7 @@ export type MoneroTransactionRsigData = {
2935
2956
  export type MoneroGetAddress = {
2936
2957
  address_n: number[];
2937
2958
  show_display?: boolean;
2938
- network_type?: number;
2959
+ network_type?: number | MoneroNetworkType;
2939
2960
  account?: number;
2940
2961
  minor?: number;
2941
2962
  payment_id?: string;
@@ -2949,7 +2970,7 @@ export type MoneroAddress = {
2949
2970
  // MoneroGetWatchKey
2950
2971
  export type MoneroGetWatchKey = {
2951
2972
  address_n: number[];
2952
- network_type?: number;
2973
+ network_type?: number | MoneroNetworkType;
2953
2974
  };
2954
2975
 
2955
2976
  // MoneroWatchKey
@@ -2980,7 +3001,7 @@ export type MoneroTransactionData = {
2980
3001
  export type MoneroTransactionInitRequest = {
2981
3002
  version?: number;
2982
3003
  address_n: number[];
2983
- network_type?: number;
3004
+ network_type?: number | MoneroNetworkType;
2984
3005
  tsx_data?: MoneroTransactionData;
2985
3006
  };
2986
3007
 
@@ -3110,7 +3131,7 @@ export type MoneroKeyImageExportInitRequest = {
3110
3131
  num?: number;
3111
3132
  hash?: string;
3112
3133
  address_n: number[];
3113
- network_type?: number;
3134
+ network_type?: number | MoneroNetworkType;
3114
3135
  subs: MoneroSubAddressIndicesList[];
3115
3136
  };
3116
3137
 
@@ -3152,7 +3173,7 @@ export type MoneroKeyImageSyncFinalAck = {
3152
3173
  // MoneroGetTxKeyRequest
3153
3174
  export type MoneroGetTxKeyRequest = {
3154
3175
  address_n: number[];
3155
- network_type?: number;
3176
+ network_type?: number | MoneroNetworkType;
3156
3177
  salt1?: string;
3157
3178
  salt2?: string;
3158
3179
  tx_enc_keys?: string;
@@ -3171,7 +3192,7 @@ export type MoneroGetTxKeyAck = {
3171
3192
  // MoneroLiveRefreshStartRequest
3172
3193
  export type MoneroLiveRefreshStartRequest = {
3173
3194
  address_n: number[];
3174
- network_type?: number;
3195
+ network_type?: number | MoneroNetworkType;
3175
3196
  };
3176
3197
 
3177
3198
  // MoneroLiveRefreshStartAck
@@ -4199,6 +4220,7 @@ export type TonSignedMessage = {
4199
4220
  signature?: string;
4200
4221
  signning_message?: string;
4201
4222
  init_data_length?: number;
4223
+ signing_message?: string;
4202
4224
  };
4203
4225
 
4204
4226
  // TonSignProof
@@ -4393,6 +4415,499 @@ export enum CommandFlags {
4393
4415
  Factory_Only = 1,
4394
4416
  }
4395
4417
 
4418
+ // experimental_message
4419
+ export type experimental_message = {};
4420
+
4421
+ // experimental_field
4422
+ export type experimental_field = {};
4423
+
4424
+ export type TextMemo = {
4425
+ text: string;
4426
+ };
4427
+
4428
+ export type RefundMemo = {
4429
+ address: string;
4430
+ mac: string;
4431
+ };
4432
+
4433
+ export type CoinPurchaseMemo = {
4434
+ coin_type: number;
4435
+ amount: UintType;
4436
+ address: string;
4437
+ mac: string;
4438
+ };
4439
+
4440
+ export type PaymentRequestMemo = {
4441
+ text_memo?: TextMemo;
4442
+ refund_memo?: RefundMemo;
4443
+ coin_purchase_memo?: CoinPurchaseMemo;
4444
+ };
4445
+
4446
+ // TxAckPaymentRequest
4447
+ export type TxAckPaymentRequest = {
4448
+ nonce?: string;
4449
+ recipient_name: string;
4450
+ memos?: PaymentRequestMemo[];
4451
+ amount?: UintType;
4452
+ signature: string;
4453
+ };
4454
+
4455
+ // SetBusy
4456
+ export type SetBusy = {
4457
+ expiry_ms?: number;
4458
+ };
4459
+
4460
+ // GetFirmwareHash
4461
+ export type GetFirmwareHash = {
4462
+ challenge?: string;
4463
+ };
4464
+
4465
+ // FirmwareHash
4466
+ export type FirmwareHash = {
4467
+ hash: string;
4468
+ };
4469
+
4470
+ // GetNonce
4471
+ export type GetNonce = {};
4472
+
4473
+ // Nonce
4474
+ export type Nonce = {
4475
+ nonce: string;
4476
+ };
4477
+
4478
+ // WriteSEPrivateKey
4479
+ export type WriteSEPrivateKey = {
4480
+ private_key: string;
4481
+ };
4482
+
4483
+ // UnlockPath
4484
+ export type UnlockPath = {
4485
+ address_n: number[];
4486
+ mac?: string;
4487
+ };
4488
+
4489
+ // UnlockedPathRequest
4490
+ export type UnlockedPathRequest = {
4491
+ mac?: string;
4492
+ };
4493
+
4494
+ export enum MoneroNetworkType {
4495
+ MAINNET = 0,
4496
+ TESTNET = 1,
4497
+ STAGENET = 2,
4498
+ FAKECHAIN = 3,
4499
+ }
4500
+
4501
+ // TxDetailsAmount
4502
+ export type TxDetailsAmount = {
4503
+ num: string;
4504
+ decimals: number;
4505
+ symbol: string;
4506
+ };
4507
+
4508
+ // TxDetailsAddress
4509
+ export type TxDetailsAddress = {
4510
+ key: number;
4511
+ address: string;
4512
+ owner?: string;
4513
+ icon?: string;
4514
+ };
4515
+
4516
+ // TxDetailsNetwork
4517
+ export type TxDetailsNetwork = {
4518
+ coin_type: number;
4519
+ chain_id?: number;
4520
+ };
4521
+
4522
+ // TxDetailsGeneral
4523
+ export type TxDetailsGeneral = {
4524
+ key: number;
4525
+ value: string;
4526
+ is_overview: boolean;
4527
+ };
4528
+
4529
+ export enum TxDetailsDisplayType {
4530
+ DISPLAY_TYPE_INFO = 0,
4531
+ DISPLAY_TYPE_SIGN = 1,
4532
+ }
4533
+
4534
+ // TxDetailsPage
4535
+ export type TxDetailsPage = {
4536
+ title: string;
4537
+ display_type: TxDetailsDisplayType;
4538
+ amount?: UintType;
4539
+ network?: TxDetailsNetwork;
4540
+ address: TxDetailsAddress[];
4541
+ general: TxDetailsGeneral[];
4542
+ };
4543
+
4544
+ // GetProtoVersion
4545
+ export type GetProtoVersion = {};
4546
+
4547
+ // ProtoVersion
4548
+ export type ProtoVersion = {
4549
+ proto_version: number;
4550
+ };
4551
+
4552
+ export enum DevRebootType {
4553
+ Normal = 0,
4554
+ Boardloader = 1,
4555
+ Bootloader = 2,
4556
+ }
4557
+
4558
+ export enum DeviceRebootType {
4559
+ Normal = 0,
4560
+ Romloader = 1,
4561
+ Bootloader = 2,
4562
+ }
4563
+
4564
+ // DevReboot
4565
+ export type DevReboot = {
4566
+ reboot_type: DevRebootType;
4567
+ };
4568
+
4569
+ // DeviceReboot
4570
+ export type DeviceReboot = {
4571
+ reboot_type: DeviceRebootType;
4572
+ };
4573
+
4574
+ export enum DeviceType {
4575
+ CLASSIC1 = 0,
4576
+ CLASSIC1S = 1,
4577
+ MINI = 2,
4578
+ TOUCH = 3,
4579
+ PRO = 5,
4580
+ CLASSIC1S_PURE = 6,
4581
+ }
4582
+
4583
+ export enum DevSeType {
4584
+ THD89 = 0,
4585
+ SE608A = 1,
4586
+ }
4587
+
4588
+ export enum DevSEState {
4589
+ BOOT = 0,
4590
+ APP_FACTORY = 51,
4591
+ APP = 85,
4592
+ }
4593
+
4594
+ // DevFirmwareImageInfo
4595
+ export type DevFirmwareImageInfo = {
4596
+ version?: string;
4597
+ build_id?: string;
4598
+ hash?: string;
4599
+ };
4600
+
4601
+ // DevHardwareInfo
4602
+ export type DevHardwareInfo = {
4603
+ device_type?: DeviceType;
4604
+ serial_no?: string;
4605
+ hardware_version?: string;
4606
+ hardware_version_raw_adc?: number;
4607
+ };
4608
+
4609
+ // DevMainMcuInfo
4610
+ export type DevMainMcuInfo = {
4611
+ board?: DevFirmwareImageInfo;
4612
+ boot?: DevFirmwareImageInfo;
4613
+ app?: DevFirmwareImageInfo;
4614
+ };
4615
+
4616
+ // DevBluetoothInfo
4617
+ export type DevBluetoothInfo = {
4618
+ boot?: DevFirmwareImageInfo;
4619
+ app?: DevFirmwareImageInfo;
4620
+ adv_name?: string;
4621
+ mac?: string;
4622
+ };
4623
+
4624
+ // DevSEInfo
4625
+ export type DevSEInfo = {
4626
+ boot?: DevFirmwareImageInfo;
4627
+ app?: DevFirmwareImageInfo;
4628
+ type?: DevSeType;
4629
+ state?: DevSEState;
4630
+ };
4631
+
4632
+ // DevInfoTargets
4633
+ export type DevInfoTargets = {
4634
+ hw?: boolean;
4635
+ fw?: boolean;
4636
+ bt?: boolean;
4637
+ se1?: boolean;
4638
+ se2?: boolean;
4639
+ se3?: boolean;
4640
+ se4?: boolean;
4641
+ status?: boolean;
4642
+ };
4643
+
4644
+ // DevInfoTypes
4645
+ export type DevInfoTypes = {
4646
+ version?: boolean;
4647
+ build_id?: boolean;
4648
+ hash?: boolean;
4649
+ specific?: boolean;
4650
+ };
4651
+
4652
+ // DevStatus
4653
+ export type DevStatus = {
4654
+ language?: string;
4655
+ bt_enable?: boolean;
4656
+ init_states?: boolean;
4657
+ backup_required?: boolean;
4658
+ passphrase_protection?: boolean;
4659
+ label?: string;
4660
+ };
4661
+
4662
+ // DevGetDeviceInfo
4663
+ export type DevGetDeviceInfo = {
4664
+ targets?: DevInfoTargets;
4665
+ types?: DevInfoTypes;
4666
+ };
4667
+
4668
+ // DeviceGetDeviceInfo
4669
+ export type DeviceGetDeviceInfo = DevGetDeviceInfo;
4670
+
4671
+ // ProtocolV2DeviceInfo
4672
+ export type ProtocolV2DeviceInfo = {
4673
+ protocol_version: number;
4674
+ hw?: DevHardwareInfo;
4675
+ fw?: DevMainMcuInfo;
4676
+ bt?: DevBluetoothInfo;
4677
+ se1?: DevSEInfo;
4678
+ se2?: DevSEInfo;
4679
+ se3?: DevSEInfo;
4680
+ se4?: DevSEInfo;
4681
+ status?: DevStatus;
4682
+ };
4683
+
4684
+ export enum DevFirmwareTargetType {
4685
+ TARGET_INVALID = 0,
4686
+ TARGET_ROMLOADER = 1,
4687
+ TARGET_BOOTLOADER = 2,
4688
+ TARGET_APPLICATION_P1 = 3,
4689
+ TARGET_APPLICATION_P2 = 4,
4690
+ TARGET_COPROCESSOR = 5,
4691
+ TARGET_SE01 = 6,
4692
+ TARGET_SE02 = 7,
4693
+ TARGET_SE03 = 8,
4694
+ TARGET_SE04 = 9,
4695
+ TARGET_RESOURCE = 10,
4696
+ }
4697
+
4698
+ export enum DeviceFirmwareTargetType {
4699
+ TARGET_INVALID = 0,
4700
+ TARGET_ROMLOADER = 1,
4701
+ TARGET_BOOTLOADER = 2,
4702
+ TARGET_APPLICATION_P1 = 3,
4703
+ TARGET_APPLICATION_P2 = 4,
4704
+ TARGET_COPROCESSOR = 5,
4705
+ TARGET_SE01 = 6,
4706
+ TARGET_SE02 = 7,
4707
+ TARGET_SE03 = 8,
4708
+ TARGET_SE04 = 9,
4709
+ TARGET_RESOURCE = 10,
4710
+ }
4711
+
4712
+ // DevFirmwareTarget
4713
+ export type DevFirmwareTarget = {
4714
+ target_id: DevFirmwareTargetType;
4715
+ path: string;
4716
+ };
4717
+
4718
+ // DeviceFirmwareTarget
4719
+ export type DeviceFirmwareTarget = {
4720
+ target_id: DeviceFirmwareTargetType;
4721
+ path: string;
4722
+ };
4723
+
4724
+ // DevFirmwareUpdate
4725
+ export type DevFirmwareUpdate = {
4726
+ targets: DevFirmwareTarget[];
4727
+ };
4728
+
4729
+ // DeviceFirmwareUpdate
4730
+ export type DeviceFirmwareUpdate = {
4731
+ targets: DeviceFirmwareTarget[];
4732
+ max_concurrent?: number;
4733
+ };
4734
+
4735
+ // DevFirmwareInstallProgress
4736
+ export type DevFirmwareInstallProgress = {
4737
+ target_id: DevFirmwareTargetType;
4738
+ progress: number;
4739
+ stage?: string;
4740
+ };
4741
+
4742
+ // DeviceFirmwareInstallProgress
4743
+ export type DeviceFirmwareInstallProgress = {
4744
+ target_id: DeviceFirmwareTargetType;
4745
+ progress: number;
4746
+ stage?: string;
4747
+ };
4748
+
4749
+ // DevFirmwareUpdateStatusEntry
4750
+ export type DevFirmwareUpdateStatusEntry = {
4751
+ target_id: DevFirmwareTargetType;
4752
+ status: number;
4753
+ };
4754
+
4755
+ // DeviceFirmwareUpdateStatusEntry
4756
+ export type DeviceFirmwareUpdateStatusEntry = {
4757
+ target_id: DeviceFirmwareTargetType;
4758
+ status: number;
4759
+ };
4760
+
4761
+ // DevGetFirmwareUpdateStatus
4762
+ export type DevGetFirmwareUpdateStatus = {};
4763
+
4764
+ // DeviceGetFirmwareUpdateStatus
4765
+ export type DeviceGetFirmwareUpdateStatus = {};
4766
+
4767
+ // DevFirmwareUpdateStatus
4768
+ export type DevFirmwareUpdateStatus = {
4769
+ targets: DevFirmwareUpdateStatusEntry[];
4770
+ };
4771
+
4772
+ // DeviceFirmwareUpdateStatus
4773
+ export type DeviceFirmwareUpdateStatus = {
4774
+ targets: DeviceFirmwareUpdateStatusEntry[];
4775
+ };
4776
+
4777
+ // FactoryDeviceInfoSettings
4778
+ export type FactoryDeviceInfoSettings = {
4779
+ serial_no?: string;
4780
+ cpu_info?: string;
4781
+ pre_firmware?: string;
4782
+ };
4783
+
4784
+ // FactoryGetDeviceInfo
4785
+ export type FactoryGetDeviceInfo = {};
4786
+
4787
+ // FactoryDeviceInfo
4788
+ export type FactoryDeviceInfo = {
4789
+ serial_no?: string;
4790
+ spi_flash_info?: string;
4791
+ se_info?: string;
4792
+ nft_voucher?: string;
4793
+ cpu_info?: string;
4794
+ pre_firmware?: string;
4795
+ };
4796
+
4797
+ // FilesystemFixPermission
4798
+ export type FilesystemFixPermission = {};
4799
+
4800
+ // FilesystemPathInfo
4801
+ export type FilesystemPathInfo = {
4802
+ exist: boolean;
4803
+ size: number;
4804
+ year: number;
4805
+ month: number;
4806
+ day: number;
4807
+ hour: number;
4808
+ minute: number;
4809
+ second: number;
4810
+ readonly: boolean;
4811
+ hidden: boolean;
4812
+ system: boolean;
4813
+ archive: boolean;
4814
+ directory: boolean;
4815
+ };
4816
+
4817
+ // FilesystemPathInfoQuery
4818
+ export type FilesystemPathInfoQuery = {
4819
+ path: string;
4820
+ };
4821
+
4822
+ // FilesystemFile
4823
+ export type FilesystemFile = {
4824
+ path: string;
4825
+ offset: number;
4826
+ total_size: number;
4827
+ data?: Buffer | ArrayBuffer | Uint8Array | string;
4828
+ data_hash?: number;
4829
+ processed_byte?: number;
4830
+ };
4831
+
4832
+ // FilesystemFileRead
4833
+ export type FilesystemFileRead = {
4834
+ file: FilesystemFile;
4835
+ chunk_len?: number;
4836
+ ui_percentage?: number;
4837
+ };
4838
+
4839
+ // FilesystemFileWrite
4840
+ export type FilesystemFileWrite = {
4841
+ file: FilesystemFile;
4842
+ overwrite: boolean;
4843
+ append: boolean;
4844
+ ui_percentage?: number;
4845
+ };
4846
+
4847
+ // FilesystemFileDelete
4848
+ export type FilesystemFileDelete = {
4849
+ path: string;
4850
+ };
4851
+
4852
+ // FilesystemDir
4853
+ export type FilesystemDir = {
4854
+ path: string;
4855
+ child_dirs?: string;
4856
+ child_files?: string;
4857
+ };
4858
+
4859
+ // FilesystemDirList
4860
+ export type FilesystemDirList = {
4861
+ path: string;
4862
+ depth?: number;
4863
+ };
4864
+
4865
+ // FilesystemDirMake
4866
+ export type FilesystemDirMake = {
4867
+ path: string;
4868
+ };
4869
+
4870
+ // FilesystemDirRemove
4871
+ export type FilesystemDirRemove = {
4872
+ path: string;
4873
+ };
4874
+
4875
+ // FilesystemFormat
4876
+ export type FilesystemFormat = {};
4877
+
4878
+ export enum OnboardingStep {
4879
+ ONBOARDING_STEP_UNKNOWN = 0,
4880
+ ONBOARDING_STEP_DEVICE_VERIFICATION = 1,
4881
+ ONBOARDING_STEP_PERSONALIZATION = 2,
4882
+ ONBOARDING_STEP_SETUP = 3,
4883
+ ONBOARDING_STEP_FIRMWARE = 4,
4884
+ }
4885
+
4886
+ // GetOnboardingStatus
4887
+ export type GetOnboardingStatus = {};
4888
+
4889
+ export type NewDevice = {
4890
+ seedcard_backup?: boolean;
4891
+ };
4892
+
4893
+ export type Restore = {
4894
+ mnemonic?: boolean;
4895
+ seedcard?: boolean;
4896
+ };
4897
+
4898
+ export type Setup = {
4899
+ new_device?: NewDevice;
4900
+ restore?: Restore;
4901
+ };
4902
+
4903
+ // OnboardingStatus
4904
+ export type OnboardingStatus = {
4905
+ step: OnboardingStep;
4906
+ setup?: Setup;
4907
+ detail_code?: number;
4908
+ detail_str?: string;
4909
+ };
4910
+
4396
4911
  // custom connect definitions
4397
4912
  export type MessageType = {
4398
4913
  AlephiumGetAddress: AlephiumGetAddress;
@@ -4449,6 +4964,7 @@ export type MessageType = {
4449
4964
  SignMessage: SignMessage;
4450
4965
  MessageSignature: MessageSignature;
4451
4966
  VerifyMessage: VerifyMessage;
4967
+ CoinJoinRequest: CoinJoinRequest;
4452
4968
  SignTx: SignTx;
4453
4969
  TxRequestDetailsType: TxRequestDetailsType;
4454
4970
  TxRequestSerializedType: TxRequestSerializedType;
@@ -4717,7 +5233,7 @@ export type MessageType = {
4717
5233
  BixinBackupDeviceAck: BixinBackupDeviceAck;
4718
5234
  DeviceInfoSettings: DeviceInfoSettings;
4719
5235
  GetDeviceInfo: GetDeviceInfo;
4720
- DeviceInfo: DeviceInfo;
5236
+ DeviceInfo: DeviceInfo | ProtocolV2DeviceInfo;
4721
5237
  ReadSEPublicKey: ReadSEPublicKey;
4722
5238
  SEPublicKey: SEPublicKey;
4723
5239
  WriteSEPublicCert: WriteSEPublicCert;
@@ -4949,6 +5465,72 @@ export type MessageType = {
4949
5465
  TronSignMessage: TronSignMessage;
4950
5466
  TronMessageSignature: TronMessageSignature;
4951
5467
  facotry: facotry;
5468
+ experimental_message: experimental_message;
5469
+ experimental_field: experimental_field;
5470
+ TextMemo: TextMemo;
5471
+ RefundMemo: RefundMemo;
5472
+ CoinPurchaseMemo: CoinPurchaseMemo;
5473
+ PaymentRequestMemo: PaymentRequestMemo;
5474
+ TxAckPaymentRequest: TxAckPaymentRequest;
5475
+ SetBusy: SetBusy;
5476
+ GetFirmwareHash: GetFirmwareHash;
5477
+ FirmwareHash: FirmwareHash;
5478
+ GetNonce: GetNonce;
5479
+ Nonce: Nonce;
5480
+ WriteSEPrivateKey: WriteSEPrivateKey;
5481
+ UnlockPath: UnlockPath;
5482
+ UnlockedPathRequest: UnlockedPathRequest;
5483
+ TxDetailsAmount: TxDetailsAmount;
5484
+ TxDetailsAddress: TxDetailsAddress;
5485
+ TxDetailsNetwork: TxDetailsNetwork;
5486
+ TxDetailsGeneral: TxDetailsGeneral;
5487
+ TxDetailsPage: TxDetailsPage;
5488
+ GetProtoVersion: GetProtoVersion;
5489
+ ProtoVersion: ProtoVersion;
5490
+ DevReboot: DevReboot;
5491
+ DeviceReboot: DeviceReboot;
5492
+ DevFirmwareImageInfo: DevFirmwareImageInfo;
5493
+ DevHardwareInfo: DevHardwareInfo;
5494
+ DevMainMcuInfo: DevMainMcuInfo;
5495
+ DevBluetoothInfo: DevBluetoothInfo;
5496
+ DevSEInfo: DevSEInfo;
5497
+ DevInfoTargets: DevInfoTargets;
5498
+ DevInfoTypes: DevInfoTypes;
5499
+ DevStatus: DevStatus;
5500
+ DevGetDeviceInfo: DevGetDeviceInfo;
5501
+ DeviceGetDeviceInfo: DeviceGetDeviceInfo;
5502
+ DevFirmwareTarget: DevFirmwareTarget;
5503
+ DeviceFirmwareTarget: DeviceFirmwareTarget;
5504
+ DevFirmwareUpdate: DevFirmwareUpdate;
5505
+ DeviceFirmwareUpdate: DeviceFirmwareUpdate;
5506
+ DevFirmwareInstallProgress: DevFirmwareInstallProgress;
5507
+ DeviceFirmwareInstallProgress: DeviceFirmwareInstallProgress;
5508
+ DevFirmwareUpdateStatusEntry: DevFirmwareUpdateStatusEntry;
5509
+ DeviceFirmwareUpdateStatusEntry: DeviceFirmwareUpdateStatusEntry;
5510
+ DevGetFirmwareUpdateStatus: DevGetFirmwareUpdateStatus;
5511
+ DeviceGetFirmwareUpdateStatus: DeviceGetFirmwareUpdateStatus;
5512
+ DevFirmwareUpdateStatus: DevFirmwareUpdateStatus;
5513
+ DeviceFirmwareUpdateStatus: DeviceFirmwareUpdateStatus;
5514
+ FactoryDeviceInfoSettings: FactoryDeviceInfoSettings;
5515
+ FactoryGetDeviceInfo: FactoryGetDeviceInfo;
5516
+ FactoryDeviceInfo: FactoryDeviceInfo;
5517
+ FilesystemFixPermission: FilesystemFixPermission;
5518
+ FilesystemPathInfo: FilesystemPathInfo;
5519
+ FilesystemPathInfoQuery: FilesystemPathInfoQuery;
5520
+ FilesystemFile: FilesystemFile;
5521
+ FilesystemFileRead: FilesystemFileRead;
5522
+ FilesystemFileWrite: FilesystemFileWrite;
5523
+ FilesystemFileDelete: FilesystemFileDelete;
5524
+ FilesystemDir: FilesystemDir;
5525
+ FilesystemDirList: FilesystemDirList;
5526
+ FilesystemDirMake: FilesystemDirMake;
5527
+ FilesystemDirRemove: FilesystemDirRemove;
5528
+ FilesystemFormat: FilesystemFormat;
5529
+ GetOnboardingStatus: GetOnboardingStatus;
5530
+ NewDevice: NewDevice;
5531
+ Restore: Restore;
5532
+ Setup: Setup;
5533
+ OnboardingStatus: OnboardingStatus;
4952
5534
  };
4953
5535
 
4954
5536
  export type MessageKey = keyof MessageType;
@@ -4958,8 +5540,19 @@ export type MessageResponse<T extends MessageKey> = {
4958
5540
  message: MessageType[T];
4959
5541
  };
4960
5542
 
4961
- export type TypedCall = <T extends MessageKey, R extends MessageKey>(
4962
- type: T,
4963
- resType: R,
4964
- message?: MessageType[T]
4965
- ) => Promise<MessageResponse<R>>;
5543
+ export type MessageResponseMap = {
5544
+ [K in MessageKey]: MessageResponse<K>;
5545
+ };
5546
+
5547
+ export type TypedCall = {
5548
+ <T extends MessageKey, R extends readonly MessageKey[]>(
5549
+ type: T,
5550
+ resType: R,
5551
+ message?: MessageType[T]
5552
+ ): Promise<MessageResponseMap[R[number]]>;
5553
+ <T extends MessageKey, R extends MessageKey>(
5554
+ type: T,
5555
+ resType: R,
5556
+ message?: MessageType[T]
5557
+ ): Promise<MessageResponse<R>>;
5558
+ };