Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bybit-api

Package Overview
Dependencies
Maintainers
1
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bybit-api - npm Package Compare versions

Comparing version 2.0.6 to 2.0.7

2

lib/linear-client.d.ts

@@ -8,3 +8,3 @@ import { AxiosRequestConfig } from 'axios';

/**
* @public Creates an instance of the inverse REST API client.
* @public Creates an instance of the linear REST API client.
*

@@ -11,0 +11,0 @@ * @param {string} key - your API key

@@ -12,3 +12,3 @@ "use strict";

/**
* @public Creates an instance of the inverse REST API client.
* @public Creates an instance of the linear REST API client.
*

@@ -15,0 +15,0 @@ * @param {string} key - your API key

@@ -5,6 +5,4 @@ /// <reference types="node" />

import WebSocket from 'isomorphic-ws';
declare type WsTopicList = Set<string>;
declare type KeyedWsTopicLists = {
[key: string]: WsTopicList;
};
declare type WsTopic = string;
declare type WsTopicList = Set<WsTopic>;
interface WsStoredState {

@@ -25,3 +23,3 @@ ws?: WebSocket;

delete(key: string): void;
hasExistingActiveConnection(key: any): boolean | undefined;
hasExistingActiveConnection(key: string): boolean | undefined;
getWs(key: string): WebSocket | undefined;

@@ -34,6 +32,6 @@ setWs(key: string, wsConnection: WebSocket): WebSocket;

getTopics(key: string): WsTopicList;
getTopicsByKey(): KeyedWsTopicLists;
addTopic(key: string, topic: string): WsTopicList;
deleteTopic(key: string, topic: string): boolean;
getTopicsByKey(): Record<string, WsTopicList>;
addTopic(key: string, topic: WsTopic): WsTopicList;
deleteTopic(key: string, topic: WsTopic): boolean;
}
export {};

@@ -18,3 +18,2 @@ "use strict";

}
return undefined;
}

@@ -21,0 +20,0 @@ getKeys() {

/// <reference types="node" />
import { EventEmitter } from 'events';
import WebSocket from 'isomorphic-ws';
import { DefaultLogger } from './logger';
import WebSocket from 'isomorphic-ws';
export declare enum WsConnectionState {

@@ -34,4 +34,5 @@ READY_STATE_INITIAL = 0,

export declare const wsKeyLinearPublic = "linearPublic";
export declare type WsKey = 'inverse' | 'linearPrivate' | 'linearPublic';
export declare interface WebsocketClient {
on(event: 'open' | 'reconnected', listener: ({ wsKey: string, event: any }: {
on(event: 'open' | 'reconnected', listener: ({ wsKey: WsKey, event: any }: {
wsKey: any;

@@ -60,3 +61,3 @@ event: any;

unsubscribe(wsTopics: string[] | string): void;
close(wsKey: string): void;
close(wsKey: WsKey): void;
/**

@@ -63,0 +64,0 @@ * Request connection of all dependent websockets, instead of waiting for automatic connection by library

@@ -17,2 +17,3 @@ "use strict";

const events_1 = require("events");
const isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
const inverse_client_1 = require("./inverse-client");

@@ -23,3 +24,2 @@ const linear_client_1 = require("./linear-client");

const requestUtils_1 = require("./util/requestUtils");
const isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
const WsStore_1 = __importDefault(require("./util/WsStore"));

@@ -98,6 +98,6 @@ const inverseEndpoints = {

// attempt to send subscription topic per websocket
this.wsStore.getKeys().forEach(wsKey => {
this.wsStore.getKeys().forEach((wsKey) => {
// if connected, send subscription request
if (this.wsStore.isConnectionState(wsKey, READY_STATE_CONNECTED)) {
return this.requestSubscribeTopics(wsKey, [...this.wsStore.getTopics(wsKey)]);
return this.requestSubscribeTopics(wsKey, topics);
}

@@ -117,6 +117,6 @@ // start connection process if it hasn't yet begun. Topics are automatically subscribed to on-connect

topics.forEach(topic => this.wsStore.deleteTopic(this.getWsKeyForTopic(topic), topic));
this.wsStore.getKeys().forEach(wsKey => {
this.wsStore.getKeys().forEach((wsKey) => {
// unsubscribe request only necessary if active connection exists
if (this.wsStore.isConnectionState(wsKey, READY_STATE_CONNECTED)) {
this.requestUnsubscribeTopics(wsKey, [...this.wsStore.getTopics(wsKey)]);
this.requestUnsubscribeTopics(wsKey, topics);
}

@@ -315,6 +315,6 @@ });

}
onWsError(err, wsKey) {
this.parseWsError('Websocket error', err, wsKey);
onWsError(error, wsKey) {
this.parseWsError('Websocket error', error, wsKey);
if (this.wsStore.isConnectionState(wsKey, READY_STATE_CONNECTED)) {
this.emit('error', err);
this.emit('error', error);
}

@@ -321,0 +321,0 @@ }

{
"name": "bybit-api",
"version": "2.0.6",
"description": "Node.js connector for Bybit's Inverse & Linear REST APIs and WebSockets",
"version": "2.0.7",
"description": "Node.js connector for Bybit's REST APIs and WebSockets, with TypeScript & integration tests.",
"main": "lib/index.js",

@@ -12,3 +12,4 @@ "types": "lib/index.d.ts",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "jest",
"test:watch": "jest --watch",
"clean": "rm -rf lib dist",

@@ -32,5 +33,8 @@ "build": "tsc",

"devDependencies": {
"@types/jest": "^26.0.23",
"@types/node": "^14.14.7",
"eslint": "^7.10.0",
"jest": "^27.0.4",
"source-map-loader": "^2.0.0",
"ts-jest": "^27.0.3",
"ts-loader": "^8.0.11",

@@ -37,0 +41,0 @@ "typescript": "^4.0.5",

# bybit-api
[![Tests](https://circleci.com/gh/tiagosiebler/bybit-api.svg?style=shield)](https://circleci.com/gh/tiagosiebler/bybit-api)
[![npm version](https://img.shields.io/npm/v/bybit-api)][1] [![npm size](https://img.shields.io/bundlephobia/min/bybit-api/latest)][1] [![npm downloads](https://img.shields.io/npm/dt/bybit-api)][1]

@@ -3,0 +4,0 @@ [![last commit](https://img.shields.io/github/last-commit/tiagosiebler/bybit-api)][1]

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc