@@ -286,25 +286,31 @@ export class DefaultSmartWallet extends SmartWallet {
286286 }
287287
288288 const bundlerClient = this . chainManager . getBundlerClient ( chainId , account ) ;
289+ const publicClient = this . chainManager . getPublicClient ( chainId ) ;
289290
290291 const gas = await bundlerClient . estimateUserOperationGas ( {
291292 account,
292293 calls : [ transactionData ] ,
293294 } ) ;
294295
295- const hash = await bundlerClient . sendUserOperation ( {
296+ const userOperationHash = await bundlerClient . sendUserOperation ( {
296297 account,
297298 calls : [ transactionData ] ,
298299 callGasLimit : this . bumpGasLimits ( gas . callGasLimit ) ,
299300 verificationGasLimit : this . bumpGasLimits ( gas . verificationGasLimit ) ,
300301 preVerificationGas : this . bumpGasLimits ( gas . preVerificationGas ) ,
301302 } ) ;
302303
303- await bundlerClient . waitForUserOperationReceipt ( {
304- hash,
304+ const userOperationReceipt = await bundlerClient . waitForUserOperationReceipt ( {
305+ hash : userOperationHash ,
305306 } ) ;
306307
307- return hash ;
308+ // Extra check that RPC node has included the transaction in the block
309+ await publicClient . waitForTransactionReceipt ( {
310+ hash : userOperationReceipt . receipt . transactionHash ,
311+ } ) ;
312+
313+ return userOperationHash ;
308314 } catch ( error ) {
309315 throw new Error (
310316 `Failed to send transaction: ${ error instanceof Error ? error . message . toString ( ) . slice ( 0 , 100 ) : 'Unknown error' } ` ,
@@ -346,25 +352,31 @@ export class DefaultSmartWallet extends SmartWallet {
346352 }
347353
348354 const bundlerClient = this . chainManager . getBundlerClient ( chainId , account ) ;
355+ const publicClient = this . chainManager . getPublicClient ( chainId ) ;
349356
350357 const gas = await bundlerClient . estimateUserOperationGas ( {
351358 account,
352359 calls : transactionData ,
353360 } ) ;
354361
355- const hash = await bundlerClient . sendUserOperation ( {
362+ const userOperationHash = await bundlerClient . sendUserOperation ( {
356363 account,
357364 calls : transactionData ,
358365 callGasLimit : this . bumpGasLimits ( gas . callGasLimit ) ,
359366 verificationGasLimit : this . bumpGasLimits ( gas . verificationGasLimit ) ,
360367 preVerificationGas : this . bumpGasLimits ( gas . preVerificationGas ) ,
361368 } ) ;
362369
363- await bundlerClient . waitForUserOperationReceipt ( {
364- hash,
370+ const userOperationReceipt = await bundlerClient . waitForUserOperationReceipt ( {
371+ hash : userOperationHash ,
372+ } ) ;
373+
374+ // Extra check that RPC node has included the transaction in the block
375+ await publicClient . waitForTransactionReceipt ( {
376+ hash : userOperationReceipt . receipt . transactionHash ,
365377 } ) ;
366378
367- return hash ;
379+ return userOperationHash ;
368380 } catch ( error ) {
369381 throw new Error (
370382 `Failed to send transaction: ${ error instanceof Error ? error . message : 'Unknown error' } ` ,
0 commit comments