diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-08-17 07:51:55 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-08-17 07:51:55 +0800 |
commit | e079790f7fe82452471fc69fa9583c07848f801d (patch) | |
tree | 8301bc0048ae5de6ef83ccb1f9c7c6b572058324 | |
parent | 89174cd63fb8c178c33d456d3b9d1d645ee07e91 (diff) | |
download | dexon-sol-tools-e079790f7fe82452471fc69fa9583c07848f801d.tar dexon-sol-tools-e079790f7fe82452471fc69fa9583c07848f801d.tar.gz dexon-sol-tools-e079790f7fe82452471fc69fa9583c07848f801d.tar.bz2 dexon-sol-tools-e079790f7fe82452471fc69fa9583c07848f801d.tar.lz dexon-sol-tools-e079790f7fe82452471fc69fa9583c07848f801d.tar.xz dexon-sol-tools-e079790f7fe82452471fc69fa9583c07848f801d.tar.zst dexon-sol-tools-e079790f7fe82452471fc69fa9583c07848f801d.zip |
Use uuid as string for requestId
-rw-r--r-- | packages/connect/package.json | 2 | ||||
-rw-r--r-- | packages/connect/src/ws_orderbook_channel.ts | 4 | ||||
-rw-r--r-- | yarn.lock | 14 |
3 files changed, 14 insertions, 6 deletions
diff --git a/packages/connect/package.json b/packages/connect/package.json index 798f839b5..ee08104cf 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -59,6 +59,7 @@ "lodash": "^4.17.5", "query-string": "^5.0.1", "sinon": "^4.0.0", + "uuid": "^3.3.2", "websocket": "^1.0.25" }, "devDependencies": { @@ -69,6 +70,7 @@ "@types/mocha": "^2.2.42", "@types/query-string": "^5.0.1", "@types/sinon": "^2.2.2", + "@types/uuid": "^3.4.3", "@types/websocket": "^0.0.39", "async-child-process": "^1.1.1", "chai": "^4.0.1", diff --git a/packages/connect/src/ws_orderbook_channel.ts b/packages/connect/src/ws_orderbook_channel.ts index 3d9230792..425ba8afb 100644 --- a/packages/connect/src/ws_orderbook_channel.ts +++ b/packages/connect/src/ws_orderbook_channel.ts @@ -1,4 +1,5 @@ import * as _ from 'lodash'; +import { v4 as uuid } from 'uuid'; import * as WebSocket from 'websocket'; import { @@ -50,11 +51,10 @@ export class WebSocketOrderbookChannel implements OrderbookChannel { assert.isOrderbookChannelSubscriptionOpts('subscriptionOpts', subscriptionOpts); assert.assert(this._client.readyState === WebSocket.w3cwebsocket.OPEN, 'WebSocket connection is closed'); this._subscriptionOptsList.push(subscriptionOpts); - // TODO: update requestId management to use UUIDs for v2 const subscribeMessage = { type: 'subscribe', channel: 'orderbook', - requestId: this._subscriptionOptsList.length - 1, + requestId: uuid(), payload: subscriptionOpts, }; this._client.send(JSON.stringify(subscribeMessage)); @@ -1258,6 +1258,12 @@ dependencies: "@types/node" "*" +"@types/uuid@^3.4.3": + version "3.4.3" + resolved "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.3.tgz#121ace265f5569ce40f4f6d0ff78a338c732a754" + dependencies: + "@types/node" "*" + "@types/valid-url@^1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@types/valid-url/-/valid-url-1.0.2.tgz#60fa435ce24bfd5ba107b8d2a80796aeaf3a8f45" @@ -5256,9 +5262,9 @@ ethereumjs-wallet@~0.6.0: utf8 "^3.0.0" uuid "^3.3.2" -ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22: - version "3.0.18" - resolved "https://codeload.github.com/0xproject/ethers.js/tar.gz/b91342bd200d142af0165d6befddf783c8ae8447" +ethers@3.0.22: + version "3.0.22" + resolved "https://registry.npmjs.org/ethers/-/ethers-3.0.22.tgz#7fab1ea16521705837aa43c15831877b2716b436" dependencies: aes-js "3.0.0" bn.js "^4.4.0" @@ -14072,7 +14078,7 @@ uuid@^2.0.1: uuid@^3.3.2: version "3.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" + resolved "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" uvm@1.7.0: version "1.7.0" |