Skip to content

Commit

Permalink
remove try/catch around prepareTransactionRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless-eth committed Oct 9, 2024
1 parent b58ce54 commit 1131ba7
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions src/executor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -596,8 +589,6 @@ export class Executor {
}
}

console.log("sent: ", transactionHash)

// needed for TS
if (!transactionHash) {
throw new Error("Transaction hash not assigned")
Expand Down

0 comments on commit 1131ba7

Please sign in to comment.