diff --git a/packages/bitcore-wallet-service/package-lock.json b/packages/bitcore-wallet-service/package-lock.json index bd53d2988fc..86270eda885 100644 --- a/packages/bitcore-wallet-service/package-lock.json +++ b/packages/bitcore-wallet-service/package-lock.json @@ -950,9 +950,9 @@ } }, "errr": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/errr/-/errr-2.2.1.tgz", - "integrity": "sha1-H+eLb7KS0mXGJcBqfsmjsy4blt8=" + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/errr/-/errr-2.6.1.tgz", + "integrity": "sha512-h4SrH28BniB6zOZ/19ZOHdonCwLI7ljC8MyDabH+6dhz66Ws+Xy0MnHwf4dn55FRdZWdVVpbrSpI5YYOscV29A==" }, "es6-promise": { "version": "3.2.1", @@ -1968,19 +1968,12 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, "preconditions": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/preconditions/-/preconditions-2.2.1.tgz", - "integrity": "sha1-o9JeRQoOrzLcb2tAEob5VWN4Ts4=", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/preconditions/-/preconditions-2.2.3.tgz", + "integrity": "sha512-Yjr1+XK/4/L0zJyhNdsD2VNJIvd6ErFVJqXQ6mxRg+yvjfiNgLJ2uTeRXlmGuZ8AlcMFxkkKZZlckydHZe6AwA==", "requires": { - "errr": "2.2.1", - "lodash": "4.17.5" - }, - "dependencies": { - "lodash": { - "version": "4.17.5", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", - "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" - } + "errr": "2.6.1", + "lodash": "4.17.11" } }, "prelude-ls": { diff --git a/packages/bitcore-wallet-service/package.json b/packages/bitcore-wallet-service/package.json index a15f702f9c1..5a1f3cb5b46 100644 --- a/packages/bitcore-wallet-service/package.json +++ b/packages/bitcore-wallet-service/package.json @@ -37,7 +37,7 @@ "morgan": "^1.9.1", "mustache": "^2.1.0", "npmlog": "^0.1.1", - "preconditions": "^2.2.1", + "preconditions": "^2.2.3", "read": "^1.0.5", "request": "^2.53.0", "request-promise-native": "^1.0.5", diff --git a/packages/bitcore-wallet-service/src/lib/errors/clienterror.ts b/packages/bitcore-wallet-service/src/lib/errors/clienterror.ts index 0c76150ce7d..ef17553df9c 100644 --- a/packages/bitcore-wallet-service/src/lib/errors/clienterror.ts +++ b/packages/bitcore-wallet-service/src/lib/errors/clienterror.ts @@ -1,9 +1,10 @@ 'use strict'; -export class ClientError { +export class ClientError extends Error { code: string; message: string; constructor(...args) { + super() switch (args.length) { case 0: this.code = 'BADREQUEST'; diff --git a/packages/bitcore-wallet-service/src/lib/server.ts b/packages/bitcore-wallet-service/src/lib/server.ts index 79c800afbc1..f61de1fbb2d 100644 --- a/packages/bitcore-wallet-service/src/lib/server.ts +++ b/packages/bitcore-wallet-service/src/lib/server.ts @@ -1,13 +1,14 @@ +import { ClientError } from "./errors/clienterror"; import { IWallet } from './model/wallet'; 'use strict'; import * as _ from 'lodash'; -import * as $ from 'preconditions'; import * as async from 'async'; import * as log from 'npmlog'; import { ITxProposal, TxProposal } from './model/txproposal'; import { Storage } from './storage'; import { INotification } from './model/notification'; +const $ = require('preconditions').singleton(); var serverMessages = require('../serverMessages'); var BCHAddressTranslator = require('./bchaddresstranslator'); @@ -28,7 +29,6 @@ var Utils = Common.Utils; var Constants = Common.Constants; var Defaults = Common.Defaults; -var ClientError = require('./errors/clienterror'); var Errors = require('./errors/errordefinitions'); var Lock = require('./lock'); diff --git a/packages/bitcore-wallet-service/src/lib/storage.ts b/packages/bitcore-wallet-service/src/lib/storage.ts index 3e0b2be2ac7..d756c9501f1 100644 --- a/packages/bitcore-wallet-service/src/lib/storage.ts +++ b/packages/bitcore-wallet-service/src/lib/storage.ts @@ -1571,5 +1571,3 @@ export class Storage { ); } } - -module.exports = Storage; diff --git a/packages/bitcore-wallet-service/src/messagebroker/messagebroker.js b/packages/bitcore-wallet-service/src/messagebroker/messagebroker.ts similarity index 85% rename from packages/bitcore-wallet-service/src/messagebroker/messagebroker.js rename to packages/bitcore-wallet-service/src/messagebroker/messagebroker.ts index d48dc637b5e..080149efe26 100644 --- a/packages/bitcore-wallet-service/src/messagebroker/messagebroker.js +++ b/packages/bitcore-wallet-service/src/messagebroker/messagebroker.ts @@ -2,8 +2,8 @@ 'use strict'; +import io = require('socket.io'); var $ = require('preconditions').singleton(); -var io = require('socket.io'); var log = require('npmlog'); log.debug = log.verbose; @@ -13,7 +13,7 @@ var opts = { port: parseInt(process.argv[2]) || DEFAULT_PORT, }; -var server = io(opts.port); +var server = io(opts.port.toString()); server.on('connection', function(socket) { socket.on('msg', function(data) { server.emit('msg', data); diff --git a/packages/bitcore-wallet-service/start.sh b/packages/bitcore-wallet-service/start.sh index ea7afb7ceff..8cd13fd0a0d 100755 --- a/packages/bitcore-wallet-service/start.sh +++ b/packages/bitcore-wallet-service/start.sh @@ -29,10 +29,10 @@ run_program () fi } -run_program messagebroker/messagebroker.js pids/messagebroker.pid logs/messagebroker.log -run_program bcmonitor/bcmonitor.js pids/bcmonitor.pid logs/bcmonitor.log -run_program emailservice/emailservice.js pids/emailservice.pid logs/emailservice.log -run_program pushnotificationsservice/pushnotificationsservice.js pids/pushnotificationsservice.pid logs/pushnotificationsservice.log -run_program fiatrateservice/fiatrateservice.js pids/fiatrateservice.pid logs/fiatrateservice.log -run_program bws.js pids/bws.pid logs/bws.log +run_program ./ts_build/messagebroker/messagebroker.js pids/messagebroker.pid logs/messagebroker.log +run_program ./ts_build/bcmonitor/bcmonitor.js pids/bcmonitor.pid logs/bcmonitor.log +run_program ./ts_build/emailservice/emailservice.js pids/emailservice.pid logs/emailservice.log +run_program ./ts_build/pushnotificationsservice/pushnotificationsservice.js pids/pushnotificationsservice.pid logs/pushnotificationsservice.log +run_program ./ts_build/fiatrateservice/fiatrateservice.js pids/fiatrateservice.pid logs/fiatrateservice.log +run_program ./ts_build/bws.js pids/bws.pid logs/bws.log