@@ -120,8 +120,8 @@ def deployModuleManager(salt) -> bool:
120120 })
121121 else :
122122 txnDict .update ({
123- 'maxFeePerGas' : math . ceil ( float ( gasFees ["medium" ]["suggestedMaxFeePerGas" ]) ),
124- 'maxPriorityFeePerGas' : math . ceil ( float ( gasFees ["medium" ]["suggestedMaxPriorityFeePerGas" ]))
123+ 'maxFeePerGas' : w3 . toWei ( gasFees ["medium" ]["suggestedMaxFeePerGas" ], 'gwei' ),
124+ 'maxPriorityFeePerGas' : w3 . toWei ( gasFees ["medium" ]["suggestedMaxPriorityFeePerGas" ], 'gwei' ),
125125 })
126126
127127 transaction = transactionTemplate .build_transaction (txnDict )
@@ -170,14 +170,18 @@ def eth_sendUserOperation(request) -> Result:
170170 transactionTemplate = entryPoint .functions .handleOps ([dict (op ) for op in bundleDict ],
171171 address )
172172
173- gasEstimation = transactionTemplate .estimate_gas ()
173+ try :
174+ gasEstimation = transactionTemplate .estimate_gas ()
175+ except Exception as inst :
176+ print ('\033 [91m' + "Bundle operation failed (Gas estimation reverted): " + str (inst ) + '\033 [39m' )
177+ return Error (2 , "Bundle operation failed" , data = str (inst ))
174178 gasFees = getGasFees ()
175179
176180 txnDict = {
177181 "chainId" : 5 ,
178182 "from" : env ('bundler_pub' ),
179183 "nonce" : w3 .eth .get_transaction_count (env ('bundler_pub' )),
180- 'gas' : math .ceil (gasEstimation * 1.2 ),
184+ 'gas' : math .ceil (gasEstimation * 1.4 ),
181185 }
182186
183187 if (env ('isGanache' ) == "True" ): #as ganache evm doesn't support maxFeePerGas & maxPriorityFeePerGas
@@ -186,8 +190,8 @@ def eth_sendUserOperation(request) -> Result:
186190 })
187191 else :
188192 txnDict .update ({
189- 'maxFeePerGas' : math . ceil ( float ( gasFees ["medium" ]["suggestedMaxFeePerGas" ]) ),
190- 'maxPriorityFeePerGas' : math . ceil ( float ( gasFees ["medium" ]["suggestedMaxPriorityFeePerGas" ]))
193+ 'maxFeePerGas' : w3 . toWei ( gasFees ["medium" ]["suggestedMaxFeePerGas" ], 'gwei' ),
194+ 'maxPriorityFeePerGas' : w3 . toWei ( gasFees ["medium" ]["suggestedMaxPriorityFeePerGas" ], 'gwei' ),
191195 })
192196
193197 transaction = transactionTemplate .build_transaction (txnDict )
0 commit comments