hollaex-node-lib 2.15.2 → 2.15.4

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/README.md CHANGED
@@ -12,12 +12,15 @@ const hollaex = require('hollaex-node-lib');
12
12
  const client = new hollaex();
13
13
  ```
14
14
 
15
- You can pass the `apiURL` and `baseURL` of the HollaEx-Enabled exchange to connect to. You can also pass your `apiKey` and `apiSecret` generated from the HollaEx-Enabled exchange.
15
+ You can pass custom `apiURL`, `wsURL` and `baseURL` of the HollaEx-Enabled exchange to connect to. `apiURL` is `https://api.hollaex.com` for HollaEx Pro and for your custom exchange it would be something like `https://myexchange.com/api`.
16
+ `wsURL` is the websocket URL for the socket connection and you should pass your stream URL. For HollaEx Pro it is `wss://api.hollaex.com/stream` and for your exchange it would be something like `wss://myexchange.com/stream`.
17
+
18
+ You can also pass your `apiKey` and `apiSecret` generated from the HollaEx-Enabled exchange to use private requests that require authentication. For public endpoints `apiKey` and `apiSecret` are not required.
16
19
 
17
20
  ```javascript
18
21
  const client = new hollaex({
19
22
  apiURL: '<EXCHANGE_API_URL>',
20
- baseURL: '<EXCHANGE_BASE_URL>',
23
+ wsURL: '<EXCHANGE_WS_URL>',
21
24
  apiKey: '<MY_API_KEY>',
22
25
  apiSecret: '<MY_API_SECRET>'
23
26
  });
@@ -30,7 +33,7 @@ You can also pass the field `apiExpiresAfter` which is the length of time in sec
30
33
  ```javascript
31
34
  const client = new hollaex({
32
35
  apiURL: '<EXCHANGE_API_URL>',
33
- baseURL: '<EXCHANGE_BASE_URL>',
36
+ wsURL: '<EXCHANGE_API_URL>',
34
37
  apiKey: '<MY_API_KEY>',
35
38
  apiSecret: '<MY_API_SECRET>'
36
39
  });
@@ -3,7 +3,13 @@ require('dotenv').load();
3
3
 
4
4
  const API_KEY = process.env.API_KEY || '';
5
5
  const API_SECRET = process.env.API_SECRET || '';
6
- const client = new HollaEx({ apiKey: API_KEY, apiSecret: API_SECRET });
6
+ const client = new HollaEx({
7
+ apiURL: 'https://api.hollaex.com',
8
+ wsURL: 'wss://api.hollaex.com/stream',
9
+ baseURL: '/v2',
10
+ apiKey: API_KEY,
11
+ apiSecret: API_SECRET
12
+ });
7
13
 
8
14
  client
9
15
  .getTicker('xht-usdt')
@@ -22,7 +28,7 @@ client
22
28
  symbols : xht-usdt
23
29
  */
24
30
 
25
- client.connect(['orderbook']);
31
+ client.connect(['orderbook:xht-usdt']);
26
32
 
27
33
  client.ws.on('message', (data) => {
28
34
  data = JSON.parse(data);
package/kit.js CHANGED
@@ -4,7 +4,7 @@ const WebSocket = require('ws');
4
4
  const moment = require('moment');
5
5
  const { createRequest, createSignature, generateHeaders, isDatetime, sanitizeDate } = require('./utils');
6
6
  const { setWsHeartbeat } = require('ws-heartbeat/client');
7
- const { each, union, isNumber, isString, isPlainObject, isBoolean, isObject, isArray } = require('lodash');
7
+ const { each, union, isNumber, isString, isPlainObject, isBoolean, isObject } = require('lodash');
8
8
  class HollaExKit {
9
9
  constructor(
10
10
  opts = {
@@ -27,10 +27,13 @@ class HollaExKit {
27
27
  };
28
28
  this.ws = null;
29
29
  const [protocol, endpoint] = this.apiUrl.split('://');
30
- this.wsUrl =
31
- protocol === 'https'
32
- ? `wss://${endpoint}/stream`
33
- : `ws://${endpoint}/stream`;
30
+ this.wsUrl = (
31
+ opts.wsURL
32
+ ? opts.wsURL
33
+ : protocol === 'https'
34
+ ? `wss://${endpoint}/stream`
35
+ : `ws://${endpoint}/stream`
36
+ );
34
37
  this.wsEvents = [];
35
38
  this.wsReconnect = true;
36
39
  this.wsReconnectInterval = 5000;
@@ -2179,13 +2182,13 @@ class HollaExKit {
2179
2182
  * @param {object} data - The content of the mail
2180
2183
  * @return {object} A JSON object with message
2181
2184
  */
2182
- sendExchangeUserEmail(userId, mailType, data) {
2185
+ sendExchangeUserEmail(userId, mailType, content) {
2183
2186
  const verb = 'POST';
2184
2187
  let path = `${this.baseUrl}/admin/send-email`;
2185
2188
  const data = {
2186
2189
  user_id: userId,
2187
2190
  mail_type: mailType,
2188
- data
2191
+ data: content
2189
2192
  };
2190
2193
 
2191
2194
  const headers = generateHeaders(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hollaex-node-lib",
3
- "version": "2.15.2",
3
+ "version": "2.15.4",
4
4
  "description": "hollaex api and websocket library for nodejs",
5
5
  "main": "index.js",
6
6
  "dependencies": {