@onekeyfe/hd-core 0.2.0 → 0.2.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.
@@ -3,6 +3,7 @@ export default class DeviceSupportFeatures extends BaseMethod {
3
3
  init(): void;
4
4
  run(): Promise<{
5
5
  inputPinOnSoftware: import("../..").SupportFeatureType;
6
+ modifyHomescreen: import("../..").SupportFeatureType;
6
7
  device: import("../..").KnownDevice | null;
7
8
  }>;
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceSupportFeatures.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceSupportFeatures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,UAAU;IAC3D,IAAI;IAIJ,GAAG;;;;CAYJ"}
1
+ {"version":3,"file":"DeviceSupportFeatures.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceSupportFeatures.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,UAAU;IAC3D,IAAI;IAIJ,GAAG;;;;;CAcJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceUploadResource.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceUploadResource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,cAAc,CAAC;IAC1E,UAAU;;;MAGR;IAEF,eAAe;;;;;IAQf,IAAI;IA8BJ,sBAAsB,QAEhB,qBAAqB,iBAAiB,CAAC,GACvC,qBAAqB,aAAa,CAAC,GACnC,qBAAqB,SAAS,CAAC,KAClC,QAAQ,OAAO,CAAC,CAkCjB;IAEI,GAAG;CASV"}
1
+ {"version":3,"file":"DeviceUploadResource.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceUploadResource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,cAAc,CAAC;IAC1E,UAAU;;;MAGR;IAEF,eAAe;;;;;IAQf,IAAI;IA8BJ,sBAAsB,QAEhB,qBAAqB,iBAAiB,CAAC,GACvC,qBAAqB,aAAa,CAAC,GACnC,qBAAqB,SAAS,CAAC,KAClC,QAAQ,OAAO,CAAC,CAkCjB;IAEI,GAAG;CAWV"}
package/dist/index.d.ts CHANGED
@@ -120,6 +120,7 @@ declare type SupportFeatureType = {
120
120
  };
121
121
  declare type SupportFeatures = {
122
122
  inputPinOnSoftware: SupportFeatureType;
123
+ modifyHomescreen: SupportFeatureType;
123
124
  };
124
125
 
125
126
  declare type ConnectSettings = {
package/dist/index.js CHANGED
@@ -853,6 +853,16 @@ const supportBatchPublicKey = (features) => {
853
853
  }
854
854
  return semver__default["default"].gte(currentVersion, '2.6.0');
855
855
  };
856
+ const supportModifyHomescreen = (features) => {
857
+ if (!features)
858
+ return { support: false };
859
+ const currentVersion = getDeviceFirmwareVersion(features).join('.');
860
+ const deviceType = getDeviceType(features);
861
+ if (deviceType === 'classic' || deviceType === 'mini') {
862
+ return { support: true };
863
+ }
864
+ return { support: semver__default["default"].gte(currentVersion, '3.4.0') };
865
+ };
856
866
 
857
867
  var nested = {
858
868
  AlgorandGetAddress: {
@@ -12548,6 +12558,7 @@ class DeviceUploadResource extends BaseMethod {
12548
12558
  run() {
12549
12559
  return __awaiter(this, void 0, void 0, function* () {
12550
12560
  const res = yield this.device.commands.typedCall('ResourceUpload', ['ResourceRequest', 'ZoomRequest', 'Success'], this.params);
12561
+ this.postMessage(createUiMessage(UI_REQUEST$1.CLOSE_UI_WINDOW));
12551
12562
  return this.processResourceRequest(res);
12552
12563
  });
12553
12564
  }
@@ -12561,8 +12572,10 @@ class DeviceSupportFeatures extends BaseMethod {
12561
12572
  if (!this.device.features)
12562
12573
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Device not initialized'));
12563
12574
  const inputPinOnSoftware = supportInputPinOnSoftware(this.device.features);
12575
+ const modifyHomescreen = supportModifyHomescreen(this.device.features);
12564
12576
  return Promise.resolve({
12565
12577
  inputPinOnSoftware,
12578
+ modifyHomescreen,
12566
12579
  device: this.device.toMessageObject(),
12567
12580
  });
12568
12581
  }
@@ -84,6 +84,7 @@ export declare type SupportFeatureType = {
84
84
  };
85
85
  export declare type SupportFeatures = {
86
86
  inputPinOnSoftware: SupportFeatureType;
87
+ modifyHomescreen: SupportFeatureType;
87
88
  };
88
89
  export {};
89
90
  //# sourceMappingURL=device.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/types/device.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,oBAAY,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7D,oBAAY,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,GAAG,UAAU,CAAC;AAE7E,oBAAY,qBAAqB,GAC7B,eAAe,GACf,YAAY,GACZ,iBAAiB,GACjB,yBAAyB,CAAC;AAE9B,oBAAY,uBAAuB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAq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M,CAAC;IACjB,eAAe,EAAE,IAAI,CAAC;IACtB,gBAAgB,EAAE,IAAI,CAAC;CACxB,GACD;IACE,aAAa,EAAE,CAAC,CAAC;IACjB,QAAQ,EAAE,IAAI,CAAC;IACf,QAAQ,EAAE,IAAI,CAAC;IACf,QAAQ,EAAE,IAAI,CAAC;IACf,eAAe,EAAE,IAAI,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC;CACzB,GACD;IACE,aAAa,EAAE,CAAC,CAAC;IACjB,QAAQ,EAAE,IAAI,CAAC;IACf,QAAQ,EAAE,IAAI,CAAC;IACf,QAAQ,EAAE,IAAI,CAAC;IACf,eAAe,EAAE,IAAI,CAAC;IACtB,gBAAgB,EAAE,IAAI,CAAC;CACxB,CAAC;AAEN,oBAAY,cAAc,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAE1D,oBAAY,kBAAkB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,oBAAY,eAAe,GAAG;IAC5B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,gBAAgB,EAAE,kBAAkB,CAAC;CACtC,CAAC"}
@@ -13,4 +13,5 @@ export declare const supportInputPinOnSoftware: (features: Features) => SupportF
13
13
  export declare const supportNewPassphrase: (features?: import("packages/hd-transport/dist").Features | undefined) => SupportFeatureType;
14
14
  export declare const getPassphraseState: (features: Features, commands: DeviceCommands) => Promise<string | false>;
15
15
  export declare const supportBatchPublicKey: (features?: import("packages/hd-transport/dist").Features | undefined) => boolean;
16
+ export declare const supportModifyHomescreen: (features?: import("packages/hd-transport/dist").Features | undefined) => SupportFeatureType;
16
17
  //# sourceMappingURL=deviceFeaturesUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0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AAsB,iCAAoB,WAAW,GAAG,IAKpE,CAAC;AAEF,eAAO,MAAM,uBAAuB,qCAAwB,WAQ3D,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,QAAQ,WAM/C,CAAC;AAEF,eAAO,MAAM,cAAc,aAAc,QAAQ,WAOhD,CAAC;AAKF,eAAO,MAAM,wBAAwB,aAAc,QAAQ,GAAG,SAAS,kBAOtE,CAAC;AAKF,eAAO,MAAM,2BAA2B,aAAc,QAAQ,KAAG,aAAa,GAAG,IAQhF,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,QAAQ,KAAG,kBAU9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,4EAA0B,kBAW1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,aAAoB,QAAQ,YAAY,cAAc,4BAUpF,CAAC;AAEF,eAAO,MAAM,qBAAqB,4EAA0B,OAU3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,4EAA0B,kBAU7D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "> TODO: description",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -24,8 +24,8 @@
24
24
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@onekeyfe/hd-shared": "^0.2.0",
28
- "@onekeyfe/hd-transport": "^0.2.0",
27
+ "@onekeyfe/hd-shared": "^0.2.1",
28
+ "@onekeyfe/hd-transport": "^0.2.1",
29
29
  "axios": "^0.27.2",
30
30
  "bignumber.js": "^9.0.2",
31
31
  "jszip": "^3.10.1",
@@ -40,5 +40,5 @@
40
40
  "@types/parse-uri": "^1.0.0",
41
41
  "@types/semver": "^7.3.9"
42
42
  },
43
- "gitHead": "7d63bbcdd05b277e361b8f6ed52c9c59973c40fa"
43
+ "gitHead": "2ed876d7027dd9c59a5d742648c2355cc595fd2f"
44
44
  }
@@ -1,5 +1,8 @@
1
1
  import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
2
- import { supportInputPinOnSoftware } from '../../utils/deviceFeaturesUtils';
2
+ import {
3
+ supportInputPinOnSoftware,
4
+ supportModifyHomescreen,
5
+ } from '../../utils/deviceFeaturesUtils';
3
6
  import { BaseMethod } from '../BaseMethod';
4
7
 
5
8
  export default class DeviceSupportFeatures extends BaseMethod {
@@ -14,8 +17,10 @@ export default class DeviceSupportFeatures extends BaseMethod {
14
17
  );
15
18
 
16
19
  const inputPinOnSoftware = supportInputPinOnSoftware(this.device.features);
20
+ const modifyHomescreen = supportModifyHomescreen(this.device.features);
17
21
  return Promise.resolve({
18
22
  inputPinOnSoftware,
23
+ modifyHomescreen,
19
24
  device: this.device.toMessageObject(),
20
25
  });
21
26
  }
@@ -6,6 +6,7 @@ import { DeviceUploadResourceParams } from '../../types';
6
6
  import { BaseMethod } from '../BaseMethod';
7
7
  import { validateParams } from '../helpers/paramsValidator';
8
8
  import { hexToBytes } from '../helpers/hexUtils';
9
+ import { createUiMessage, UI_REQUEST } from '../../events';
9
10
 
10
11
  export default class DeviceUploadResource extends BaseMethod<ResourceUpload> {
11
12
  paramsData = {
@@ -99,6 +100,8 @@ export default class DeviceUploadResource extends BaseMethod<ResourceUpload> {
99
100
  this.params
100
101
  );
101
102
 
103
+ this.postMessage(createUiMessage(UI_REQUEST.CLOSE_UI_WINDOW));
104
+
102
105
  return this.processResourceRequest(res);
103
106
  }
104
107
  }
@@ -135,4 +135,5 @@ export type SupportFeatureType = { support: boolean; require?: string };
135
135
 
136
136
  export type SupportFeatures = {
137
137
  inputPinOnSoftware: SupportFeatureType;
138
+ modifyHomescreen: SupportFeatureType;
138
139
  };
@@ -143,3 +143,15 @@ export const supportBatchPublicKey = (features?: Features): boolean => {
143
143
 
144
144
  return semver.gte(currentVersion, '2.6.0');
145
145
  };
146
+
147
+ export const supportModifyHomescreen = (features?: Features): SupportFeatureType => {
148
+ if (!features) return { support: false };
149
+ const currentVersion = getDeviceFirmwareVersion(features).join('.');
150
+
151
+ const deviceType = getDeviceType(features);
152
+ if (deviceType === 'classic' || deviceType === 'mini') {
153
+ return { support: true };
154
+ }
155
+
156
+ return { support: semver.gte(currentVersion, '3.4.0') };
157
+ };