hollaex-node-lib 2.15.0 → 2.15.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.
Files changed (3) hide show
  1. package/README.md +6 -2
  2. package/kit.js +67 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -107,6 +107,8 @@ client
107
107
  | `deactivateExchangeUserOtp` | <ul><li>**userId**: The identifier of the user to deactivate their otp</li></ul> | Deactivate user otp by admin |
108
108
  | `getExchangeUserReferrals` | <ul><li>**userId**: The identifier of the user to filter by</li><li>**opts.limit**: Amount of referrals per page. Maximum: 50. Default: 50</li><li>**opts.page**: Page of referral data. Default: 1</li><li>**opts.orderBy**: The field to order data by e.g. amount, id.</li><li>**opts.order**: Ascending (asc) or descending (desc).</li><li>**opts.startDate**: Start date of query in ISO8601 format.</li><li>**opts.endDate**: End date of query in ISO8601 format.</li></ul> | Retrieve user's referrals info by admin |
109
109
  | `getExchangeUserReferrer` | <ul><li>**userId**: The identifier of the user to filter by</li></ul> | Retrieve user's referer info by admin |
110
+ | `sendExchangeUserEmail` | <ul><li>**userId**: The identifier of the user</li><li>**mailType**: The mail type for the email payload</li><li>**data**: The content of the mail</li></ul> | Send email to exchange user account by admin |
111
+ | `sendRawEmail` | <ul><li>**receivers**: The array of emails to send mail</li><li>**html**: The stringified html content</li><li>**opts.title**: The title of the mail</li><li>**opts.text**: The text of the mail</li></ul> | Send email to users with custom html by admin |
110
112
 
111
113
 
112
114
  ### Websocket
@@ -143,12 +145,14 @@ client.unsubscribe(['orderbook']);
143
145
 
144
146
  Here is the list of channels you can subscribe to:
145
147
 
146
- - `orderbook`
147
- - `trades`
148
+ - `orderbook` (Available publicly)
149
+ - `trade` (Available publicly)
148
150
  - `order` (Only available with authentication. Receive order updates)
151
+ - `usertrade` (Only available with authentication. Receive user trades)
149
152
  - `wallet` (Only available with authentication. Receive balance updates)
150
153
  - `deposit` (Only available with authentication. Receive deposit notifications)
151
154
  - `withdrawal` (Only available with authentication. Receive withdrawal notifications)
155
+ - `admin` (Only available with authentication for the exchange administrator. Receive exchange operations such as deposits and withdrawals of all users)
152
156
 
153
157
 
154
158
  For public channels (`orderbook`, `trade`), you can subscribe to specific symbols as follows:
package/kit.js CHANGED
@@ -993,7 +993,7 @@ class HollaExKit {
993
993
  return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
994
994
  }
995
995
 
996
- /**
996
+ /**
997
997
  * Create exchange deposit by admin
998
998
  * @param {number} userId - The identifier of the user
999
999
  * @param {string} currency - The currency to specify
@@ -1371,7 +1371,6 @@ class HollaExKit {
1371
1371
  orderBy: null,
1372
1372
  order: null,
1373
1373
  startDate: null,
1374
- startDate: null,
1375
1374
  format: null
1376
1375
  }
1377
1376
  ) {
@@ -2043,7 +2042,7 @@ class HollaExKit {
2043
2042
  return createRequest(verb, `${this.apiUrl}${path}`, headers);
2044
2043
  }
2045
2044
 
2046
- /**
2045
+ /**
2047
2046
  * Deactivate exchange user account by admin
2048
2047
  * @param {number} userId - The identifier of the user to deactivate their exchange account
2049
2048
  * @return {object} A JSON object with message
@@ -2173,7 +2172,72 @@ class HollaExKit {
2173
2172
  return createRequest(verb, `${this.apiUrl}${path}`, headers);
2174
2173
  }
2175
2174
 
2175
+ /**
2176
+ * Send email to exchange user account by admin
2177
+ * @param {number} userId - The identifier of the user
2178
+ * @param {string} mailType - The mail type for the email payload
2179
+ * @param {object} data - The content of the mail
2180
+ * @return {object} A JSON object with message
2181
+ */
2182
+ sendExchangeUserEmail(userId, mailType, data) {
2183
+ const verb = 'POST';
2184
+ let path = `${this.baseUrl}/admin/send-email`;
2185
+ const data = {
2186
+ user_id: userId,
2187
+ mail_type: mailType,
2188
+ data
2189
+ };
2190
+
2191
+ const headers = generateHeaders(
2192
+ this.headers,
2193
+ this.apiSecret,
2194
+ verb,
2195
+ path,
2196
+ this.apiExpiresAfter,
2197
+ data
2198
+ );
2199
+ return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
2200
+ }
2176
2201
 
2202
+ /**
2203
+ * Send email to users with custom html by admin
2204
+ * @param {array} receivers - The array of emails to send mail
2205
+ * @param {string} html - The stringified html content
2206
+ * @param {string} opts.title - The title of the mail
2207
+ * @param {string} opts.text - The text of the mail
2208
+ * @return {object} A JSON object with message
2209
+ */
2210
+ sendRawEmail(receivers, html, opts = {
2211
+ title: null,
2212
+ text: null
2213
+ }) {
2214
+ const verb = 'POST';
2215
+ let path = `${this.baseUrl}/admin/send-email/raw`;
2216
+ const data = {
2217
+ receivers,
2218
+ html,
2219
+ };
2220
+
2221
+ if(isString(opts.title)) {
2222
+ data.title = opts.title
2223
+ }
2224
+
2225
+ if(isString(opts.text)) {
2226
+ data.text = opts.text
2227
+ }
2228
+
2229
+ const headers = generateHeaders(
2230
+ this.headers,
2231
+ this.apiSecret,
2232
+ verb,
2233
+ path,
2234
+ this.apiExpiresAfter,
2235
+ data
2236
+ );
2237
+ return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
2238
+ }
2239
+
2240
+
2177
2241
  /**
2178
2242
  * Connect to hollaEx websocket and listen to an event
2179
2243
  * @param {array} events - The events to listen to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hollaex-node-lib",
3
- "version": "2.15.0",
3
+ "version": "2.15.2",
4
4
  "description": "hollaex api and websocket library for nodejs",
5
5
  "main": "index.js",
6
6
  "dependencies": {