From 1131ba7439481b9e7c2d44f267edb5a14c494bd5 Mon Sep 17 00:00:00 2001 From: mouseless <97399882+mouseless-eth@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:40:24 +0100 Subject: [PATCH] remove try/catch around prepareTransactionRequest --- src/executor/executor.ts | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/executor/executor.ts b/src/executor/executor.ts index c1dc69d3..02e468cf 100644 --- a/src/executor/executor.ts +++ b/src/executor/executor.ts @@ -542,28 +542,21 @@ export class Executor { nonce: number } ) { - let request: PrepareTransactionRequestRequest - - try { - request = await this.walletClient.prepareTransactionRequest({ - to: entryPoint, - data: encodeFunctionData({ - abi: EntryPointV07Abi, - functionName: "handleOps", - args: [userOps, opts.account.address] - }), - ...opts, - nonce: opts.nonce - 1 - }) - } catch (e: unknown) { - throw new Error("Failed to generate transactionRequest") - } + const request = await this.walletClient.prepareTransactionRequest({ + to: entryPoint, + data: encodeFunctionData({ + abi: EntryPointV07Abi, + functionName: "handleOps", + args: [userOps, opts.account.address] + }), + ...opts + }) let attempts = 0 let transactionHash: Hex | undefined const maxAttempts = 3 - // Try sending the transaction and updating if there is an error + // Try sending the transaction and updating relevant fields if there is an error. while (attempts < maxAttempts) { try { transactionHash = @@ -596,8 +589,6 @@ export class Executor { } } - console.log("sent: ", transactionHash) - // needed for TS if (!transactionHash) { throw new Error("Transaction hash not assigned")