From 496bbe1e7b5a6e50e2bd3580612f93e6d346cc77 Mon Sep 17 00:00:00 2001 From: nicholaspai <9457025+nicholaspai@users.noreply.github.com> Date: Thu, 3 Aug 2023 17:17:43 -0400 Subject: [PATCH] improve(utils): Catch expected RPC logs (#795) We shouldn't send `error` level logs when the error is a nonce collision, which sometimes gets returned with an RPC specific error msg --- src/utils/TransactionUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/TransactionUtils.ts b/src/utils/TransactionUtils.ts index d96fa15c4..79c530863 100644 --- a/src/utils/TransactionUtils.ts +++ b/src/utils/TransactionUtils.ts @@ -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 {