chore: tslint fix

This commit is contained in:
Fabio Berger 2018-10-17 18:23:06 +01:00
parent 87fabbb943
commit bdae4ba2a2
4 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,5 @@
import { abiUtils, BigNumber } from '@0xproject/utils'; import { abiUtils, BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { FunctionAbi } from 'ethereum-protocol';
import { import {
AbiDefinition, AbiDefinition,
AbiType, AbiType,
@ -130,6 +129,7 @@ export class BaseContract {
if (abiDefinition.type !== AbiType.Function) { if (abiDefinition.type !== AbiType.Function) {
return false; return false;
} }
// tslint:disable-next-line:no-unnecessary-type-assertion
const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition as MethodAbi); const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition as MethodAbi);
if (abiFunctionSignature === functionSignature) { if (abiFunctionSignature === functionSignature) {
return true; return true;

View File

@ -7,6 +7,7 @@ export const encoder = {
const constructorTypes: string[] = []; const constructorTypes: string[] = [];
_.each(abi, (element: AbiDefinition) => { _.each(abi, (element: AbiDefinition) => {
if (element.type === AbiType.Constructor) { if (element.type === AbiType.Constructor) {
// tslint:disable-next-line:no-unnecessary-type-assertion
const constuctorAbi = element as ConstructorAbi; const constuctorAbi = element as ConstructorAbi;
_.each(constuctorAbi.inputs, (input: DataItem) => { _.each(constuctorAbi.inputs, (input: DataItem) => {
constructorTypes.push(input.type); constructorTypes.push(input.type);

View File

@ -324,18 +324,22 @@ export class SolDoc {
switch (abiDefinition.type) { switch (abiDefinition.type) {
case 'constructor': case 'constructor':
docSection.constructors.push( docSection.constructors.push(
// tslint:disable-next-line:no-unnecessary-type-assertion
this._genConstructorDoc(contractName, abiDefinition as ConstructorAbi, compiledContract.devdoc), this._genConstructorDoc(contractName, abiDefinition as ConstructorAbi, compiledContract.devdoc),
); );
break; break;
case 'event': case 'event':
// tslint:disable-next-line:no-unnecessary-type-assertion
(docSection.events as Event[]).push(SolDoc._genEventDoc(abiDefinition as EventAbi)); (docSection.events as Event[]).push(SolDoc._genEventDoc(abiDefinition as EventAbi));
// note that we're not sending devdoc to this._genEventDoc(). // note that we're not sending devdoc to this._genEventDoc().
// that's because the type of the events array doesn't have any fields for documentation! // that's because the type of the events array doesn't have any fields for documentation!
break; break;
case 'function': case 'function':
// tslint:disable-next-line:no-unnecessary-type-assertion
docSection.methods.push(this._genMethodDoc(abiDefinition as MethodAbi, compiledContract.devdoc)); docSection.methods.push(this._genMethodDoc(abiDefinition as MethodAbi, compiledContract.devdoc));
break; break;
case 'fallback': case 'fallback':
// tslint:disable-next-line:no-unnecessary-type-assertion
docSection.methods.push( docSection.methods.push(
SolDoc._genFallbackDoc(abiDefinition as FallbackAbi, compiledContract.devdoc), SolDoc._genFallbackDoc(abiDefinition as FallbackAbi, compiledContract.devdoc),
); );

View File

@ -99,6 +99,7 @@ export class AbiDecoder {
const ethersInterface = new ethers.utils.Interface(abiArray); const ethersInterface = new ethers.utils.Interface(abiArray);
_.map(abiArray, (abi: AbiDefinition) => { _.map(abiArray, (abi: AbiDefinition) => {
if (abi.type === AbiType.Event) { if (abi.type === AbiType.Event) {
// tslint:disable-next-line:no-unnecessary-type-assertion
const eventAbi = abi as EventAbi; const eventAbi = abi as EventAbi;
const topic = ethersInterface.events[eventAbi.name].topic; const topic = ethersInterface.events[eventAbi.name].topic;
const numIndexedArgs = _.reduce(eventAbi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0); const numIndexedArgs = _.reduce(eventAbi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0);