diff --git a/.github/workflows/e2etest.yml b/.github/workflows/e2etest.yml index fab434e..38ef71c 100644 --- a/.github/workflows/e2etest.yml +++ b/.github/workflows/e2etest.yml @@ -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 diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml index 0564534..2c8c33a 100644 --- a/.github/workflows/npmpublish.yml +++ b/.github/workflows/npmpublish.yml @@ -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}} diff --git a/examples/ws-public-v5.ts b/examples/ws-public-v5.ts index 2c7f854..9a8dff8 100644 --- a/examples/ws-public-v5.ts +++ b/examples/ws-public-v5.ts @@ -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); diff --git a/package-lock.json b/package-lock.json index d4e4a8e..2bbb043 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 1def7df..fb32916 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/v5/private.write.test.ts b/test/v5/private.write.test.ts index ffbf324..1f1a154 100644 --- a/test/v5/private.write.test.ts +++ b/test/v5/private.write.test.ts @@ -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 () => {