Skip to content

Commit

Permalink
Add support for more formats of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TomiOhl committed Sep 9, 2022
1 parent 9bd039e commit abdc561
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export async function expectRevertCustomError(

if (values) {
expect(values.length, "Expected the number of values to match the number of types").to.eq(types.length);
const decodedValues = utils.defaultAbiCoder.decode(types, utils.hexDataSlice(revert.data.result, 4));
const revertData = typeof revert.data === "string" ? revert.data : revert.data.result;
const decodedValues = utils.defaultAbiCoder.decode(types, utils.hexDataSlice(revertData, 4));
decodedValues.forEach((elem, index) => expect(elem.toString()).to.eq(values[index].toString()));
}
}
Expand Down

0 comments on commit abdc561

Please sign in to comment.