diff options
32 files changed, 82 insertions, 161 deletions
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index b0c646bc5..41dc65467 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -78,7 +78,7 @@ "typedoc": "~0.8.0", "typescript": "~2.6.1", "web3-provider-engine": "^13.0.1", - "web3-typescript-typings": "^0.7.2", + "web3-typescript-typings": "^0.9.0", "webpack": "^3.1.0" }, "dependencies": { diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 67b75df95..244b77a85 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -213,12 +213,17 @@ export class ZeroEx { * @param networkId The id of the network your provider is connected to */ public setProvider(provider: Web3Provider, networkId: number): void { - this._web3Wrapper.setProvider(provider, networkId); + this._web3Wrapper.setProvider(provider); (this.exchange as any)._invalidateContractInstances(); + (this.exchange as any)._setNetworkId(networkId); (this.tokenRegistry as any)._invalidateContractInstance(); + (this.tokenRegistry as any)._setNetworkId(networkId); (this.token as any)._invalidateContractInstances(); + (this.token as any)._setNetworkId(networkId); (this.proxy as any)._invalidateContractInstance(); + (this.proxy as any)._setNetworkId(networkId); (this.etherToken as any)._invalidateContractInstance(); + (this.etherToken as any)._setNetworkId(networkId); } /** * Get user Ethereum addresses available through the supplied web3 provider available for sending transactions. diff --git a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts index eb7e042e7..d308d207e 100644 --- a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts @@ -177,6 +177,9 @@ export class ContractWrapper { this._onLogStateChanged.bind(this, isRemoved), ); } + private _setNetworkId(networkId: number): void { + this._networkId = networkId; + } private _stopBlockAndLogStream(): void { if (_.isUndefined(this._blockAndLogStreamerIfExists)) { throw new Error(ZeroExError.SubscriptionNotFound); diff --git a/packages/0x.js/tsconfig.json b/packages/0x.js/tsconfig.json index d872fcf54..3d3b7a4f5 100644 --- a/packages/0x.js/tsconfig.json +++ b/packages/0x.js/tsconfig.json @@ -1,21 +1,14 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2015", "dom"], "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "experimentalDecorators": true, - "strictNullChecks": true + "strict": false }, "include": [ "./src/**/*", "./test/**/*", "../../node_modules/types-bn/index.d.ts", "../../node_modules/types-ethereumjs-util/index.d.ts", - "../../node_modules/web3-typescript-typings/index.d.ts", "../../node_modules/chai-typescript-typings/index.d.ts", "../../node_modules/chai-as-promised-typescript-typings/index.d.ts" ] diff --git a/packages/abi-gen/tsconfig.json b/packages/abi-gen/tsconfig.json index c9a7e9189..e35816553 100644 --- a/packages/abi-gen/tsconfig.json +++ b/packages/abi-gen/tsconfig.json @@ -1,13 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2015", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, - "include": ["./src/**/*", "./test/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] + "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts index 051a741c5..56f663780 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -18,9 +18,6 @@ export const assert = { `${variableName} should be in baseUnits (no decimals), found value: ${value.toNumber()}`, ); }, - isUndefined(value: any, variableName?: string): void { - this.assert(_.isUndefined(value), this.typeAssertionMessage(variableName, 'undefined', value)); - }, isString(variableName: string, value: string): void { this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value)); }, @@ -77,11 +74,11 @@ Validation errors: ${validationResult.errors.join(', ')}`; this.assert(!hasValidationErrors, msg); }, isHttpUrl(variableName: string, value: any): void { - const isValidUrl = validUrl.isWebUri(value); + const isValidUrl = !_.isUndefined(validUrl.isWebUri(value)); this.assert(isValidUrl, this.typeAssertionMessage(variableName, 'http url', value)); }, isUri(variableName: string, value: any): void { - const isValidUri = validUrl.isUri(value); + const isValidUri = !_.isUndefined(validUrl.isUri(value)); this.assert(isValidUri, this.typeAssertionMessage(variableName, 'uri', value)); }, assert(condition: boolean, message: string): void { diff --git a/packages/assert/test/assert_test.ts b/packages/assert/test/assert_test.ts index 29344584a..ff337196d 100644 --- a/packages/assert/test/assert_test.ts +++ b/packages/assert/test/assert_test.ts @@ -22,16 +22,6 @@ describe('Assertions', () => { invalidInputs.forEach(input => expect(assert.isBigNumber.bind(assert, variableName, input)).to.throw()); }); }); - describe('#isUndefined', () => { - it('should not throw for valid input', () => { - const validInputs = [undefined]; - validInputs.forEach(input => expect(assert.isUndefined.bind(assert, input, variableName)).to.not.throw()); - }); - it('should throw for invalid input', () => { - const invalidInputs = ['test', 42, false, { random: 'test' }]; - invalidInputs.forEach(input => expect(assert.isUndefined.bind(assert, input, variableName)).to.throw()); - }); - }); describe('#isString', () => { it('should not throw for valid input', () => { const validInputs = ['hello', 'goodbye']; @@ -44,7 +34,7 @@ describe('Assertions', () => { }); describe('#isFunction', () => { it('should not throw for valid input', () => { - const validInputs = [BigNumber, assert.isString.bind(this)]; + const validInputs = [BigNumber, assert.isString]; validInputs.forEach(input => expect(assert.isFunction.bind(assert, variableName, input)).to.not.throw()); }); it('should throw for invalid input', () => { diff --git a/packages/assert/tsconfig.json b/packages/assert/tsconfig.json index 31bedfeb7..88a467ccb 100644 --- a/packages/assert/tsconfig.json +++ b/packages/assert/tsconfig.json @@ -1,18 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2017", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, - "include": [ - "./src/**/*", - "./test/**/*", - "../../node_modules/chai-typescript-typings/index.d.ts", - "../../node_modules/web3-typescript-typings/index.d.ts" - ] + "include": ["./src/**/*", "./test/**/*", "../../node_modules/chai-typescript-typings/index.d.ts"] } diff --git a/packages/connect/package.json b/packages/connect/package.json index bd200db8d..2eb0cc0b0 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -59,6 +59,6 @@ "tslint": "5.8.0", "typedoc": "~0.8.0", "typescript": "~2.6.1", - "web3-typescript-typings": "^0.7.2" + "web3-typescript-typings": "^0.9.0" } } diff --git a/packages/connect/tsconfig.json b/packages/connect/tsconfig.json index 90400975b..3c150236e 100644 --- a/packages/connect/tsconfig.json +++ b/packages/connect/tsconfig.json @@ -1,19 +1,12 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2015", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, "include": [ "./src/**/*", "./test/**/*", "../../node_modules/chai-as-promised-typescript-typings/index.d.ts", - "../../node_modules/chai-typescript-typings/index.d.ts", - "../../node_modules/web3-typescript-typings/index.d.ts" + "../../node_modules/chai-typescript-typings/index.d.ts" ] } diff --git a/packages/contracts/deploy/solc/bin_paths.ts b/packages/contracts/deploy/solc/bin_paths.ts index a2d345bd7..e5b107101 100644 --- a/packages/contracts/deploy/solc/bin_paths.ts +++ b/packages/contracts/deploy/solc/bin_paths.ts @@ -1,4 +1,4 @@ -interface BinaryPaths { +export interface BinaryPaths { [key: string]: string; } diff --git a/packages/contracts/deploy/src/utils/contract.ts b/packages/contracts/deploy/src/utils/contract.ts index 2c8bbb79e..546e82dfb 100644 --- a/packages/contracts/deploy/src/utils/contract.ts +++ b/packages/contracts/deploy/src/utils/contract.ts @@ -24,7 +24,7 @@ export class Contract implements Web3.ContractInstance { this._validator = new SchemaValidator(); } private _populateFunctions(): void { - const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function); + const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function) as Web3.FunctionAbi[]; _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => { if (functionAbi.constant) { const cbStyleCallFunction = this._contract[functionAbi.name].call; @@ -42,7 +42,7 @@ export class Contract implements Web3.ContractInstance { }); } private _populateEvents(): void { - const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event); + const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event) as Web3.EventAbi[]; _.forEach(eventsAbi, (eventAbi: Web3.EventAbi) => { this[eventAbi.name] = this._contract[eventAbi.name]; }); diff --git a/packages/contracts/package.json b/packages/contracts/package.json index d5bd78fc2..41a7756da 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -52,7 +52,7 @@ "types-bn": "^0.0.1", "types-ethereumjs-util": "0xProject/types-ethereumjs-util", "typescript": "~2.6.1", - "web3-typescript-typings": "^0.7.2", + "web3-typescript-typings": "^0.9.0", "yargs": "^10.0.3" }, "dependencies": { diff --git a/packages/contracts/tsconfig.json b/packages/contracts/tsconfig.json index cbcd8ad6d..b3ab06b0d 100644 --- a/packages/contracts/tsconfig.json +++ b/packages/contracts/tsconfig.json @@ -1,16 +1,15 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "outDir": "./lib/", - "sourceMap": true, - "noImplicitAny": true, - "module": "commonjs", - "target": "es6", + "outDir": "lib", "baseUrl": ".", + "declaration": false, + "strictNullChecks": false, + "strictFunctionTypes": false, "allowJs": true }, "include": [ "../../node_modules/types-ethereumjs-util/index.d.ts", - "../../node_modules/web3-typescript-typings/index.d.ts", "../../node_modules/chai-typescript-typings/index.d.ts", "../../node_modules/chai-as-promised-typescript-typings/index.d.ts", "../../node_modules/types-ethereumjs-util/index.d.ts", diff --git a/packages/dev-utils/tsconfig.json b/packages/dev-utils/tsconfig.json index 51e3d5ef0..b28e45170 100644 --- a/packages/dev-utils/tsconfig.json +++ b/packages/dev-utils/tsconfig.json @@ -1,13 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2017", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, "include": [ "./src/**/*", diff --git a/packages/json-schemas/tsconfig.json b/packages/json-schemas/tsconfig.json index 27d415a13..88a467ccb 100644 --- a/packages/json-schemas/tsconfig.json +++ b/packages/json-schemas/tsconfig.json @@ -1,13 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2017", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, "include": ["./src/**/*", "./test/**/*", "../../node_modules/chai-typescript-typings/index.d.ts"] } 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/**/*"] } diff --git a/packages/monorepo-scripts/tsconfig.json b/packages/monorepo-scripts/tsconfig.json index b915df2a8..c56d255d5 100644 --- a/packages/monorepo-scripts/tsconfig.json +++ b/packages/monorepo-scripts/tsconfig.json @@ -1,11 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2015", "dom"], - "outDir": "lib", - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, "include": ["./src/**/*"] } diff --git a/packages/subproviders/tsconfig.json b/packages/subproviders/tsconfig.json index 63fb7d7d1..d889e2a51 100644 --- a/packages/subproviders/tsconfig.json +++ b/packages/subproviders/tsconfig.json @@ -1,19 +1,11 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2015", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "experimentalDecorators": true, - "strictNullChecks": true + "outDir": "lib" }, "include": [ "./src/**/*", "./test/**/*", - "../../node_modules/web3-typescript-typings/index.d.ts", "../../node_modules/chai-typescript-typings/index.d.ts", "../../node_modules/types-bn/index.d.ts", "../../node_modules/types-ethereumjs-util/index.d.ts", diff --git a/packages/tslint-config/tsconfig.json b/packages/tslint-config/tsconfig.json index 77ddf892f..15da53092 100644 --- a/packages/tslint-config/tsconfig.json +++ b/packages/tslint-config/tsconfig.json @@ -1,13 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2017", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, "include": ["./rules/**/*"] } diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index 0aa8c3dde..c56d255d5 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -1,13 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2017", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, - "include": ["./src/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] + "include": ["./src/**/*"] } diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index 10c38a15b..c56d255d5 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -1,13 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2017", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, "include": ["./src/**/*"] } diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index e7269d277..13e32e991 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -26,7 +26,7 @@ "shx": "^0.2.2", "tslint": "5.8.0", "typescript": "~2.6.1", - "web3-typescript-typings": "^0.7.2" + "web3-typescript-typings": "^0.9.0" }, "dependencies": { "@0xproject/utils": "^0.1.2", diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts index 8fa38e987..c4826f2be 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -33,7 +33,7 @@ export class Web3Wrapper { public getContractDefaults(): Partial<TxData> { return this._defaults; } - public setProvider(provider: Web3.Provider, networkId: number) { + public setProvider(provider: Web3.Provider) { this._web3.setProvider(provider); } public isAddress(address: string): boolean { diff --git a/packages/web3-wrapper/tsconfig.json b/packages/web3-wrapper/tsconfig.json index 0aa8c3dde..c56d255d5 100644 --- a/packages/web3-wrapper/tsconfig.json +++ b/packages/web3-wrapper/tsconfig.json @@ -1,13 +1,7 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "module": "commonjs", - "target": "es5", - "lib": ["es2017", "dom"], - "outDir": "lib", - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "strictNullChecks": true + "outDir": "lib" }, - "include": ["./src/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] + "include": ["./src/**/*"] } diff --git a/packages/website/package.json b/packages/website/package.json index 89f8e14bc..eb541218b 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -101,7 +101,7 @@ "style-loader": "0.13.x", "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-dev-middleware": "^1.10.0", "webpack-dev-server": "^2.5.0" diff --git a/packages/website/tsconfig.json b/packages/website/tsconfig.json index ebbee7ff3..43c417be0 100644 --- a/packages/website/tsconfig.json +++ b/packages/website/tsconfig.json @@ -1,18 +1,16 @@ { + "extends": "../../tsconfig", "compilerOptions": { "allowSyntheticDefaultImports": true, "outDir": "./transpiled/", - "sourceMap": true, - "lib": ["es2015", "dom"], - "noImplicitAny": true, - "module": "commonjs", - "target": "es5", "jsx": "react", "baseUrl": "./", "allowJs": true, + "strictNullChecks": true, + "declaration": false, "paths": { "*": ["node_modules/@types/*", "*"] } }, - "include": ["./ts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] + "include": ["./ts/**/*"] } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..a180f7298 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": ["es2017", "dom"], + "sourceMap": true, + "declaration": true, + "experimentalDecorators": true, + "noImplicitReturns": true, + "pretty": true, + "strict": true, + "typeRoots": ["node_modules/@types", "node_modules/web3-typescript-typings"] + } +} |