@onekeyfe/hd-core 1.1.22-alpha.4 → 1.1.22-alpha.6

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":"DeviceSettings.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceSettings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CAAC,aAAa,CAAC;IACnE,IAAI;IAwCJ,eAAe;;;;;;;IAWT,GAAG;CAeV"}
1
+ {"version":3,"file":"DeviceSettings.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceSettings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CAAC,aAAa,CAAC;IACnE,IAAI;IAwCJ,eAAe;;;;;;;IAWT,GAAG;CAmCV"}
@@ -31,7 +31,7 @@ export declare const cancelDeviceInPrompt: (device: Device, expectResponse?: boo
31
31
  };
32
32
  } | {
33
33
  success: boolean;
34
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 900 | 901 | 902;
34
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 900 | 901 | 902;
35
35
  payload: {
36
36
  message: string;
37
37
  };
@@ -50,7 +50,7 @@ export declare const cancelDeviceWithInitialize: (device: Device) => Promise<{
50
50
  };
51
51
  } | {
52
52
  success: boolean;
53
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 900 | 901 | 902;
53
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 900 | 901 | 902;
54
54
  payload: {
55
55
  message: string;
56
56
  };
@@ -80,7 +80,7 @@ export declare class DeviceCommands {
80
80
  };
81
81
  } | {
82
82
  success: boolean;
83
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 900 | 901 | 902;
83
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 900 | 901 | 902;
84
84
  payload: {
85
85
  message: string;
86
86
  };
@@ -99,7 +99,7 @@ export declare class DeviceCommands {
99
99
  };
100
100
  } | {
101
101
  success: boolean;
102
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 900 | 901 | 902;
102
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 900 | 901 | 902;
103
103
  payload: {
104
104
  message: string;
105
105
  };
package/dist/index.d.ts CHANGED
@@ -2958,7 +2958,7 @@ declare class DeviceCommands {
2958
2958
  };
2959
2959
  } | {
2960
2960
  success: boolean;
2961
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 900 | 901 | 902;
2961
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 900 | 901 | 902;
2962
2962
  payload: {
2963
2963
  message: string;
2964
2964
  };
@@ -2977,7 +2977,7 @@ declare class DeviceCommands {
2977
2977
  };
2978
2978
  } | {
2979
2979
  success: boolean;
2980
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 900 | 901 | 902;
2980
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 900 | 901 | 902;
2981
2981
  payload: {
2982
2982
  message: string;
2983
2983
  };
package/dist/index.js CHANGED
@@ -7966,17 +7966,21 @@ var nested$1 = {
7966
7966
  type: "uint32",
7967
7967
  id: 520
7968
7968
  },
7969
+ product: {
7970
+ type: "string",
7971
+ id: 521
7972
+ },
7969
7973
  brightness_prcent: {
7970
7974
  type: "uint32",
7971
- id: 521
7975
+ id: 522
7972
7976
  },
7973
7977
  haptic_feedback: {
7974
7978
  type: "bool",
7975
- id: 522
7979
+ id: 523
7976
7980
  },
7977
7981
  auto_shutdown_delay_ms: {
7978
7982
  type: "uint32",
7979
- id: 523
7983
+ id: 524
7980
7984
  },
7981
7985
  onekey_device_type: {
7982
7986
  type: "OneKeyDeviceType",
@@ -28791,7 +28795,7 @@ class DeviceSettings extends BaseMethod {
28791
28795
  return {};
28792
28796
  }
28793
28797
  run() {
28794
- var _a;
28798
+ var _a, _b, _c, _d, _e;
28795
28799
  return __awaiter(this, void 0, void 0, function* () {
28796
28800
  try {
28797
28801
  const res = yield this.device.commands.typedCall('ApplySettings', 'Success', Object.assign({}, this.params));
@@ -28801,6 +28805,19 @@ class DeviceSettings extends BaseMethod {
28801
28805
  if ((_a = error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('no setting provided')) {
28802
28806
  return Promise.reject(hdShared.TypedError(hdShared.HardwareErrorCode.DeviceSettingsNotProvided, error.message));
28803
28807
  }
28808
+ if ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('all support ISO_639-1 language keys include')) {
28809
+ const supportedLanguages = (_e = (_d = (_c = error.message) === null || _c === void 0 ? void 0 : _c.replace('all support ISO_639-1 language keys include', '')) === null || _d === void 0 ? void 0 : _d.trim()) === null || _e === void 0 ? void 0 : _e.split(' ');
28810
+ const errorMessage = supportedLanguages.reduce((acc, language) => {
28811
+ const label = LANGUAGE_LABELS === null || LANGUAGE_LABELS === void 0 ? void 0 : LANGUAGE_LABELS[language];
28812
+ if (label) {
28813
+ acc.push(label);
28814
+ }
28815
+ return acc;
28816
+ }, []);
28817
+ return Promise.reject(hdShared.TypedError(hdShared.HardwareErrorCode.DeviceSettingsLanguageNotSupport, error.message, {
28818
+ languages: errorMessage.join(', '),
28819
+ }));
28820
+ }
28804
28821
  throw error;
28805
28822
  }
28806
28823
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.1.22-alpha.4",
3
+ "version": "1.1.22-alpha.6",
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.22-alpha.4",
29
- "@onekeyfe/hd-transport": "1.1.22-alpha.4",
28
+ "@onekeyfe/hd-shared": "1.1.22-alpha.6",
29
+ "@onekeyfe/hd-transport": "1.1.22-alpha.6",
30
30
  "axios": "1.12.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "bytebuffer": "^5.0.1",
@@ -44,5 +44,5 @@
44
44
  "@types/w3c-web-usb": "^1.0.10",
45
45
  "@types/web-bluetooth": "^0.0.21"
46
46
  },
47
- "gitHead": "a5d51754eacce486600523f2662526a97b8102c2"
47
+ "gitHead": "c49887aa4e741a01b60239fe247441f811e8e3b9"
48
48
  }
@@ -2,6 +2,7 @@ import { HardwareErrorCode, TypedError } from '@onekeyfe/hd-shared';
2
2
 
3
3
  import { BaseMethod } from '../BaseMethod';
4
4
  import { validateParams } from '../helpers/paramsValidator';
5
+ import { LANGUAGE_LABELS } from '../../utils/deviceSettings';
5
6
 
6
7
  import type { ApplySettings } from '@onekeyfe/hd-transport';
7
8
 
@@ -69,6 +70,26 @@ export default class DeviceSettings extends BaseMethod<ApplySettings> {
69
70
  TypedError(HardwareErrorCode.DeviceSettingsNotProvided, error.message)
70
71
  );
71
72
  }
73
+ if (error.message?.includes('all support ISO_639-1 language keys include')) {
74
+ const supportedLanguages: string[] = error.message
75
+ ?.replace('all support ISO_639-1 language keys include', '')
76
+ ?.trim()
77
+ ?.split(' ');
78
+
79
+ const errorMessage = supportedLanguages.reduce((acc, language) => {
80
+ const label = LANGUAGE_LABELS?.[language as keyof typeof LANGUAGE_LABELS];
81
+ if (label) {
82
+ acc.push(label);
83
+ }
84
+ return acc;
85
+ }, [] as string[]);
86
+
87
+ return Promise.reject(
88
+ TypedError(HardwareErrorCode.DeviceSettingsLanguageNotSupport, error.message, {
89
+ languages: errorMessage.join(', '),
90
+ })
91
+ );
92
+ }
72
93
  throw error;
73
94
  }
74
95
  }
@@ -6498,17 +6498,21 @@
6498
6498
  "type": "uint32",
6499
6499
  "id": 520
6500
6500
  },
6501
+ "product": {
6502
+ "type": "string",
6503
+ "id": 521
6504
+ },
6501
6505
  "brightness_prcent": {
6502
6506
  "type": "uint32",
6503
- "id": 521
6507
+ "id": 522
6504
6508
  },
6505
6509
  "haptic_feedback": {
6506
6510
  "type": "bool",
6507
- "id": 522
6511
+ "id": 523
6508
6512
  },
6509
6513
  "auto_shutdown_delay_ms": {
6510
6514
  "type": "uint32",
6511
- "id": 523
6515
+ "id": 524
6512
6516
  },
6513
6517
  "onekey_device_type": {
6514
6518
  "type": "OneKeyDeviceType",