aboutsummaryrefslogtreecommitdiffstats
path: root/packages/testnet-faucets/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/testnet-faucets/src')
-rw-r--r--packages/testnet-faucets/src/ts/dispatch_queue.ts5
-rw-r--r--packages/testnet-faucets/src/ts/dispense_asset_tasks.ts15
-rw-r--r--packages/testnet-faucets/src/ts/error_reporter.ts6
-rw-r--r--packages/testnet-faucets/src/ts/handler.ts7
-rw-r--r--packages/testnet-faucets/src/ts/parameter_transformer.ts1
-rw-r--r--packages/testnet-faucets/src/ts/utils.ts7
6 files changed, 15 insertions, 26 deletions
diff --git a/packages/testnet-faucets/src/ts/dispatch_queue.ts b/packages/testnet-faucets/src/ts/dispatch_queue.ts
index 672511619..2dbeeba7a 100644
--- a/packages/testnet-faucets/src/ts/dispatch_queue.ts
+++ b/packages/testnet-faucets/src/ts/dispatch_queue.ts
@@ -1,8 +1,7 @@
-import { intervalUtils } from '@0xproject/utils';
+import { intervalUtils, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import { errorReporter } from './error_reporter';
-import { utils } from './utils';
const MAX_QUEUE_SIZE = 500;
const DEFAULT_QUEUE_INTERVAL_MS = 1000;
@@ -45,7 +44,7 @@ export class DispatchQueue {
},
this._queueIntervalMs,
(err: Error) => {
- utils.consoleLog(`Unexpected err: ${err} - ${JSON.stringify(err)}`);
+ logUtils.log(`Unexpected err: ${err} - ${JSON.stringify(err)}`);
// tslint:disable-next-line:no-floating-promises
errorReporter.reportAsync(err);
},
diff --git a/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts b/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts
index 56b0a9e45..99f1bad36 100644
--- a/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts
+++ b/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts
@@ -1,11 +1,10 @@
import { ZeroEx } from '0x.js';
-import { BigNumber, promisify } from '@0xproject/utils';
+import { BigNumber, logUtils, promisify } from '@0xproject/utils';
import * as _ from 'lodash';
import * as Web3 from 'web3';
import { configs } from './configs';
import { errorReporter } from './error_reporter';
-import { utils } from './utils';
const DISPENSE_AMOUNT_ETHER = 0.1;
const DISPENSE_AMOUNT_TOKEN = 0.1;
@@ -15,11 +14,11 @@ const DISPENSE_MAX_AMOUNT_ETHER = 2;
export const dispenseAssetTasks = {
dispenseEtherTask(recipientAddress: string, web3: Web3) {
return async () => {
- utils.consoleLog(`Processing ETH ${recipientAddress}`);
+ logUtils.log(`Processing ETH ${recipientAddress}`);
const userBalance = await promisify<BigNumber>(web3.eth.getBalance)(recipientAddress);
const maxAmountInWei = new BigNumber(web3.toWei(DISPENSE_MAX_AMOUNT_ETHER, 'ether'));
if (userBalance.greaterThanOrEqualTo(maxAmountInWei)) {
- utils.consoleLog(
+ logUtils.log(
`User exceeded ETH balance maximum (${maxAmountInWei}) ${recipientAddress} ${userBalance} `,
);
return;
@@ -30,12 +29,12 @@ export const dispenseAssetTasks = {
to: recipientAddress,
value: web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'),
});
- utils.consoleLog(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);
+ logUtils.log(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);
};
},
dispenseTokenTask(recipientAddress: string, tokenSymbol: string, zeroEx: ZeroEx) {
return async () => {
- utils.consoleLog(`Processing ${tokenSymbol} ${recipientAddress}`);
+ logUtils.log(`Processing ${tokenSymbol} ${recipientAddress}`);
const amountToDispense = new BigNumber(DISPENSE_AMOUNT_TOKEN);
const token = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(tokenSymbol);
if (_.isUndefined(token)) {
@@ -48,7 +47,7 @@ export const dispenseAssetTasks = {
token.decimals,
);
if (userBalanceBaseUnits.greaterThanOrEqualTo(maxAmountBaseUnits)) {
- utils.consoleLog(
+ logUtils.log(
`User exceeded token balance maximum (${maxAmountBaseUnits}) ${recipientAddress} ${userBalanceBaseUnits} `,
);
return;
@@ -59,7 +58,7 @@ export const dispenseAssetTasks = {
recipientAddress,
baseUnitAmount,
);
- utils.consoleLog(`Sent ${amountToDispense} ZRX to ${recipientAddress} tx: ${txHash}`);
+ logUtils.log(`Sent ${amountToDispense} ZRX to ${recipientAddress} tx: ${txHash}`);
};
},
};
diff --git a/packages/testnet-faucets/src/ts/error_reporter.ts b/packages/testnet-faucets/src/ts/error_reporter.ts
index 7fd76bde5..f0f3ca679 100644
--- a/packages/testnet-faucets/src/ts/error_reporter.ts
+++ b/packages/testnet-faucets/src/ts/error_reporter.ts
@@ -1,8 +1,8 @@
+import { logUtils } from '@0xproject/utils';
import * as express from 'express';
import rollbar = require('rollbar');
import { configs } from './configs';
-import { utils } from './utils';
export const errorReporter = {
setup() {
@@ -11,7 +11,7 @@ export const errorReporter = {
});
rollbar.handleUncaughtExceptions(configs.ROLLBAR_ACCESS_KEY);
process.on('unhandledRejection', async (err: Error) => {
- utils.consoleLog(`Uncaught exception ${err}. Stack: ${err.stack}`);
+ logUtils.log(`Uncaught exception ${err}. Stack: ${err.stack}`);
await this.reportAsync(err);
process.exit(1);
});
@@ -23,7 +23,7 @@ export const errorReporter = {
return new Promise((resolve, reject) => {
rollbar.handleError(err, req, (rollbarErr: Error) => {
if (rollbarErr) {
- utils.consoleLog(`Error reporting to rollbar, ignoring: ${rollbarErr}`);
+ logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`);
reject(rollbarErr);
} else {
resolve();
diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts
index 5f6ada186..f9ac484de 100644
--- a/packages/testnet-faucets/src/ts/handler.ts
+++ b/packages/testnet-faucets/src/ts/handler.ts
@@ -1,5 +1,5 @@
import { Order, SignedOrder, ZeroEx } from '0x.js';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as express from 'express';
import * as _ from 'lodash';
import * as Web3 from 'web3';
@@ -19,7 +19,6 @@ import { DispatchQueue } from './dispatch_queue';
import { dispenseAssetTasks } from './dispense_asset_tasks';
import { idManagement } from './id_management';
import { rpcUrls } from './rpc_urls';
-import { utils } from './utils';
interface NetworkConfig {
dispatchQueue: DispatchQueue;
@@ -118,7 +117,7 @@ export class Handler {
res.status(503).send('QUEUE_IS_FULL');
return;
}
- utils.consoleLog(`Added ${recipient} to queue: ${requestedAssetType} networkId: ${networkId}`);
+ logUtils.log(`Added ${recipient} to queue: ${requestedAssetType} networkId: ${networkId}`);
res.status(200).end();
}
private async _dispenseOrder(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {
@@ -163,7 +162,7 @@ export class Handler {
};
const signedOrderHash = ZeroEx.getOrderHashHex(signedOrder);
const payload = JSON.stringify(signedOrder);
- utils.consoleLog(`Dispensed signed order: ${payload}`);
+ logUtils.log(`Dispensed signed order: ${payload}`);
res.status(200).send(payload);
}
}
diff --git a/packages/testnet-faucets/src/ts/parameter_transformer.ts b/packages/testnet-faucets/src/ts/parameter_transformer.ts
index c5711d462..2630a5e0b 100644
--- a/packages/testnet-faucets/src/ts/parameter_transformer.ts
+++ b/packages/testnet-faucets/src/ts/parameter_transformer.ts
@@ -4,7 +4,6 @@ import * as _ from 'lodash';
import { configs } from './configs';
import { rpcUrls } from './rpc_urls';
-import { utils } from './utils';
const DEFAULT_NETWORK_ID = 42; // kovan
diff --git a/packages/testnet-faucets/src/ts/utils.ts b/packages/testnet-faucets/src/ts/utils.ts
deleted file mode 100644
index 893f82ca3..000000000
--- a/packages/testnet-faucets/src/ts/utils.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export const utils = {
- consoleLog(message: string) {
- /* tslint:disable */
- console.log(message);
- /* tslint:enable */
- },
-};