From 0ad221fe5a1549c2f6edbd95d5e71626a82b3343 Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Mon, 19 Sep 2022 23:58:02 +0100 Subject: [PATCH] cleaning in the base rest client --- src/util/BaseRestClient.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/util/BaseRestClient.ts b/src/util/BaseRestClient.ts index c9a7328..dc87f1a 100644 --- a/src/util/BaseRestClient.ts +++ b/src/util/BaseRestClient.ts @@ -115,22 +115,18 @@ export default abstract class BaseRestClient { return this.clientType === REST_CLIENT_TYPE_ENUM.spot; } - private isUSDCClient() { - return this.clientType === REST_CLIENT_TYPE_ENUM.v3; - } - get(endpoint: string, params?: any) { return this._call('GET', endpoint, params, true); } - post(endpoint: string, params?: any) { - return this._call('POST', endpoint, params, true); - } - getPrivate(endpoint: string, params?: any) { return this._call('GET', endpoint, params, false); } + post(endpoint: string, params?: any) { + return this._call('POST', endpoint, params, true); + } + postPrivate(endpoint: string, params?: any) { return this._call('POST', endpoint, params, false); } @@ -201,8 +197,8 @@ export default abstract class BaseRestClient { }; } - // USDC Options uses a different way of authenticating requests (headers instead of params) - if (this.isUSDCClient()) { + // USDC endpoints, unified margin and a few others use a different way of authenticating requests (headers instead of params) + if (this.clientType === REST_CLIENT_TYPE_ENUM.v3) { if (!options.headers) { options.headers = {}; }