address linter complaints
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable max-len */
|
||||
import { API_ERROR_CODE, ContractClient } from '../../src';
|
||||
import { successResponseObjectV3 } from '../response.util';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UMCandlesRequest, ContractClient } from '../../src';
|
||||
import { ContractClient, UMCandlesRequest } from '../../src';
|
||||
import {
|
||||
successResponseObject,
|
||||
successResponseObjectV3,
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { SpotClientV3 } from '../../src';
|
||||
import {
|
||||
notAuthenticatedError,
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UnifiedMarginClient, UMCandlesRequest } from '../../src';
|
||||
import { UMCandlesRequest, UnifiedMarginClient } from '../../src';
|
||||
import {
|
||||
successResponseObject,
|
||||
successResponseObjectV3,
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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)', () => {
|
||||
|
||||
@@ -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)', () => {
|
||||
|
||||
@@ -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)', () => {
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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);
|
||||
|
||||
8
tsconfig.examples.json
Normal file
8
tsconfig.examples.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "distExamples",
|
||||
"allowJs": true
|
||||
},
|
||||
"include": ["examples/**/*.ts", "examples/**/*.js"]
|
||||
}
|
||||
8
tsconfig.test.json
Normal file
8
tsconfig.test.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "distTest",
|
||||
"allowJs": true
|
||||
},
|
||||
"include": ["test/**/*.ts", "test/**/*.js"]
|
||||
}
|
||||
Reference in New Issue
Block a user