Skip to content

Commit 4e9ea68

Browse files
authored
add another error phrase for nonce too low (#771)
1 parent 0b784dc commit 4e9ea68

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/utils/error.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ const _parseMessage = (error: unknown): string | null => {
1616

1717
export const isNonceAlreadyUsedError = (error: unknown) => {
1818
const message = _parseMessage(error);
19+
const errorPhrases = ["nonce too low", "already known"];
20+
1921
if (message) {
20-
return message.includes("nonce too low");
22+
return errorPhrases.some((phrase) =>
23+
message.toLowerCase().includes(phrase),
24+
);
2125
}
26+
2227
return isEthersErrorCode(error, ethers.errors.NONCE_EXPIRED);
2328
};
2429

0 commit comments

Comments
 (0)