Skip to content

Commit

Permalink
Include the missing fragment key and args when no matching Contract m…
Browse files Browse the repository at this point in the history
…ethod or event is present (#3809).
  • Loading branch information
ricmoo committed Jul 23, 2023
1 parent b1375f4 commit 450a176
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src.ts/contract/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ function buildWrappedMethod<A extends Array<any> = Array<any>, R = any, D extend
const getFragment = function(...args: ContractMethodArgs<A>): FunctionFragment {
const fragment = contract.interface.getFunction(key, args);
assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
operation: "fragment"
operation: "fragment",
info: { key, args }
});
return fragment;
}
Expand Down Expand Up @@ -348,7 +349,8 @@ function buildWrappedMethod<A extends Array<any> = Array<any>, R = any, D extend
get: () => {
const fragment = contract.interface.getFunction(key);
assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
operation: "fragment"
operation: "fragment",
info: { key }
});
return fragment;
}
Expand All @@ -363,7 +365,8 @@ function buildWrappedEvent<A extends Array<any> = Array<any>>(contract: BaseCont
const fragment = contract.interface.getEvent(key, args);

assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
operation: "fragment"
operation: "fragment",
info: { key, args }
});

return fragment;
Expand All @@ -388,7 +391,8 @@ function buildWrappedEvent<A extends Array<any> = Array<any>>(contract: BaseCont
const fragment = contract.interface.getEvent(key);

assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
operation: "fragment"
operation: "fragment",
info: { key }
});

return fragment;
Expand Down

0 comments on commit 450a176

Please sign in to comment.