aboutsummaryrefslogtreecommitdiffstats
path: root/packages/kovan-faucets
diff options
context:
space:
mode:
Diffstat (limited to 'packages/kovan-faucets')
-rw-r--r--packages/kovan-faucets/package.json8
-rw-r--r--packages/kovan-faucets/src/ts/configs.ts7
-rw-r--r--packages/kovan-faucets/src/ts/error_reporter.ts4
-rw-r--r--packages/kovan-faucets/src/ts/ether_request_queue.ts10
-rw-r--r--packages/kovan-faucets/src/ts/handler.ts18
-rw-r--r--packages/kovan-faucets/src/ts/id_management.ts8
-rw-r--r--packages/kovan-faucets/src/ts/request_queue.ts3
-rw-r--r--packages/kovan-faucets/src/ts/server.ts14
-rw-r--r--packages/kovan-faucets/src/ts/zrx_request_queue.ts15
9 files changed, 46 insertions, 41 deletions
diff --git a/packages/kovan-faucets/package.json b/packages/kovan-faucets/package.json
index 864490711..bfc705c56 100644
--- a/packages/kovan-faucets/package.json
+++ b/packages/kovan-faucets/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@0xproject/kovan_faucets",
- "version": "1.0.1",
+ "version": "1.0.2",
"description": "A faucet micro-service that dispenses test ERC20 tokens or Ether",
"main": "server.js",
"scripts": {
@@ -14,8 +14,8 @@
"author": "Fabio Berger",
"license": "Apache-2.0",
"dependencies": {
- "0x.js": "^0.28.0",
- "@0xproject/utils": "^0.1.1",
+ "0x.js": "^0.29.0",
+ "@0xproject/utils": "^0.1.2",
"bignumber.js": "~4.1.0",
"body-parser": "^1.17.1",
"ethereumjs-tx": "^1.3.3",
@@ -26,7 +26,7 @@
"web3-provider-engine": "^13.0.1"
},
"devDependencies": {
- "@0xproject/tslint-config": "^0.3.0",
+ "@0xproject/tslint-config": "^0.4.0",
"@types/body-parser": "^1.16.1",
"@types/express": "^4.0.35",
"@types/lodash": "^4.14.86",
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) {