From 3269e457c915f3efd0abedf0c5e57a7f70f09ea8 Mon Sep 17 00:00:00 2001 From: CryptoCompiler <72892531+peepopoggers@users.noreply.github.com> Date: Fri, 29 Jan 2021 14:34:02 +0000 Subject: [PATCH] Moved function to util --- src/util/requestWrapper.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/util/requestWrapper.ts b/src/util/requestWrapper.ts index 9dab5ad..7645061 100644 --- a/src/util/requestWrapper.ts +++ b/src/util/requestWrapper.ts @@ -1,6 +1,6 @@ import axios, { AxiosRequestConfig, AxiosResponse, Method } from 'axios'; -import { signMessage, serializeParams, RestClientInverseOptions, GenericAPIResponse } from './requestUtils'; +import { signMessage, serializeParams, RestClientInverseOptions, GenericAPIResponse, isPublicEndpoint } from './requestUtils'; export default class RequestUtil { private timeOffset: number | null; @@ -68,17 +68,7 @@ export default class RequestUtil { * @private Make a HTTP request to a specific endpoint. Private endpoints are automatically signed. */ async _call(method: Method, endpoint: string, params?: any): GenericAPIResponse { - const isPublicEndpoint = (endpoint: string): boolean => { - if (endpoint.startsWith('v2/public')) { - return true; - } - if (endpoint.startsWith('public/linear')) { - return true; - } - return false; - } - - if (isPublicEndpoint(endpoint) === false) { + if (!isPublicEndpoint(endpoint)) { if (!this.key || !this.secret) { throw new Error('Private endpoints require api and private keys set'); }