aboutsummaryrefslogtreecommitdiffstats
path: root/packages/testnet-faucets/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-17 18:59:02 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-07-17 18:59:02 +0800
commitbf8ac3b9e6ee59f267f7850418febfe84dedceb8 (patch)
tree0617e583892f9a8fe96a55dcac3a7f9af1ddae10 /packages/testnet-faucets/src
parentedcdc9b1b903158cc61529853d7e9028ecbc266a (diff)
downloaddexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar
dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.gz
dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.bz2
dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.lz
dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.xz
dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.zst
dexon-sol-tools-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.zip
Fix tslint issues
Diffstat (limited to 'packages/testnet-faucets/src')
-rw-r--r--packages/testnet-faucets/src/ts/dispatch_queue.ts4
-rw-r--r--packages/testnet-faucets/src/ts/error_reporter.ts4
-rw-r--r--packages/testnet-faucets/src/ts/handler.ts2
-rw-r--r--packages/testnet-faucets/src/ts/server.ts24
4 files changed, 25 insertions, 9 deletions
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());