@dashevo/dapi-client 1.0.0-dev.1 → 1.0.0-dev.3

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.
package/lib/DAPIClient.js CHANGED
@@ -34,6 +34,7 @@ class DAPIClient extends EventEmitter {
34
34
  blockHeadersProviderOptions: BlockHeadersProvider.defaultOptions,
35
35
  loggerOptions: {
36
36
  identifier: '',
37
+ level: undefined,
37
38
  },
38
39
  ...options,
39
40
  };
@@ -57,7 +58,10 @@ class DAPIClient extends EventEmitter {
57
58
 
58
59
  this.core = new CoreMethodsFacade(jsonRpcTransport, grpcTransport);
59
60
  this.platform = new PlatformMethodsFacade(grpcTransport);
60
- this.logger = logger.getForId(this.options.loggerOptions.identifier);
61
+ this.logger = logger.getForId(
62
+ this.options.loggerOptions.identifier,
63
+ this.options.loggerOptions.level,
64
+ );
61
65
 
62
66
  this.initBlockHeadersProvider();
63
67
  }
@@ -89,6 +93,7 @@ DAPIClient.EVENTS = EVENTS;
89
93
  * @property {boolean} [throwDeadlineExceeded]
90
94
  * @property {object} [loggerOptions]
91
95
  * @property {string} [loggerOptions.identifier]
96
+ * @property {string} [loggerOptions.level]
92
97
  * @property {BlockHeadersProvider} [blockHeadersProvider]
93
98
  * @property {BlockHeadersProviderOptions} [blockHeadersProviderOptions]
94
99
  */
@@ -1,7 +1,9 @@
1
1
  const util = require('util');
2
2
  const winston = require('winston');
3
3
 
4
- const LOG_LEVEL = process.env.LOG_LEVEL || 'info';
4
+ // TODO: Refactor to use params instead on envs
5
+
6
+ const LOG_LEVEL = process.env.LOG_LEVEL || 'silent';
5
7
  const LOG_TO_FILE = process.env.LOG_WALLET_TO_FILE || 'false';
6
8
 
7
9
  // Log levels:
@@ -36,6 +38,7 @@ const createLogger = (formats = [], id = '') => {
36
38
  const transports = [
37
39
  new winston.transports.Console({
38
40
  format,
41
+ silent: LOG_LEVEL === 'silent',
39
42
  }),
40
43
  ];
41
44
 
@@ -44,6 +47,7 @@ const createLogger = (formats = [], id = '') => {
44
47
  new winston.transports.File({
45
48
  filename: `wallet${id !== '' ? `_${id}` : ''}`,
46
49
  format,
50
+ silent: LOG_LEVEL === 'silent',
47
51
  }),
48
52
  );
49
53
  }
@@ -98,6 +98,8 @@ class GrpcTransport {
98
98
  throw responseError;
99
99
  }
100
100
 
101
+ // TODO: Shouldn't we call address.markAsBanned() here?
102
+
101
103
  if (options.retries === 0) {
102
104
  throw new MaxRetriesReachedError(responseError);
103
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-client",
3
- "version": "1.0.0-dev.1",
3
+ "version": "1.0.0-dev.3",
4
4
  "description": "Client library used to access Dash DAPI endpoints",
5
5
  "main": "lib/index.js",
6
6
  "contributors": [
@@ -26,11 +26,11 @@
26
26
  }
27
27
  ],
28
28
  "dependencies": {
29
- "@dashevo/dapi-grpc": "1.0.0-dev.1",
30
- "@dashevo/dash-spv": "1.0.0-dev.1",
29
+ "@dashevo/dapi-grpc": "1.0.0-dev.3",
30
+ "@dashevo/dash-spv": "1.0.0-dev.3",
31
31
  "@dashevo/dashcore-lib": "~0.21.0",
32
- "@dashevo/grpc-common": "1.0.0-dev.1",
33
- "@dashevo/wasm-dpp": "1.0.0-dev.1",
32
+ "@dashevo/grpc-common": "1.0.0-dev.3",
33
+ "@dashevo/wasm-dpp": "1.0.0-dev.3",
34
34
  "bs58": "^4.0.1",
35
35
  "cbor": "^8.0.0",
36
36
  "google-protobuf": "^3.12.2",