cleaning in the base rest client

This commit is contained in:
tiagosiebler
2022-09-19 23:58:02 +01:00
parent 6e2ba00730
commit 0ad221fe5a

View File

@@ -115,22 +115,18 @@ export default abstract class BaseRestClient {
return this.clientType === REST_CLIENT_TYPE_ENUM.spot; return this.clientType === REST_CLIENT_TYPE_ENUM.spot;
} }
private isUSDCClient() {
return this.clientType === REST_CLIENT_TYPE_ENUM.v3;
}
get(endpoint: string, params?: any) { get(endpoint: string, params?: any) {
return this._call('GET', endpoint, params, true); return this._call('GET', endpoint, params, true);
} }
post(endpoint: string, params?: any) {
return this._call('POST', endpoint, params, true);
}
getPrivate(endpoint: string, params?: any) { getPrivate(endpoint: string, params?: any) {
return this._call('GET', endpoint, params, false); return this._call('GET', endpoint, params, false);
} }
post(endpoint: string, params?: any) {
return this._call('POST', endpoint, params, true);
}
postPrivate(endpoint: string, params?: any) { postPrivate(endpoint: string, params?: any) {
return this._call('POST', endpoint, params, false); 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) // USDC endpoints, unified margin and a few others use a different way of authenticating requests (headers instead of params)
if (this.isUSDCClient()) { if (this.clientType === REST_CLIENT_TYPE_ENUM.v3) {
if (!options.headers) { if (!options.headers) {
options.headers = {}; options.headers = {};
} }