@onekeyfe/hd-transport 1.2.0-alpha.0 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport",
3
- "version": "1.2.0-alpha.0",
3
+ "version": "1.2.0-alpha.1",
4
4
  "description": "Transport layer abstractions and utilities for OneKey hardware SDK.",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -28,5 +28,5 @@
28
28
  "long": "^4.0.0",
29
29
  "protobufjs": "^6.11.2"
30
30
  },
31
- "gitHead": "de9efe20b83666b641ab9e8d945e6350f6450904"
31
+ "gitHead": "4f4aae3a47be7bd54b4db4a10c400056784e01bd"
32
32
  }
@@ -407,23 +407,23 @@ export async function probeProtocolV2({
407
407
  onBeforeProbe?: () => Promise<void> | void;
408
408
  onProbeFailed?: (error: unknown) => Promise<void> | void;
409
409
  }) {
410
- let pingError: unknown;
410
+ let probeError: unknown;
411
411
  try {
412
412
  await onBeforeProbe?.();
413
413
  const response = await call(
414
414
  'Ping',
415
- { message: 'probe' },
415
+ { message: 'protocol-v2-probe' },
416
416
  { timeoutMs, expectedTypes: ['Success'] }
417
417
  );
418
418
  if (response.type === 'Success') {
419
419
  return true;
420
420
  }
421
- pingError = new Error(`unexpected response type ${response.type}`);
421
+ probeError = new Error(`unexpected response type ${response.type}`);
422
422
  } catch (error) {
423
- pingError = error;
423
+ probeError = error;
424
424
  }
425
425
 
426
- logger?.debug?.(`[${logPrefix}] Protocol V2 ping probe failed:`, getErrorMessage(pingError));
427
- await onProbeFailed?.(pingError);
426
+ logger?.debug?.(`[${logPrefix}] Protocol V2 probe failed:`, getErrorMessage(probeError));
427
+ await onProbeFailed?.(probeError);
428
428
  return false;
429
429
  }
@@ -4452,6 +4452,23 @@ export type TxAckPaymentRequest = {
4452
4452
  signature: string;
4453
4453
  };
4454
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
+
4455
4472
  // SetBusy
4456
4473
  export type SetBusy = {
4457
4474
  expiry_ms?: number;
@@ -4480,6 +4497,28 @@ export type WriteSEPrivateKey = {
4480
4497
  private_key: string;
4481
4498
  };
4482
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
+
4483
4522
  // UnlockPath
4484
4523
  export type UnlockPath = {
4485
4524
  address_n: number[];
@@ -4498,47 +4537,47 @@ export enum MoneroNetworkType {
4498
4537
  FAKECHAIN = 3,
4499
4538
  }
4500
4539
 
4501
- // TxDetailsAmount
4502
- export type TxDetailsAmount = {
4540
+ // ViewAmount
4541
+ export type ViewAmount = {
4542
+ is_unlimited: boolean;
4503
4543
  num: string;
4504
- decimals: number;
4505
- symbol: string;
4506
4544
  };
4507
4545
 
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 = {
4546
+ // ViewDetail
4547
+ export type ViewDetail = {
4524
4548
  key: number;
4525
4549
  value: string;
4526
4550
  is_overview: boolean;
4551
+ has_icon: boolean;
4527
4552
  };
4528
4553
 
4529
- export enum TxDetailsDisplayType {
4530
- DISPLAY_TYPE_INFO = 0,
4531
- DISPLAY_TYPE_SIGN = 1,
4554
+ export enum ViewTipType {
4555
+ Default = 0,
4556
+ Highlight = 1,
4557
+ Recommend = 2,
4558
+ Warning = 3,
4559
+ Danger = 4,
4532
4560
  }
4533
4561
 
4534
- // TxDetailsPage
4535
- export type TxDetailsPage = {
4562
+ // ViewTip
4563
+ export type ViewTip = {
4564
+ type: ViewTipType;
4565
+ text: string;
4566
+ };
4567
+
4568
+ // ViewSignPage
4569
+ export type ViewSignPage = {
4536
4570
  title: string;
4537
- display_type: TxDetailsDisplayType;
4538
4571
  amount?: UintType;
4539
- network?: TxDetailsNetwork;
4540
- address: TxDetailsAddress[];
4541
- general: TxDetailsGeneral[];
4572
+ general: ViewDetail[];
4573
+ tip?: ViewTip;
4574
+ };
4575
+
4576
+ // ViewVerifyPage
4577
+ export type ViewVerifyPage = {
4578
+ title: string;
4579
+ address: string;
4580
+ path: string;
4542
4581
  };
4543
4582
 
4544
4583
  // GetProtoVersion
@@ -4555,22 +4594,11 @@ export enum DevRebootType {
4555
4594
  Bootloader = 2,
4556
4595
  }
4557
4596
 
4558
- export enum DeviceRebootType {
4559
- Normal = 0,
4560
- Romloader = 1,
4561
- Bootloader = 2,
4562
- }
4563
-
4564
4597
  // DevReboot
4565
4598
  export type DevReboot = {
4566
4599
  reboot_type: DevRebootType;
4567
4600
  };
4568
4601
 
4569
- // DeviceReboot
4570
- export type DeviceReboot = {
4571
- reboot_type: DeviceRebootType;
4572
- };
4573
-
4574
4602
  export enum DeviceType {
4575
4603
  CLASSIC1 = 0,
4576
4604
  CLASSIC1S = 1,
@@ -4602,6 +4630,7 @@ export type DevFirmwareImageInfo = {
4602
4630
  export type DevHardwareInfo = {
4603
4631
  device_type?: DeviceType;
4604
4632
  serial_no?: string;
4633
+ device_id?: string;
4605
4634
  hardware_version?: string;
4606
4635
  hardware_version_raw_adc?: number;
4607
4636
  };
@@ -4665,9 +4694,6 @@ export type DevGetDeviceInfo = {
4665
4694
  types?: DevInfoTypes;
4666
4695
  };
4667
4696
 
4668
- // DeviceGetDeviceInfo
4669
- export type DeviceGetDeviceInfo = DevGetDeviceInfo;
4670
-
4671
4697
  // ProtocolV2DeviceInfo
4672
4698
  export type ProtocolV2DeviceInfo = {
4673
4699
  protocol_version: number;
@@ -4682,30 +4708,13 @@ export type ProtocolV2DeviceInfo = {
4682
4708
  };
4683
4709
 
4684
4710
  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,
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,
4709
4718
  TARGET_RESOURCE = 10,
4710
4719
  }
4711
4720
 
@@ -4715,23 +4724,11 @@ export type DevFirmwareTarget = {
4715
4724
  path: string;
4716
4725
  };
4717
4726
 
4718
- // DeviceFirmwareTarget
4719
- export type DeviceFirmwareTarget = {
4720
- target_id: DeviceFirmwareTargetType;
4721
- path: string;
4722
- };
4723
-
4724
4727
  // DevFirmwareUpdate
4725
4728
  export type DevFirmwareUpdate = {
4726
4729
  targets: DevFirmwareTarget[];
4727
4730
  };
4728
4731
 
4729
- // DeviceFirmwareUpdate
4730
- export type DeviceFirmwareUpdate = {
4731
- targets: DeviceFirmwareTarget[];
4732
- max_concurrent?: number;
4733
- };
4734
-
4735
4732
  // DevFirmwareInstallProgress
4736
4733
  export type DevFirmwareInstallProgress = {
4737
4734
  target_id: DevFirmwareTargetType;
@@ -4739,41 +4736,20 @@ export type DevFirmwareInstallProgress = {
4739
4736
  stage?: string;
4740
4737
  };
4741
4738
 
4742
- // DeviceFirmwareInstallProgress
4743
- export type DeviceFirmwareInstallProgress = {
4744
- target_id: DeviceFirmwareTargetType;
4745
- progress: number;
4746
- stage?: string;
4747
- };
4748
-
4749
4739
  // DevFirmwareUpdateStatusEntry
4750
4740
  export type DevFirmwareUpdateStatusEntry = {
4751
4741
  target_id: DevFirmwareTargetType;
4752
4742
  status: number;
4753
4743
  };
4754
4744
 
4755
- // DeviceFirmwareUpdateStatusEntry
4756
- export type DeviceFirmwareUpdateStatusEntry = {
4757
- target_id: DeviceFirmwareTargetType;
4758
- status: number;
4759
- };
4760
-
4761
4745
  // DevGetFirmwareUpdateStatus
4762
4746
  export type DevGetFirmwareUpdateStatus = {};
4763
4747
 
4764
- // DeviceGetFirmwareUpdateStatus
4765
- export type DeviceGetFirmwareUpdateStatus = {};
4766
-
4767
4748
  // DevFirmwareUpdateStatus
4768
4749
  export type DevFirmwareUpdateStatus = {
4769
4750
  targets: DevFirmwareUpdateStatusEntry[];
4770
4751
  };
4771
4752
 
4772
- // DeviceFirmwareUpdateStatus
4773
- export type DeviceFirmwareUpdateStatus = {
4774
- targets: DeviceFirmwareUpdateStatusEntry[];
4775
- };
4776
-
4777
4753
  // FactoryDeviceInfoSettings
4778
4754
  export type FactoryDeviceInfoSettings = {
4779
4755
  serial_no?: string;
@@ -5472,23 +5448,27 @@ export type MessageType = {
5472
5448
  CoinPurchaseMemo: CoinPurchaseMemo;
5473
5449
  PaymentRequestMemo: PaymentRequestMemo;
5474
5450
  TxAckPaymentRequest: TxAckPaymentRequest;
5451
+ DebugLinkInput: DebugLinkInput;
5452
+ InternalMyAddressRequest: InternalMyAddressRequest;
5475
5453
  SetBusy: SetBusy;
5476
5454
  GetFirmwareHash: GetFirmwareHash;
5477
5455
  FirmwareHash: FirmwareHash;
5478
5456
  GetNonce: GetNonce;
5479
5457
  Nonce: Nonce;
5480
5458
  WriteSEPrivateKey: WriteSEPrivateKey;
5459
+ SetWallpaper: SetWallpaper;
5460
+ GetWallpaper: GetWallpaper;
5461
+ Wallpaper: Wallpaper;
5481
5462
  UnlockPath: UnlockPath;
5482
5463
  UnlockedPathRequest: UnlockedPathRequest;
5483
- TxDetailsAmount: TxDetailsAmount;
5484
- TxDetailsAddress: TxDetailsAddress;
5485
- TxDetailsNetwork: TxDetailsNetwork;
5486
- TxDetailsGeneral: TxDetailsGeneral;
5487
- TxDetailsPage: TxDetailsPage;
5464
+ ViewAmount: ViewAmount;
5465
+ ViewDetail: ViewDetail;
5466
+ ViewTip: ViewTip;
5467
+ ViewSignPage: ViewSignPage;
5468
+ ViewVerifyPage: ViewVerifyPage;
5488
5469
  GetProtoVersion: GetProtoVersion;
5489
5470
  ProtoVersion: ProtoVersion;
5490
5471
  DevReboot: DevReboot;
5491
- DeviceReboot: DeviceReboot;
5492
5472
  DevFirmwareImageInfo: DevFirmwareImageInfo;
5493
5473
  DevHardwareInfo: DevHardwareInfo;
5494
5474
  DevMainMcuInfo: DevMainMcuInfo;
@@ -5498,19 +5478,12 @@ export type MessageType = {
5498
5478
  DevInfoTypes: DevInfoTypes;
5499
5479
  DevStatus: DevStatus;
5500
5480
  DevGetDeviceInfo: DevGetDeviceInfo;
5501
- DeviceGetDeviceInfo: DeviceGetDeviceInfo;
5502
5481
  DevFirmwareTarget: DevFirmwareTarget;
5503
- DeviceFirmwareTarget: DeviceFirmwareTarget;
5504
5482
  DevFirmwareUpdate: DevFirmwareUpdate;
5505
- DeviceFirmwareUpdate: DeviceFirmwareUpdate;
5506
5483
  DevFirmwareInstallProgress: DevFirmwareInstallProgress;
5507
- DeviceFirmwareInstallProgress: DeviceFirmwareInstallProgress;
5508
5484
  DevFirmwareUpdateStatusEntry: DevFirmwareUpdateStatusEntry;
5509
- DeviceFirmwareUpdateStatusEntry: DeviceFirmwareUpdateStatusEntry;
5510
5485
  DevGetFirmwareUpdateStatus: DevGetFirmwareUpdateStatus;
5511
- DeviceGetFirmwareUpdateStatus: DeviceGetFirmwareUpdateStatus;
5512
5486
  DevFirmwareUpdateStatus: DevFirmwareUpdateStatus;
5513
- DeviceFirmwareUpdateStatus: DeviceFirmwareUpdateStatus;
5514
5487
  FactoryDeviceInfoSettings: FactoryDeviceInfoSettings;
5515
5488
  FactoryGetDeviceInfo: FactoryGetDeviceInfo;
5516
5489
  FactoryDeviceInfo: FactoryDeviceInfo;