@onekeyfe/hd-core 1.1.22-alpha.2 → 1.1.22-alpha.4
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/dist/api/device/DeviceSettings.d.ts +1 -1
- package/dist/api/device/DeviceSettings.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +2 -2
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +4 -4
- package/dist/index.d.ts +19 -5
- package/dist/index.js +185 -18
- package/dist/types/api/deviceSettings.d.ts +4 -1
- package/dist/types/api/deviceSettings.d.ts.map +1 -1
- package/dist/types/api/solSignTransaction.d.ts +2 -1
- package/dist/types/api/solSignTransaction.d.ts.map +1 -1
- package/dist/utils/deviceSettings.d.ts +29 -0
- package/dist/utils/deviceSettings.d.ts.map +1 -0
- package/dist/utils/homescreen.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/device/DeviceSettings.ts +25 -6
- package/src/api/solana/SolSignTransaction.ts +5 -2
- package/src/data/messages/messages.json +61 -0
- package/src/data/messages/messages_legacy_v1.json +12 -0
- package/src/types/api/deviceSettings.ts +4 -1
- package/src/types/api/solSignTransaction.ts +5 -1
- package/src/utils/deviceSettings.ts +109 -0
- package/src/utils/homescreen.ts +3 -1
- package/src/utils/index.ts +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SafetyCheckLevel, Success } from '@onekeyfe/hd-transport';
|
|
1
|
+
import type { SafetyCheckLevel, Success } from '@onekeyfe/hd-transport';
|
|
2
2
|
import type { CommonParams, Response } from '../params';
|
|
3
3
|
|
|
4
4
|
export type DeviceSettingsParams = {
|
|
@@ -12,6 +12,9 @@ export type DeviceSettingsParams = {
|
|
|
12
12
|
passphraseAlwaysOnDevice?: boolean;
|
|
13
13
|
safetyChecks?: SafetyCheckLevel;
|
|
14
14
|
experimentalFeatures?: boolean;
|
|
15
|
+
autoShutdownDelayMs?: number;
|
|
16
|
+
changeBrightness?: boolean;
|
|
17
|
+
hapticFeedback?: boolean;
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
export declare function deviceSettings(
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
SolanaSignedTx as HardwareSolanaSignedTx,
|
|
3
|
+
SolanaTxExtraInfo,
|
|
4
|
+
} from '@onekeyfe/hd-transport';
|
|
2
5
|
import type { CommonParams, Response } from '../params';
|
|
3
6
|
|
|
4
7
|
export type SolanaSignedTx = {
|
|
@@ -8,6 +11,7 @@ export type SolanaSignedTx = {
|
|
|
8
11
|
export type SolanaSignTransactionParams = {
|
|
9
12
|
path: string | number[];
|
|
10
13
|
rawTx?: string;
|
|
14
|
+
extraInfo?: SolanaTxExtraInfo;
|
|
11
15
|
};
|
|
12
16
|
|
|
13
17
|
export declare function solSignTransaction(
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
2
|
+
|
|
3
|
+
import type { IDeviceType } from '../types';
|
|
4
|
+
|
|
5
|
+
export const LANGUAGE_LABELS = {
|
|
6
|
+
en: 'English',
|
|
7
|
+
zh_cn: '简体中文',
|
|
8
|
+
zh_hk: '繁體中文',
|
|
9
|
+
ja: '日本語',
|
|
10
|
+
ko: '한국어',
|
|
11
|
+
fr: 'Français',
|
|
12
|
+
de: 'Deutsch',
|
|
13
|
+
ru: 'Russian',
|
|
14
|
+
es: 'Spanish',
|
|
15
|
+
it: 'Italiano',
|
|
16
|
+
pt_br: 'Portuguese (Brazil)',
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
export type LanguageKey = keyof typeof LANGUAGE_LABELS;
|
|
20
|
+
export type LanguageOption = { code: LanguageKey; label: (typeof LANGUAGE_LABELS)[LanguageKey] };
|
|
21
|
+
|
|
22
|
+
export const getLanguageConfig = (deviceType: IDeviceType): Record<string, string>[] => {
|
|
23
|
+
let keys: LanguageKey[] = [];
|
|
24
|
+
|
|
25
|
+
switch (deviceType) {
|
|
26
|
+
case EDeviceType.Classic:
|
|
27
|
+
case EDeviceType.Mini:
|
|
28
|
+
keys = ['en', 'zh_cn'];
|
|
29
|
+
break;
|
|
30
|
+
case EDeviceType.Classic1s:
|
|
31
|
+
case EDeviceType.ClassicPure:
|
|
32
|
+
keys = ['en', 'zh_cn', 'zh_hk', 'ja', 'pt_br', 'de', 'ko'];
|
|
33
|
+
break;
|
|
34
|
+
|
|
35
|
+
case EDeviceType.Touch:
|
|
36
|
+
case EDeviceType.Pro:
|
|
37
|
+
keys = Object.keys(LANGUAGE_LABELS) as LanguageKey[];
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
keys = [];
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return keys.map(key => ({ code: key, label: LANGUAGE_LABELS[key] }));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type DurationParts = {
|
|
48
|
+
seconds: number;
|
|
49
|
+
minute: number;
|
|
50
|
+
hour: number;
|
|
51
|
+
day: number;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const getAutoLockOptions = (_deviceType: IDeviceType): DurationParts[] => {
|
|
55
|
+
switch (_deviceType) {
|
|
56
|
+
case EDeviceType.Mini:
|
|
57
|
+
case EDeviceType.Classic:
|
|
58
|
+
case EDeviceType.Classic1s:
|
|
59
|
+
case EDeviceType.ClassicPure:
|
|
60
|
+
return [
|
|
61
|
+
{ seconds: 0, minute: 1, hour: 0, day: 0 },
|
|
62
|
+
{ seconds: 0, minute: 2, hour: 0, day: 0 },
|
|
63
|
+
{ seconds: 0, minute: 5, hour: 0, day: 0 },
|
|
64
|
+
{ seconds: 0, minute: 10, hour: 0, day: 0 },
|
|
65
|
+
{ seconds: 0, minute: 0, hour: 0, day: 0 },
|
|
66
|
+
];
|
|
67
|
+
case EDeviceType.Touch:
|
|
68
|
+
case EDeviceType.Pro:
|
|
69
|
+
return [
|
|
70
|
+
{ seconds: 30, minute: 0, hour: 0, day: 0 },
|
|
71
|
+
{ seconds: 0, minute: 1, hour: 0, day: 0 },
|
|
72
|
+
{ seconds: 0, minute: 2, hour: 0, day: 0 },
|
|
73
|
+
{ seconds: 0, minute: 5, hour: 0, day: 0 },
|
|
74
|
+
{ seconds: 0, minute: 10, hour: 0, day: 0 },
|
|
75
|
+
{ seconds: 0, minute: 30, hour: 0, day: 0 },
|
|
76
|
+
{ seconds: 0, minute: 0, hour: 0, day: 0 },
|
|
77
|
+
];
|
|
78
|
+
default:
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const getAutoShutDownOptions = (_deviceType: IDeviceType): DurationParts[] => {
|
|
84
|
+
switch (_deviceType) {
|
|
85
|
+
case EDeviceType.Mini:
|
|
86
|
+
return [];
|
|
87
|
+
case EDeviceType.Classic:
|
|
88
|
+
case EDeviceType.Classic1s:
|
|
89
|
+
case EDeviceType.ClassicPure:
|
|
90
|
+
return [
|
|
91
|
+
{ seconds: 0, minute: 1, hour: 0, day: 0 },
|
|
92
|
+
{ seconds: 0, minute: 3, hour: 0, day: 0 },
|
|
93
|
+
{ seconds: 0, minute: 5, hour: 0, day: 0 },
|
|
94
|
+
{ seconds: 0, minute: 10, hour: 0, day: 0 },
|
|
95
|
+
{ seconds: 0, minute: 0, hour: 0, day: 0 },
|
|
96
|
+
];
|
|
97
|
+
case EDeviceType.Touch:
|
|
98
|
+
case EDeviceType.Pro:
|
|
99
|
+
return [
|
|
100
|
+
{ seconds: 0, minute: 1, hour: 0, day: 0 },
|
|
101
|
+
{ seconds: 0, minute: 2, hour: 0, day: 0 },
|
|
102
|
+
{ seconds: 0, minute: 5, hour: 0, day: 0 },
|
|
103
|
+
{ seconds: 0, minute: 10, hour: 0, day: 0 },
|
|
104
|
+
{ seconds: 0, minute: 0, hour: 0, day: 0 },
|
|
105
|
+
];
|
|
106
|
+
default:
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
};
|
package/src/utils/homescreen.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { getDeviceType } from './deviceInfoUtils';
|
|
5
5
|
import { getDeviceFirmwareVersion } from './deviceVersionUtils';
|
|
6
6
|
|
|
7
|
+
import type { Features, IDeviceType } from '../types';
|
|
8
|
+
|
|
7
9
|
type IScreenData = { name: string; hex: string };
|
|
8
10
|
|
|
9
11
|
export const getT1Data = (): Record<string, IScreenData> => ({
|
package/src/utils/index.ts
CHANGED