diff options
author | Fabio Berger <me@fabioberger.com> | 2018-05-16 22:18:47 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-05-16 22:18:47 +0800 |
commit | 78623ae3bdba39b629a22aa2d15d8aee5e6225ab (patch) | |
tree | f44871dc1b081669c83cf041cebe559ecb57bace /packages/testnet-faucets/src/ts/handler.ts | |
parent | 136c6d01b3f01e6db8aab01c4b4b7315abadba24 (diff) | |
parent | 4de6221825447e77d7b1ee6bab28ce3407939301 (diff) | |
download | dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.gz dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.bz2 dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.lz dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.xz dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.zst dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.zip |
Merge branch 'development' into v2-prototype
* development: (29 commits)
Do not remove artifacts when running `clean`
fix style errors
Fix circular dependency
Add my profile image to images
Add myself to about page
Add dogfood configs to website
Revert to lerna:run lint
Do lint sequentially
Exclude monorepo-scripts from tslint as test
Fix prettier
Add hover state to top tokens
Change to weekly txn volume
Change minimum Node version to 6.12
Document Node.js version requirement and add it to package.json
Apply prettier to some files which were not formatted correctly
Fix TSLint issues
Fix TSLint issues
Update ethereeumjs-testrpc to ganache-cli
Fix infinite loop
Add changelog entries for packages where executable binary exporting fixed
...
# Conflicts:
# packages/contracts/package.json
# packages/contracts/util/formatters.ts
# packages/contracts/util/signed_order_utils.ts
# packages/migrations/package.json
# yarn.lock
Diffstat (limited to 'packages/testnet-faucets/src/ts/handler.ts')
-rw-r--r-- | packages/testnet-faucets/src/ts/handler.ts | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts index a6e786552..3858b5339 100644 --- a/packages/testnet-faucets/src/ts/handler.ts +++ b/packages/testnet-faucets/src/ts/handler.ts @@ -1,4 +1,5 @@ import { Order, SignedOrder, ZeroEx } from '0x.js'; +import { Provider } from '@0xproject/types'; import { BigNumber, logUtils } from '@0xproject/utils'; import * as express from 'express'; import * as _ from 'lodash'; @@ -38,7 +39,7 @@ const FIVE_DAYS_IN_MS = 4.32e8; // TODO: make this configurable export class Handler { private _networkConfigByNetworkId: ItemByNetworkId<NetworkConfig> = {}; - private static _createProviderEngine(rpcUrl: string) { + private static _createProviderEngine(rpcUrl: string): Provider { if (_.isUndefined(configs.DISPENSER_PRIVATE_KEY)) { throw new Error('Dispenser Private key not found'); } @@ -69,7 +70,7 @@ export class Handler { }; }); } - public getQueueInfo(req: express.Request, res: express.Response) { + public getQueueInfo(req: express.Request, res: express.Response): void { res.setHeader('Content-Type', 'application/json'); const queueInfo = _.mapValues(rpcUrls, (rpcUrl: string, networkId: string) => { const dispatchQueue = this._networkConfigByNetworkId[networkId].dispatchQueue; @@ -81,19 +82,23 @@ export class Handler { const payload = JSON.stringify(queueInfo); res.status(200).send(payload); } - public dispenseEther(req: express.Request, res: express.Response) { + public dispenseEther(req: express.Request, res: express.Response): void { this._dispenseAsset(req, res, RequestedAssetType.ETH); } - public dispenseZRX(req: express.Request, res: express.Response) { + public dispenseZRX(req: express.Request, res: express.Response): void { this._dispenseAsset(req, res, RequestedAssetType.ZRX); } - public async dispenseWETHOrder(req: express.Request, res: express.Response) { - await this._dispenseOrder(req, res, RequestedAssetType.WETH); + public async dispenseWETHOrderAsync(req: express.Request, res: express.Response): Promise<void> { + await this._dispenseOrderAsync(req, res, RequestedAssetType.WETH); } - public async dispenseZRXOrder(req: express.Request, res: express.Response, next: express.NextFunction) { - await this._dispenseOrder(req, res, RequestedAssetType.ZRX); + public async dispenseZRXOrderAsync( + req: express.Request, + res: express.Response, + next: express.NextFunction, + ): Promise<void> { + await this._dispenseOrderAsync(req, res, RequestedAssetType.ZRX); } - private _dispenseAsset(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) { + private _dispenseAsset(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType): void { const networkId = req.params.networkId; const recipient = req.params.recipient; const networkConfig = this._networkConfigByNetworkId[networkId]; @@ -121,7 +126,11 @@ export class Handler { logUtils.log(`Added ${recipient} to queue: ${requestedAssetType} networkId: ${networkId}`); res.status(200).end(); } - private async _dispenseOrder(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) { + private async _dispenseOrderAsync( + req: express.Request, + res: express.Response, + requestedAssetType: RequestedAssetType, + ): Promise<void> { const networkConfig = _.get(this._networkConfigByNetworkId, req.params.networkId); if (_.isUndefined(networkConfig)) { res.status(400).send('UNSUPPORTED_NETWORK_ID'); |