diff --git a/.eslintrc.json b/.eslintrc.json index c684cf8..85a2cc4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -16,7 +16,11 @@ ], "parserOptions": { "projecasdft": true, - "project": ["./tsconfig.json", "examples/tsconfig.examples.json"] + "project": [ + "./tsconfig.json", + "examples/tsconfig.examples.json", + "tsconfig.test.json" + ] }, "rules": { "@typescript-eslint/await-thenable": "error", diff --git a/examples/tsconfig.examples.json b/examples/tsconfig.examples.json deleted file mode 100644 index 883bb93..0000000 --- a/examples/tsconfig.examples.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "distExamples", - "allowJs": true - }, - "include": [ - "**/*.ts", - // if you have a mixed JS/TS codebase, don't forget to include your JS files - "**/*.js" - ] -} diff --git a/examples/ws-private.ts b/examples/ws-private.ts index ae55f56..2b4908a 100644 --- a/examples/ws-private.ts +++ b/examples/ws-private.ts @@ -1,4 +1,4 @@ -import { WebsocketClient, WS_KEY_MAP, DefaultLogger } from '../src'; +import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from '../src'; // or // import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from 'bybit-api'; diff --git a/examples/ws-public.ts b/examples/ws-public.ts index e358919..d156564 100644 --- a/examples/ws-public.ts +++ b/examples/ws-public.ts @@ -18,8 +18,8 @@ import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from '../src'; // market: 'spot', // market: 'spotv3', // market: 'usdcOption', - // market: 'usdcPerp', - market: 'unifiedPerp', + market: 'usdcPerp', + // market: 'unifiedPerp', // market: 'unifiedOption', }, logger @@ -138,11 +138,13 @@ import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from '../src'; // ]); // usdc perps (note: the syntax is different for the unified perp market) + // (market: 'usdcPerp') // wsClient.subscribe('trade.BTCUSDC'); + wsClient.subscribe('instrument_info.100ms.BTCPERP'); // unified perps // wsClient.subscribe('publicTrade.BTCUSDT'); - wsClient.subscribe('publicTrade.BTCPERP'); + // wsClient.subscribe('publicTrade.BTCPERP'); // For spot v1 (the old, deprecated client), request public connection first then send required topics on 'open' // Not necessary for spot v3 diff --git a/test/contract/private.read.test.ts b/test/contract/private.read.test.ts index 7777495..c1cff4b 100644 --- a/test/contract/private.read.test.ts +++ b/test/contract/private.read.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable max-len */ import { API_ERROR_CODE, ContractClient } from '../../src'; import { successResponseObjectV3 } from '../response.util'; diff --git a/test/contract/public.read.test.ts b/test/contract/public.read.test.ts index 5c245b0..c8ceafd 100644 --- a/test/contract/public.read.test.ts +++ b/test/contract/public.read.test.ts @@ -1,4 +1,4 @@ -import { UMCandlesRequest, ContractClient } from '../../src'; +import { ContractClient, UMCandlesRequest } from '../../src'; import { successResponseObject, successResponseObjectV3, diff --git a/test/contract/ws.private.test.ts b/test/contract/ws.private.test.ts index 49937e6..5392208 100644 --- a/test/contract/ws.private.test.ts +++ b/test/contract/ws.private.test.ts @@ -1,14 +1,16 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - logAllEvents, - getSilentLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, fullLogger, + getSilentLogger, + logAllEvents, + waitForSocketEvent, } from '../ws.util'; describe('Private Contract Websocket Client', () => { diff --git a/test/contract/ws.public.inverse.test.ts b/test/contract/ws.public.inverse.test.ts index 5c76374..24cc45e 100644 --- a/test/contract/ws.public.inverse.test.ts +++ b/test/contract/ws.public.inverse.test.ts @@ -1,13 +1,15 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - logAllEvents, - getSilentLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, + getSilentLogger, + logAllEvents, + waitForSocketEvent, } from '../ws.util'; describe('Public Contract Inverse Websocket Client', () => { diff --git a/test/contract/ws.public.usdt.test.ts b/test/contract/ws.public.usdt.test.ts index c5da8b5..c72b7c5 100644 --- a/test/contract/ws.public.usdt.test.ts +++ b/test/contract/ws.public.usdt.test.ts @@ -1,13 +1,15 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - logAllEvents, - getSilentLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, + getSilentLogger, + logAllEvents, + waitForSocketEvent, } from '../ws.util'; describe('Public Contract USDT Websocket Client', () => { diff --git a/test/inverse-futures/private.read.test.ts b/test/inverse-futures/private.read.test.ts index 0d52485..02c695e 100644 --- a/test/inverse-futures/private.read.test.ts +++ b/test/inverse-futures/private.read.test.ts @@ -11,7 +11,8 @@ describe('Private Inverse-Futures REST API GET Endpoints', () => { testnet: false, }); - // Warning: if some of these start to fail with 10001 params error, it's probably that this future expired and a newer one exists with a different symbol! + // Warning: if some of these start to fail with 10001 params error, + // it's probably that this future expired and a newer one exists with a different symbol! let symbol = ''; beforeAll(async () => { diff --git a/test/inverse-futures/private.write.test.ts b/test/inverse-futures/private.write.test.ts index 7573ca5..d8b60da 100644 --- a/test/inverse-futures/private.write.test.ts +++ b/test/inverse-futures/private.write.test.ts @@ -16,7 +16,8 @@ describe('Private Inverse-Futures REST API POST Endpoints', () => { testnet: false, }); - // Warning: if some of these start to fail with 10001 params error, it's probably that this future expired and a newer one exists with a different symbol! + // Warning: if some of these start to fail with 10001 params error, + // it's probably that this future expired and a newer one exists with a different symbol! let symbol = ''; beforeAll(async () => { diff --git a/test/inverse/ws.private.test.ts b/test/inverse/ws.private.test.ts index 6c6bc5c..b4000ba 100644 --- a/test/inverse/ws.private.test.ts +++ b/test/inverse/ws.private.test.ts @@ -1,12 +1,12 @@ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { + WS_OPEN_EVENT_PARTIAL, getSilentLogger, waitForSocketEvent, - WS_OPEN_EVENT_PARTIAL, } from '../ws.util'; describe('Private Inverse Perps Websocket Client', () => { diff --git a/test/inverse/ws.public.test.ts b/test/inverse/ws.public.test.ts index 901e14f..305059e 100644 --- a/test/inverse/ws.public.test.ts +++ b/test/inverse/ws.public.test.ts @@ -1,14 +1,16 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { LinearClient, - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - promiseSleep, - getSilentLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, + getSilentLogger, + promiseSleep, + waitForSocketEvent, } from '../ws.util'; describe('Public Inverse Perps Websocket Client', () => { diff --git a/test/linear/private.write.test.ts b/test/linear/private.write.test.ts index a34189f..1fce947 100644 --- a/test/linear/private.write.test.ts +++ b/test/linear/private.write.test.ts @@ -16,7 +16,8 @@ describe('Private Linear REST API POST Endpoints', () => { testnet: false, }); - // Warning: if some of these start to fail with 10001 params error, it's probably that this future expired and a newer one exists with a different symbol! + // Warning: if some of these start to fail with 10001 params error, + // it's probably that this future expired and a newer one exists with a different symbol! const symbol = 'BTCUSDT'; // These tests are primarily check auth is working by expecting balance or order not found style errors diff --git a/test/linear/ws.private.test.ts b/test/linear/ws.private.test.ts index 60c16fd..f6bf92a 100644 --- a/test/linear/ws.private.test.ts +++ b/test/linear/ws.private.test.ts @@ -1,12 +1,12 @@ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { + WS_OPEN_EVENT_PARTIAL, getSilentLogger, waitForSocketEvent, - WS_OPEN_EVENT_PARTIAL, } from '../ws.util'; describe('Private Linear Perps Websocket Client', () => { diff --git a/test/linear/ws.public.test.ts b/test/linear/ws.public.test.ts index 744edc1..75647bb 100644 --- a/test/linear/ws.public.test.ts +++ b/test/linear/ws.public.test.ts @@ -1,12 +1,12 @@ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { + WS_OPEN_EVENT_PARTIAL, getSilentLogger, waitForSocketEvent, - WS_OPEN_EVENT_PARTIAL, } from '../ws.util'; describe('Public Linear Perps Websocket Client', () => { diff --git a/test/response.util.ts b/test/response.util.ts index 48823d7..36adaec 100644 --- a/test/response.util.ts +++ b/test/response.util.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { API_ERROR_CODE } from '../src'; const SUCCESS_MSG_REGEX = /OK|SUCCESS|success|success\.|Request accepted|/gim; @@ -19,7 +20,7 @@ export function successResponseListV3() { }; } -export function successResponseObject(successMsg: string | null = 'OK') { +export function successResponseObject() { return { result: expect.any(Object), ret_code: API_ERROR_CODE.SUCCESS, diff --git a/test/spot/private.v1.write.test.ts b/test/spot/private.v1.write.test.ts index fb59c7a..f833f64 100644 --- a/test/spot/private.v1.write.test.ts +++ b/test/spot/private.v1.write.test.ts @@ -16,7 +16,8 @@ describe('Private Spot REST API POST Endpoints', () => { testnet: false, }); - // Warning: if some of these start to fail with 10001 params error, it's probably that this future expired and a newer one exists with a different symbol! + // Warning: if some of these start to fail with 10001 params error, + // it's probably that this future expired and a newer one exists with a different symbol! const symbol = 'BTCUSDT'; // These tests are primarily check auth is working by expecting balance or order not found style errors diff --git a/test/spot/private.v3.read.test.ts b/test/spot/private.v3.read.test.ts index 8c4fa37..ee59dc0 100644 --- a/test/spot/private.v3.read.test.ts +++ b/test/spot/private.v3.read.test.ts @@ -21,7 +21,7 @@ describe('Private Spot REST API GET Endpoints', () => { }); const symbol = 'BTCUSDT'; - const interval = '15m'; + // const interval = '15m'; const ltCode = 'BTC3S'; it('getOrder()', async () => { diff --git a/test/spot/public.v1.test.ts b/test/spot/public.v1.test.ts index e89afbc..90288f8 100644 --- a/test/spot/public.v1.test.ts +++ b/test/spot/public.v1.test.ts @@ -1,3 +1,5 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { SpotClient } from '../../src'; import { notAuthenticatedError, @@ -28,43 +30,39 @@ describe('Public Spot REST API Endpoints', () => { it('getOrderBook()', async () => { expect(await api.getOrderBook(symbol)).toMatchObject( - successResponseObject(null) + successResponseObject() ); }); it('getMergedOrderBook()', async () => { expect(await api.getMergedOrderBook(symbol)).toMatchObject( - successResponseObject(null) + successResponseObject() ); }); it('getTrades()', async () => { - expect(await api.getTrades(symbol)).toMatchObject( - successResponseObject(null) - ); + expect(await api.getTrades(symbol)).toMatchObject(successResponseObject()); }); it('getCandles()', async () => { expect(await api.getCandles(symbol, interval)).toMatchObject( - successResponseObject(null) + successResponseObject() ); }); it('get24hrTicker()', async () => { - expect(await api.get24hrTicker()).toMatchObject( - successResponseObject(null) - ); + expect(await api.get24hrTicker()).toMatchObject(successResponseObject()); }); it('getLastTradedPrice()', async () => { expect(await api.getLastTradedPrice()).toMatchObject( - successResponseObject(null) + successResponseObject() ); }); it('getBestBidAskPrice()', async () => { expect(await api.getBestBidAskPrice()).toMatchObject( - successResponseObject(null) + successResponseObject() ); }); diff --git a/test/spot/public.v3.test.ts b/test/spot/public.v3.test.ts index 58d92cb..d908c46 100644 --- a/test/spot/public.v3.test.ts +++ b/test/spot/public.v3.test.ts @@ -1,3 +1,5 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { SpotClientV3 } from '../../src'; import { notAuthenticatedError, diff --git a/test/spot/ws.private.v1.test.ts b/test/spot/ws.private.v1.test.ts index 617e21b..d409b7f 100644 --- a/test/spot/ws.private.v1.test.ts +++ b/test/spot/ws.private.v1.test.ts @@ -1,15 +1,17 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - logAllEvents, - promiseSleep, - getSilentLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, fullLogger, + getSilentLogger, + logAllEvents, + promiseSleep, + waitForSocketEvent, } from '../ws.util'; describe('Private Spot V1 Websocket Client', () => { diff --git a/test/spot/ws.private.v3.test.ts b/test/spot/ws.private.v3.test.ts index 39a3b0b..0628151 100644 --- a/test/spot/ws.private.v3.test.ts +++ b/test/spot/ws.private.v3.test.ts @@ -1,13 +1,15 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_ERROR_ENUM, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { + WS_OPEN_EVENT_PARTIAL, getSilentLogger, waitForSocketEvent, - WS_OPEN_EVENT_PARTIAL, } from '../ws.util'; describe('Private Spot V3 Websocket Client', () => { @@ -19,7 +21,7 @@ describe('Private Spot V3 Websocket Client', () => { key: API_KEY, secret: API_SECRET, }; - const wsTopic = `outboundAccountInfo`; + const wsTopic = 'outboundAccountInfo'; describe('with invalid credentials', () => { it('should reject private subscribe if keys/signature are incorrect', async () => { diff --git a/test/spot/ws.public.v1.test.ts b/test/spot/ws.public.v1.test.ts index 0e2219c..b6b1d87 100644 --- a/test/spot/ws.public.v1.test.ts +++ b/test/spot/ws.public.v1.test.ts @@ -1,14 +1,16 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - logAllEvents, - getSilentLogger, - fullLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, + fullLogger, + getSilentLogger, + logAllEvents, + waitForSocketEvent, } from '../ws.util'; describe('Public Spot V1 Websocket Client', () => { @@ -64,7 +66,7 @@ describe('Public Spot V1 Websocket Client', () => { try { await wsUpdatePromise; } catch (e) { - console.error(`Wait for spot v1 orderbook event exception: `, e); + console.error('Wait for spot v1 orderbook event exception: ', e); } }); }); diff --git a/test/spot/ws.public.v3.test.ts b/test/spot/ws.public.v3.test.ts index bea6951..a6327d8 100644 --- a/test/spot/ws.public.v3.test.ts +++ b/test/spot/ws.public.v3.test.ts @@ -1,14 +1,16 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - logAllEvents, - getSilentLogger, - fullLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, + fullLogger, + getSilentLogger, + logAllEvents, + waitForSocketEvent, } from '../ws.util'; describe('Public Spot V3 Websocket Client', () => { diff --git a/test/unified-margin/public.read.test.ts b/test/unified-margin/public.read.test.ts index 406e8a9..0798f5f 100644 --- a/test/unified-margin/public.read.test.ts +++ b/test/unified-margin/public.read.test.ts @@ -1,4 +1,4 @@ -import { UnifiedMarginClient, UMCandlesRequest } from '../../src'; +import { UMCandlesRequest, UnifiedMarginClient } from '../../src'; import { successResponseObject, successResponseObjectV3, diff --git a/test/unified-margin/ws.private.test.ts b/test/unified-margin/ws.private.test.ts index 9e738a5..fbe6760 100644 --- a/test/unified-margin/ws.private.test.ts +++ b/test/unified-margin/ws.private.test.ts @@ -1,14 +1,16 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - logAllEvents, - getSilentLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, fullLogger, + getSilentLogger, + logAllEvents, + waitForSocketEvent, } from '../ws.util'; describe('Private Unified Margin Websocket Client', () => { diff --git a/test/unified-margin/ws.public.option.test.ts b/test/unified-margin/ws.public.option.test.ts index 0870511..0d7cc79 100644 --- a/test/unified-margin/ws.public.option.test.ts +++ b/test/unified-margin/ws.public.option.test.ts @@ -1,13 +1,15 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - logAllEvents, - getSilentLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, + getSilentLogger, + logAllEvents, + waitForSocketEvent, } from '../ws.util'; describe('Public Unified Margin Websocket Client (Options)', () => { diff --git a/test/unified-margin/ws.public.perp.usdc.test.ts b/test/unified-margin/ws.public.perp.usdc.test.ts index 9abd3c7..11634f4 100644 --- a/test/unified-margin/ws.public.perp.usdc.test.ts +++ b/test/unified-margin/ws.public.perp.usdc.test.ts @@ -1,14 +1,16 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - logAllEvents, - getSilentLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, fullLogger, + getSilentLogger, + logAllEvents, + waitForSocketEvent, } from '../ws.util'; describe('Public Unified Margin Websocket Client (Perps - USDC)', () => { diff --git a/test/unified-margin/ws.public.perp.usdt.test.ts b/test/unified-margin/ws.public.perp.usdt.test.ts index 8bb1017..34f27a3 100644 --- a/test/unified-margin/ws.public.perp.usdt.test.ts +++ b/test/unified-margin/ws.public.perp.usdt.test.ts @@ -1,14 +1,16 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../src'; import { - logAllEvents, - getSilentLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, fullLogger, + getSilentLogger, + logAllEvents, + waitForSocketEvent, } from '../ws.util'; describe('Public Unified Margin Websocket Client (Perps - USDT)', () => { diff --git a/test/usdc/options/ws.private.test.ts b/test/usdc/options/ws.private.test.ts index b6f52d4..6efcccf 100644 --- a/test/usdc/options/ws.private.test.ts +++ b/test/usdc/options/ws.private.test.ts @@ -1,15 +1,17 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_ERROR_ENUM, WS_KEY_MAP, + WebsocketClient, } from '../../../src'; import { + WS_OPEN_EVENT_PARTIAL, fullLogger, getSilentLogger, logAllEvents, waitForSocketEvent, - WS_OPEN_EVENT_PARTIAL, } from '../../ws.util'; describe('Private USDC Option Websocket Client', () => { @@ -22,7 +24,7 @@ describe('Private USDC Option Websocket Client', () => { secret: API_SECRET, }; - const wsTopic = `user.openapi.option.position`; + const wsTopic = 'user.openapi.option.position'; describe('with invalid credentials', () => { it('should reject private subscribe if keys/signature are incorrect', async () => { diff --git a/test/usdc/options/ws.public.test.ts b/test/usdc/options/ws.public.test.ts index 63d6ef9..ad054b4 100644 --- a/test/usdc/options/ws.public.test.ts +++ b/test/usdc/options/ws.public.test.ts @@ -1,13 +1,15 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../../src'; import { - logAllEvents, - getSilentLogger, - waitForSocketEvent, WS_OPEN_EVENT_PARTIAL, + getSilentLogger, + logAllEvents, + waitForSocketEvent, } from '../../ws.util'; describe('Public USDC Option Websocket Client', () => { diff --git a/test/usdc/perpetual/ws.private.test.ts b/test/usdc/perpetual/ws.private.test.ts index 5c2e302..e9011d4 100644 --- a/test/usdc/perpetual/ws.private.test.ts +++ b/test/usdc/perpetual/ws.private.test.ts @@ -1,15 +1,17 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { - WebsocketClient, WSClientConfigurableOptions, WS_ERROR_ENUM, WS_KEY_MAP, + WebsocketClient, } from '../../../src'; import { + WS_OPEN_EVENT_PARTIAL, fullLogger, getSilentLogger, logAllEvents, waitForSocketEvent, - WS_OPEN_EVENT_PARTIAL, } from '../../ws.util'; describe('Private USDC Perp Websocket Client', () => { @@ -22,7 +24,7 @@ describe('Private USDC Perp Websocket Client', () => { secret: API_SECRET, }; - const wsTopic = `user.openapi.perp.position`; + const wsTopic = 'user.openapi.perp.position'; describe('with invalid credentials', () => { it('should reject private subscribe if keys/signature are incorrect', async () => { diff --git a/test/usdc/perpetual/ws.public.test.ts b/test/usdc/perpetual/ws.public.test.ts index 4c7dded..a44db83 100644 --- a/test/usdc/perpetual/ws.public.test.ts +++ b/test/usdc/perpetual/ws.public.test.ts @@ -1,13 +1,12 @@ import { - WebsocketClient, WSClientConfigurableOptions, WS_KEY_MAP, + WebsocketClient, } from '../../../src'; import { - logAllEvents, + WS_OPEN_EVENT_PARTIAL, getSilentLogger, waitForSocketEvent, - WS_OPEN_EVENT_PARTIAL, } from '../../ws.util'; describe('Public USDC Perp Websocket Client', () => { diff --git a/test/ws.util.ts b/test/ws.util.ts index a20793b..695bedb 100644 --- a/test/ws.util.ts +++ b/test/ws.util.ts @@ -1,3 +1,5 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable @typescript-eslint/no-empty-function */ import { WebsocketClient, WsClientEvent } from '../src'; export function getSilentLogger(logHint?: string) { @@ -33,6 +35,7 @@ export function waitForSocketEvent( return new Promise((resolve, reject) => { const timeout = setTimeout(() => { reject( + // eslint-disable-next-line max-len `Failed to receive "${event}" event before timeout. Check that these are correct: topic, api keys (if private), signature process (if private)` ); }, timeoutMs); diff --git a/tsconfig.examples.json b/tsconfig.examples.json new file mode 100644 index 0000000..d1f02f1 --- /dev/null +++ b/tsconfig.examples.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "distExamples", + "allowJs": true + }, + "include": ["examples/**/*.ts", "examples/**/*.js"] +} diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 0000000..c381f98 --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "distTest", + "allowJs": true + }, + "include": ["test/**/*.ts", "test/**/*.js"] +}