diff options
Diffstat (limited to 'packages/base-contract')
-rw-r--r-- | packages/base-contract/package.json | 9 | ||||
-rw-r--r-- | packages/base-contract/src/index.ts | 8 |
2 files changed, 9 insertions, 8 deletions
diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index c01a133e4..595bca3a9 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -8,15 +8,16 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts", - "test": "run-s clean build run_mocha", + "test": "yarn run_mocha", + "rebuild_and_test": "run-s clean build test", "test:circleci": "yarn test:coverage", - "run_mocha": "mocha lib/test/**/*_test.js --bail --exit", + "run_mocha": "mocha --require source-map-support/register lib/test/**/*_test.js --bail --exit", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", - "lint": "tslint --project .", + "lint": "tslint --project . --exclude **/src/contract_wrappers/**/*", "manual:postpublish": "yarn build; node ./scripts/postpublish.js" }, "license": "Apache-2.0", diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index d9e28f9f2..cb9042415 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -37,13 +37,14 @@ export class BaseContract { protected static _lowercaseAddress(type: string, value: string): string { return type === 'address' ? value.toLowerCase() : value; } - protected static _bigNumberToString(type: string, value: any): any { + protected static _bigNumberToString(_type: string, value: any): any { return _.isObject(value) && value.isBigNumber ? value.toString() : value; } protected static _lookupConstructorAbi(abi: ContractAbi): ConstructorAbi { const constructorAbiIfExists = _.find( abi, (abiDefinition: AbiDefinition) => abiDefinition.type === AbiType.Constructor, + // tslint:disable-next-line:no-unnecessary-type-assertion ) as ConstructorAbi | undefined; if (!_.isUndefined(constructorAbiIfExists)) { return constructorAbiIfExists; @@ -59,7 +60,7 @@ export class BaseContract { return defaultConstructorAbi; } } - protected static _bnToBigNumber(type: string, value: any): any { + protected static _bnToBigNumber(_type: string, value: any): any { return _.isObject(value) && value._bn ? new BigNumber(value.toString()) : value; } protected static async _applyDefaultsToTxDataAsync<T extends Partial<TxData | TxDataPayable>>( @@ -79,8 +80,7 @@ export class BaseContract { // Awaiting https://github.com/Microsoft/TypeScript/pull/13288 to be merged } as any; if (_.isUndefined(txDataWithDefaults.gas) && !_.isUndefined(estimateGasAsync)) { - const estimatedGas = await estimateGasAsync(txData); - txDataWithDefaults.gas = estimatedGas; + txDataWithDefaults.gas = await estimateGasAsync(txData); } return txDataWithDefaults; } |