{"action":"created","comment":{"url":"https://api.github.com/repos/0xProject/0x.js/pulls/comments/166125602","pull_request_review_id":94158150,"id":166125602,"diff_hunk":"@@ -62,37 +77,83 @@ export class Handler {\n         res.status(200).send(payload);\n     }\n     public dispenseEther(req: express.Request, res: express.Response) {\n-        this._dispense(req, res, this._etherRequestQueueByNetworkId, QueueType.ETH);\n+        this._dispenseAsset(req, res, this._etherRequestQueueByNetworkId, RequestedAssetType.ETH);\n     }\n     public dispenseZRX(req: express.Request, res: express.Response) {\n-        this._dispense(req, res, this._zrxRequestQueueByNetworkId, QueueType.ZRX);\n+        this._dispenseAsset(req, res, this._zrxRequestQueueByNetworkId, RequestedAssetType.ZRX);\n+    }\n+    public async dispenseWETHOrder(req: express.Request, res: express.Response) {\n+        await this._dispenseOrder(req, res, RequestedAssetType.WETH);\n     }\n-    private _dispense(\n+    public async dispenseZRXOrder(req: express.Request, res: express.Response, next: express.NextFunction) {\n+        await this._dispenseOrder(req, res, RequestedAssetType.ZRX);\n+    }\n+    // tslint:disable-next-line:prefer-function-over-method\n+    private _dispenseAsset(\n         req: express.Request,\n         res: express.Response,\n-        requestQueueByNetworkId: RequestQueueByNetworkId,\n-        queueType: QueueType,\n+        requestQueueByNetworkId: ItemByNetworkId<RequestQueue>,\n+        requestedAssetType: RequestedAssetType,\n     ) {\n-        const recipientAddress = req.params.recipient;\n-        if (_.isUndefined(recipientAddress) || !this._isValidEthereumAddress(recipientAddress)) {\n-            res.status(400).send('INVALID_RECIPIENT_ADDRESS');\n-            return;\n-        }\n-        const networkId = _.get(req.query, 'networkId', DEFAULT_NETWORK_ID);\n-        const requestQueue = _.get(requestQueueByNetworkId, networkId);\n+        const requestQueue = _.get(requestQueueByNetworkId, req.networkId);\n         if (_.isUndefined(requestQueue)) {\n-            res.status(400).send('INVALID_NETWORK_ID');\n+            res.status(400).send('UNSUPPORTED_NETWORK_ID');\n             return;\n         }\n-        const lowerCaseRecipientAddress = recipientAddress.toLowerCase();\n-        const didAddToQueue = requestQueue.add(lowerCaseRecipientAddress);\n+        const didAddToQueue = requestQueue.add(req.recipientAddress);\n         if (!didAddToQueue) {\n             res.status(503).send('QUEUE_IS_FULL');\n             return;\n         }\n-        utils.consoleLog(`Added ${lowerCaseRecipientAddress} to queue: ${queueType} networkId: ${networkId}`);\n+        utils.consoleLog(`Added ${req.recipientAddress} to queue: ${requestedAssetType} networkId: ${req.networkId}`);\n         res.status(200).end();\n     }\n+    private async _dispenseOrder(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {\n+        const zeroEx = _.get(this._zeroExByNetworkId, req.networkId);\n+        if (_.isUndefined(zeroEx)) {\n+            res.status(400).send('UNSUPPORTED_NETWORK_ID');\n+            return;\n+        }\n+        res.setHeader('Content-Type', 'application/json');\n+        const makerTokenAddress = await zeroEx.tokenRegistry.getTokenAddressBySymbolIfExistsAsync(requestedAssetType);\n+        if (_.isUndefined(makerTokenAddress)) {","path":"packages/testnet-faucets/src/ts/handler.ts","position":128,"original_position":128,"commit_id":"6577d607332e2fb1a442d663e260ecb969457c36","original_commit_id":"6577d607332e2fb1a442d663e260ecb969457c36","user":{"login":"BMillman19","id":1141340,"avatar_url":"https://avatars0.githubusercontent.com/u/1141340?v=4","gravatar_id":"","url":"https://api.github.com/users/BMillman19","html_url":"https://github.com/BMillman19","followers_url":"https://api.github.com/users/BMillman19/followers","following_url":"https://api.github.com/users/BMillman19/following{/other_user}","gists_url":"https://api.github.com/users/BMillman19/gists{/gist_id}","starred_url":"https://api.github.com/users/BMillman19/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BMillman19/subscriptions","organizations_url":"https://api.github.com/users/BMillman19/orgs","repos_url":"https://api.github.com/users/BMillman19/repos","events_url":"https://api.github.com/users/BMillman19/events{/privacy}","received_events_url":"https://api.github.com/users/BMillman19/received_events","type":"User","site_admin":false},"body":"sure, makes sense","created_at":"2018-02-05T21:59:32Z","updated_at":"2018-02-05T21:59:32Z","html_url":"https://github.com/0xProject/0x.js/pull/352#discussion_r166125602","pull_request_url":"https://api.github.com/repos/0xProject/0x.js/pulls/352","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/0xProject/0x.js/pulls/comments/166125602"},"html":{"href":"https://github.com/0xProject/0x.js/pull/352#discussion_r166125602"},"pull_request":{"href":"https://api.github.com/repos/0xProject/0x.js/pulls/352"}},"in_reply_to_id":165525728},"pull_request":{"url":"https://api.github.com/repos/0xProject/0x.js/pulls/352","id":166078092,"html_url":"https://github.com/0xProject/0x.js/pull/352","diff_url":"https://github.com/0xProject/0x.js/pull/352.diff","patch_url":"https://github.com/0xProject/0x.js/pull/352.patch","issue_url":"https://api.github.com/repos/0xProject/0x.js/issues/352","number":352,"state":"open","locked":false,"title":"Add order signing and dispensing ability to faucet","user":{"login":"BMillman19","id":1141340,"avatar_url":"https://avatars0.githubusercontent.com/u/1141340?v=4","gravatar_id":"","url":"https://api.github.com/users/BMillman19","html_url":"https://github.com/BMillman19","followers_url":"https://api.github.com/users/BMillman19/followers","following_url":"https://api.github.com/users/BMillman19/following{/other_user}","gists_url":"https://api.github.com/users/BMillman19/gists{/gist_id}","starred_url":"https://api.github.com/users/BMillman19/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BMillman19/subscriptions","organizations_url":"https://api.github.com/users/BMillman19/orgs","repos_url":"https://api.github.com/users/BMillman19/repos","events_url":"https://api.github.com/users/BMillman19/events{/privacy}","received_events_url":"https://api.github.com/users/BMillman19/received_events","type":"User","site_admin":false},"body":"## Description\r\n\r\n- Add new endpoints to the testnet faucet that dispense orders signed by the dispenser address\r\n- Extract common parameter extraction and sanitizing into middleware\r\n\r\n## Motivation and Context\r\n\r\n- An easy source of ZRX/WETH liquidity on testnets\r\n\r\n## How Has This Been Tested?\r\n\r\n- Manual testing in dev environment\r\n\r\n## Types of changes\r\n\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [ ] Bug fix (non-breaking change which fixes an issue)\r\n- [x] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n\r\n* [x] Change requires a change to the documentation.\r\n* [ ] Added tests to cover my changes.\r\n","created_at":"2018-01-30T19:41:15Z","updated_at":"2018-02-05T21:59:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8fa4b008f6b71d2d3e1b0ceac4bf4fd7a2fe2aae","assignee":null,"assignees":[],"requested_reviewers":[{"login":"dekz","id":27389,"avatar_url":"https://avatars0.githubusercontent.com/u/27389?v=4","gravatar_id":"","url":"https://api.github.com/users/dekz","html_url":"https://github.com/dekz","followers_url":"https://api.github.com/users/dekz/followers","following_url":"https://api.github.com/users/dekz/following{/other_user}","gists_url":"https://api.github.com/users/dekz/gists{/gist_id}","starred_url":"https://api.github.com/users/dekz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dekz/subscriptions","organizations_url":"https://api.github.com/users/dekz/orgs","repos_url":"https://api.github.com/users/dekz/repos","events_url":"https://api.github.com/users/dekz/events{/privacy}","received_events_url":"https://api.github.com/users/dekz/received_events","type":"User","site_admin":false},{"login":"LogvinovLeon","id":6204356,"avatar_url":"https://avatars1.githubusercontent.com/u/6204356?v=4","gravatar_id":"","url":"https://api.github.com/users/LogvinovLeon","html_url":"https://github.com/LogvinovLeon","followers_url":"https://api.github.com/users/LogvinovLeon/followers","following_url":"https://api.github.com/users/LogvinovLeon/following{/other_user}","gists_url":"https://api.github.com/users/LogvinovLeon/gists{/gist_id}","starred_url":"https://api.github.com/users/LogvinovLeon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LogvinovLeon/subscriptions","organizations_url":"https://api.github.com/users/LogvinovLeon/orgs","repos_url":"https://api.github.com/users/LogvinovLeon/repos","events_url":"https://api.github.com/users/LogvinovLeon/events{/privacy}","received_events_url":"https://api.github.com/users/LogvinovLeon/received_events","type":"User","site_admin":false},{"login":"abandeali1","id":18060168,"avatar_url":"https://avatars0.githubusercontent.com/u/18060168?v=4","gravatar_id":"","url":"https://api.github.com/users/abandeali1","html_url":"https://github.com/abandeali1","followers_url":"https://api.github.com/users/abandeali1/followers","following_url":"https://api.github.com/users/abandeali1/following{/other_user}","gists_url":"https://api.github.com/users/abandeali1/gists{/gist_id}","starred_url":"https://api.github.com/users/abandeali1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abandeali1/subscriptions","organizations_url":"https://api.github.com/users/abandeali1/orgs","repos_url":"https://api.github.com/users/abandeali1/repos","events_url":"https://api.github.com/users/abandeali1/events{/privacy}","received_events_url":"https://api.github.com/users/abandeali1/received_events","type":"User","site_admin":false}],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/0xProject/0x.js/pulls/352/commits","review_comments_url":"https://api.github.com/repos/0xProject/0x.js/pulls/352/comments","review_comment_url":"https://api.github.com/repos/0xProject/0x.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/0xProject/0x.js/issues/352/comments","statuses_url":"https://api.github.com/repos/0xProject/0x.js/statuses/6577d607332e2fb1a442d663e260ecb969457c36","head":{"label":"0xProject:feature/testnet-faucets/order-dispenser","ref":"feature/testnet-faucets/order-dispenser","sha":"6577d607332e2fb1a442d663e260ecb969457c36","user":{"login":"0xProject","id":24832717,"avatar_url":"https://avatars2.githubusercontent.com/u/24832717?v=4","gravatar_id":"","url":"https://api.github.com/users/0xProject","html_url":"https://github.com/0xProject","followers_url":"https://api.github.com/users/0xProject/followers","following_url":"https://api.github.com/users/0xProject/following{/other_user}","gists_url":"https://api.github.com/users/0xProject/gists{/gist_id}","starred_url":"https://api.github.com/users/0xProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0xProject/subscriptions","organizations_url":"https://api.github.com/users/0xProject/orgs","repos_url":"https://api.github.com/users/0xProject/repos","events_url":"https://api.github.com/users/0xProject/events{/privacy}","received_events_url":"https://api.github.com/users/0xProject/received_events","type":"Organization","site_admin":false},"repo":{"id":92181371,"name":"0x.js","full_name":"0xProject/0x.js","owner":{"login":"0xProject","id":24832717,"avatar_url":"https://avatars2.githubusercontent.com/u/24832717?v=4","gravatar_id":"","url":"https://api.github.com/users/0xProject","html_url":"https://github.com/0xProject","followers_url":"https://api.github.com/users/0xProject/followers","following_url":"https://api.github.com/users/0xProject/following{/other_user}","gists_url":"https://api.github.com/users/0xProject/gists{/gist_id}","starred_url":"https://api.github.com/users/0xProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0xProject/subscriptions","organizations_url":"https://api.github.com/users/0xProject/orgs","repos_url":"https://api.github.com/users/0xProject/repos","events_url":"https://api.github.com/users/0xProject/events{/privacy}","received_events_url":"https://api.github.com/users/0xProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/0xProject/0x.js","description":"0x protocol TypeScript monorepo","fork":false,"url":"https://api.github.com/repos/0xProject/0x.js","forks_url":"https://api.github.com/repos/0xProject/0x.js/forks","keys_url":"https://api.github.com/repos/0xProject/0x.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/0xProject/0x.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/0xProject/0x.js/teams","hooks_url":"https://api.github.com/repos/0xProject/0x.js/hooks","issue_events_url":"https://api.github.com/repos/0xProject/0x.js/issues/events{/number}","events_url":"https://api.github.com/repos/0xProject/0x.js/events","assignees_url":"https://api.github.com/repos/0xProject/0x.js/assignees{/user}","branches_url":"https://api.github.com/repos/0xProject/0x.js/branches{/branch}","tags_url":"https://api.github.com/repos/0xProject/0x.js/tags","blobs_url":"https://api.github.com/repos/0xProject/0x.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/0xProject/0x.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/0xProject/0x.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/0xProject/0x.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/0xProject/0x.js/statuses/{sha}","languages_url":"https://api.github.com/repos/0xProject/0x.js/languages","stargazers_url":"https://api.github.com/repos/0xProject/0x.js/stargazers","contributors_url":"https://api.github.com/repos/0xProject/0x.js/contributors","subscribers_url":"https://api.github.com/repos/0xProject/0x.js/subscribers","subscription_url":"https://api.github.com/repos/0xProject/0x.js/subscription","commits_url":"https://api.github.com/repos/0xProject/0x.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/0xProject/0x.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/0xProject/0x.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/0xProject/0x.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/0xProject/0x.js/contents/{+path}","compare_url":"https://api.github.com/repos/0xProject/0x.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/0xProject/0x.js/merges","archive_url":"https://api.github.com/repos/0xProject/0x.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/0xProject/0x.js/downloads","issues_url":"https://api.github.com/repos/0xProject/0x.js/issues{/number}","pulls_url":"https://api.github.com/repos/0xProject/0x.js/pulls{/number}","milestones_url":"https://api.github.com/repos/0xProject/0x.js/milestones{/number}","notifications_url":"https://api.github.com/repos/0xProject/0x.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/0xProject/0x.js/labels{/name}","releases_url":"https://api.github.com/repos/0xProject/0x.js/releases{/id}","deployments_url":"https://api.github.com/repos/0xProject/0x.js/deployments","created_at":"2017-05-23T14:17:33Z","updated_at":"2018-02-05T16:18:07Z","pushed_at":"2018-02-05T21:55:09Z","git_url":"git://github.com/0xProject/0x.js.git","ssh_url":"git@github.com:0xProject/0x.js.git","clone_url":"https://github.com/0xProject/0x.js.git","svn_url":"https://github.com/0xProject/0x.js","homepage":"","size":24560,"stargazers_count":366,"watchers_count":366,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":71,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":71,"open_issues":19,"watchers":366,"default_branch":"development"}},"base":{"label":"0xProject:development","ref":"development","sha":"6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2","user":{"login":"0xProject","id":24832717,"avatar_url":"https://avatars2.githubusercontent.com/u/24832717?v=4","gravatar_id":"","url":"https://api.github.com/users/0xProject","html_url":"https://github.com/0xProject","followers_url":"https://api.github.com/users/0xProject/followers","following_url":"https://api.github.com/users/0xProject/following{/other_user}","gists_url":"https://api.github.com/users/0xProject/gists{/gist_id}","starred_url":"https://api.github.com/users/0xProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0xProject/subscriptions","organizations_url":"https://api.github.com/users/0xProject/orgs","repos_url":"https://api.github.com/users/0xProject/repos","events_url":"https://api.github.com/users/0xProject/events{/privacy}","received_events_url":"https://api.github.com/users/0xProject/received_events","type":"Organization","site_admin":false},"repo":{"id":92181371,"name":"0x.js","full_name":"0xProject/0x.js","owner":{"login":"0xProject","id":24832717,"avatar_url":"https://avatars2.githubusercontent.com/u/24832717?v=4","gravatar_id":"","url":"https://api.github.com/users/0xProject","html_url":"https://github.com/0xProject","followers_url":"https://api.github.com/users/0xProject/followers","following_url":"https://api.github.com/users/0xProject/following{/other_user}","gists_url":"https://api.github.com/users/0xProject/gists{/gist_id}","starred_url":"https://api.github.com/users/0xProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0xProject/subscriptions","organizations_url":"https://api.github.com/users/0xProject/orgs","repos_url":"https://api.github.com/users/0xProject/repos","events_url":"https://api.github.com/users/0xProject/events{/privacy}","received_events_url":"https://api.github.com/users/0xProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/0xProject/0x.js","description":"0x protocol TypeScript monorepo","fork":false,"url":"https://api.github.com/repos/0xProject/0x.js","forks_url":"https://api.github.com/repos/0xProject/0x.js/forks","keys_url":"https://api.github.com/repos/0xProject/0x.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/0xProject/0x.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/0xProject/0x.js/teams","hooks_url":"https://api.github.com/repos/0xProject/0x.js/hooks","issue_events_url":"https://api.github.com/repos/0xProject/0x.js/issues/events{/number}","events_url":"https://api.github.com/repos/0xProject/0x.js/events","assignees_url":"https://api.github.com/repos/0xProject/0x.js/assignees{/user}","branches_url":"https://api.github.com/repos/0xProject/0x.js/branches{/branch}","tags_url":"https://api.github.com/repos/0xProject/0x.js/tags","blobs_url":"https://api.github.com/repos/0xProject/0x.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/0xProject/0x.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/0xProject/0x.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/0xProject/0x.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/0xProject/0x.js/statuses/{sha}","languages_url":"https://api.github.com/repos/0xProject/0x.js/languages","stargazers_url":"https://api.github.com/repos/0xProject/0x.js/stargazers","contributors_url":"https://api.github.com/repos/0xProject/0x.js/contributors","subscribers_url":"https://api.github.com/repos/0xProject/0x.js/subscribers","subscription_url":"https://api.github.com/repos/0xProject/0x.js/subscription","commits_url":"https://api.github.com/repos/0xProject/0x.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/0xProject/0x.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/0xProject/0x.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/0xProject/0x.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/0xProject/0x.js/contents/{+path}","compare_url":"https://api.github.com/repos/0xProject/0x.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/0xProject/0x.js/merges","archive_url":"https://api.github.com/repos/0xProject/0x.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/0xProject/0x.js/downloads","issues_url":"https://api.github.com/repos/0xProject/0x.js/issues{/number}","pulls_url":"https://api.github.com/repos/0xProject/0x.js/pulls{/number}","milestones_url":"https://api.github.com/repos/0xProject/0x.js/milestones{/number}","notifications_url":"https://api.github.com/repos/0xProject/0x.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/0xProject/0x.js/labels{/name}","releases_url":"https://api.github.com/repos/0xProject/0x.js/releases{/id}","deployments_url":"https://api.github.com/repos/0xProject/0x.js/deployments","created_at":"2017-05-23T14:17:33Z","updated_at":"2018-02-05T16:18:07Z","pushed_at":"2018-02-05T21:55:09Z","git_url":"git://github.com/0xProject/0x.js.git","ssh_url":"git@github.com:0xProject/0x.js.git","clone_url":"https://github.com/0xProject/0x.js.git","svn_url":"https://github.com/0xProject/0x.js","homepage":"","size":24560,"stargazers_count":366,"watchers_count":366,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":71,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":71,"open_issues":19,"watchers":366,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/0xProject/0x.js/pulls/352"},"html":{"href":"https://github.com/0xProject/0x.js/pull/352"},"issue":{"href":"https://api.github.com/repos/0xProject/0x.js/issues/352"},"comments":{"href":"https://api.github.com/repos/0xProject/0x.js/issues/352/comments"},"review_comments":{"href":"https://api.github.com/repos/0xProject/0x.js/pulls/352/comments"},"review_comment":{"href":"https://api.github.com/repos/0xProject/0x.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/0xProject/0x.js/pulls/352/commits"},"statuses":{"href":"https://api.github.com/repos/0xProject/0x.js/statuses/6577d607332e2fb1a442d663e260ecb969457c36"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"BMillman19"}}