Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sembrestels committed Oct 12, 2024
1 parent 705e807 commit b56923a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/evmcrispr/src/modules/std/helpers/token.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fetch from "isomorphic-fetch";

import { isAddress, parseAbiItem } from "viem";
import { getAddress, isAddress, parseAbiItem } from "viem";

import { ErrorException } from "../../../errors";

Expand Down Expand Up @@ -60,7 +60,7 @@ export const _token = async (
);
}

return tokenAddress;
return getAddress(tokenAddress);
};

export const token: HelperFunction<Std> = async (
Expand Down
4 changes: 4 additions & 0 deletions packages/evmcrispr/src/utils/web3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import type { Address } from "../types";
export const isFunctionSignature = (signature: string) => {
try {
parseAbiItem(`function ${signature} external`);
if (signature.includes(",)")) {
// Viem does not catch fn(a,) as invalid
return false;
}
return true;
} catch (error) {
return false;
Expand Down
3 changes: 3 additions & 0 deletions packages/evmcrispr/test/modules/aragonos/commands/act.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ describe("AragonOS > commands > act <agent> <targetAddress> <methodSignature> [.
["mint)", "right parenthesis"],
["mint(uint,)", "right comma"],
["mint(,uint)", "left comma"],
["mint(uint,uint,())", "empty tuple"],
["mint(uint,uint,(uint,))", "right comma in tuple"],
["mint(uint,uint,(,uint))", "left comma in tuple"],
];

await Promise.all(
Expand Down

0 comments on commit b56923a

Please sign in to comment.