@onekeyfe/hd-transport-http 0.1.12 → 0.1.13

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/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAMxF,aAAK,wBAAwB,GAAG;IAC9B,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IACrD,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,SAAS,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;IAEnE,UAAU,UAAS;IAEnB,OAAO,UAAS;IAEhB,GAAG,EAAE,MAAM,CAAC;gBAEA,GAAG,CAAC,EAAE,MAAM;IAIxB,KAAK,CAAC,OAAO,EAAE,wBAAwB;IAWjC,IAAI;IAKJ,WAAW;IASjB,SAAS,CAAC,UAAU,EAAE,GAAG;IAMnB,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,2BAA2B,CAAC;IAY/C,SAAS;IAMf,aAAa,CAAC,KAAK,EAAE,YAAY;IAO3B,OAAO,CAAC,KAAK,EAAE,YAAY;IAK3B,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAUzC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IA4BjE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EA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C,OAAO,EAAE,MAAM;IAe1B,aAAa;IAKb,IAAI;IAIJ,MAAM;CAGP"}
package/dist/index.js CHANGED
@@ -82,11 +82,13 @@ function request(options) {
82
82
  const DEFAULT_URL = 'http://localhost:21320';
83
83
 
84
84
  const { check, buildOne, receiveOne, parseConfigure } = transport__default["default"];
85
+ const Log = hdShared.initLog('@onekey/hd-transport-http');
85
86
  class HttpTransport {
86
87
  constructor(url) {
87
88
  this.configured = false;
88
89
  this.stopped = false;
89
90
  this.url = url == null ? DEFAULT_URL : url;
91
+ hdShared.enableLog(true);
90
92
  }
91
93
  _post(options) {
92
94
  if (this.stopped) {
@@ -163,7 +165,7 @@ class HttpTransport {
163
165
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportNotConfigured);
164
166
  }
165
167
  const messages = this._messages;
166
- console.log('transport-http', 'call-', 'messages: ', messages, ' name: ', name, ' data: ', data);
168
+ Log.debug('call-', ' name: ', name, ' data: ', data);
167
169
  const o = buildOne(messages, name, data);
168
170
  const outData = o.toString('hex');
169
171
  const resData = yield this._post({
@@ -213,7 +215,7 @@ class HttpTransport {
213
215
  this.stopped = true;
214
216
  }
215
217
  cancel() {
216
- console.log('transport-http canceled');
218
+ Log.debug('canceled');
217
219
  }
218
220
  }
219
221
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-http",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "hardware http transport",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -24,9 +24,9 @@
24
24
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@onekeyfe/hd-shared": "^0.1.12",
28
- "@onekeyfe/hd-transport": "^0.1.12",
27
+ "@onekeyfe/hd-shared": "^0.1.13",
28
+ "@onekeyfe/hd-transport": "^0.1.13",
29
29
  "axios": "^0.27.2"
30
30
  },
31
- "gitHead": "38d4f8d711d212de8617f217a0148dcf3cdcc477"
31
+ "gitHead": "f69fd0696e38efbc838848fb361cb900043bb2ec"
32
32
  }
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import transport from '@onekeyfe/hd-transport';
2
- import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
2
+ import { ERRORS, HardwareErrorCode, enableLog, initLog } from '@onekeyfe/hd-shared';
3
3
  import type { AcquireInput, OneKeyDeviceInfoWithSession } from '@onekeyfe/hd-transport';
4
4
  import { request as http } from './http';
5
5
  import { DEFAULT_URL } from './constants';
@@ -11,6 +11,8 @@ type IncompleteRequestOptions = {
11
11
  url: string;
12
12
  };
13
13
 
14
+ const Log = initLog('@onekey/hd-transport-http');
15
+
14
16
  export default class HttpTransport {
15
17
  _messages: ReturnType<typeof transport.parseConfigure> | undefined;
16
18
 
@@ -22,6 +24,7 @@ export default class HttpTransport {
22
24
 
23
25
  constructor(url?: string) {
24
26
  this.url = url == null ? DEFAULT_URL : url;
27
+ enableLog(true);
25
28
  }
26
29
 
27
30
  _post(options: IncompleteRequestOptions) {
@@ -100,16 +103,7 @@ export default class HttpTransport {
100
103
  throw ERRORS.TypedError(HardwareErrorCode.TransportNotConfigured);
101
104
  }
102
105
  const messages = this._messages;
103
- console.log(
104
- 'transport-http',
105
- 'call-',
106
- 'messages: ',
107
- messages,
108
- ' name: ',
109
- name,
110
- ' data: ',
111
- data
112
- );
106
+ Log.debug('call-', ' name: ', name, ' data: ', data);
113
107
  const o = buildOne(messages, name, data);
114
108
  const outData = o.toString('hex');
115
109
  const resData = await this._post({
@@ -160,6 +154,6 @@ export default class HttpTransport {
160
154
  }
161
155
 
162
156
  cancel() {
163
- console.log('transport-http canceled');
157
+ Log.debug('canceled');
164
158
  }
165
159
  }