Include the missing fragment key and args when no matching Contract method or event is present (#3809).

This commit is contained in:
Richard Moore 2023-07-23 12:36:52 -04:00
parent b1375f4e44
commit 450a176ee2

@ -251,7 +251,8 @@ function buildWrappedMethod<A extends Array<any> = Array<any>, R = any, D extend
const getFragment = function(...args: ContractMethodArgs<A>): FunctionFragment { const getFragment = function(...args: ContractMethodArgs<A>): FunctionFragment {
const fragment = contract.interface.getFunction(key, args); const fragment = contract.interface.getFunction(key, args);
assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
operation: "fragment" operation: "fragment",
info: { key, args }
}); });
return fragment; return fragment;
} }
@ -348,7 +349,8 @@ function buildWrappedMethod<A extends Array<any> = Array<any>, R = any, D extend
get: () => { get: () => {
const fragment = contract.interface.getFunction(key); const fragment = contract.interface.getFunction(key);
assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
operation: "fragment" operation: "fragment",
info: { key }
}); });
return fragment; return fragment;
} }
@ -363,7 +365,8 @@ function buildWrappedEvent<A extends Array<any> = Array<any>>(contract: BaseCont
const fragment = contract.interface.getEvent(key, args); const fragment = contract.interface.getEvent(key, args);
assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
operation: "fragment" operation: "fragment",
info: { key, args }
}); });
return fragment; return fragment;
@ -388,7 +391,8 @@ function buildWrappedEvent<A extends Array<any> = Array<any>>(contract: BaseCont
const fragment = contract.interface.getEvent(key); const fragment = contract.interface.getEvent(key);
assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
operation: "fragment" operation: "fragment",
info: { key }
}); });
return fragment; return fragment;