address linter complaints

This commit is contained in:
tiagosiebler
2023-02-17 14:01:07 +00:00
parent 8e54ecbaf5
commit dd6ef2fea5
37 changed files with 154 additions and 106 deletions

View File

@@ -16,7 +16,11 @@
], ],
"parserOptions": { "parserOptions": {
"projecasdft": true, "projecasdft": true,
"project": ["./tsconfig.json", "examples/tsconfig.examples.json"] "project": [
"./tsconfig.json",
"examples/tsconfig.examples.json",
"tsconfig.test.json"
]
}, },
"rules": { "rules": {
"@typescript-eslint/await-thenable": "error", "@typescript-eslint/await-thenable": "error",

View File

@@ -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"
]
}

View File

@@ -1,4 +1,4 @@
import { WebsocketClient, WS_KEY_MAP, DefaultLogger } from '../src'; import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from '../src';
// or // or
// import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from 'bybit-api'; // import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from 'bybit-api';

View File

@@ -18,8 +18,8 @@ import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from '../src';
// market: 'spot', // market: 'spot',
// market: 'spotv3', // market: 'spotv3',
// market: 'usdcOption', // market: 'usdcOption',
// market: 'usdcPerp', market: 'usdcPerp',
market: 'unifiedPerp', // market: 'unifiedPerp',
// market: 'unifiedOption', // market: 'unifiedOption',
}, },
logger 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) // usdc perps (note: the syntax is different for the unified perp market)
// (market: 'usdcPerp')
// wsClient.subscribe('trade.BTCUSDC'); // wsClient.subscribe('trade.BTCUSDC');
wsClient.subscribe('instrument_info.100ms.BTCPERP');
// unified perps // unified perps
// wsClient.subscribe('publicTrade.BTCUSDT'); // 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' // For spot v1 (the old, deprecated client), request public connection first then send required topics on 'open'
// Not necessary for spot v3 // Not necessary for spot v3

View File

@@ -1,3 +1,4 @@
/* eslint-disable max-len */
import { API_ERROR_CODE, ContractClient } from '../../src'; import { API_ERROR_CODE, ContractClient } from '../../src';
import { successResponseObjectV3 } from '../response.util'; import { successResponseObjectV3 } from '../response.util';

View File

@@ -1,4 +1,4 @@
import { UMCandlesRequest, ContractClient } from '../../src'; import { ContractClient, UMCandlesRequest } from '../../src';
import { import {
successResponseObject, successResponseObject,
successResponseObjectV3, successResponseObjectV3,

View File

@@ -1,14 +1,16 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
logAllEvents,
getSilentLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
fullLogger, fullLogger,
getSilentLogger,
logAllEvents,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Private Contract Websocket Client', () => { describe('Private Contract Websocket Client', () => {

View File

@@ -1,13 +1,15 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
logAllEvents,
getSilentLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
getSilentLogger,
logAllEvents,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Public Contract Inverse Websocket Client', () => { describe('Public Contract Inverse Websocket Client', () => {

View File

@@ -1,13 +1,15 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
logAllEvents,
getSilentLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
getSilentLogger,
logAllEvents,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Public Contract USDT Websocket Client', () => { describe('Public Contract USDT Websocket Client', () => {

View File

@@ -11,7 +11,8 @@ describe('Private Inverse-Futures REST API GET Endpoints', () => {
testnet: false, 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 = ''; let symbol = '';
beforeAll(async () => { beforeAll(async () => {

View File

@@ -16,7 +16,8 @@ describe('Private Inverse-Futures REST API POST Endpoints', () => {
testnet: false, 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 = ''; let symbol = '';
beforeAll(async () => { beforeAll(async () => {

View File

@@ -1,12 +1,12 @@
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
WS_OPEN_EVENT_PARTIAL,
getSilentLogger, getSilentLogger,
waitForSocketEvent, waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL,
} from '../ws.util'; } from '../ws.util';
describe('Private Inverse Perps Websocket Client', () => { describe('Private Inverse Perps Websocket Client', () => {

View File

@@ -1,14 +1,16 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
LinearClient, LinearClient,
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
promiseSleep,
getSilentLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
getSilentLogger,
promiseSleep,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Public Inverse Perps Websocket Client', () => { describe('Public Inverse Perps Websocket Client', () => {

View File

@@ -16,7 +16,8 @@ describe('Private Linear REST API POST Endpoints', () => {
testnet: false, 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'; const symbol = 'BTCUSDT';
// These tests are primarily check auth is working by expecting balance or order not found style errors // These tests are primarily check auth is working by expecting balance or order not found style errors

View File

@@ -1,12 +1,12 @@
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
WS_OPEN_EVENT_PARTIAL,
getSilentLogger, getSilentLogger,
waitForSocketEvent, waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL,
} from '../ws.util'; } from '../ws.util';
describe('Private Linear Perps Websocket Client', () => { describe('Private Linear Perps Websocket Client', () => {

View File

@@ -1,12 +1,12 @@
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
WS_OPEN_EVENT_PARTIAL,
getSilentLogger, getSilentLogger,
waitForSocketEvent, waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL,
} from '../ws.util'; } from '../ws.util';
describe('Public Linear Perps Websocket Client', () => { describe('Public Linear Perps Websocket Client', () => {

View File

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { API_ERROR_CODE } from '../src'; import { API_ERROR_CODE } from '../src';
const SUCCESS_MSG_REGEX = /OK|SUCCESS|success|success\.|Request accepted|/gim; 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 { return {
result: expect.any(Object), result: expect.any(Object),
ret_code: API_ERROR_CODE.SUCCESS, ret_code: API_ERROR_CODE.SUCCESS,

View File

@@ -16,7 +16,8 @@ describe('Private Spot REST API POST Endpoints', () => {
testnet: false, 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'; const symbol = 'BTCUSDT';
// These tests are primarily check auth is working by expecting balance or order not found style errors // These tests are primarily check auth is working by expecting balance or order not found style errors

View File

@@ -21,7 +21,7 @@ describe('Private Spot REST API GET Endpoints', () => {
}); });
const symbol = 'BTCUSDT'; const symbol = 'BTCUSDT';
const interval = '15m'; // const interval = '15m';
const ltCode = 'BTC3S'; const ltCode = 'BTC3S';
it('getOrder()', async () => { it('getOrder()', async () => {

View File

@@ -1,3 +1,5 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { SpotClient } from '../../src'; import { SpotClient } from '../../src';
import { import {
notAuthenticatedError, notAuthenticatedError,
@@ -28,43 +30,39 @@ describe('Public Spot REST API Endpoints', () => {
it('getOrderBook()', async () => { it('getOrderBook()', async () => {
expect(await api.getOrderBook(symbol)).toMatchObject( expect(await api.getOrderBook(symbol)).toMatchObject(
successResponseObject(null) successResponseObject()
); );
}); });
it('getMergedOrderBook()', async () => { it('getMergedOrderBook()', async () => {
expect(await api.getMergedOrderBook(symbol)).toMatchObject( expect(await api.getMergedOrderBook(symbol)).toMatchObject(
successResponseObject(null) successResponseObject()
); );
}); });
it('getTrades()', async () => { it('getTrades()', async () => {
expect(await api.getTrades(symbol)).toMatchObject( expect(await api.getTrades(symbol)).toMatchObject(successResponseObject());
successResponseObject(null)
);
}); });
it('getCandles()', async () => { it('getCandles()', async () => {
expect(await api.getCandles(symbol, interval)).toMatchObject( expect(await api.getCandles(symbol, interval)).toMatchObject(
successResponseObject(null) successResponseObject()
); );
}); });
it('get24hrTicker()', async () => { it('get24hrTicker()', async () => {
expect(await api.get24hrTicker()).toMatchObject( expect(await api.get24hrTicker()).toMatchObject(successResponseObject());
successResponseObject(null)
);
}); });
it('getLastTradedPrice()', async () => { it('getLastTradedPrice()', async () => {
expect(await api.getLastTradedPrice()).toMatchObject( expect(await api.getLastTradedPrice()).toMatchObject(
successResponseObject(null) successResponseObject()
); );
}); });
it('getBestBidAskPrice()', async () => { it('getBestBidAskPrice()', async () => {
expect(await api.getBestBidAskPrice()).toMatchObject( expect(await api.getBestBidAskPrice()).toMatchObject(
successResponseObject(null) successResponseObject()
); );
}); });

View File

@@ -1,3 +1,5 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { SpotClientV3 } from '../../src'; import { SpotClientV3 } from '../../src';
import { import {
notAuthenticatedError, notAuthenticatedError,

View File

@@ -1,15 +1,17 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
logAllEvents,
promiseSleep,
getSilentLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
fullLogger, fullLogger,
getSilentLogger,
logAllEvents,
promiseSleep,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Private Spot V1 Websocket Client', () => { describe('Private Spot V1 Websocket Client', () => {

View File

@@ -1,13 +1,15 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_ERROR_ENUM, WS_ERROR_ENUM,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
WS_OPEN_EVENT_PARTIAL,
getSilentLogger, getSilentLogger,
waitForSocketEvent, waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL,
} from '../ws.util'; } from '../ws.util';
describe('Private Spot V3 Websocket Client', () => { describe('Private Spot V3 Websocket Client', () => {
@@ -19,7 +21,7 @@ describe('Private Spot V3 Websocket Client', () => {
key: API_KEY, key: API_KEY,
secret: API_SECRET, secret: API_SECRET,
}; };
const wsTopic = `outboundAccountInfo`; const wsTopic = 'outboundAccountInfo';
describe('with invalid credentials', () => { describe('with invalid credentials', () => {
it('should reject private subscribe if keys/signature are incorrect', async () => { it('should reject private subscribe if keys/signature are incorrect', async () => {

View File

@@ -1,14 +1,16 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
logAllEvents,
getSilentLogger,
fullLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
fullLogger,
getSilentLogger,
logAllEvents,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Public Spot V1 Websocket Client', () => { describe('Public Spot V1 Websocket Client', () => {
@@ -64,7 +66,7 @@ describe('Public Spot V1 Websocket Client', () => {
try { try {
await wsUpdatePromise; await wsUpdatePromise;
} catch (e) { } catch (e) {
console.error(`Wait for spot v1 orderbook event exception: `, e); console.error('Wait for spot v1 orderbook event exception: ', e);
} }
}); });
}); });

View File

@@ -1,14 +1,16 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
logAllEvents,
getSilentLogger,
fullLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
fullLogger,
getSilentLogger,
logAllEvents,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Public Spot V3 Websocket Client', () => { describe('Public Spot V3 Websocket Client', () => {

View File

@@ -1,4 +1,4 @@
import { UnifiedMarginClient, UMCandlesRequest } from '../../src'; import { UMCandlesRequest, UnifiedMarginClient } from '../../src';
import { import {
successResponseObject, successResponseObject,
successResponseObjectV3, successResponseObjectV3,

View File

@@ -1,14 +1,16 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
logAllEvents,
getSilentLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
fullLogger, fullLogger,
getSilentLogger,
logAllEvents,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Private Unified Margin Websocket Client', () => { describe('Private Unified Margin Websocket Client', () => {

View File

@@ -1,13 +1,15 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
logAllEvents,
getSilentLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
getSilentLogger,
logAllEvents,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Public Unified Margin Websocket Client (Options)', () => { describe('Public Unified Margin Websocket Client (Options)', () => {

View File

@@ -1,14 +1,16 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
logAllEvents,
getSilentLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
fullLogger, fullLogger,
getSilentLogger,
logAllEvents,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Public Unified Margin Websocket Client (Perps - USDC)', () => { describe('Public Unified Margin Websocket Client (Perps - USDC)', () => {

View File

@@ -1,14 +1,16 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../src'; } from '../../src';
import { import {
logAllEvents,
getSilentLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
fullLogger, fullLogger,
getSilentLogger,
logAllEvents,
waitForSocketEvent,
} from '../ws.util'; } from '../ws.util';
describe('Public Unified Margin Websocket Client (Perps - USDT)', () => { describe('Public Unified Margin Websocket Client (Perps - USDT)', () => {

View File

@@ -1,15 +1,17 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_ERROR_ENUM, WS_ERROR_ENUM,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../../src'; } from '../../../src';
import { import {
WS_OPEN_EVENT_PARTIAL,
fullLogger, fullLogger,
getSilentLogger, getSilentLogger,
logAllEvents, logAllEvents,
waitForSocketEvent, waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL,
} from '../../ws.util'; } from '../../ws.util';
describe('Private USDC Option Websocket Client', () => { describe('Private USDC Option Websocket Client', () => {
@@ -22,7 +24,7 @@ describe('Private USDC Option Websocket Client', () => {
secret: API_SECRET, secret: API_SECRET,
}; };
const wsTopic = `user.openapi.option.position`; const wsTopic = 'user.openapi.option.position';
describe('with invalid credentials', () => { describe('with invalid credentials', () => {
it('should reject private subscribe if keys/signature are incorrect', async () => { it('should reject private subscribe if keys/signature are incorrect', async () => {

View File

@@ -1,13 +1,15 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../../src'; } from '../../../src';
import { import {
logAllEvents,
getSilentLogger,
waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL, WS_OPEN_EVENT_PARTIAL,
getSilentLogger,
logAllEvents,
waitForSocketEvent,
} from '../../ws.util'; } from '../../ws.util';
describe('Public USDC Option Websocket Client', () => { describe('Public USDC Option Websocket Client', () => {

View File

@@ -1,15 +1,17 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_ERROR_ENUM, WS_ERROR_ENUM,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../../src'; } from '../../../src';
import { import {
WS_OPEN_EVENT_PARTIAL,
fullLogger, fullLogger,
getSilentLogger, getSilentLogger,
logAllEvents, logAllEvents,
waitForSocketEvent, waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL,
} from '../../ws.util'; } from '../../ws.util';
describe('Private USDC Perp Websocket Client', () => { describe('Private USDC Perp Websocket Client', () => {
@@ -22,7 +24,7 @@ describe('Private USDC Perp Websocket Client', () => {
secret: API_SECRET, secret: API_SECRET,
}; };
const wsTopic = `user.openapi.perp.position`; const wsTopic = 'user.openapi.perp.position';
describe('with invalid credentials', () => { describe('with invalid credentials', () => {
it('should reject private subscribe if keys/signature are incorrect', async () => { it('should reject private subscribe if keys/signature are incorrect', async () => {

View File

@@ -1,13 +1,12 @@
import { import {
WebsocketClient,
WSClientConfigurableOptions, WSClientConfigurableOptions,
WS_KEY_MAP, WS_KEY_MAP,
WebsocketClient,
} from '../../../src'; } from '../../../src';
import { import {
logAllEvents, WS_OPEN_EVENT_PARTIAL,
getSilentLogger, getSilentLogger,
waitForSocketEvent, waitForSocketEvent,
WS_OPEN_EVENT_PARTIAL,
} from '../../ws.util'; } from '../../ws.util';
describe('Public USDC Perp Websocket Client', () => { describe('Public USDC Perp Websocket Client', () => {

View File

@@ -1,3 +1,5 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-empty-function */
import { WebsocketClient, WsClientEvent } from '../src'; import { WebsocketClient, WsClientEvent } from '../src';
export function getSilentLogger(logHint?: string) { export function getSilentLogger(logHint?: string) {
@@ -33,6 +35,7 @@ export function waitForSocketEvent(
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
reject( 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)` `Failed to receive "${event}" event before timeout. Check that these are correct: topic, api keys (if private), signature process (if private)`
); );
}, timeoutMs); }, timeoutMs);

8
tsconfig.examples.json Normal file
View File

@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "distExamples",
"allowJs": true
},
"include": ["examples/**/*.ts", "examples/**/*.js"]
}

8
tsconfig.test.json Normal file
View File

@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "distTest",
"allowJs": true
},
"include": ["test/**/*.ts", "test/**/*.js"]
}