Skip to content

Commit

Permalink
apply pr suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Jun 28, 2023
1 parent 37a2b72 commit 162e2ba
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/conditions/base/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ const functionAbiSchema = Joi.object({
// Now we just need to validate against the parent schema
// Validate method name
const method = helper.state.ancestors[0].method;
const abiMethodName = Object.keys(asInterface.functions).find((name) =>
name.startsWith(`${method}(`)
);
const functionFragment = abiMethodName
? asInterface.functions[abiMethodName]
: null;

let functionFragment;
try {
functionFragment = asInterface.getFunction(method);
} catch (e) {
return helper.message({
custom: `"functionAbi" contains ambiguous "${method}"`,
});
}

if (!functionFragment) {
return helper.message({
custom: `"functionAbi" not valid for method: "${method}"`,
Expand Down

0 comments on commit 162e2ba

Please sign in to comment.