diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2019-02-07 15:59:25 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2019-02-09 08:25:30 +0800 |
commit | c72e3667b8366f8b125091d704a67c1de91985ff (patch) | |
tree | bcc863d33410b97d93e30b671a03e15f06eeac88 | |
parent | 6406126ae356a6dd1102cf603d4ce00333c9fd62 (diff) | |
download | dexon-0x-contracts-c72e3667b8366f8b125091d704a67c1de91985ff.tar.gz dexon-0x-contracts-c72e3667b8366f8b125091d704a67c1de91985ff.tar.zst dexon-0x-contracts-c72e3667b8366f8b125091d704a67c1de91985ff.zip |
ran prettier and linter
-rw-r--r-- | packages/contract-wrappers/src/contract_wrappers.ts | 2 | ||||
-rw-r--r-- | packages/utils/src/abi_decoder.ts | 21 | ||||
-rw-r--r-- | packages/utils/test/abi_decoder_test.ts | 4 |
3 files changed, 14 insertions, 13 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index 63de61a47..bd9a377ed 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -171,7 +171,7 @@ export class ContractWrappers { public getProvider(): Provider { return this._web3Wrapper.getProvider(); } - /** + /** * Get the provider instance currently used by contract-wrappers * @return Web3 provider instance */ diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index c817ad285..e8a222229 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -46,7 +46,7 @@ export class AbiDecoder { * @return AbiDecoder instance */ constructor(abiArrays: AbiDefinition[][]) { - _.each(abiArrays, (abi) => { + _.each(abiArrays, abi => { this.addABI(abi); }); } @@ -122,12 +122,12 @@ export class AbiDecoder { throw new Error(`No functions registered for selector '${functionSelector}'`); } const functionInfo = _.find(candidateFunctionInfos, txDecoder => { - return ( - (_.isUndefined(contractName) || - _.toLower(txDecoder.contractName) === _.toLower(contractName))); + return _.isUndefined(contractName) || _.toLower(txDecoder.contractName) === _.toLower(contractName); }); if (_.isUndefined(functionInfo)) { - throw new Error(`No function registered with selector ${functionSelector} and contract name ${contractName}.`); + throw new Error( + `No function registered with selector ${functionSelector} and contract name ${contractName}.`, + ); } else if (_.isUndefined(functionInfo.abiEncoder)) { throw new Error( `Function ABI Encoder is not defined, for function registered with selector ${functionSelector} and contract name ${contractName}.`, @@ -151,10 +151,7 @@ export class AbiDecoder { * @param abiDefinitions ABI definitions for a given contract. * @param contractName Name of contract that encapsulates the ABI definitions (optional). */ - public addABI( - abiArray: AbiDefinition[], - contractName?: string - ): void { + public addABI(abiArray: AbiDefinition[], contractName?: string): void { if (_.isUndefined(abiArray)) { return; } @@ -162,16 +159,20 @@ export class AbiDecoder { _.map(abiArray, (abi: AbiDefinition) => { switch (abi.type) { case AbiType.Event: + // tslint:disable no-unnecessary-type-assertion this._addEventABI(abi as EventAbi, ethersInterface); + // tslint:enable no-unnecessary-type-assertion break; case AbiType.Function: + // tslint:disable no-unnecessary-type-assertion this._addMethodABI(abi as MethodAbi, contractName); + // tslint:enable no-unnecessary-type-assertion break; default: // ignore other types - break; + break; } }); } diff --git a/packages/utils/test/abi_decoder_test.ts b/packages/utils/test/abi_decoder_test.ts index 346bfdfd3..601434614 100644 --- a/packages/utils/test/abi_decoder_test.ts +++ b/packages/utils/test/abi_decoder_test.ts @@ -2,7 +2,7 @@ import * as chai from 'chai'; import { MethodAbi } from 'ethereum-types'; import 'mocha'; -import { AbiEncoder, AbiDecoder } from '../src'; +import { AbiDecoder, AbiEncoder } from '../src'; import { chaiSetup } from './utils/chai_setup'; @@ -42,7 +42,7 @@ describe('AbiDecoder', () => { // Decode tx data using contract name const decodedTxData = abiDecoder.tryDecodeCalldata(foobarTxData, contractName); const expectedFunctionName = abi.name; - const expectedFunctionArguments = {testAddress}; + const expectedFunctionArguments = { testAddress }; expect(decodedTxData.functionName).to.be.equal(expectedFunctionName); expect(decodedTxData.functionSignature).to.be.equal(foobarSignature); expect(decodedTxData.functionArguments).to.be.deep.equal(expectedFunctionArguments); |