aboutsummaryrefslogtreecommitdiffstats
path: root/packages/testnet-faucets
diff options
context:
space:
mode:
Diffstat (limited to 'packages/testnet-faucets')
-rw-r--r--packages/testnet-faucets/package.json13
-rw-r--r--packages/testnet-faucets/src/ts/ether_request_queue.ts6
-rw-r--r--packages/testnet-faucets/src/ts/request_queue.ts36
-rw-r--r--packages/testnet-faucets/src/ts/zrx_request_queue.ts4
4 files changed, 30 insertions, 29 deletions
diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json
index 3b42ebb3e..c6e7faf02 100644
--- a/packages/testnet-faucets/package.json
+++ b/packages/testnet-faucets/package.json
@@ -1,10 +1,11 @@
{
"private": true,
"name": "@0xproject/testnet-faucets",
- "version": "1.0.8",
+ "version": "1.0.9",
"description": "A faucet micro-service that dispenses test ERC20 tokens or Ether",
"main": "server.js",
"scripts": {
+ "build:watch": "tsc -w",
"build": "node ../../node_modules/gulp/bin/gulp.js build",
"dev": "node ../../node_modules/gulp/bin/gulp.js run",
"start": "node ./bin/server.js",
@@ -14,8 +15,8 @@
"author": "Fabio Berger",
"license": "Apache-2.0",
"dependencies": {
- "0x.js": "^0.31.0",
- "@0xproject/utils": "^0.2.3",
+ "0x.js": "^0.31.1",
+ "@0xproject/utils": "^0.2.4",
"body-parser": "^1.17.1",
"ethereumjs-tx": "^1.3.3",
"express": "^4.15.2",
@@ -25,7 +26,7 @@
"web3-provider-engine": "^13.0.1"
},
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.5",
+ "@0xproject/tslint-config": "^0.4.6",
"@types/body-parser": "^1.16.1",
"@types/express": "^4.0.35",
"@types/lodash": "^4.14.86",
@@ -35,8 +36,8 @@
"shx": "^0.2.2",
"source-map-loader": "^0.1.6",
"tslint": "5.8.0",
- "typescript": "~2.6.1",
- "web3-typescript-typings": "^0.9.7",
+ "typescript": "2.7.1",
+ "web3-typescript-typings": "^0.9.8",
"webpack": "^3.1.0",
"webpack-node-externals": "^1.6.0"
}
diff --git a/packages/testnet-faucets/src/ts/ether_request_queue.ts b/packages/testnet-faucets/src/ts/ether_request_queue.ts
index 1c4b19ab9..710d49f39 100644
--- a/packages/testnet-faucets/src/ts/ether_request_queue.ts
+++ b/packages/testnet-faucets/src/ts/ether_request_queue.ts
@@ -9,14 +9,14 @@ import { utils } from './utils';
const DISPENSE_AMOUNT_ETHER = 0.1;
export class EtherRequestQueue extends RequestQueue {
- protected async processNextRequestFireAndForgetAsync(recipientAddress: string) {
+ protected async _processNextRequestFireAndForgetAsync(recipientAddress: string) {
utils.consoleLog(`Processing ETH ${recipientAddress}`);
- const sendTransactionAsync = promisify(this.web3.eth.sendTransaction);
+ const sendTransactionAsync = promisify(this._web3.eth.sendTransaction);
try {
const txHash = await sendTransactionAsync({
from: configs.DISPENSER_ADDRESS,
to: recipientAddress,
- value: this.web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'),
+ value: this._web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'),
});
utils.consoleLog(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);
} catch (err) {
diff --git a/packages/testnet-faucets/src/ts/request_queue.ts b/packages/testnet-faucets/src/ts/request_queue.ts
index 20f2833a1..7d685522a 100644
--- a/packages/testnet-faucets/src/ts/request_queue.ts
+++ b/packages/testnet-faucets/src/ts/request_queue.ts
@@ -11,46 +11,46 @@ const MAX_QUEUE_SIZE = 500;
const DEFAULT_QUEUE_INTERVAL_MS = 1000;
export class RequestQueue {
- protected queueIntervalMs: number;
- protected queue: string[];
- protected queueIntervalId: NodeJS.Timer;
- protected web3: Web3;
+ protected _queueIntervalMs: number;
+ protected _queue: string[];
+ protected _queueIntervalId: NodeJS.Timer;
+ protected _web3: Web3;
constructor(web3: any) {
- this.queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS;
- this.queue = [];
+ this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS;
+ this._queue = [];
- this.web3 = web3;
+ this._web3 = web3;
- this.start();
+ this._start();
}
public add(recipientAddress: string): boolean {
if (this.isFull()) {
return false;
}
- this.queue.push(recipientAddress);
+ this._queue.push(recipientAddress);
return true;
}
public size(): number {
- return this.queue.length;
+ return this._queue.length;
}
public isFull(): boolean {
return this.size() >= MAX_QUEUE_SIZE;
}
- protected start() {
- this.queueIntervalId = timers.setInterval(() => {
- const recipientAddress = this.queue.shift();
+ protected _start() {
+ this._queueIntervalId = timers.setInterval(() => {
+ const recipientAddress = this._queue.shift();
if (_.isUndefined(recipientAddress)) {
return;
}
// tslint:disable-next-line:no-floating-promises
- this.processNextRequestFireAndForgetAsync(recipientAddress);
- }, this.queueIntervalMs);
+ this._processNextRequestFireAndForgetAsync(recipientAddress);
+ }, this._queueIntervalMs);
}
- protected stop() {
- clearInterval(this.queueIntervalId);
+ protected _stop() {
+ clearInterval(this._queueIntervalId);
}
// tslint:disable-next-line:prefer-function-over-method
- protected async processNextRequestFireAndForgetAsync(recipientAddress: string) {
+ protected async _processNextRequestFireAndForgetAsync(recipientAddress: string) {
throw new Error('Expected processNextRequestFireAndForgetAsync to be implemented by a subclass');
}
}
diff --git a/packages/testnet-faucets/src/ts/zrx_request_queue.ts b/packages/testnet-faucets/src/ts/zrx_request_queue.ts
index 3d73f9dd2..db1b619a8 100644
--- a/packages/testnet-faucets/src/ts/zrx_request_queue.ts
+++ b/packages/testnet-faucets/src/ts/zrx_request_queue.ts
@@ -20,13 +20,13 @@ export class ZRXRequestQueue extends RequestQueue {
private _zeroEx: ZeroEx;
constructor(web3: Web3, networkId: number) {
super(web3);
- this.queueIntervalMs = QUEUE_INTERVAL_MS;
+ this._queueIntervalMs = QUEUE_INTERVAL_MS;
const zeroExConfig = {
networkId,
};
this._zeroEx = new ZeroEx(web3.currentProvider, zeroExConfig);
}
- protected async processNextRequestFireAndForgetAsync(recipientAddress: string) {
+ protected async _processNextRequestFireAndForgetAsync(recipientAddress: string) {
utils.consoleLog(`Processing ZRX ${recipientAddress}`);
const baseUnitAmount = ZeroEx.toBaseUnitAmount(DISPENSE_AMOUNT_ZRX, 18);
try {