diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-18 21:27:38 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-18 21:27:38 +0800 |
commit | dad557164ea4ccc012243d43df013078a7c37eb6 (patch) | |
tree | 88e8477941dc0c98273fcb054086b2e89d034e19 /packages/testnet-faucets | |
parent | acff177c547dee049b97e4b051fe22e1efaf992c (diff) | |
parent | f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0 (diff) | |
download | dexon-sol-tools-dad557164ea4ccc012243d43df013078a7c37eb6.tar dexon-sol-tools-dad557164ea4ccc012243d43df013078a7c37eb6.tar.gz dexon-sol-tools-dad557164ea4ccc012243d43df013078a7c37eb6.tar.bz2 dexon-sol-tools-dad557164ea4ccc012243d43df013078a7c37eb6.tar.lz dexon-sol-tools-dad557164ea4ccc012243d43df013078a7c37eb6.tar.xz dexon-sol-tools-dad557164ea4ccc012243d43df013078a7c37eb6.tar.zst dexon-sol-tools-dad557164ea4ccc012243d43df013078a7c37eb6.zip |
Merge branch 'v2-prototype' into feature/order-watcher-v2
Diffstat (limited to 'packages/testnet-faucets')
-rw-r--r-- | packages/testnet-faucets/package.json | 2 | ||||
-rw-r--r-- | packages/testnet-faucets/src/ts/dispatch_queue.ts | 4 | ||||
-rw-r--r-- | packages/testnet-faucets/src/ts/error_reporter.ts | 4 | ||||
-rw-r--r-- | packages/testnet-faucets/src/ts/handler.ts | 2 | ||||
-rw-r--r-- | packages/testnet-faucets/src/ts/server.ts | 24 |
5 files changed, 26 insertions, 10 deletions
diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index d3c9cff34..6711817f0 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -42,7 +42,7 @@ "nodemon": "^1.11.0", "shx": "^0.2.2", "source-map-loader": "^0.1.6", - "tslint": "5.10.0", + "tslint": "5.11.0", "typescript": "2.7.1", "webpack": "^3.1.0", "webpack-node-externals": "^1.6.0" diff --git a/packages/testnet-faucets/src/ts/dispatch_queue.ts b/packages/testnet-faucets/src/ts/dispatch_queue.ts index b1996a0c2..0a13df7c9 100644 --- a/packages/testnet-faucets/src/ts/dispatch_queue.ts +++ b/packages/testnet-faucets/src/ts/dispatch_queue.ts @@ -7,8 +7,8 @@ const MAX_QUEUE_SIZE = 500; const DEFAULT_QUEUE_INTERVAL_MS = 1000; export class DispatchQueue { - private _queueIntervalMs: number; - private _queue: Array<() => Promise<void>>; + private readonly _queueIntervalMs: number; + private readonly _queue: Array<() => Promise<void>>; private _queueIntervalIdIfExists?: NodeJS.Timer; constructor() { this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS; diff --git a/packages/testnet-faucets/src/ts/error_reporter.ts b/packages/testnet-faucets/src/ts/error_reporter.ts index a0abcc07b..49c37b6eb 100644 --- a/packages/testnet-faucets/src/ts/error_reporter.ts +++ b/packages/testnet-faucets/src/ts/error_reporter.ts @@ -12,7 +12,7 @@ export const errorReporter = { rollbar.handleUncaughtExceptions(configs.ROLLBAR_ACCESS_KEY); process.on('unhandledRejection', async (err: Error) => { logUtils.log(`Uncaught exception ${err}. Stack: ${err.stack}`); - await this.reportAsync(err); + await errorReporter.reportAsync(err); process.exit(1); }); }, @@ -20,7 +20,7 @@ export const errorReporter = { if (configs.ENVIRONMENT === 'development') { return; // Do not log development environment errors } - return new Promise((resolve, reject) => { + return new Promise<any>((resolve, reject) => { rollbar.handleError(err, req, (rollbarErr: Error) => { if (rollbarErr) { logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`); diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts index 0f61159fa..3749bc70b 100644 --- a/packages/testnet-faucets/src/ts/handler.ts +++ b/packages/testnet-faucets/src/ts/handler.ts @@ -37,7 +37,7 @@ enum RequestedAssetType { const FIVE_DAYS_IN_MS = 4.32e8; // TODO: make this configurable export class Handler { - private _networkConfigByNetworkId: ItemByNetworkId<NetworkConfig> = {}; + private readonly _networkConfigByNetworkId: ItemByNetworkId<NetworkConfig> = {}; private static _createProviderEngine(rpcUrl: string): Provider { if (_.isUndefined(configs.DISPENSER_PRIVATE_KEY)) { throw new Error('Dispenser Private key not found'); diff --git a/packages/testnet-faucets/src/ts/server.ts b/packages/testnet-faucets/src/ts/server.ts index 5416cdcc3..f00562000 100644 --- a/packages/testnet-faucets/src/ts/server.ts +++ b/packages/testnet-faucets/src/ts/server.ts @@ -24,10 +24,26 @@ app.get('/ping', (req: express.Request, res: express.Response) => { res.status(constants.SUCCESS_STATUS).send('pong'); }); app.get('/info', handler.getQueueInfo.bind(handler)); -app.get('/ether/:recipient', parameterTransformer.transform, handler.dispenseEther.bind(handler)); -app.get('/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRX.bind(handler)); -app.get('/order/weth/:recipient', parameterTransformer.transform, handler.dispenseWETHOrderAsync.bind(handler)); -app.get('/order/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRXOrderAsync.bind(handler)); +app.get( + '/ether/:recipient', + parameterTransformer.transform.bind(parameterTransformer), + handler.dispenseEther.bind(handler), +); +app.get( + '/zrx/:recipient', + parameterTransformer.transform.bind(parameterTransformer), + handler.dispenseZRX.bind(handler), +); +app.get( + '/order/weth/:recipient', + parameterTransformer.transform.bind(parameterTransformer), + handler.dispenseWETHOrderAsync.bind(handler), +); +app.get( + '/order/zrx/:recipient', + parameterTransformer.transform.bind(parameterTransformer), + handler.dispenseZRXOrderAsync.bind(handler), +); // Log to rollbar any errors unhandled by handlers app.use(errorReporter.errorHandler()); |