From e744e4cd989bd3ae1070c59f7baa8097f18b8b06 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 22 Dec 2017 15:05:32 +0100 Subject: Apply prettier config --- packages/kovan-faucets/src/ts/configs.ts | 7 ++++--- packages/kovan-faucets/src/ts/error_reporter.ts | 4 ++-- packages/kovan-faucets/src/ts/ether_request_queue.ts | 10 +++++----- packages/kovan-faucets/src/ts/handler.ts | 18 ++++++++++-------- packages/kovan-faucets/src/ts/id_management.ts | 8 +++----- packages/kovan-faucets/src/ts/request_queue.ts | 3 +-- packages/kovan-faucets/src/ts/server.ts | 14 ++++++++------ packages/kovan-faucets/src/ts/zrx_request_queue.ts | 15 +++++++++------ 8 files changed, 42 insertions(+), 37 deletions(-) (limited to 'packages/kovan-faucets/src') diff --git a/packages/kovan-faucets/src/ts/configs.ts b/packages/kovan-faucets/src/ts/configs.ts index f432ba66f..697e7522b 100644 --- a/packages/kovan-faucets/src/ts/configs.ts +++ b/packages/kovan-faucets/src/ts/configs.ts @@ -3,9 +3,10 @@ export const configs = { DISPENSER_PRIVATE_KEY: process.env.DISPENSER_PRIVATE_KEY, ENVIRONMENT: process.env.FAUCET_ENVIRONMENT, ROLLBAR_ACCESS_KEY: process.env.FAUCET_ROLLBAR_ACCESS_KEY, - RPC_URL: process.env.FAUCET_ENVIRONMENT === 'development' ? - 'http://127.0.0.1:8545' : - `https://kovan.infura.io/${process.env.INFURA_API_KEY}`, + RPC_URL: + process.env.FAUCET_ENVIRONMENT === 'development' + ? 'http://127.0.0.1:8545' + : `https://kovan.infura.io/${process.env.INFURA_API_KEY}`, ZRX_TOKEN_ADDRESS: '0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570', KOVAN_NETWORK_ID: 42, }; diff --git a/packages/kovan-faucets/src/ts/error_reporter.ts b/packages/kovan-faucets/src/ts/error_reporter.ts index bc1844aa2..c9d09a99e 100644 --- a/packages/kovan-faucets/src/ts/error_reporter.ts +++ b/packages/kovan-faucets/src/ts/error_reporter.ts @@ -1,8 +1,8 @@ import * as express from 'express'; import rollbar = require('rollbar'); -import {configs} from './configs'; -import {utils} from './utils'; +import { configs } from './configs'; +import { utils } from './utils'; export const errorReporter = { setup() { diff --git a/packages/kovan-faucets/src/ts/ether_request_queue.ts b/packages/kovan-faucets/src/ts/ether_request_queue.ts index 0750e6170..1c4b19ab9 100644 --- a/packages/kovan-faucets/src/ts/ether_request_queue.ts +++ b/packages/kovan-faucets/src/ts/ether_request_queue.ts @@ -1,10 +1,10 @@ -import {promisify} from '@0xproject/utils'; +import { promisify } from '@0xproject/utils'; import * as _ from 'lodash'; -import {configs} from './configs'; -import {errorReporter} from './error_reporter'; -import {RequestQueue} from './request_queue'; -import {utils} from './utils'; +import { configs } from './configs'; +import { errorReporter } from './error_reporter'; +import { RequestQueue } from './request_queue'; +import { utils } from './utils'; const DISPENSE_AMOUNT_ETHER = 0.1; diff --git a/packages/kovan-faucets/src/ts/handler.ts b/packages/kovan-faucets/src/ts/handler.ts index 071eb8ba0..4bf776264 100644 --- a/packages/kovan-faucets/src/ts/handler.ts +++ b/packages/kovan-faucets/src/ts/handler.ts @@ -5,11 +5,11 @@ import HookedWalletSubprovider = require('web3-provider-engine/subproviders/hook import NonceSubprovider = require('web3-provider-engine/subproviders/nonce-tracker'); import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); -import {configs} from './configs'; -import {EtherRequestQueue} from './ether_request_queue'; -import {idManagement} from './id_management'; -import {utils} from './utils'; -import {ZRXRequestQueue} from './zrx_request_queue'; +import { configs } from './configs'; +import { EtherRequestQueue } from './ether_request_queue'; +import { idManagement } from './id_management'; +import { utils } from './utils'; +import { ZRXRequestQueue } from './zrx_request_queue'; // HACK: web3 leaks XMLHttpRequest into the global scope and causes requests to hang // because they are using the wrong XHR package. @@ -78,9 +78,11 @@ export class Handler { const engine = new ProviderEngine(); engine.addProvider(new NonceSubprovider()); engine.addProvider(new HookedWalletSubprovider(idManagement)); - engine.addProvider(new RpcSubprovider({ - rpcUrl, - })); + engine.addProvider( + new RpcSubprovider({ + rpcUrl, + }), + ); engine.start(); return engine; } diff --git a/packages/kovan-faucets/src/ts/id_management.ts b/packages/kovan-faucets/src/ts/id_management.ts index 89d6f6fd1..74865afb8 100644 --- a/packages/kovan-faucets/src/ts/id_management.ts +++ b/packages/kovan-faucets/src/ts/id_management.ts @@ -1,16 +1,14 @@ import EthereumTx = require('ethereumjs-tx'); -import {configs} from './configs'; -import {utils} from './utils'; +import { configs } from './configs'; +import { utils } from './utils'; type Callback = (err: Error, accounts: any) => void; export const idManagement = { getAccounts(callback: Callback) { utils.consoleLog(`configs.DISPENSER_ADDRESS: ${configs.DISPENSER_ADDRESS}`); - callback(null, [ - configs.DISPENSER_ADDRESS, - ]); + callback(null, [configs.DISPENSER_ADDRESS]); }, approveTransaction(txData: object, callback: Callback) { callback(null, true); diff --git a/packages/kovan-faucets/src/ts/request_queue.ts b/packages/kovan-faucets/src/ts/request_queue.ts index 1ad7e68be..ea3eee18e 100644 --- a/packages/kovan-faucets/src/ts/request_queue.ts +++ b/packages/kovan-faucets/src/ts/request_queue.ts @@ -42,9 +42,8 @@ export class RequestQueue { return; } const recipientAddress = this.queue.shift(); - // tslint:disable-next-line:no-floating-promises + // tslint:disable-next-line:no-floating-promises this.processNextRequestFireAndForgetAsync(recipientAddress); - }, this.queueIntervalMs); } protected stop() { diff --git a/packages/kovan-faucets/src/ts/server.ts b/packages/kovan-faucets/src/ts/server.ts index fbb9caf1e..23642787d 100644 --- a/packages/kovan-faucets/src/ts/server.ts +++ b/packages/kovan-faucets/src/ts/server.ts @@ -1,8 +1,8 @@ import * as bodyParser from 'body-parser'; import * as express from 'express'; -import {errorReporter} from './error_reporter'; -import {Handler} from './handler'; +import { errorReporter } from './error_reporter'; +import { Handler } from './handler'; // Setup the errorReporter to catch uncaught exceptions and unhandled rejections errorReporter.setup(); @@ -10,13 +10,15 @@ errorReporter.setup(); const app = express(); app.use(bodyParser.json()); // for parsing application/json app.use((req, res, next) => { - res.header('Access-Control-Allow-Origin', '*'); - res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); - next(); + res.header('Access-Control-Allow-Origin', '*'); + res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); + next(); }); const handler = new Handler(); -app.get('/ping', (req: express.Request, res: express.Response) => { res.status(200).send('pong'); }); +app.get('/ping', (req: express.Request, res: express.Response) => { + res.status(200).send('pong'); +}); app.get('/ether/:recipient', handler.dispenseEther.bind(handler)); app.get('/zrx/:recipient', handler.dispenseZRX.bind(handler)); diff --git a/packages/kovan-faucets/src/ts/zrx_request_queue.ts b/packages/kovan-faucets/src/ts/zrx_request_queue.ts index 630991e3b..dddc940bf 100644 --- a/packages/kovan-faucets/src/ts/zrx_request_queue.ts +++ b/packages/kovan-faucets/src/ts/zrx_request_queue.ts @@ -1,11 +1,11 @@ -import {ZeroEx} from '0x.js'; +import { ZeroEx } from '0x.js'; import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; -import {configs} from './configs'; -import {errorReporter} from './error_reporter'; -import {RequestQueue} from './request_queue'; -import {utils} from './utils'; +import { configs } from './configs'; +import { errorReporter } from './error_reporter'; +import { RequestQueue } from './request_queue'; +import { utils } from './utils'; // HACK: web3 leaks XMLHttpRequest into the global scope and causes requests to hang // because they are using the wrong XHR package. @@ -31,7 +31,10 @@ export class ZRXRequestQueue extends RequestQueue { const baseUnitAmount = ZeroEx.toBaseUnitAmount(DISPENSE_AMOUNT_ZRX, 18); try { await this._zeroEx.token.transferAsync( - configs.ZRX_TOKEN_ADDRESS, configs.DISPENSER_ADDRESS, recipientAddress, baseUnitAmount, + configs.ZRX_TOKEN_ADDRESS, + configs.DISPENSER_ADDRESS, + recipientAddress, + baseUnitAmount, ); utils.consoleLog(`Sent ${DISPENSE_AMOUNT_ZRX} ZRX to ${recipientAddress}`); } catch (err) { -- cgit v1.2.3