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: steps:
- name: 'Checkout source code' - name: 'Checkout source code'
uses: actions/checkout@v3 uses: actions/checkout@v4
- uses: actions/setup-node@v3 - uses: actions/setup-node@v4
with: with:
node-version: 20.11.0 node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org/'
cache: 'npm' cache: 'npm'
- name: Install - name: Install

View File

@@ -8,6 +8,10 @@ on:
branches: branches:
- master - master
# permissions:
# id-token: 'write'
# contents: 'read'
jobs: jobs:
publish-npm: publish-npm:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -20,42 +24,28 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2 - name: 'Checkout source code'
if: steps.version-updated.outputs.has-updated 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 if: steps.version-updated.outputs.has-updated
with: with:
node-version: 20.11.0 node-version-file: '.nvmrc'
registry-url: https://registry.npmjs.org/ registry-url: https://registry.npmjs.org/
cache: 'npm' cache: 'npm'
- run: npm ci --ignore-scripts - name: Install
run: npm ci --ignore-scripts
if: steps.version-updated.outputs.has-updated if: steps.version-updated.outputs.has-updated
- run: npm run clean - run: npm run clean
if: steps.version-updated.outputs.has-updated if: steps.version-updated.outputs.has-updated
- run: npm run build - run: npm run build
if: steps.version-updated.outputs.has-updated 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 if: steps.version-updated.outputs.has-updated
env: env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}} 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( const wsClient = new WebsocketClient(
{ {
// key: key,
// secret: secret,
market: 'v5', market: 'v5',
}, },
logger logger,
); );
wsClient.on('update', (data) => { wsClient.on('update', (data) => {
console.log('raw message received ', JSON.stringify(data)); console.log('raw message received ', JSON.stringify(data));
// console.log('raw message received ', JSON.stringify(data, null, 2));
}); });
wsClient.on('open', (data) => { wsClient.on('open', (data) => {
@@ -78,17 +75,19 @@ wsClient.on('reconnected', (data) => {
* (compared to one public one per category) * (compared to one public one per category)
*/ */
wsClient.subscribeV5('position', 'linear'); // wsClient.subscribeV5('position', 'linear');
wsClient.subscribeV5('execution', 'linear'); // wsClient.subscribeV5('execution', 'linear');
wsClient.subscribeV5(['order', 'wallet', 'greek'], '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): // To unsubscribe from topics (after a 5 second delay, in this example):
// setTimeout(() => { setTimeout(() => {
// console.log('unsubscribing'); console.log('unsubscribing');
// wsClient.unsubscribeV5('orderbook.50.BTCUSDT', 'linear); wsClient.unsubscribeV5('kline.5.ETHUSDT', 'spot');
// }, 5 * 1000); }, 5 * 1000);
// Topics are tracked per websocket type // Topics are tracked per websocket type
// Get a list of subscribed topics (e.g. for public v3 spot topics) (after a 5 second delay) // Get a list of subscribed topics (e.g. for public v3 spot topics) (after a 5 second delay)
@@ -113,4 +112,4 @@ setTimeout(() => {
.getWsStore() .getWsStore()
.getTopics(WS_KEY_MAP.v5OptionPublic); .getTopics(WS_KEY_MAP.v5OptionPublic);
console.log('Active public option v5 topics: ', activePublicOptionsTopics); 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", "name": "bybit-api",
"version": "3.9.0", "version": "3.9.2",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "bybit-api", "name": "bybit-api",
"version": "3.9.0", "version": "3.9.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"axios": "^1.6.6", "axios": "^1.6.6",

View File

@@ -1,6 +1,6 @@
{ {
"name": "bybit-api", "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.", "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

@@ -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 // These should use a real symbol from the options category
let optionsSymbol: string; let optionsSymbol: string;
beforeAll(async () => { beforeAll(async () => {