@onekeyfe/hd-core 1.1.16-alpha.5 → 1.1.16-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":"paramsValidator.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/paramsValidator.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EACD,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,WAAW,GACX,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,WAAW,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAQF,eAAO,MAAM,cAAc,WAAY,GAAG,UAAU,MAAM,WAAW,CAAC,KAAG,IAwFxE,CAAC;AAEF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,GAAG,EACX,iBAAiB,EAAE,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE;IACR,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CAC5C,QAwBF"}
1
+ {"version":3,"file":"paramsValidator.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/paramsValidator.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EACD,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,WAAW,GACX,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,WAAW,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAQF,eAAO,MAAM,cAAc,WAAY,GAAG,UAAU,MAAM,WAAW,CAAC,KAAG,IAgGxE,CAAC;AAEF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,GAAG,EACX,iBAAiB,EAAE,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE;IACR,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CAC5C,QAwBF"}
package/dist/index.js CHANGED
@@ -28063,12 +28063,19 @@ const validateParams = (values, fields) => {
28063
28063
  throw invalidParameter(`Parameter [${field.name}] is of type invalid and should be [${field.type}].`);
28064
28064
  }
28065
28065
  break;
28066
- case 'buffer':
28067
- if (typeof value === 'undefined' ||
28068
- (typeof value.constructor.isBuffer === 'function' && value.constructor.isBuffer(value))) {
28066
+ case 'buffer': {
28067
+ const isNodeBuffer = typeof Buffer !== 'undefined' &&
28068
+ typeof Buffer.isBuffer === 'function' &&
28069
+ Buffer.isBuffer(value);
28070
+ const isCustomBuffer = value &&
28071
+ value.constructor &&
28072
+ typeof value.constructor.isBuffer === 'function' &&
28073
+ value.constructor.isBuffer(value);
28074
+ if (!isNodeBuffer && !isCustomBuffer) {
28069
28075
  throw invalidParameter(`Parameter [${field.name}] is of type invalid and should be [buffer].`);
28070
28076
  }
28071
28077
  break;
28078
+ }
28072
28079
  case 'hexString':
28073
28080
  if (typeof value !== 'string' || !isHexString(addHexPrefix(value))) {
28074
28081
  throw invalidParameter(`Parameter [${field.name}] is of type invalid and should be [${field.type}].`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.1.16-alpha.5",
3
+ "version": "1.1.16-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.16-alpha.5",
29
- "@onekeyfe/hd-transport": "1.1.16-alpha.5",
28
+ "@onekeyfe/hd-shared": "1.1.16-alpha.6",
29
+ "@onekeyfe/hd-transport": "1.1.16-alpha.6",
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": "336159b5671671a7ff3d741af6d27f53094a0f37"
49
+ "gitHead": "0cdb0ec713982b905789cdbab66f07bad8c8c11e"
50
50
  }
@@ -83,16 +83,24 @@ export const validateParams = (values: any, fields: Array<SchemaParam>): void =>
83
83
  }
84
84
  break;
85
85
 
86
- case 'buffer':
87
- if (
88
- typeof value === 'undefined' ||
89
- (typeof value.constructor.isBuffer === 'function' && value.constructor.isBuffer(value))
90
- ) {
86
+ case 'buffer': {
87
+ const isNodeBuffer =
88
+ typeof Buffer !== 'undefined' &&
89
+ typeof Buffer.isBuffer === 'function' &&
90
+ Buffer.isBuffer(value);
91
+ const isCustomBuffer =
92
+ value &&
93
+ value.constructor &&
94
+ typeof value.constructor.isBuffer === 'function' &&
95
+ value.constructor.isBuffer(value);
96
+
97
+ if (!isNodeBuffer && !isCustomBuffer) {
91
98
  throw invalidParameter(
92
99
  `Parameter [${field.name}] is of type invalid and should be [buffer].`
93
100
  );
94
101
  }
95
102
  break;
103
+ }
96
104
 
97
105
  case 'hexString':
98
106
  if (typeof value !== 'string' || !isHexString(addHexPrefix(value))) {