Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const methodAbis = contractAbi.filter((abi: AbiDefinition) => abi.type === AbiType.Function) as MethodAbi[];
// Sort method Abis into alphabetical order, by function signature
const methodAbi = _.find(this.abi, (abiDefinition: AbiDefinition) => {
if (abiDefinition.type !== AbiType.Function) {
return false;
}
// tslint:disable-next-line:no-unnecessary-type-assertion
const abiFunctionSignature = new AbiEncoder.Method(abiDefinition as MethodAbi).getSignature();
if (abiFunctionSignature === functionSignature) {
return true;
}
return false;
}) as MethodAbi;
return methodAbi;
_.map(abiArray, (abi: AbiDefinition) => {
switch (abi.type) {
case AbiType.Event:
// tslint:disable-next-line:no-unnecessary-type-assertion
this._addEventABI(abi as EventAbi, ethersInterface);
break;
case AbiType.Function:
// tslint:disable-next-line:no-unnecessary-type-assertion
this._addMethodABI(abi as MethodAbi, contractName);
break;
default:
// ignore other types
break;
}
});
}
(abiDefinition: AbiDefinition) => abiDefinition.type === AbiType.Function,
) as MethodAbi[];