@onekeyfe/hd-core 0.3.40-alpha.4 → 0.3.40-alpha.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"getBinary.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/getBinary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,cAAe,SAAQ,YAAY;IAC3C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,2DAKnB,cAAc;;;;;;;;;;;;;;;;;;;;EAkChB,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAe,MAAM;;EAWrD,CAAC;AAEF,eAAO,MAAM,OAAO,4CAA6C,YAAY,2DAY5E,CAAC"}
1
+ {"version":3,"file":"getBinary.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/getBinary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,cAAe,SAAQ,YAAY;IAC3C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,2DAKnB,cAAc;;;;;;;;;;;;;;;;;;;;EAiChB,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAe,MAAM;;EAWrD,CAAC;AAEF,eAAO,MAAM,OAAO,4CAA6C,YAAY,2DAY5E,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2499,7 +2499,7 @@ declare enum LoggerNames {
2499
2499
  }
2500
2500
  declare const getLogger: (key: LoggerNames) => Log;
2501
2501
 
2502
- declare const getHomeScreenHex: (deviceType: IDeviceType, name: string) => any;
2502
+ declare const getHomeScreenHex: (deviceType: IDeviceType, name: string) => string;
2503
2503
 
2504
2504
  declare const wait: (ms: number) => Promise<unknown>;
2505
2505
  declare const isBleConnect: (env: string) => boolean;
package/dist/index.js CHANGED
@@ -6615,7 +6615,6 @@ var nested$1 = {
6615
6615
  CLASSIC1S: 1,
6616
6616
  MINI: 2,
6617
6617
  TOUCH: 3,
6618
- TOUCH_PRO: 4,
6619
6618
  PRO: 5
6620
6619
  }
6621
6620
  },
@@ -23242,7 +23241,22 @@ const getTouchData = () => ({
23242
23241
  });
23243
23242
  const getHomeScreenHex = (deviceType, name) => {
23244
23243
  var _a, _b;
23245
- const data = deviceType === 'touch' ? getTouchData() : getT1Data();
23244
+ let data;
23245
+ switch (deviceType) {
23246
+ case 'classic':
23247
+ case 'classic1s':
23248
+ case 'mini':
23249
+ data = getT1Data();
23250
+ break;
23251
+ case 'touch':
23252
+ data = getTouchData();
23253
+ break;
23254
+ case 'pro':
23255
+ data = {};
23256
+ break;
23257
+ default:
23258
+ data = {};
23259
+ }
23246
23260
  return (_b = (_a = data[name]) === null || _a === void 0 ? void 0 : _a.hex) !== null && _b !== void 0 ? _b : '';
23247
23261
  };
23248
23262
 
@@ -23544,10 +23558,8 @@ const getDeviceType = (features) => {
23544
23558
  return 'mini';
23545
23559
  case 'TOUCH':
23546
23560
  return 'touch';
23547
- case 'TOUCH_PRO':
23548
- return 'touch';
23549
23561
  case 'PRO':
23550
- return 'touch';
23562
+ return 'pro';
23551
23563
  }
23552
23564
  if (!features.serial_no)
23553
23565
  return 'classic';
@@ -23568,7 +23580,7 @@ const getDeviceTypeByBleName = (name) => {
23568
23580
  if (name.startsWith('T'))
23569
23581
  return 'touch';
23570
23582
  if (name.startsWith('P'))
23571
- return 'touch';
23583
+ return 'pro';
23572
23584
  return 'classic';
23573
23585
  };
23574
23586
  const getDeviceTypeByDeviceId = (deviceId) => {
@@ -25717,6 +25729,12 @@ const getBinary = ({ features, updateType, version, isUpdateBootloader, }) => __
25717
25729
  if (!releaseInfo) {
25718
25730
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'no firmware found for this device');
25719
25731
  }
25732
+ if (version && !semver__default["default"].eq(releaseInfo.version.join('.'), version.join('.'))) {
25733
+ const touchWithoutVersion = getDeviceType(features) === 'touch' && !features.onekey_version;
25734
+ if (!touchWithoutVersion) {
25735
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'firmware version mismatch');
25736
+ }
25737
+ }
25720
25738
  const url = updateType === 'ble'
25721
25739
  ?
25722
25740
  releaseInfo.webUpdate
@@ -26762,9 +26780,9 @@ const getCoinAndScriptType = (path, coin, multisig) => {
26762
26780
  };
26763
26781
  };
26764
26782
 
26765
- function doesCoinExistByParams(coinName, params) {
26766
- for (let i = 0; i < params.length; i++) {
26767
- const coin_name = params[i];
26783
+ function isCoinNameInList(coinName, coinNames) {
26784
+ for (let i = 0; i < coinNames.length; i++) {
26785
+ const coin_name = coinNames[i];
26768
26786
  if ((coin_name === null || coin_name === void 0 ? void 0 : coin_name.toLowerCase()) === (coinName === null || coinName === void 0 ? void 0 : coinName.toLowerCase())) {
26769
26787
  return true;
26770
26788
  }
@@ -26772,7 +26790,7 @@ function doesCoinExistByParams(coinName, params) {
26772
26790
  return false;
26773
26791
  }
26774
26792
  function getBitcoinForkVersionRange(params) {
26775
- if (doesCoinExistByParams('Neurai', params)) {
26793
+ if (isCoinNameInList('Neurai', params)) {
26776
26794
  return {
26777
26795
  model_mini: {
26778
26796
  min: '3.7.0',
@@ -1 +1 @@
1
- {"version":3,"file":"deviceFeaturesUtils.d.ts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Q,kBAe5D,CAAC;AAEF,eAAO,MAAM,wBAAwB,aACzB,QAAQ,GAAG,SAAS,KAC7B;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,cAAc,EAAE,cAAc,CAAA;CAiClD,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,QAAQ,KAAG,kBAU9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,cAAe,QAAQ,KAAG,kBAW1D,CAAC;AAEF,eAAO,MAAM,uCAAuC,WAAkB,MAAM,4BAY3E,CAAC;AAEF,eAAO,MAAM,kBAAkB,aACnB,QAAQ,GAAG,SAAS,YACpB,cAAc,4BAgBzB,CAAC;AAEF,eAAO,MAAM,qBAAqB,cAAe,QAAQ,KAAG,OAU3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,cAAe,QAAQ,KAAG,kBAU7D,CAAC;AAKF,eAAO,MAAM,sBAAsB;cAKvB,QAAQ;gBACN,UAAU,GAAG,KAAK;;MAE5B,KAAK,GAAG,aAsBX,CAAC"}
@@ -1,235 +1,10 @@
1
1
  import type { IDeviceType } from '../types';
2
- export declare const getT1Data: () => {
3
- default: {
4
- name: string;
5
- hex: string;
6
- };
7
- original: {
8
- name: string;
9
- hex: string;
10
- };
11
- circleweb: {
12
- name: string;
13
- hex: string;
14
- };
15
- circuit: {
16
- name: string;
17
- hex: string;
18
- };
19
- starweb: {
20
- name: string;
21
- hex: string;
22
- };
23
- stars: {
24
- name: string;
25
- hex: string;
26
- };
27
- bitcoin_b2: {
28
- name: string;
29
- hex: string;
30
- };
31
- bitcoin_shade: {
32
- name: string;
33
- hex: string;
34
- };
35
- bitcoin_b: {
36
- name: string;
37
- hex: string;
38
- };
39
- bitcoin_full: {
40
- name: string;
41
- hex: string;
42
- };
43
- bitcat: {
44
- name: string;
45
- hex: string;
46
- };
47
- nyancat: {
48
- name: string;
49
- hex: string;
50
- };
51
- coffee: {
52
- name: string;
53
- hex: string;
54
- };
55
- flower: {
56
- name: string;
57
- hex: string;
58
- };
59
- saturn: {
60
- name: string;
61
- hex: string;
62
- };
63
- jupiter: {
64
- name: string;
65
- hex: string;
66
- };
67
- einstein: {
68
- name: string;
69
- hex: string;
70
- };
71
- piggy: {
72
- name: string;
73
- hex: string;
74
- };
75
- honeybadger: {
76
- name: string;
77
- hex: string;
78
- };
79
- dragon: {
80
- name: string;
81
- hex: string;
82
- };
83
- narwal: {
84
- name: string;
85
- hex: string;
86
- };
87
- rabbit: {
88
- name: string;
89
- hex: string;
90
- };
91
- bunny: {
92
- name: string;
93
- hex: string;
94
- };
95
- rooster: {
96
- name: string;
97
- hex: string;
98
- };
99
- genesis: {
100
- name: string;
101
- hex: string;
102
- };
103
- my_bank: {
104
- name: string;
105
- hex: string;
106
- };
107
- candle: {
108
- name: string;
109
- hex: string;
110
- };
111
- ancap: {
112
- name: string;
113
- hex: string;
114
- };
115
- anonymous: {
116
- name: string;
117
- hex: string;
118
- };
119
- mushroom: {
120
- name: string;
121
- hex: string;
122
- };
123
- invader: {
124
- name: string;
125
- hex: string;
126
- };
127
- mtgox: {
128
- name: string;
129
- hex: string;
130
- };
131
- electrum: {
132
- name: string;
133
- hex: string;
134
- };
135
- mycelium: {
136
- name: string;
137
- hex: string;
138
- };
139
- ethereum: {
140
- name: string;
141
- hex: string;
142
- };
143
- litecoin: {
144
- name: string;
145
- hex: string;
146
- };
147
- myetherwallet: {
148
- name: string;
149
- hex: string;
150
- };
151
- zcash: {
152
- name: string;
153
- hex: string;
154
- };
155
- dash: {
156
- name: string;
157
- hex: string;
158
- };
159
- bitcoin_cash: {
160
- name: string;
161
- hex: string;
162
- };
163
- bitcoin_gold: {
164
- name: string;
165
- hex: string;
166
- };
167
- vertcoin: {
168
- name: string;
169
- hex: string;
170
- };
171
- namecoin: {
172
- name: string;
173
- hex: string;
174
- };
175
- monacoin: {
176
- name: string;
177
- hex: string;
178
- };
179
- doge: {
180
- name: string;
181
- hex: string;
182
- };
183
- digibyte: {
184
- name: string;
185
- hex: string;
186
- };
187
- decred: {
188
- name: string;
189
- hex: string;
190
- };
191
- multibit: {
192
- name: string;
193
- hex: string;
194
- };
195
- reddit: {
196
- name: string;
197
- hex: string;
198
- };
199
- hacker: {
200
- name: string;
201
- hex: string;
202
- };
203
- polis: {
204
- name: string;
205
- hex: string;
206
- };
207
- carlos: {
208
- name: string;
209
- hex: string;
210
- };
211
- xrc: {
212
- name: string;
213
- hex: string;
214
- };
2
+ type IScreenData = {
3
+ name: string;
4
+ hex: string;
215
5
  };
216
- export declare const getTouchData: () => {
217
- 'wallpaper-1': {
218
- name: string;
219
- hex: string;
220
- };
221
- 'wallpaper-2': {
222
- name: string;
223
- hex: string;
224
- };
225
- 'wallpaper-3': {
226
- name: string;
227
- hex: string;
228
- };
229
- 'wallpaper-4': {
230
- name: string;
231
- hex: string;
232
- };
233
- };
234
- export declare const getHomeScreenHex: (deviceType: IDeviceType, name: string) => any;
6
+ export declare const getT1Data: () => Record<string, IScreenData>;
7
+ export declare const getTouchData: () => Record<string, IScreenData>;
8
+ export declare const getHomeScreenHex: (deviceType: IDeviceType, name: string) => string;
9
+ export {};
235
10
  //# sourceMappingURL=homescreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"homescreen.d.ts","sourceRoot":"","sources":["../../src/utils/homescreen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqNpB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;CAiBvB,CAAC;AAEH,eAAO,MAAM,gBAAgB,eAAgB,WAAW,QAAQ,MAAM,QAIrE,CAAC"}
1
+ {"version":3,"file":"homescreen.d.ts","sourceRoot":"","sources":["../../src/utils/homescreen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjD,eAAO,MAAM,SAAS,QAAO,OAAO,MAAM,EAAE,WAAW,CAqNrD,CAAC;AAEH,eAAO,MAAM,YAAY,QAAO,OAAO,MAAM,EAAE,WAAW,CAiBxD,CAAC;AAEH,eAAO,MAAM,gBAAgB,eAAgB,WAAW,QAAQ,MAAM,WAmBrE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.3.40-alpha.4",
3
+ "version": "0.3.40-alpha.5",
4
4
  "description": "> TODO: description",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-shared": "^0.3.40-alpha.4",
29
- "@onekeyfe/hd-transport": "^0.3.40-alpha.4",
28
+ "@onekeyfe/hd-shared": "^0.3.40-alpha.5",
29
+ "@onekeyfe/hd-transport": "^0.3.40-alpha.5",
30
30
  "axios": "^0.27.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "bytebuffer": "^5.0.1",
@@ -44,5 +44,5 @@
44
44
  "@types/semver": "^7.3.9",
45
45
  "ripple-keypairs": "^1.1.4"
46
46
  },
47
- "gitHead": "ca121236c3c500bf59b8ee1908268410e40bc135"
47
+ "gitHead": "1d25663783754326d2fc99e9a05864cfbc4c3f07"
48
48
  }
@@ -1,6 +1,6 @@
1
- function doesCoinExistByParams(coinName: string, params: (string | undefined)[]) {
2
- for (let i = 0; i < params.length; i++) {
3
- const coin_name = params[i];
1
+ function isCoinNameInList(coinName: string, coinNames: (string | undefined)[]) {
2
+ for (let i = 0; i < coinNames.length; i++) {
3
+ const coin_name = coinNames[i];
4
4
  if (coin_name?.toLowerCase() === coinName?.toLowerCase()) {
5
5
  return true;
6
6
  }
@@ -9,7 +9,7 @@ function doesCoinExistByParams(coinName: string, params: (string | undefined)[])
9
9
  }
10
10
 
11
11
  export function getBitcoinForkVersionRange(params: (string | undefined)[]) {
12
- if (doesCoinExistByParams('Neurai', params)) {
12
+ if (isCoinNameInList('Neurai', params)) {
13
13
  return {
14
14
  model_mini: {
15
15
  min: '3.7.0',
@@ -30,13 +30,12 @@ export const getBinary = async ({
30
30
  throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'no firmware found for this device');
31
31
  }
32
32
 
33
- // temporary disable version check
34
- // if (version && !semver.eq(releaseInfo.version.join('.'), version.join('.'))) {
35
- // const touchWithoutVersion = getDeviceType(features) === 'touch' && !features.onekey_version;
36
- // if (!touchWithoutVersion) {
37
- // throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'firmware version mismatch');
38
- // }
39
- // }
33
+ if (version && !semver.eq(releaseInfo.version.join('.'), version.join('.'))) {
34
+ const touchWithoutVersion = getDeviceType(features) === 'touch' && !features.onekey_version;
35
+ if (!touchWithoutVersion) {
36
+ throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'firmware version mismatch');
37
+ }
38
+ }
40
39
 
41
40
  const url =
42
41
  // eslint-disable-next-line no-nested-ternary
@@ -5766,7 +5766,6 @@
5766
5766
  "CLASSIC1S": 1,
5767
5767
  "MINI": 2,
5768
5768
  "TOUCH": 3,
5769
- "TOUCH_PRO": 4,
5770
5769
  "PRO": 5
5771
5770
  }
5772
5771
  },
@@ -45,10 +45,8 @@ export const getDeviceType = (features?: Features): IDeviceType => {
45
45
  return 'mini';
46
46
  case 'TOUCH':
47
47
  return 'touch';
48
- case 'TOUCH_PRO':
49
- return 'touch';
50
48
  case 'PRO':
51
- return 'touch';
49
+ return 'pro';
52
50
  default:
53
51
  // other
54
52
  }
@@ -69,7 +67,7 @@ export const getDeviceTypeByBleName = (name?: string): IDeviceType | null => {
69
67
  if (!name) return 'classic';
70
68
  if (name.startsWith('MI')) return 'mini';
71
69
  if (name.startsWith('T')) return 'touch';
72
- if (name.startsWith('P')) return 'touch';
70
+ if (name.startsWith('P')) return 'pro';
73
71
  return 'classic';
74
72
  };
75
73
 
@@ -1,6 +1,8 @@
1
1
  import type { IDeviceType } from '../types';
2
2
 
3
- export const getT1Data = () => ({
3
+ type IScreenData = { name: string; hex: string };
4
+
5
+ export const getT1Data = (): Record<string, IScreenData> => ({
4
6
  default: {
5
7
  name: 'default',
6
8
  hex: '',
@@ -215,7 +217,7 @@ export const getT1Data = () => ({
215
217
  },
216
218
  });
217
219
 
218
- export const getTouchData = () => ({
220
+ export const getTouchData = (): Record<string, IScreenData> => ({
219
221
  'wallpaper-1': {
220
222
  name: 'wallpaper-1',
221
223
  hex: '77616c6c70617065722d312e706e67',
@@ -235,7 +237,22 @@ export const getTouchData = () => ({
235
237
  });
236
238
 
237
239
  export const getHomeScreenHex = (deviceType: IDeviceType, name: string) => {
238
- const data = deviceType === 'touch' ? getTouchData() : getT1Data();
239
- // @ts-expect-errorpect
240
+ let data: Record<string, IScreenData>;
241
+ switch (deviceType) {
242
+ case 'classic':
243
+ case 'classic1s':
244
+ case 'mini':
245
+ data = getT1Data();
246
+ break;
247
+ case 'touch':
248
+ data = getTouchData();
249
+ break;
250
+ case 'pro':
251
+ data = {};
252
+ break;
253
+ default:
254
+ data = {};
255
+ }
256
+
240
257
  return data[name]?.hex ?? '';
241
258
  };