@onekeyfe/hd-transport 1.1.28 → 1.2.0-alpha.1

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 +905 -41
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +811 -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 +441 -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 +13375 -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 +579 -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,475 @@ 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
+ // DebugLinkInput
4456
+ export type DebugLinkInput = {
4457
+ x?: number;
4458
+ y?: number;
4459
+ duration_ms?: number;
4460
+ x_end?: number;
4461
+ y_end?: number;
4462
+ };
4463
+
4464
+ // InternalMyAddressRequest
4465
+ export type InternalMyAddressRequest = {
4466
+ coin_type: number;
4467
+ chain_id: number;
4468
+ account_index: number;
4469
+ derive_type: number;
4470
+ };
4471
+
4472
+ // SetBusy
4473
+ export type SetBusy = {
4474
+ expiry_ms?: number;
4475
+ };
4476
+
4477
+ // GetFirmwareHash
4478
+ export type GetFirmwareHash = {
4479
+ challenge?: string;
4480
+ };
4481
+
4482
+ // FirmwareHash
4483
+ export type FirmwareHash = {
4484
+ hash: string;
4485
+ };
4486
+
4487
+ // GetNonce
4488
+ export type GetNonce = {};
4489
+
4490
+ // Nonce
4491
+ export type Nonce = {
4492
+ nonce: string;
4493
+ };
4494
+
4495
+ // WriteSEPrivateKey
4496
+ export type WriteSEPrivateKey = {
4497
+ private_key: string;
4498
+ };
4499
+
4500
+ export enum WallpaperTarget {
4501
+ Home = 0,
4502
+ Lock = 1,
4503
+ }
4504
+
4505
+ // SetWallpaper
4506
+ export type SetWallpaper = {
4507
+ target: WallpaperTarget;
4508
+ path: string;
4509
+ };
4510
+
4511
+ // GetWallpaper
4512
+ export type GetWallpaper = {
4513
+ target: WallpaperTarget;
4514
+ };
4515
+
4516
+ // Wallpaper
4517
+ export type Wallpaper = {
4518
+ target: WallpaperTarget;
4519
+ path: string;
4520
+ };
4521
+
4522
+ // UnlockPath
4523
+ export type UnlockPath = {
4524
+ address_n: number[];
4525
+ mac?: string;
4526
+ };
4527
+
4528
+ // UnlockedPathRequest
4529
+ export type UnlockedPathRequest = {
4530
+ mac?: string;
4531
+ };
4532
+
4533
+ export enum MoneroNetworkType {
4534
+ MAINNET = 0,
4535
+ TESTNET = 1,
4536
+ STAGENET = 2,
4537
+ FAKECHAIN = 3,
4538
+ }
4539
+
4540
+ // ViewAmount
4541
+ export type ViewAmount = {
4542
+ is_unlimited: boolean;
4543
+ num: string;
4544
+ };
4545
+
4546
+ // ViewDetail
4547
+ export type ViewDetail = {
4548
+ key: number;
4549
+ value: string;
4550
+ is_overview: boolean;
4551
+ has_icon: boolean;
4552
+ };
4553
+
4554
+ export enum ViewTipType {
4555
+ Default = 0,
4556
+ Highlight = 1,
4557
+ Recommend = 2,
4558
+ Warning = 3,
4559
+ Danger = 4,
4560
+ }
4561
+
4562
+ // ViewTip
4563
+ export type ViewTip = {
4564
+ type: ViewTipType;
4565
+ text: string;
4566
+ };
4567
+
4568
+ // ViewSignPage
4569
+ export type ViewSignPage = {
4570
+ title: string;
4571
+ amount?: UintType;
4572
+ general: ViewDetail[];
4573
+ tip?: ViewTip;
4574
+ };
4575
+
4576
+ // ViewVerifyPage
4577
+ export type ViewVerifyPage = {
4578
+ title: string;
4579
+ address: string;
4580
+ path: string;
4581
+ };
4582
+
4583
+ // GetProtoVersion
4584
+ export type GetProtoVersion = {};
4585
+
4586
+ // ProtoVersion
4587
+ export type ProtoVersion = {
4588
+ proto_version: number;
4589
+ };
4590
+
4591
+ export enum DevRebootType {
4592
+ Normal = 0,
4593
+ Boardloader = 1,
4594
+ Bootloader = 2,
4595
+ }
4596
+
4597
+ // DevReboot
4598
+ export type DevReboot = {
4599
+ reboot_type: DevRebootType;
4600
+ };
4601
+
4602
+ export enum DeviceType {
4603
+ CLASSIC1 = 0,
4604
+ CLASSIC1S = 1,
4605
+ MINI = 2,
4606
+ TOUCH = 3,
4607
+ PRO = 5,
4608
+ CLASSIC1S_PURE = 6,
4609
+ }
4610
+
4611
+ export enum DevSeType {
4612
+ THD89 = 0,
4613
+ SE608A = 1,
4614
+ }
4615
+
4616
+ export enum DevSEState {
4617
+ BOOT = 0,
4618
+ APP_FACTORY = 51,
4619
+ APP = 85,
4620
+ }
4621
+
4622
+ // DevFirmwareImageInfo
4623
+ export type DevFirmwareImageInfo = {
4624
+ version?: string;
4625
+ build_id?: string;
4626
+ hash?: string;
4627
+ };
4628
+
4629
+ // DevHardwareInfo
4630
+ export type DevHardwareInfo = {
4631
+ device_type?: DeviceType;
4632
+ serial_no?: string;
4633
+ device_id?: string;
4634
+ hardware_version?: string;
4635
+ hardware_version_raw_adc?: number;
4636
+ };
4637
+
4638
+ // DevMainMcuInfo
4639
+ export type DevMainMcuInfo = {
4640
+ board?: DevFirmwareImageInfo;
4641
+ boot?: DevFirmwareImageInfo;
4642
+ app?: DevFirmwareImageInfo;
4643
+ };
4644
+
4645
+ // DevBluetoothInfo
4646
+ export type DevBluetoothInfo = {
4647
+ boot?: DevFirmwareImageInfo;
4648
+ app?: DevFirmwareImageInfo;
4649
+ adv_name?: string;
4650
+ mac?: string;
4651
+ };
4652
+
4653
+ // DevSEInfo
4654
+ export type DevSEInfo = {
4655
+ boot?: DevFirmwareImageInfo;
4656
+ app?: DevFirmwareImageInfo;
4657
+ type?: DevSeType;
4658
+ state?: DevSEState;
4659
+ };
4660
+
4661
+ // DevInfoTargets
4662
+ export type DevInfoTargets = {
4663
+ hw?: boolean;
4664
+ fw?: boolean;
4665
+ bt?: boolean;
4666
+ se1?: boolean;
4667
+ se2?: boolean;
4668
+ se3?: boolean;
4669
+ se4?: boolean;
4670
+ status?: boolean;
4671
+ };
4672
+
4673
+ // DevInfoTypes
4674
+ export type DevInfoTypes = {
4675
+ version?: boolean;
4676
+ build_id?: boolean;
4677
+ hash?: boolean;
4678
+ specific?: boolean;
4679
+ };
4680
+
4681
+ // DevStatus
4682
+ export type DevStatus = {
4683
+ language?: string;
4684
+ bt_enable?: boolean;
4685
+ init_states?: boolean;
4686
+ backup_required?: boolean;
4687
+ passphrase_protection?: boolean;
4688
+ label?: string;
4689
+ };
4690
+
4691
+ // DevGetDeviceInfo
4692
+ export type DevGetDeviceInfo = {
4693
+ targets?: DevInfoTargets;
4694
+ types?: DevInfoTypes;
4695
+ };
4696
+
4697
+ // ProtocolV2DeviceInfo
4698
+ export type ProtocolV2DeviceInfo = {
4699
+ protocol_version: number;
4700
+ hw?: DevHardwareInfo;
4701
+ fw?: DevMainMcuInfo;
4702
+ bt?: DevBluetoothInfo;
4703
+ se1?: DevSEInfo;
4704
+ se2?: DevSEInfo;
4705
+ se3?: DevSEInfo;
4706
+ se4?: DevSEInfo;
4707
+ status?: DevStatus;
4708
+ };
4709
+
4710
+ export enum DevFirmwareTargetType {
4711
+ TARGET_MAIN_APP = 0,
4712
+ TARGET_MAIN_BOOT = 1,
4713
+ TARGET_BT = 2,
4714
+ TARGET_SE1 = 3,
4715
+ TARGET_SE2 = 4,
4716
+ TARGET_SE3 = 5,
4717
+ TARGET_SE4 = 6,
4718
+ TARGET_RESOURCE = 10,
4719
+ }
4720
+
4721
+ // DevFirmwareTarget
4722
+ export type DevFirmwareTarget = {
4723
+ target_id: DevFirmwareTargetType;
4724
+ path: string;
4725
+ };
4726
+
4727
+ // DevFirmwareUpdate
4728
+ export type DevFirmwareUpdate = {
4729
+ targets: DevFirmwareTarget[];
4730
+ };
4731
+
4732
+ // DevFirmwareInstallProgress
4733
+ export type DevFirmwareInstallProgress = {
4734
+ target_id: DevFirmwareTargetType;
4735
+ progress: number;
4736
+ stage?: string;
4737
+ };
4738
+
4739
+ // DevFirmwareUpdateStatusEntry
4740
+ export type DevFirmwareUpdateStatusEntry = {
4741
+ target_id: DevFirmwareTargetType;
4742
+ status: number;
4743
+ };
4744
+
4745
+ // DevGetFirmwareUpdateStatus
4746
+ export type DevGetFirmwareUpdateStatus = {};
4747
+
4748
+ // DevFirmwareUpdateStatus
4749
+ export type DevFirmwareUpdateStatus = {
4750
+ targets: DevFirmwareUpdateStatusEntry[];
4751
+ };
4752
+
4753
+ // FactoryDeviceInfoSettings
4754
+ export type FactoryDeviceInfoSettings = {
4755
+ serial_no?: string;
4756
+ cpu_info?: string;
4757
+ pre_firmware?: string;
4758
+ };
4759
+
4760
+ // FactoryGetDeviceInfo
4761
+ export type FactoryGetDeviceInfo = {};
4762
+
4763
+ // FactoryDeviceInfo
4764
+ export type FactoryDeviceInfo = {
4765
+ serial_no?: string;
4766
+ spi_flash_info?: string;
4767
+ se_info?: string;
4768
+ nft_voucher?: string;
4769
+ cpu_info?: string;
4770
+ pre_firmware?: string;
4771
+ };
4772
+
4773
+ // FilesystemFixPermission
4774
+ export type FilesystemFixPermission = {};
4775
+
4776
+ // FilesystemPathInfo
4777
+ export type FilesystemPathInfo = {
4778
+ exist: boolean;
4779
+ size: number;
4780
+ year: number;
4781
+ month: number;
4782
+ day: number;
4783
+ hour: number;
4784
+ minute: number;
4785
+ second: number;
4786
+ readonly: boolean;
4787
+ hidden: boolean;
4788
+ system: boolean;
4789
+ archive: boolean;
4790
+ directory: boolean;
4791
+ };
4792
+
4793
+ // FilesystemPathInfoQuery
4794
+ export type FilesystemPathInfoQuery = {
4795
+ path: string;
4796
+ };
4797
+
4798
+ // FilesystemFile
4799
+ export type FilesystemFile = {
4800
+ path: string;
4801
+ offset: number;
4802
+ total_size: number;
4803
+ data?: Buffer | ArrayBuffer | Uint8Array | string;
4804
+ data_hash?: number;
4805
+ processed_byte?: number;
4806
+ };
4807
+
4808
+ // FilesystemFileRead
4809
+ export type FilesystemFileRead = {
4810
+ file: FilesystemFile;
4811
+ chunk_len?: number;
4812
+ ui_percentage?: number;
4813
+ };
4814
+
4815
+ // FilesystemFileWrite
4816
+ export type FilesystemFileWrite = {
4817
+ file: FilesystemFile;
4818
+ overwrite: boolean;
4819
+ append: boolean;
4820
+ ui_percentage?: number;
4821
+ };
4822
+
4823
+ // FilesystemFileDelete
4824
+ export type FilesystemFileDelete = {
4825
+ path: string;
4826
+ };
4827
+
4828
+ // FilesystemDir
4829
+ export type FilesystemDir = {
4830
+ path: string;
4831
+ child_dirs?: string;
4832
+ child_files?: string;
4833
+ };
4834
+
4835
+ // FilesystemDirList
4836
+ export type FilesystemDirList = {
4837
+ path: string;
4838
+ depth?: number;
4839
+ };
4840
+
4841
+ // FilesystemDirMake
4842
+ export type FilesystemDirMake = {
4843
+ path: string;
4844
+ };
4845
+
4846
+ // FilesystemDirRemove
4847
+ export type FilesystemDirRemove = {
4848
+ path: string;
4849
+ };
4850
+
4851
+ // FilesystemFormat
4852
+ export type FilesystemFormat = {};
4853
+
4854
+ export enum OnboardingStep {
4855
+ ONBOARDING_STEP_UNKNOWN = 0,
4856
+ ONBOARDING_STEP_DEVICE_VERIFICATION = 1,
4857
+ ONBOARDING_STEP_PERSONALIZATION = 2,
4858
+ ONBOARDING_STEP_SETUP = 3,
4859
+ ONBOARDING_STEP_FIRMWARE = 4,
4860
+ }
4861
+
4862
+ // GetOnboardingStatus
4863
+ export type GetOnboardingStatus = {};
4864
+
4865
+ export type NewDevice = {
4866
+ seedcard_backup?: boolean;
4867
+ };
4868
+
4869
+ export type Restore = {
4870
+ mnemonic?: boolean;
4871
+ seedcard?: boolean;
4872
+ };
4873
+
4874
+ export type Setup = {
4875
+ new_device?: NewDevice;
4876
+ restore?: Restore;
4877
+ };
4878
+
4879
+ // OnboardingStatus
4880
+ export type OnboardingStatus = {
4881
+ step: OnboardingStep;
4882
+ setup?: Setup;
4883
+ detail_code?: number;
4884
+ detail_str?: string;
4885
+ };
4886
+
4396
4887
  // custom connect definitions
4397
4888
  export type MessageType = {
4398
4889
  AlephiumGetAddress: AlephiumGetAddress;
@@ -4449,6 +4940,7 @@ export type MessageType = {
4449
4940
  SignMessage: SignMessage;
4450
4941
  MessageSignature: MessageSignature;
4451
4942
  VerifyMessage: VerifyMessage;
4943
+ CoinJoinRequest: CoinJoinRequest;
4452
4944
  SignTx: SignTx;
4453
4945
  TxRequestDetailsType: TxRequestDetailsType;
4454
4946
  TxRequestSerializedType: TxRequestSerializedType;
@@ -4717,7 +5209,7 @@ export type MessageType = {
4717
5209
  BixinBackupDeviceAck: BixinBackupDeviceAck;
4718
5210
  DeviceInfoSettings: DeviceInfoSettings;
4719
5211
  GetDeviceInfo: GetDeviceInfo;
4720
- DeviceInfo: DeviceInfo;
5212
+ DeviceInfo: DeviceInfo | ProtocolV2DeviceInfo;
4721
5213
  ReadSEPublicKey: ReadSEPublicKey;
4722
5214
  SEPublicKey: SEPublicKey;
4723
5215
  WriteSEPublicCert: WriteSEPublicCert;
@@ -4949,6 +5441,69 @@ export type MessageType = {
4949
5441
  TronSignMessage: TronSignMessage;
4950
5442
  TronMessageSignature: TronMessageSignature;
4951
5443
  facotry: facotry;
5444
+ experimental_message: experimental_message;
5445
+ experimental_field: experimental_field;
5446
+ TextMemo: TextMemo;
5447
+ RefundMemo: RefundMemo;
5448
+ CoinPurchaseMemo: CoinPurchaseMemo;
5449
+ PaymentRequestMemo: PaymentRequestMemo;
5450
+ TxAckPaymentRequest: TxAckPaymentRequest;
5451
+ DebugLinkInput: DebugLinkInput;
5452
+ InternalMyAddressRequest: InternalMyAddressRequest;
5453
+ SetBusy: SetBusy;
5454
+ GetFirmwareHash: GetFirmwareHash;
5455
+ FirmwareHash: FirmwareHash;
5456
+ GetNonce: GetNonce;
5457
+ Nonce: Nonce;
5458
+ WriteSEPrivateKey: WriteSEPrivateKey;
5459
+ SetWallpaper: SetWallpaper;
5460
+ GetWallpaper: GetWallpaper;
5461
+ Wallpaper: Wallpaper;
5462
+ UnlockPath: UnlockPath;
5463
+ UnlockedPathRequest: UnlockedPathRequest;
5464
+ ViewAmount: ViewAmount;
5465
+ ViewDetail: ViewDetail;
5466
+ ViewTip: ViewTip;
5467
+ ViewSignPage: ViewSignPage;
5468
+ ViewVerifyPage: ViewVerifyPage;
5469
+ GetProtoVersion: GetProtoVersion;
5470
+ ProtoVersion: ProtoVersion;
5471
+ DevReboot: DevReboot;
5472
+ DevFirmwareImageInfo: DevFirmwareImageInfo;
5473
+ DevHardwareInfo: DevHardwareInfo;
5474
+ DevMainMcuInfo: DevMainMcuInfo;
5475
+ DevBluetoothInfo: DevBluetoothInfo;
5476
+ DevSEInfo: DevSEInfo;
5477
+ DevInfoTargets: DevInfoTargets;
5478
+ DevInfoTypes: DevInfoTypes;
5479
+ DevStatus: DevStatus;
5480
+ DevGetDeviceInfo: DevGetDeviceInfo;
5481
+ DevFirmwareTarget: DevFirmwareTarget;
5482
+ DevFirmwareUpdate: DevFirmwareUpdate;
5483
+ DevFirmwareInstallProgress: DevFirmwareInstallProgress;
5484
+ DevFirmwareUpdateStatusEntry: DevFirmwareUpdateStatusEntry;
5485
+ DevGetFirmwareUpdateStatus: DevGetFirmwareUpdateStatus;
5486
+ DevFirmwareUpdateStatus: DevFirmwareUpdateStatus;
5487
+ FactoryDeviceInfoSettings: FactoryDeviceInfoSettings;
5488
+ FactoryGetDeviceInfo: FactoryGetDeviceInfo;
5489
+ FactoryDeviceInfo: FactoryDeviceInfo;
5490
+ FilesystemFixPermission: FilesystemFixPermission;
5491
+ FilesystemPathInfo: FilesystemPathInfo;
5492
+ FilesystemPathInfoQuery: FilesystemPathInfoQuery;
5493
+ FilesystemFile: FilesystemFile;
5494
+ FilesystemFileRead: FilesystemFileRead;
5495
+ FilesystemFileWrite: FilesystemFileWrite;
5496
+ FilesystemFileDelete: FilesystemFileDelete;
5497
+ FilesystemDir: FilesystemDir;
5498
+ FilesystemDirList: FilesystemDirList;
5499
+ FilesystemDirMake: FilesystemDirMake;
5500
+ FilesystemDirRemove: FilesystemDirRemove;
5501
+ FilesystemFormat: FilesystemFormat;
5502
+ GetOnboardingStatus: GetOnboardingStatus;
5503
+ NewDevice: NewDevice;
5504
+ Restore: Restore;
5505
+ Setup: Setup;
5506
+ OnboardingStatus: OnboardingStatus;
4952
5507
  };
4953
5508
 
4954
5509
  export type MessageKey = keyof MessageType;
@@ -4958,8 +5513,19 @@ export type MessageResponse<T extends MessageKey> = {
4958
5513
  message: MessageType[T];
4959
5514
  };
4960
5515
 
4961
- export type TypedCall = <T extends MessageKey, R extends MessageKey>(
4962
- type: T,
4963
- resType: R,
4964
- message?: MessageType[T]
4965
- ) => Promise<MessageResponse<R>>;
5516
+ export type MessageResponseMap = {
5517
+ [K in MessageKey]: MessageResponse<K>;
5518
+ };
5519
+
5520
+ export type TypedCall = {
5521
+ <T extends MessageKey, R extends readonly MessageKey[]>(
5522
+ type: T,
5523
+ resType: R,
5524
+ message?: MessageType[T]
5525
+ ): Promise<MessageResponseMap[R[number]]>;
5526
+ <T extends MessageKey, R extends MessageKey>(
5527
+ type: T,
5528
+ resType: R,
5529
+ message?: MessageType[T]
5530
+ ): Promise<MessageResponse<R>>;
5531
+ };