diff --git a/package-lock.json b/package-lock.json index 3249949..23d7244 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bybit-api", - "version": "2.1.10", + "version": "2.2.0-beta.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bybit-api", - "version": "2.1.10", + "version": "2.2.0-beta.1", "license": "MIT", "dependencies": { "axios": "^0.21.0", diff --git a/package.json b/package.json index 4ee162d..931465d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bybit-api", - "version": "2.2.0", + "version": "2.2.0-beta.1", "description": "Node.js connector for Bybit's REST APIs and WebSockets, with TypeScript & integration tests.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/logger.ts b/src/logger.ts index 0f5f29e..e74187c 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -18,5 +18,5 @@ export const DefaultLogger = { }, error: (...params: LogParams): void => { console.error(params); - } -}; \ No newline at end of file + }, +}; diff --git a/src/util/BaseRestClient.ts b/src/util/BaseRestClient.ts index cfef8d9..6e19922 100644 --- a/src/util/BaseRestClient.ts +++ b/src/util/BaseRestClient.ts @@ -1,5 +1,4 @@ import axios, { AxiosRequestConfig, AxiosResponse, Method } from 'axios'; -import { APIResponse, APIResponseWithTime } from '../types/shared'; import { signMessage } from './node-support'; import { @@ -36,19 +35,12 @@ interface SignedRequest { export default abstract class BaseRestClient { private timeOffset: number | null; - private syncTimePromise: null | Promise; - private options: RestClientOptions; - private baseUrl: string; - private globalRequestOptions: AxiosRequestConfig; - private key: string | undefined; - private secret: string | undefined; - private clientType: RestClientType; /** Function that calls exchange API to query & resolve server time, used by time sync */ diff --git a/src/util/browser-support.ts b/src/util/browser-support.ts index fcaa9ad..b470940 100644 --- a/src/util/browser-support.ts +++ b/src/util/browser-support.ts @@ -1,18 +1,25 @@ - -export async function signMessage(message: string, secret: string): Promise { +export async function signMessage( + message: string, + secret: string +): Promise { const encoder = new TextEncoder(); const key = await window.crypto.subtle.importKey( 'raw', encoder.encode(secret), - {name: 'HMAC', hash: {name: 'SHA-256'}}, + { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign'] ); - const signature = await window.crypto.subtle.sign('HMAC', key, encoder.encode(message)); + const signature = await window.crypto.subtle.sign( + 'HMAC', + key, + encoder.encode(message) + ); - return Array.prototype.map.call( - new Uint8Array(signature), - (x: any) => ('00'+x.toString(16)).slice(-2) - ).join(''); -}; + return Array.prototype.map + .call(new Uint8Array(signature), (x: any) => + ('00' + x.toString(16)).slice(-2) + ) + .join(''); +}