Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.

Commit e7645b3

Browse files
author
Tiago Siebler
committed
chore: clean up old methods
1 parent 42fcfe3 commit e7645b3

2 files changed

Lines changed: 4 additions & 65 deletions

File tree

src/WebsocketClient.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -647,49 +647,10 @@ export class WebsocketClient extends BaseWebsocketClient<
647647
return PRIVATE_WS_KEYS;
648648
}
649649

650-
// TODO: is auth mechn for bitmart, auth after connect?
651650
protected isAuthOnConnectWsKey(wsKey: WsKey): boolean {
652651
return PRIVATE_WS_KEYS.includes(wsKey);
653652
}
654653

655-
/**
656-
* Map one or more topics into fully prepared "subscribe request" events (already stringified and ready to send)
657-
*/
658-
protected getWsSubscribeEventsForTopics(
659-
topics: WsTopic[],
660-
wsKey: WsKey,
661-
): string[] {
662-
if (!topics.length) {
663-
return [];
664-
}
665-
666-
const market = this.getWsMarketForWsKey(wsKey);
667-
668-
const subscribeEvents: string[] = [];
669-
670-
const maxTopicsPerEvent = this.getMaxTopicsPerSubscribeEvent(wsKey);
671-
if (
672-
maxTopicsPerEvent &&
673-
maxTopicsPerEvent !== null &&
674-
topics.length > maxTopicsPerEvent
675-
) {
676-
for (let i = 0; i < topics.length; i += maxTopicsPerEvent) {
677-
const batch = topics.slice(i, i + maxTopicsPerEvent);
678-
const subscribeEvent = this.getWsRequestEvent(
679-
market,
680-
'subscribe',
681-
batch,
682-
);
683-
subscribeEvents.push(JSON.stringify(subscribeEvent));
684-
}
685-
686-
return subscribeEvents;
687-
}
688-
689-
const subscribeEvent = this.getWsRequestEvent(market, 'subscribe', topics);
690-
return [JSON.stringify(subscribeEvent)];
691-
}
692-
693654
/**
694655
* Map one or more topics into fully prepared "unsubscribe request" events (already stringified and ready to send)
695656
*/

src/lib/BaseWSClient.ts

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ export abstract class BaseWebsocketClient<
198198
reconnectTimeout: 500,
199199
recvWindow: 0,
200200

201-
// TODO: what's the setting for these on bitmart?
202201
// Requires a confirmation "response" from the ws connection before assuming it is ready
203202
requireConnectionReadyConfirmation: false,
204203

@@ -210,7 +209,7 @@ export abstract class BaseWebsocketClient<
210209
authPrivateRequests: false,
211210

212211
// Automatically re-auth WS API, if we were auth'd before and get reconnected
213-
reauthWSAPIOnReconnect: true, // TODO: not in use?
212+
reauthWSAPIOnReconnect: true,
214213

215214
// Whether to use native heartbeats (depends on the exchange)
216215
useNativeHeartbeats: false,
@@ -287,23 +286,6 @@ export abstract class BaseWebsocketClient<
287286
wsKey: TWSKey,
288287
): Promise<MidflightWsRequestEvent<TWSRequestEvent>[]>;
289288

290-
// TODO: deprecate these two
291-
// /**
292-
// * Returns a list of string events that can be individually sent upstream to complete subscribing to these topics
293-
// */
294-
// protected abstract getWsSubscribeEventsForTopics(
295-
// topics: WsTopic[],
296-
// wsKey: TWSKey,
297-
// ): string[];
298-
299-
// /**
300-
// * Returns a list of string events that can be individually sent upstream to complete unsubscribing to these topics
301-
// */
302-
// protected abstract getWsUnsubscribeEventsForTopics(
303-
// topics: WsTopic[],
304-
// wsKey: TWSKey,
305-
// ): string[];
306-
307289
/**
308290
* Abstraction called to sort ws events into emittable event types (response to a request, data update, etc)
309291
*/
@@ -317,10 +299,6 @@ export abstract class BaseWebsocketClient<
317299
*/
318300
abstract connectAll(): Promise<WSConnectedResult | undefined>[];
319301

320-
protected isPrivateWsKey(wsKey: TWSKey): boolean {
321-
return this.getPrivateWSKeys().includes(wsKey);
322-
}
323-
324302
/** Returns auto-incrementing request ID, used to track promise references for async requests */
325303
protected getNewRequestId(): number {
326304
return ++this.wsApiRequestId;
@@ -388,7 +366,7 @@ export abstract class BaseWebsocketClient<
388366
}
389367

390368
// We're connected. Check if auth is needed and if already authenticated
391-
const isPrivateConnection = this.isPrivateWsKey(wsKey);
369+
const isPrivateConnection = this.isAuthOnConnectWsKey(wsKey);
392370
const isAuthenticated = this.wsStore.get(wsKey)?.isAuthenticated;
393371
if (isPrivateConnection && !isAuthenticated) {
394372
/**
@@ -429,7 +407,7 @@ export abstract class BaseWebsocketClient<
429407
}
430408

431409
// We're connected. Check if auth is needed and if already authenticated
432-
const isPrivateConnection = this.isPrivateWsKey(wsKey);
410+
const isPrivateConnection = this.isAuthOnConnectWsKey(wsKey);
433411
const isAuthenticated = this.wsStore.get(wsKey)?.isAuthenticated;
434412
if (isPrivateConnection && !isAuthenticated) {
435413
/**
@@ -1080,7 +1058,7 @@ export abstract class BaseWebsocketClient<
10801058

10811059
// Some websockets require an auth packet to be sent after opening the connection
10821060
if (
1083-
this.isAuthOnConnectWsKey(wsKey) && // same as isPrivateWsKey << deprecate isPrivateWsKey TODO:
1061+
this.isAuthOnConnectWsKey(wsKey) &&
10841062
this.authPrivateConnectionsOnConnect(wsKey)
10851063
) {
10861064
await this.assertIsAuthenticated(wsKey);

0 commit comments

Comments
 (0)