@onekeyfe/hd-web-sdk 0.0.1 → 0.0.2

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.
@@ -14276,6 +14276,7 @@ class Device extends events.exports {
14276
14276
  deviceType: getDeviceType(this.features),
14277
14277
  deviceId: this.features.device_id || null,
14278
14278
  path: this.originalDescriptor.path,
14279
+ name: this.features.ble_name || this.features.label || `OneKey ${getDeviceType(this.features).toUpperCase()}`,
14279
14280
  label: getDeviceLabel(this.features),
14280
14281
  mode: this.getMode(),
14281
14282
  features: this.features,
@@ -14685,7 +14686,8 @@ class SearchDevices extends BaseMethod {
14685
14686
 
14686
14687
  if (env === 'react-native') {
14687
14688
  return devicesDescriptor.map(device => Object.assign(Object.assign({}, device), {
14688
- connectId: device.id
14689
+ connectId: device.id,
14690
+ deviceType: 'classic'
14689
14691
  }));
14690
14692
  }
14691
14693
 
@@ -14813,6 +14815,17 @@ const getOutputScriptType = path => {
14813
14815
  }
14814
14816
  };
14815
14817
 
14818
+ const serializedPath = path => {
14819
+ const pathStr = path.map(p => {
14820
+ if (p & HD_HARDENED) {
14821
+ return `${p & ~HD_HARDENED}'`;
14822
+ }
14823
+
14824
+ return p;
14825
+ }).join('/');
14826
+ return `m/${pathStr}`;
14827
+ };
14828
+
14816
14829
  const validatePath = (path, length = 0, base = false) => {
14817
14830
  let valid;
14818
14831
 
@@ -15233,7 +15246,9 @@ class BTCGetAddress extends BaseMethod {
15233
15246
  for (let i = 0; i < this.params.length; i++) {
15234
15247
  const param = this.params[i];
15235
15248
  const res = yield this.device.commands.typedCall('GetAddress', 'Address', Object.assign({}, param));
15236
- responses.push(res.message);
15249
+ responses.push(Object.assign({
15250
+ path: serializedPath(param.address_n)
15251
+ }, res.message));
15237
15252
  }
15238
15253
 
15239
15254
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -15310,7 +15325,9 @@ class BTCGetPublicKey extends BaseMethod {
15310
15325
  for (let i = 0; i < this.params.length; i++) {
15311
15326
  const param = this.params[i];
15312
15327
  const res = yield this.device.commands.typedCall('GetPublicKey', 'PublicKey', Object.assign({}, param));
15313
- responses.push(res.message);
15328
+ responses.push(Object.assign({
15329
+ path: serializedPath(param.address_n)
15330
+ }, res.message));
15314
15331
  }
15315
15332
 
15316
15333
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -16358,7 +16375,13 @@ class EvmGetAddress extends BaseMethod {
16358
16375
  for (let i = 0; i < this.params.length; i++) {
16359
16376
  const param = this.params[i];
16360
16377
  const res = yield this.device.commands.typedCall('EthereumGetAddress', 'EthereumAddress', Object.assign({}, param));
16361
- responses.push(res.message);
16378
+ const {
16379
+ address
16380
+ } = res.message;
16381
+ responses.push({
16382
+ path: serializedPath(param.address_n),
16383
+ address
16384
+ });
16362
16385
  }
16363
16386
 
16364
16387
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -16412,7 +16435,9 @@ class EVMGetPublicKey extends BaseMethod {
16412
16435
  for (let i = 0; i < this.params.length; i++) {
16413
16436
  const param = this.params[i];
16414
16437
  const res = yield this.device.commands.typedCall('EthereumGetPublicKey', 'EthereumPublicKey', Object.assign({}, param));
16415
- responses.push(res.message);
16438
+ responses.push(Object.assign({
16439
+ path: serializedPath(param.address_n)
16440
+ }, res.message));
16416
16441
  }
16417
16442
 
16418
16443
  return Promise.resolve(this.hasBundle ? responses : responses[0]);