aboutsummaryrefslogtreecommitdiffstats
path: root/packages/kovan-faucets/src/ts/handler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/kovan-faucets/src/ts/handler.ts')
-rw-r--r--packages/kovan-faucets/src/ts/handler.ts36
1 files changed, 18 insertions, 18 deletions
diff --git a/packages/kovan-faucets/src/ts/handler.ts b/packages/kovan-faucets/src/ts/handler.ts
index d31d1478d..071eb8ba0 100644
--- a/packages/kovan-faucets/src/ts/handler.ts
+++ b/packages/kovan-faucets/src/ts/handler.ts
@@ -18,25 +18,25 @@ import {ZRXRequestQueue} from './zrx_request_queue';
import * as Web3 from 'web3';
export class Handler {
- private etherRequestQueue: EtherRequestQueue;
- private zrxRequestQueue: ZRXRequestQueue;
- private web3: Web3;
+ private _etherRequestQueue: EtherRequestQueue;
+ private _zrxRequestQueue: ZRXRequestQueue;
+ private _web3: Web3;
constructor() {
// Setup provider engine to talk with RPC node
- const providerObj = this.createProviderEngine(configs.RPC_URL);
- this.web3 = new Web3(providerObj);
+ const providerObj = this._createProviderEngine(configs.RPC_URL);
+ this._web3 = new Web3(providerObj);
- this.etherRequestQueue = new EtherRequestQueue(this.web3);
- this.zrxRequestQueue = new ZRXRequestQueue(this.web3);
+ this._etherRequestQueue = new EtherRequestQueue(this._web3);
+ this._zrxRequestQueue = new ZRXRequestQueue(this._web3);
}
public dispenseEther(req: express.Request, res: express.Response) {
const recipientAddress = req.params.recipient;
- if (_.isUndefined(recipientAddress) || !this.isValidEthereumAddress(recipientAddress)) {
+ if (_.isUndefined(recipientAddress) || !this._isValidEthereumAddress(recipientAddress)) {
res.status(400).send('INVALID_REQUEST');
return;
}
const lowerCaseRecipientAddress = recipientAddress.toLowerCase();
- const didAddToQueue = this.etherRequestQueue.add(lowerCaseRecipientAddress);
+ const didAddToQueue = this._etherRequestQueue.add(lowerCaseRecipientAddress);
if (!didAddToQueue) {
res.status(503).send('QUEUE_IS_FULL');
return;
@@ -46,12 +46,12 @@ export class Handler {
}
public dispenseZRX(req: express.Request, res: express.Response) {
const recipientAddress = req.params.recipient;
- if (_.isUndefined(recipientAddress) || !this.isValidEthereumAddress(recipientAddress)) {
+ if (_.isUndefined(recipientAddress) || !this._isValidEthereumAddress(recipientAddress)) {
res.status(400).send('INVALID_REQUEST');
return;
}
const lowerCaseRecipientAddress = recipientAddress.toLowerCase();
- const didAddToQueue = this.zrxRequestQueue.add(lowerCaseRecipientAddress);
+ const didAddToQueue = this._zrxRequestQueue.add(lowerCaseRecipientAddress);
if (!didAddToQueue) {
res.status(503).send('QUEUE_IS_FULL');
return;
@@ -63,18 +63,18 @@ export class Handler {
res.setHeader('Content-Type', 'application/json');
const payload = JSON.stringify({
ether: {
- full: this.etherRequestQueue.isFull(),
- size: this.etherRequestQueue.size(),
+ full: this._etherRequestQueue.isFull(),
+ size: this._etherRequestQueue.size(),
},
zrx: {
- full: this.zrxRequestQueue.isFull(),
- size: this.zrxRequestQueue.size(),
+ full: this._zrxRequestQueue.isFull(),
+ size: this._zrxRequestQueue.size(),
},
});
res.status(200).send(payload);
}
// tslint:disable-next-line:prefer-function-over-method
- private createProviderEngine(rpcUrl: string) {
+ private _createProviderEngine(rpcUrl: string) {
const engine = new ProviderEngine();
engine.addProvider(new NonceSubprovider());
engine.addProvider(new HookedWalletSubprovider(idManagement));
@@ -84,8 +84,8 @@ export class Handler {
engine.start();
return engine;
}
- private isValidEthereumAddress(address: string): boolean {
+ private _isValidEthereumAddress(address: string): boolean {
const lowercaseAddress = address.toLowerCase();
- return this.web3.isAddress(lowercaseAddress);
+ return this._web3.isAddress(lowercaseAddress);
}
}