@onekeyfe/hd-core 1.1.27-alpha.41 → 1.1.27-alpha.42

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 (48) hide show
  1. package/__tests__/logBlockEvent.test.ts +37 -0
  2. package/__tests__/protocol-v2.test.ts +129 -12
  3. package/dist/api/device/DeviceLock.d.ts.map +1 -1
  4. package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +1 -1
  5. package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -1
  6. package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +1 -1
  7. package/dist/api/sui/SuiGetAddress.d.ts +3 -0
  8. package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
  9. package/dist/api/sui/SuiGetPublicKey.d.ts +3 -0
  10. package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
  11. package/dist/api/sui/SuiSignMessage.d.ts +3 -0
  12. package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
  13. package/dist/api/sui/SuiSignTransaction.d.ts +3 -0
  14. package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
  15. package/dist/api/ton/TonGetAddress.d.ts +3 -0
  16. package/dist/api/ton/TonGetAddress.d.ts.map +1 -1
  17. package/dist/api/ton/TonSignData.d.ts +5 -0
  18. package/dist/api/ton/TonSignData.d.ts.map +1 -1
  19. package/dist/api/ton/TonSignMessage.d.ts +3 -0
  20. package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
  21. package/dist/api/ton/TonSignProof.d.ts +3 -0
  22. package/dist/api/ton/TonSignProof.d.ts.map +1 -1
  23. package/dist/device/Device.d.ts +2 -2
  24. package/dist/device/Device.d.ts.map +1 -1
  25. package/dist/events/logBlockEvent.d.ts +1 -0
  26. package/dist/events/logBlockEvent.d.ts.map +1 -1
  27. package/dist/index.d.ts +6 -5
  28. package/dist/index.js +513 -246
  29. package/dist/types/api/protocolV2.d.ts +2 -2
  30. package/dist/types/api/protocolV2.d.ts.map +1 -1
  31. package/dist/utils/patch.d.ts +1 -1
  32. package/dist/utils/patch.d.ts.map +1 -1
  33. package/package.json +4 -4
  34. package/src/api/device/DeviceLock.ts +1 -3
  35. package/src/api/evm/EVMSignTypedData.ts +1 -1
  36. package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +1 -5
  37. package/src/api/sui/SuiGetAddress.ts +3 -0
  38. package/src/api/sui/SuiGetPublicKey.ts +3 -0
  39. package/src/api/sui/SuiSignMessage.ts +3 -0
  40. package/src/api/sui/SuiSignTransaction.ts +3 -0
  41. package/src/api/ton/TonGetAddress.ts +3 -0
  42. package/src/api/ton/TonSignData.ts +10 -3
  43. package/src/api/ton/TonSignMessage.ts +3 -0
  44. package/src/api/ton/TonSignProof.ts +3 -0
  45. package/src/data/messages/messages-protocol-v2.json +489 -268
  46. package/src/device/Device.ts +6 -2
  47. package/src/events/logBlockEvent.ts +23 -0
  48. package/src/types/api/protocolV2.ts +2 -2
@@ -51,7 +51,7 @@ import type {
51
51
  } from '../events';
52
52
  import type { PassphrasePromptResponse } from './DeviceCommands';
53
53
  import type { Deferred, HardwareConnectProtocol } from '@onekeyfe/hd-shared';
54
- import type { OneKeyDeviceInfo as DeviceDescriptor } from '@onekeyfe/hd-transport';
54
+ import type { OneKeyDeviceInfo as DeviceDescriptor, Success } from '@onekeyfe/hd-transport';
55
55
  import type DeviceConnector from './DeviceConnector';
56
56
 
57
57
  export type InitOptions = {
@@ -862,7 +862,11 @@ export class Device extends EventEmitter {
862
862
  return false;
863
863
  }
864
864
 
865
- async lockDevice() {
865
+ async lockDevice(): Promise<Success> {
866
+ if (getDeviceType(this.features) === EDeviceType.Pro2) {
867
+ return { message: 'LockDevice skipped for Pro2' };
868
+ }
869
+
866
870
  const res = await this.commands.typedCall('LockDevice', 'Success', {});
867
871
  return res.message;
868
872
  }
@@ -4,3 +4,26 @@ export const LogBlockEvent: Set<string> = new Set([
4
4
  UI_RESPONSE.RECEIVE_PIN,
5
5
  UI_RESPONSE.RECEIVE_PASSPHRASE,
6
6
  ]);
7
+
8
+ const LogBlockMethod: Set<string> = new Set(['evmSignTypedData']);
9
+
10
+ export function getLogBlockLabel(message: unknown): string | undefined {
11
+ if (!message || typeof message !== 'object') return undefined;
12
+
13
+ const { type, payload, method } = message as {
14
+ type?: string;
15
+ payload?: { method?: string };
16
+ method?: string;
17
+ };
18
+
19
+ if (type && LogBlockEvent.has(type)) {
20
+ return type;
21
+ }
22
+
23
+ const methodName = method ?? payload?.method;
24
+ if (methodName && LogBlockMethod.has(methodName)) {
25
+ return methodName;
26
+ }
27
+
28
+ return undefined;
29
+ }
@@ -2,11 +2,11 @@ import type { CommonParams, Response } from '../params';
2
2
  import type {
3
3
  DeviceFirmwareTarget,
4
4
  DeviceFirmwareUpdateStatus,
5
- DeviceOnboardingStatus,
6
5
  DeviceInfoTargets,
7
6
  DeviceInfoTypes,
8
7
  DeviceRebootType,
9
8
  FactoryDeviceInfo,
9
+ OnboardingStatus,
10
10
  ProtoVersion,
11
11
  ProtocolV2DeviceInfo,
12
12
  Success,
@@ -162,7 +162,7 @@ export declare function deviceGetDeviceInfo(
162
162
  export declare function deviceGetOnboardingStatus(
163
163
  connectId: string,
164
164
  params?: CommonParams
165
- ): Response<DeviceOnboardingStatus>;
165
+ ): Response<OnboardingStatus>;
166
166
 
167
167
  export declare function deviceFirmwareUpdate(
168
168
  connectId: string,