@onekeyfe/hd-core 0.1.42 → 0.1.43

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":"BaseMethod.d.ts","sourceRoot":"","sources":["../../src/api/BaseMethod.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,WAAW,EAA2C,MAAM,WAAW,CAAC;AAMjF,8BAAsB,UAAU,CAAC,MAAM,GAAG,SAAS;IACjD,UAAU,EAAE,MAAM,CAAC;IAGnB,MAAM,EAAE,MAAM,CAAC;IAGf,MAAM,EAAE,MAAM,CAAC;IAOf,SAAS,CAAC,EAAE,MAAM,CAAC;IAKnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,WAAW,CAAC,EAAE,MAAM,CAAC;IAKrB,IAAI,EAAE,MAAM,CAAC;IAKb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE7B,SAAS,CAAC,EAAE,eAAe,CAAC;IAK5B,SAAS,EAAE,OAAO,CAAC;IAKnB,eAAe,EAAE,MAAM,EAAE,CAAC;IAK1B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAK5B,qBAAqB,UAAQ;IAK7B,aAAa,UAAS;IAKtB,wBAAwB,UAAQ;IAGhC,WAAW,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;gBAEhC,OAAO,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,GAAG,CAAA;KAAE;IAYlD,QAAQ,CAAC,IAAI,IAAI,IAAI;IAErB,QAAQ,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IAE5B,eAAe,IAAI,mBAAmB;IAItC,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AKxB,oBAAoB;IAkBpB,yBAAyB;IAenB,yBAAyB;IAkB/B,OAAO;CACR"}
package/dist/index.js CHANGED
@@ -11113,7 +11113,8 @@ class BaseMethod {
11113
11113
  if (deviceType !== 'touch')
11114
11114
  return;
11115
11115
  let checkFlag = false;
11116
- if (this.name === 'evmSignTransaction' && Number((_b = (_a = this.payload) === null || _a === void 0 ? void 0 : _a.transaction) === null || _b === void 0 ? void 0 : _b.chainId) !== 1) {
11116
+ if (this.name === 'evmSignTransaction' &&
11117
+ [3, 4, 5, 42].includes(Number((_b = (_a = this.payload) === null || _a === void 0 ? void 0 : _a.transaction) === null || _b === void 0 ? void 0 : _b.chainId))) {
11117
11118
  checkFlag = true;
11118
11119
  }
11119
11120
  if (checkFlag && ((_c = this.device.features) === null || _c === void 0 ? void 0 : _c.safety_checks) === 'Strict') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
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.1.42",
28
- "@onekeyfe/hd-transport": "^0.1.42",
27
+ "@onekeyfe/hd-shared": "^0.1.43",
28
+ "@onekeyfe/hd-transport": "^0.1.43",
29
29
  "axios": "^0.27.2",
30
30
  "bignumber.js": "^9.0.2",
31
31
  "js-sha256": "^0.9.0",
@@ -36,5 +36,5 @@
36
36
  "@types/parse-uri": "^1.0.0",
37
37
  "@types/semver": "^7.3.9"
38
38
  },
39
- "gitHead": "fa65f27f4d043ebf89f03bd98393a9cb3a010199"
39
+ "gitHead": "15d5f1b90ef26478f2183317dd192443e44adbe2"
40
40
  }
@@ -133,14 +133,17 @@ export abstract class BaseMethod<Params = undefined> {
133
133
  }
134
134
 
135
135
  /**
136
- * Check the level of safety_check when performing transactions on the test network on touch
136
+ * Automatic check safety_check level for Kovan, Ropsten, Rinkeby, Goerli test networks.
137
137
  * @returns {void}
138
138
  */
139
139
  async checkSafetyLevelOnTestNet() {
140
140
  const deviceType = getDeviceType(this.device.features);
141
141
  if (deviceType !== 'touch') return;
142
142
  let checkFlag = false;
143
- if (this.name === 'evmSignTransaction' && Number(this.payload?.transaction?.chainId) !== 1) {
143
+ if (
144
+ this.name === 'evmSignTransaction' &&
145
+ [3, 4, 5, 42].includes(Number(this.payload?.transaction?.chainId))
146
+ ) {
144
147
  checkFlag = true;
145
148
  }
146
149
  if (checkFlag && this.device.features?.safety_checks === 'Strict') {
package/src/core/index.ts CHANGED
@@ -242,7 +242,7 @@ export const callAPI = async (message: CoreMessage) => {
242
242
  }
243
243
  }
244
244
 
245
- // Check the level of safety_check when performing transactions on the test network on touch
245
+ // Automatic check safety_check level for Kovan, Ropsten, Rinkeby, Goerli test networks.
246
246
  try {
247
247
  await method.checkSafetyLevelOnTestNet();
248
248
  } catch (e) {