diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-01-05 01:56:30 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-01-10 18:24:31 +0800 |
commit | 27d9fba785a5a53550be53b12baf9069bda8d160 (patch) | |
tree | bde34d668e53832dd03dd279992721d56291124b /packages/kovan-faucets | |
parent | e6a783aff803c276392efec93571d24fc96feb6e (diff) | |
download | dexon-sol-tools-27d9fba785a5a53550be53b12baf9069bda8d160.tar dexon-sol-tools-27d9fba785a5a53550be53b12baf9069bda8d160.tar.gz dexon-sol-tools-27d9fba785a5a53550be53b12baf9069bda8d160.tar.bz2 dexon-sol-tools-27d9fba785a5a53550be53b12baf9069bda8d160.tar.lz dexon-sol-tools-27d9fba785a5a53550be53b12baf9069bda8d160.tar.xz dexon-sol-tools-27d9fba785a5a53550be53b12baf9069bda8d160.tar.zst dexon-sol-tools-27d9fba785a5a53550be53b12baf9069bda8d160.zip |
Include web3 types via typeRoots and factor out common parts of tsconfig.json
Diffstat (limited to 'packages/kovan-faucets')
-rw-r--r-- | packages/kovan-faucets/package.json | 2 | ||||
-rw-r--r-- | packages/kovan-faucets/src/ts/configs.ts | 2 | ||||
-rw-r--r-- | packages/kovan-faucets/src/ts/id_management.ts | 4 | ||||
-rw-r--r-- | packages/kovan-faucets/src/ts/request_queue.ts | 4 | ||||
-rw-r--r-- | packages/kovan-faucets/tsconfig.json | 12 |
5 files changed, 9 insertions, 15 deletions
diff --git a/packages/kovan-faucets/package.json b/packages/kovan-faucets/package.json index fe7cef5f2..797368064 100644 --- a/packages/kovan-faucets/package.json +++ b/packages/kovan-faucets/package.json @@ -36,7 +36,7 @@ "source-map-loader": "^0.1.6", "tslint": "5.8.0", "typescript": "~2.6.1", - "web3-typescript-typings": "^0.7.2", + "web3-typescript-typings": "^0.9.0", "webpack": "^3.1.0", "webpack-node-externals": "^1.6.0" } diff --git a/packages/kovan-faucets/src/ts/configs.ts b/packages/kovan-faucets/src/ts/configs.ts index 697e7522b..2e5a7f64d 100644 --- a/packages/kovan-faucets/src/ts/configs.ts +++ b/packages/kovan-faucets/src/ts/configs.ts @@ -1,5 +1,5 @@ export const configs = { - DISPENSER_ADDRESS: process.env.DISPENSER_ADDRESS.toLowerCase(), + DISPENSER_ADDRESS: (process.env.DISPENSER_ADDRESS as string).toLowerCase(), DISPENSER_PRIVATE_KEY: process.env.DISPENSER_PRIVATE_KEY, ENVIRONMENT: process.env.FAUCET_ENVIRONMENT, ROLLBAR_ACCESS_KEY: process.env.FAUCET_ROLLBAR_ACCESS_KEY, diff --git a/packages/kovan-faucets/src/ts/id_management.ts b/packages/kovan-faucets/src/ts/id_management.ts index 74865afb8..930821172 100644 --- a/packages/kovan-faucets/src/ts/id_management.ts +++ b/packages/kovan-faucets/src/ts/id_management.ts @@ -3,7 +3,7 @@ import EthereumTx = require('ethereumjs-tx'); import { configs } from './configs'; import { utils } from './utils'; -type Callback = (err: Error, accounts: any) => void; +type Callback = (err: Error | null, accounts: any) => void; export const idManagement = { getAccounts(callback: Callback) { @@ -15,7 +15,7 @@ export const idManagement = { }, signTransaction(txData: object, callback: Callback) { const tx = new EthereumTx(txData); - const privateKeyBuffer = new Buffer(configs.DISPENSER_PRIVATE_KEY, 'hex'); + const privateKeyBuffer = new Buffer(configs.DISPENSER_PRIVATE_KEY as string, 'hex'); tx.sign(privateKeyBuffer); const rawTx = `0x${tx.serialize().toString('hex')}`; callback(null, rawTx); diff --git a/packages/kovan-faucets/src/ts/request_queue.ts b/packages/kovan-faucets/src/ts/request_queue.ts index ea3eee18e..2b42ca4bf 100644 --- a/packages/kovan-faucets/src/ts/request_queue.ts +++ b/packages/kovan-faucets/src/ts/request_queue.ts @@ -38,10 +38,10 @@ export class RequestQueue { } protected start() { this.queueIntervalId = timers.setInterval(() => { - if (this.queue.length === 0) { + const recipientAddress = this.queue.shift(); + if (_.isUndefined(recipientAddress)) { return; } - const recipientAddress = this.queue.shift(); // tslint:disable-next-line:no-floating-promises this.processNextRequestFireAndForgetAsync(recipientAddress); }, this.queueIntervalMs); diff --git a/packages/kovan-faucets/tsconfig.json b/packages/kovan-faucets/tsconfig.json index 7f0031ec6..6f3948fc5 100644 --- a/packages/kovan-faucets/tsconfig.json +++ b/packages/kovan-faucets/tsconfig.json @@ -1,13 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2015", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "experimentalDecorators": true + "outDir": "lib" }, - "include": ["../../node_modules/web3-typescript-typings/index.d.ts", "./src/ts/**/*"] + "include": ["./src/ts/**/*"] } |