carbon-js-sdk 0.4.2 → 0.4.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.
|
@@ -150,12 +150,13 @@ export declare class WSConnector {
|
|
|
150
150
|
* options: subscribe, unsubscribe, get_recent_trades, get_candlesticks, get_open_orders,
|
|
151
151
|
* get_account_trades, get_market_stats, get_leverages, get_open_positions, get_closed_positions
|
|
152
152
|
* @param {any} params - parameters based on the specified method
|
|
153
|
+
* @param {any} extras - additional args to be sent in the request
|
|
153
154
|
*
|
|
154
155
|
* @returns {Promise<WSResult<T>>} - a Promise resolving to the response from the endpoint
|
|
155
156
|
*
|
|
156
157
|
* @see WSConnector documentation for usage example
|
|
157
158
|
*/
|
|
158
|
-
request<T = unknown>(method: string, params: any): Promise<WSResult<T> | undefined>;
|
|
159
|
+
request<T = unknown>(method: string, params: any, extras?: any): Promise<WSResult<T> | undefined>;
|
|
159
160
|
/**
|
|
160
161
|
* Sends a message to the web socket
|
|
161
162
|
* @param {string | Buffer} data - the message sent to the web socket
|
|
@@ -224,19 +224,17 @@ class WSConnector {
|
|
|
224
224
|
* options: subscribe, unsubscribe, get_recent_trades, get_candlesticks, get_open_orders,
|
|
225
225
|
* get_account_trades, get_market_stats, get_leverages, get_open_positions, get_closed_positions
|
|
226
226
|
* @param {any} params - parameters based on the specified method
|
|
227
|
+
* @param {any} extras - additional args to be sent in the request
|
|
227
228
|
*
|
|
228
229
|
* @returns {Promise<WSResult<T>>} - a Promise resolving to the response from the endpoint
|
|
229
230
|
*
|
|
230
231
|
* @see WSConnector documentation for usage example
|
|
231
232
|
*/
|
|
232
|
-
request(method, params) {
|
|
233
|
+
request(method, params, extras = {}) {
|
|
233
234
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
235
|
const requestId = `r${++this.requestIdCounter}`;
|
|
235
|
-
this.sendMessage(JSON.stringify({
|
|
236
|
-
|
|
237
|
-
method,
|
|
238
|
-
params,
|
|
239
|
-
}));
|
|
236
|
+
this.sendMessage(JSON.stringify(Object.assign({ id: requestId, method,
|
|
237
|
+
params }, extras)));
|
|
240
238
|
return new Promise((resolve, reject) => {
|
|
241
239
|
this.requestHandlers[requestId] = { requestId, resolve, reject };
|
|
242
240
|
});
|