v3.7.1: chore() naming consistency for interface, pass through logger for ws url getter

This commit is contained in:
tiagosiebler
2023-06-27 11:13:54 +01:00
parent b12f243a3d
commit 2d31bda1d7
7 changed files with 19 additions and 11 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "bybit-api", "name": "bybit-api",
"version": "3.7.0", "version": "3.7.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "bybit-api", "name": "bybit-api",
"version": "3.7.0", "version": "3.7.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"axios": "^0.21.0", "axios": "^0.21.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "bybit-api", "name": "bybit-api",
"version": "3.7.0", "version": "3.7.1",
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.", "description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",

View File

@@ -46,8 +46,8 @@ import {
FeeRateV5, FeeRateV5,
FundingRateHistoryResponseV5, FundingRateHistoryResponseV5,
GetAccountCoinBalanceParamsV5, GetAccountCoinBalanceParamsV5,
GetAccountHistoricOrdersPArams, GetAccountHistoricOrdersParamsV5,
GetAccountOrdersParams, GetAccountOrdersParamsV5,
GetAllCoinsBalanceParamsV5, GetAllCoinsBalanceParamsV5,
GetAllowedDepositCoinInfoParamsV5, GetAllowedDepositCoinInfoParamsV5,
GetAssetInfoParamsV5, GetAssetInfoParamsV5,
@@ -392,7 +392,7 @@ export class RestClientV5 extends BaseRestClient {
* Query unfilled or partially filled orders in real-time. To query older order records, please use the order history interface. * Query unfilled or partially filled orders in real-time. To query older order records, please use the order history interface.
*/ */
getActiveOrders( getActiveOrders(
params: GetAccountOrdersParams, params: GetAccountOrdersParamsV5,
): Promise<APIResponseV3WithTime<CategoryCursorListV5<AccountOrderV5[]>>> { ): Promise<APIResponseV3WithTime<CategoryCursorListV5<AccountOrderV5[]>>> {
return this.getPrivate('/v5/order/realtime', params); return this.getPrivate('/v5/order/realtime', params);
} }
@@ -409,7 +409,7 @@ export class RestClientV5 extends BaseRestClient {
* If you want to get real-time order information, you could query this endpoint or rely on the websocket stream (recommended). * If you want to get real-time order information, you could query this endpoint or rely on the websocket stream (recommended).
*/ */
getHistoricOrders( getHistoricOrders(
params: GetAccountHistoricOrdersPArams, params: GetAccountHistoricOrdersParamsV5,
): Promise<APIResponseV3WithTime<CategoryCursorListV5<AccountOrderV5[]>>> { ): Promise<APIResponseV3WithTime<CategoryCursorListV5<AccountOrderV5[]>>> {
return this.getPrivate('/v5/order/history', params); return this.getPrivate('/v5/order/history', params);
} }

View File

@@ -67,7 +67,7 @@ export interface CancelOrderParamsV5 {
orderFilter?: OrderFilterV5; orderFilter?: OrderFilterV5;
} }
export interface GetAccountOrdersParams { export interface GetAccountOrdersParamsV5 {
category: CategoryV5; category: CategoryV5;
symbol?: string; symbol?: string;
baseCoin?: string; baseCoin?: string;
@@ -81,7 +81,7 @@ export interface GetAccountOrdersParams {
cursor?: string; cursor?: string;
} }
export interface GetAccountHistoricOrdersPArams { export interface GetAccountHistoricOrdersParamsV5 {
category: CategoryV5; category: CategoryV5;
symbol?: string; symbol?: string;
baseCoin?: string; baseCoin?: string;

View File

@@ -1,4 +1,5 @@
import { APIMarket, CategoryV5, WsKey } from '../types'; import { APIMarket, CategoryV5, WsKey } from '../types';
import { DefaultLogger } from './logger';
interface NetworkMapV3 { interface NetworkMapV3 {
livenet: string; livenet: string;
@@ -397,6 +398,7 @@ export function getWsUrl(
wsKey: WsKey, wsKey: WsKey,
wsUrl: string | undefined, wsUrl: string | undefined,
isTestnet: boolean, isTestnet: boolean,
logger: typeof DefaultLogger,
): string { ): string {
if (wsUrl) { if (wsUrl) {
return wsUrl; return wsUrl;
@@ -479,7 +481,7 @@ export function getWsUrl(
return WS_BASE_URL_MAP.v5OptionPublic.public[networkKey]; return WS_BASE_URL_MAP.v5OptionPublic.public[networkKey];
} }
default: { default: {
this.logger.error('getWsUrl(): Unhandled wsKey: ', { logger.error('getWsUrl(): Unhandled wsKey: ', {
category: 'bybit-ws', category: 'bybit-ws',
wsKey, wsKey,
}); });

View File

@@ -621,7 +621,12 @@ export class WebsocketClient extends EventEmitter {
} }
const authParams = await this.getAuthParams(wsKey); const authParams = await this.getAuthParams(wsKey);
const url = getWsUrl(wsKey, this.options.wsUrl, this.isTestnet()); const url = getWsUrl(
wsKey,
this.options.wsUrl,
this.isTestnet(),
this.logger,
);
const ws = this.connectToWsUrl(url + authParams, wsKey); const ws = this.connectToWsUrl(url + authParams, wsKey);
return this.wsStore.setWs(wsKey, ws); return this.wsStore.setWs(wsKey, ws);

View File

@@ -21,6 +21,7 @@ function generateConfig(name) {
alias: { alias: {
[path.resolve(__dirname, "../lib/util/node-support.js")]: [path.resolve(__dirname, "../lib/util/node-support.js")]:
path.resolve(__dirname, "../lib/util/browser-support.js"), path.resolve(__dirname, "../lib/util/browser-support.js"),
process: "process/browser",
} }
}, },