diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-18 20:54:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-18 20:54:47 +0800 |
commit | f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0 (patch) | |
tree | 4aacfa2652ba2c5f976e36ac25449decb561d3f0 /packages/testnet-faucets | |
parent | 904968cf4a899642d3f4e78abc53352125e17447 (diff) | |
parent | bf8ac3b9e6ee59f267f7850418febfe84dedceb8 (diff) | |
download | dexon-sol-tools-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar dexon-sol-tools-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar.gz dexon-sol-tools-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar.bz2 dexon-sol-tools-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar.lz dexon-sol-tools-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar.xz dexon-sol-tools-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar.zst dexon-sol-tools-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.zip |
Merge pull request #883 from 0xProject/feature/tslint-improvements
New tslint rules
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 442f488c9..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.8.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()); |