@onekeyfe/hd-core 0.1.7 → 0.1.8

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":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AASlC,OAAO,EACL,WAAW,EAYZ,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAE7D,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAkBxD,eAAO,MAAM,OAAO,YAAmB,WAAW,iBAuJjD,CAAC;AA+DF,eAAO,MAAM,MAAM,0CAalB,CAAC;AAuEF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IACtC,aAAa,CAAC,OAAO,EAAE,WAAW;IA+BxC,OAAO;CAGR;AAED,eAAO,MAAM,QAAQ,YAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAGzB,CAAC;AAMF,eAAO,MAAM,IAAI,aAAoB,eAAe,aAAa,GAAG,8BAgBnE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AASlC,OAAO,EACL,WAAW,EAYZ,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAE7D,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAkBxD,eAAO,MAAM,OAAO,YAAmB,WAAW,iBA4JjD,CAAC;AA+DF,eAAO,MAAM,MAAM,0CAalB,CAAC;AAuEF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IACtC,aAAa,CAAC,OAAO,EAAE,WAAW;IA+BxC,OAAO;CAGR;AAED,eAAO,MAAM,QAAQ,YAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAGzB,CAAC;AAMF,eAAO,MAAM,IAAI,aAAoB,eAAe,aAAa,GAAG,8BAgBnE,CAAC"}
@@ -60,7 +60,7 @@ export declare class Device extends EventEmitter {
60
60
  isInitialized(): boolean | undefined;
61
61
  isSeedless(): boolean | undefined;
62
62
  isUnacquired(): boolean;
63
- hasUnexpectedMode(allow: string[], require: string[]): "ui-device_bootloader_mode" | "ui-device_not_in_bootloader_mode" | "ui-device_not_initialized" | "ui-device_seedless" | null;
63
+ hasUnexpectedMode(allow: string[], require: string[]): "ui-device_not_in_bootloader_mode" | "ui-device_bootloader_mode" | "ui-device_not_initialized" | "ui-device_seedless" | null;
64
64
  }
65
65
  export default Device;
66
66
  //# sourceMappingURL=Device.d.ts.map
@@ -11,6 +11,7 @@ export declare const UI_REQUEST: {
11
11
  readonly BLUETOOTH_PERMISSION: "ui-bluetooth_permission";
12
12
  readonly LOCATION_PERMISSION: "ui-location_permission";
13
13
  readonly FIRMWARE_PROGRESS: "ui-firmware-progress";
14
+ readonly NOT_IN_BOOTLOADER: "ui-device_not_in_bootloader_mode";
14
15
  };
15
16
  export interface UiRequestWithoutPayload {
16
17
  type: typeof UI_REQUEST.CLOSE_UI_WINDOW | typeof UI_REQUEST.BLUETOOTH_PERMISSION | typeof UI_REQUEST.LOCATION_PERMISSION;
@@ -1 +1 @@
1
- {"version":3,"file":"ui-request.d.ts","sourceRoot":"","sources":["../../src/events/ui-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,QAAQ,aAAa,CAAC;AAEnC,eAAO,MAAM,UAAU;;;;;;;;CAWb,CAAC;AAEX,MAAM,WAAW,uBAAuB;I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,MAAM,QAAQ,aAAa,CAAC;AAEnC,eAAO,MAAM,UAAU;;;;;;;;;CAab,CAAC;AAEX,MAAM,WAAW,uBAAuB;IACtC,IAAI,EACA,OAAO,UAAU,CAAC,eAAe,GACjC,OAAO,UAAU,CAAC,oBAAoB,GACtC,OAAO,UAAU,CAAC,mBAAmB,CAAC;IAC1C,OAAO,CAAC,EAAE,OAAO,SAAS,CAAC;CAC5B;AAED,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,OAAO,UAAU,CAAC,WAAW,CAAC;IACpC,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,KAAK,CAAC,oBAAoB,GAAG,wBAAwB,CAAC;KAC9D,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,UAAU,CAAC,cAAc,CAAC;IACvC,OAAO,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,UAAU,CAAC,iBAAiB,CAAC;IAC1C,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,oBAAY,OAAO,GACf,uBAAuB,GACvB,qBAAqB,GACrB,eAAe,GACf,gBAAgB,CAAC;AAErB,oBAAY,cAAc,GAAG,OAAO,GAAG;IAAE,KAAK,EAAE,OAAO,QAAQ,CAAA;CAAE,CAAC;AAElE,eAAO,MAAM,eAAe,EAAE,gBAAgB,CAAC,OAAO,QAAQ,EAAE,OAAO,CAK5D,CAAC"}
package/dist/index.d.ts CHANGED
@@ -975,6 +975,7 @@ declare const UI_REQUEST: {
975
975
  readonly BLUETOOTH_PERMISSION: "ui-bluetooth_permission";
976
976
  readonly LOCATION_PERMISSION: "ui-location_permission";
977
977
  readonly FIRMWARE_PROGRESS: "ui-firmware-progress";
978
+ readonly NOT_IN_BOOTLOADER: "ui-device_not_in_bootloader_mode";
978
979
  };
979
980
  interface UiRequestWithoutPayload {
980
981
  type: typeof UI_REQUEST.CLOSE_UI_WINDOW | typeof UI_REQUEST.BLUETOOTH_PERMISSION | typeof UI_REQUEST.LOCATION_PERMISSION;
@@ -1202,7 +1203,7 @@ declare class Device extends EventEmitter {
1202
1203
  isInitialized(): boolean | undefined;
1203
1204
  isSeedless(): boolean | undefined;
1204
1205
  isUnacquired(): boolean;
1205
- hasUnexpectedMode(allow: string[], require: string[]): "ui-device_bootloader_mode" | "ui-device_not_in_bootloader_mode" | "ui-device_not_initialized" | "ui-device_seedless" | null;
1206
+ hasUnexpectedMode(allow: string[], require: string[]): "ui-device_not_in_bootloader_mode" | "ui-device_bootloader_mode" | "ui-device_not_initialized" | "ui-device_seedless" | null;
1206
1207
  }
1207
1208
 
1208
1209
  declare type UiPromiseResponse = UiResponseEvent | {
package/dist/index.js CHANGED
@@ -9935,6 +9935,7 @@ const UI_REQUEST$1 = {
9935
9935
  BLUETOOTH_PERMISSION: 'ui-bluetooth_permission',
9936
9936
  LOCATION_PERMISSION: 'ui-location_permission',
9937
9937
  FIRMWARE_PROGRESS: 'ui-firmware-progress',
9938
+ NOT_IN_BOOTLOADER: 'ui-device_not_in_bootloader_mode',
9938
9939
  };
9939
9940
  const createUiMessage = (type, payload) => ({
9940
9941
  event: UI_EVENT,
@@ -13259,6 +13260,9 @@ const callAPI = (message) => __awaiter(void 0, void 0, void 0, function* () {
13259
13260
  }
13260
13261
  const unexpectedMode = device.hasUnexpectedMode(method.allowDeviceMode, method.requireDeviceMode);
13261
13262
  if (unexpectedMode) {
13263
+ if (unexpectedMode === UI_REQUEST$1.NOT_IN_BOOTLOADER) {
13264
+ return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceUnexpectedBootloaderMode));
13265
+ }
13262
13266
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceUnexpectedMode, unexpectedMode));
13263
13267
  }
13264
13268
  if (_deviceList) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
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.1.7",
29
- "@onekeyfe/hd-transport": "^0.1.7",
28
+ "@onekeyfe/hd-shared": "^0.1.8",
29
+ "@onekeyfe/hd-transport": "^0.1.8",
30
30
  "axios": "^0.27.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "parse-uri": "^1.0.7",
@@ -36,5 +36,5 @@
36
36
  "@types/parse-uri": "^1.0.0",
37
37
  "@types/semver": "^7.3.9"
38
38
  },
39
- "gitHead": "1d3889d02e41afd60cd0388b6e01d7f2ac7c5399"
39
+ "gitHead": "d9514ac6207a2561ad107910ab005b3f9e12d794"
40
40
  }
package/src/core/index.ts CHANGED
@@ -140,6 +140,11 @@ export const callAPI = async (message: CoreMessage) => {
140
140
  method.requireDeviceMode
141
141
  );
142
142
  if (unexpectedMode) {
143
+ if (unexpectedMode === UI_REQUEST.NOT_IN_BOOTLOADER) {
144
+ return Promise.reject(
145
+ ERRORS.TypedError(HardwareErrorCode.DeviceUnexpectedBootloaderMode)
146
+ );
147
+ }
143
148
  return Promise.reject(
144
149
  ERRORS.TypedError(HardwareErrorCode.DeviceUnexpectedMode, unexpectedMode)
145
150
  );
@@ -16,6 +16,8 @@ export const UI_REQUEST = {
16
16
  LOCATION_PERMISSION: 'ui-location_permission',
17
17
 
18
18
  FIRMWARE_PROGRESS: 'ui-firmware-progress',
19
+
20
+ NOT_IN_BOOTLOADER: 'ui-device_not_in_bootloader_mode',
19
21
  } as const;
20
22
 
21
23
  export interface UiRequestWithoutPayload {