v3.9.4: feat() update test & publish actions, update public ws example, disable test for deprecated endpoint

This commit is contained in:
tiagosiebler
2024-02-20 13:00:42 +00:00
parent d3a9bc97f8
commit 5bd2797cb1
6 changed files with 34 additions and 44 deletions

View File

@@ -16,11 +16,12 @@ jobs:
steps:
- name: 'Checkout source code'
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.11.0
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org/'
cache: 'npm'
- name: Install

View File

@@ -8,6 +8,10 @@ on:
branches:
- master
# permissions:
# id-token: 'write'
# contents: 'read'
jobs:
publish-npm:
runs-on: ubuntu-latest
@@ -20,42 +24,28 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
- name: 'Checkout source code'
if: steps.version-updated.outputs.has-updated
uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
if: steps.version-updated.outputs.has-updated
with:
node-version: 20.11.0
node-version-file: '.nvmrc'
registry-url: https://registry.npmjs.org/
cache: 'npm'
- run: npm ci --ignore-scripts
- name: Install
run: npm ci --ignore-scripts
if: steps.version-updated.outputs.has-updated
- run: npm run clean
if: steps.version-updated.outputs.has-updated
- run: npm run build
if: steps.version-updated.outputs.has-updated
- run: npm publish --ignore-scripts
- run: npm publish --ignore-scripts --provenance
if: steps.version-updated.outputs.has-updated
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
# - name: Create Github Release
# if: steps.version-updated.outputs.has-updated
# id: create_release
# uses: ncipollo/release-action@v1
#publish-gpr:
#needs: build
#runs-on: ubuntu-latest
#steps:
#- uses: actions/checkout@v2
#- uses: actions/setup-node@v1
# with:
# node-version: 12
# registry-url: https://npm.pkg.github.com/
#- run: npm ci
#- run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

View File

@@ -19,16 +19,13 @@ const logger = {
*/
const wsClient = new WebsocketClient(
{
// key: key,
// secret: secret,
market: 'v5',
},
logger
logger,
);
wsClient.on('update', (data) => {
console.log('raw message received ', JSON.stringify(data));
// console.log('raw message received ', JSON.stringify(data, null, 2));
});
wsClient.on('open', (data) => {
@@ -78,17 +75,19 @@ wsClient.on('reconnected', (data) => {
* (compared to one public one per category)
*/
wsClient.subscribeV5('position', 'linear');
wsClient.subscribeV5('execution', 'linear');
wsClient.subscribeV5(['order', 'wallet', 'greek'], 'linear');
// wsClient.subscribeV5('position', 'linear');
// wsClient.subscribeV5('execution', 'linear');
// wsClient.subscribeV5(['order', 'wallet', 'greek'], 'linear');
// Other example topics
const topics = ['kline.5.XRPUSDT', 'kline.5.BTCUSDT', 'kline.5.ETHUSDT'];
wsClient.subscribeV5(topics, 'spot');
// To unsubscribe from topics (after a 5 second delay, in this example):
// setTimeout(() => {
// console.log('unsubscribing');
// wsClient.unsubscribeV5('orderbook.50.BTCUSDT', 'linear);
// }, 5 * 1000);
setTimeout(() => {
console.log('unsubscribing');
wsClient.unsubscribeV5('kline.5.ETHUSDT', 'spot');
}, 5 * 1000);
// Topics are tracked per websocket type
// Get a list of subscribed topics (e.g. for public v3 spot topics) (after a 5 second delay)
@@ -113,4 +112,4 @@ setTimeout(() => {
.getWsStore()
.getTopics(WS_KEY_MAP.v5OptionPublic);
console.log('Active public option v5 topics: ', activePublicOptionsTopics);
}, 5 * 1000);
}, 15 * 1000);

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "bybit-api",
"version": "3.9.0",
"version": "3.9.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "bybit-api",
"version": "3.9.0",
"version": "3.9.2",
"license": "MIT",
"dependencies": {
"axios": "^1.6.6",

View File

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

View File

@@ -98,7 +98,7 @@ describe('Private WRITE V5 REST API Endpoints', () => {
});
});
describe('options only methods', () => {
describe.skip('options only methods', () => {
// These should use a real symbol from the options category
let optionsSymbol: string;
beforeAll(async () => {