Skip to content

Commit

Permalink
improve(utils): Catch expected RPC logs (#795)
Browse files Browse the repository at this point in the history
We shouldn't send `error` level logs when the error is a nonce collision, which sometimes gets returned with an RPC specific error msg
  • Loading branch information
nicholaspai committed Aug 3, 2023
1 parent f744dd5 commit 496bbe1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/TransactionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ export type TransactionSimulationResult = {
};

const txnRetryErrors = new Set(["INSUFFICIENT_FUNDS", "NONCE_EXPIRED", "REPLACEMENT_UNDERPRICED"]);
const expectedRpcErrorMessages = new Set(["nonce has already been used", "intrinsic gas too low"]);
const txnRetryable = (error?: unknown): boolean => {
if (typeguards.isEthersError(error)) {
return txnRetryErrors.has(error.code);
}

return (error as Error)?.message?.includes("intrinsic gas too low");
return expectedRpcErrorMessages.has((error as Error)?.message);
};

export function getMultisender(chainId: number, baseSigner: Wallet): Contract | undefined {
Expand Down

0 comments on commit 496bbe1

Please sign in to comment.