Skip to content

Commit

Permalink
fix missing "src" code to allow build
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherDedominici committed Nov 19, 2024
1 parent 5217f8d commit d9d4207
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,14 @@ function checkToken(token: unknown, method: string) {
method,
},
);
} else if ((token as any).interface.getFunction("balanceOf") === null) {
} else if (
isObject(token) &&
"interface" in token &&
isObject(token.interface) &&
"getFunction" in token.interface &&
typeof token.interface.getFunction === "function" &&
token.interface.getFunction("balanceOf") === null
) {
throw new HardhatError(
HardhatError.ERRORS.CHAI_MATCHERS.CONTRACT_IS_NOT_AN_ERC20_TOKEN,
);
Expand Down
2 changes: 0 additions & 2 deletions v-next/hardhat-chai-matchers/src/internal/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// TODO: check if all are used

export const ASSERTION_ABORTED = "hh-chai-matchers-assertion-aborted";
export const PREVIOUS_MATCHER_NAME = "previousMatcherName";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const PANIC_CODE_PREFIX = "0x4e487b71";
*/
export function getReturnDataFromError(error: any): string {
if (!(error instanceof Error)) {
// eslint-disable-next-line no-restricted-syntax -- keep the original chai error structure
throw new AssertionError("Expected an Error object");
}

Expand Down

0 comments on commit d9d4207

Please sign in to comment.