diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-02-01 07:30:09 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-02-01 07:30:09 +0800 |
commit | 03cb7233dc5b8556952b4481f87a292e0fca1acf (patch) | |
tree | 4c203211a7ce7b0f44ebc45bb6c40621d4ee5b7e /packages/testnet-faucets | |
parent | 3a1ca32ff172f735e4b69f125fea4237c83643f0 (diff) | |
parent | 6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2 (diff) | |
download | dexon-sol-tools-03cb7233dc5b8556952b4481f87a292e0fca1acf.tar dexon-sol-tools-03cb7233dc5b8556952b4481f87a292e0fca1acf.tar.gz dexon-sol-tools-03cb7233dc5b8556952b4481f87a292e0fca1acf.tar.bz2 dexon-sol-tools-03cb7233dc5b8556952b4481f87a292e0fca1acf.tar.lz dexon-sol-tools-03cb7233dc5b8556952b4481f87a292e0fca1acf.tar.xz dexon-sol-tools-03cb7233dc5b8556952b4481f87a292e0fca1acf.tar.zst dexon-sol-tools-03cb7233dc5b8556952b4481f87a292e0fca1acf.zip |
Merge branch 'development' into feature/testnet-faucets/order-dispenser
* development: (49 commits)
Prettier
Updated contract generation in 0x to new abi-gen CLI
Add PR number to changelog
Fix lint errors
Removed deprecated CLI options
Add protected keyword to underscore lint rule
Remove unused prop
Fix prettier
Uppercase Networks enum values
Make default gasPrice more readable
Fix prettier mess
Fix linter errors
Shrink img
Fix all setState calls after unmounted errors. Decided to create our own flag rather then using a cancellablePromise since there was little to be gained from this alternative
Fix bug where we were return undefined instead of the empty object
Default the derivation path to that found in the Ledger subprovider
Add browser data to dialog info
Add Rinkeby support
Pass in whether we want the personal message prefix appended and never append it for Ledger. This fixes signing when Ledger is used and the backing node is not Parity
Wholesale replace the tokenByAddress and de-dup properly
...
Diffstat (limited to 'packages/testnet-faucets')
-rw-r--r-- | packages/testnet-faucets/src/ts/ether_request_queue.ts | 6 | ||||
-rw-r--r-- | packages/testnet-faucets/src/ts/request_queue.ts | 36 | ||||
-rw-r--r-- | packages/testnet-faucets/src/ts/zrx_request_queue.ts | 4 |
3 files changed, 23 insertions, 23 deletions
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 1a8bfe1d8..3659f4856 100644 --- a/packages/testnet-faucets/src/ts/zrx_request_queue.ts +++ b/packages/testnet-faucets/src/ts/zrx_request_queue.ts @@ -20,10 +20,10 @@ export class ZRXRequestQueue extends RequestQueue { private _zeroEx: ZeroEx; constructor(web3: Web3, zeroEx: ZeroEx) { super(web3); - this.queueIntervalMs = QUEUE_INTERVAL_MS; + this._queueIntervalMs = QUEUE_INTERVAL_MS; this._zeroEx = zeroEx; } - protected async processNextRequestFireAndForgetAsync(recipientAddress: string) { + protected async _processNextRequestFireAndForgetAsync(recipientAddress: string) { utils.consoleLog(`Processing ZRX ${recipientAddress}`); const baseUnitAmount = ZeroEx.toBaseUnitAmount(DISPENSE_AMOUNT_ZRX, 18); try { |