Skip to content

Commit

Permalink
Merge pull request #318 from tiagosiebler/nextstufffeb
Browse files Browse the repository at this point in the history
v3.9.4: feat() update test & publish actions, update public ws example, disable test for deprecated endpoint
  • Loading branch information
tiagosiebler authored Feb 20, 2024
2 parents d3a9bc9 + 5bd2797 commit 2730083
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 44 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/e2etest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 14 additions & 24 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
branches:
- master

# permissions:
# id-token: 'write'
# contents: 'read'

jobs:
publish-npm:
runs-on: ubuntu-latest
Expand All @@ -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}}
25 changes: 12 additions & 13 deletions examples/ws-public-v5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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)
Expand All @@ -113,4 +112,4 @@ setTimeout(() => {
.getWsStore()
.getTopics(WS_KEY_MAP.v5OptionPublic);
console.log('Active public option v5 topics: ', activePublicOptionsTopics);
}, 5 * 1000);
}, 15 * 1000);
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/v5/private.write.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 2730083

Please sign in to comment.