@onekeyfe/hd-core 1.1.16-alpha.2 → 1.1.16-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/DeviceUploadResource.d.ts +0 -1
- package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +5 -16
- package/dist/types/api/deviceUploadResource.d.ts +1 -3
- package/dist/types/api/deviceUploadResource.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/device/DeviceUploadResource.ts +6 -19
- package/src/types/api/deviceUploadResource.ts +1 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceUploadResource.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceUploadResource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAGL,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,cAAc,CAAC;IAC1E,UAAU;;;;MAIR;IAEF,OAAO,CAAC,cAAc,CAIpB;IAEF,
|
|
1
|
+
{"version":3,"file":"DeviceUploadResource.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceUploadResource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAGL,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,cAAc,CAAC;IAC1E,UAAU;;;;MAIR;IAEF,OAAO,CAAC,cAAc,CAIpB;IAEF,eAAe;;;;;IAQf,qBAAqB;IAgBrB,IAAI;IA+CJ,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,cAAc;IAoBtB,sBAAsB,QAEhB,qBAAqB,iBAAiB,CAAC,GACvC,qBAAqB,aAAa,CAAC,GACnC,qBAAqB,aAAa,CAAC,GACnC,qBAAqB,SAAS,CAAC,KAClC,QAAQ,4BAA4B,CAAC,CAuDtC;IAEI,GAAG;CAaV"}
|
package/dist/index.d.ts
CHANGED
|
@@ -444,9 +444,7 @@ type DeviceUploadResourceParams = {
|
|
|
444
444
|
fileNameNoExt?: string;
|
|
445
445
|
};
|
|
446
446
|
type DeviceUploadResourceResponse = Success$1 & {
|
|
447
|
-
|
|
448
|
-
zoomUpload?: boolean;
|
|
449
|
-
blurUpload?: boolean;
|
|
447
|
+
applyScreen?: boolean;
|
|
450
448
|
};
|
|
451
449
|
declare function deviceUploadResource(connectId: string, params: CommonParams & DeviceUploadResourceParams): Response<DeviceUploadResourceResponse>;
|
|
452
450
|
|
package/dist/index.js
CHANGED
|
@@ -28340,24 +28340,16 @@ class DeviceUploadResource extends BaseMethod {
|
|
|
28340
28340
|
uploadedBytes: 0,
|
|
28341
28341
|
currentFile: 'main',
|
|
28342
28342
|
};
|
|
28343
|
-
this.requestedResources = {
|
|
28344
|
-
resourceUpload: false,
|
|
28345
|
-
zoomUpload: false,
|
|
28346
|
-
blurUpload: false,
|
|
28347
|
-
};
|
|
28348
28343
|
this.processResourceRequest = (res) => __awaiter(this, void 0, void 0, function* () {
|
|
28349
28344
|
if (res.type === 'Success') {
|
|
28350
28345
|
const response = {
|
|
28351
28346
|
message: res.message.message,
|
|
28352
28347
|
};
|
|
28353
|
-
|
|
28354
|
-
|
|
28355
|
-
|
|
28356
|
-
if (
|
|
28357
|
-
response.
|
|
28358
|
-
}
|
|
28359
|
-
if (this.requestedResources.blurUpload) {
|
|
28360
|
-
response.blurUpload = true;
|
|
28348
|
+
response.applyScreen = true;
|
|
28349
|
+
const firmwareVersion = getDeviceFirmwareVersion(this.device.features).join('.');
|
|
28350
|
+
const deviceType = getDeviceType(this.device.features);
|
|
28351
|
+
if (deviceType === hdShared.EDeviceType.Pro && semver__default["default"].gte(firmwareVersion, '4.17.0')) {
|
|
28352
|
+
response.applyScreen = false;
|
|
28361
28353
|
}
|
|
28362
28354
|
return response;
|
|
28363
28355
|
}
|
|
@@ -28370,15 +28362,12 @@ class DeviceUploadResource extends BaseMethod {
|
|
|
28370
28362
|
switch (res.type) {
|
|
28371
28363
|
case 'ResourceRequest':
|
|
28372
28364
|
sourceData = data;
|
|
28373
|
-
this.requestedResources.resourceUpload = true;
|
|
28374
28365
|
break;
|
|
28375
28366
|
case 'BlurRequest':
|
|
28376
28367
|
sourceData = blurData;
|
|
28377
|
-
this.requestedResources.blurUpload = true;
|
|
28378
28368
|
break;
|
|
28379
28369
|
case 'ZoomRequest':
|
|
28380
28370
|
sourceData = thumbnailData;
|
|
28381
|
-
this.requestedResources.zoomUpload = true;
|
|
28382
28371
|
break;
|
|
28383
28372
|
default:
|
|
28384
28373
|
throw new Error('Invalid request type');
|
|
@@ -10,9 +10,7 @@ export type DeviceUploadResourceParams = {
|
|
|
10
10
|
fileNameNoExt?: string;
|
|
11
11
|
};
|
|
12
12
|
export type DeviceUploadResourceResponse = Success & {
|
|
13
|
-
|
|
14
|
-
zoomUpload?: boolean;
|
|
15
|
-
blurUpload?: boolean;
|
|
13
|
+
applyScreen?: boolean;
|
|
16
14
|
};
|
|
17
15
|
export declare function deviceUploadResource(connectId: string, params: CommonParams & DeviceUploadResourceParams): Response<DeviceUploadResourceResponse>;
|
|
18
16
|
//# sourceMappingURL=deviceUploadResource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceUploadResource.d.ts","sourceRoot":"","sources":["../../../src/types/api/deviceUploadResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,OAAO,GAAG;IACnD,
|
|
1
|
+
{"version":3,"file":"deviceUploadResource.d.ts","sourceRoot":"","sources":["../../../src/types/api/deviceUploadResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,OAAO,GAAG;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,0BAA0B,GAChD,QAAQ,CAAC,4BAA4B,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.1.16-alpha.
|
|
3
|
+
"version": "1.1.16-alpha.4",
|
|
4
4
|
"description": "Core processes and APIs for communicating with OneKey hardware devices.",
|
|
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": "1.1.16-alpha.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.1.16-alpha.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.1.16-alpha.4",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.1.16-alpha.4",
|
|
30
30
|
"axios": "1.12.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"bytebuffer": "^5.0.1",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/web-bluetooth": "^0.0.21",
|
|
47
47
|
"ripple-keypairs": "^1.3.1"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "afb34e7032a88bcaad3be96473d5aa4be81ba2ad"
|
|
50
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
|
-
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
|
+
import { EDeviceType, ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
3
3
|
import { bytesToHex } from '@noble/hashes/utils';
|
|
4
4
|
import { ResourceUpload } from '@onekeyfe/hd-transport';
|
|
5
5
|
import { blake2s } from '@noble/hashes/blake2s';
|
|
@@ -29,12 +29,6 @@ export default class DeviceUploadResource extends BaseMethod<ResourceUpload> {
|
|
|
29
29
|
currentFile: 'main' as 'main' | 'thumbnail' | 'blur',
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
private requestedResources = {
|
|
33
|
-
resourceUpload: false,
|
|
34
|
-
zoomUpload: false,
|
|
35
|
-
blurUpload: false,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
32
|
getVersionRange() {
|
|
39
33
|
return {
|
|
40
34
|
model_touch: {
|
|
@@ -143,16 +137,12 @@ export default class DeviceUploadResource extends BaseMethod<ResourceUpload> {
|
|
|
143
137
|
const response: DeviceUploadResourceResponse = {
|
|
144
138
|
message: res.message.message,
|
|
145
139
|
};
|
|
140
|
+
response.applyScreen = true;
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (this.requestedResources.zoomUpload) {
|
|
152
|
-
response.zoomUpload = true;
|
|
153
|
-
}
|
|
154
|
-
if (this.requestedResources.blurUpload) {
|
|
155
|
-
response.blurUpload = true;
|
|
142
|
+
const firmwareVersion = getDeviceFirmwareVersion(this.device.features).join('.');
|
|
143
|
+
const deviceType = getDeviceType(this.device.features);
|
|
144
|
+
if (deviceType === EDeviceType.Pro && semver.gte(firmwareVersion, '4.17.0')) {
|
|
145
|
+
response.applyScreen = false;
|
|
156
146
|
}
|
|
157
147
|
|
|
158
148
|
return response;
|
|
@@ -170,15 +160,12 @@ export default class DeviceUploadResource extends BaseMethod<ResourceUpload> {
|
|
|
170
160
|
switch (res.type) {
|
|
171
161
|
case 'ResourceRequest':
|
|
172
162
|
sourceData = data;
|
|
173
|
-
this.requestedResources.resourceUpload = true;
|
|
174
163
|
break;
|
|
175
164
|
case 'BlurRequest':
|
|
176
165
|
sourceData = blurData;
|
|
177
|
-
this.requestedResources.blurUpload = true;
|
|
178
166
|
break;
|
|
179
167
|
case 'ZoomRequest':
|
|
180
168
|
sourceData = thumbnailData;
|
|
181
|
-
this.requestedResources.zoomUpload = true;
|
|
182
169
|
break;
|
|
183
170
|
default:
|
|
184
171
|
throw new Error('Invalid request type');
|
|
@@ -12,9 +12,7 @@ export type DeviceUploadResourceParams = {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export type DeviceUploadResourceResponse = Success & {
|
|
15
|
-
|
|
16
|
-
zoomUpload?: boolean;
|
|
17
|
-
blurUpload?: boolean;
|
|
15
|
+
applyScreen?: boolean;
|
|
18
16
|
};
|
|
19
17
|
|
|
20
18
|
export declare function deviceUploadResource(
|