@@ -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 )
@@ -223,9 +227,9 @@ def eth_sendUserOperation(request) -> Result:
223227 return Error (2 , "Bundle operation failed" , data = str (inst ))
224228
225229@method
226- def eth_getRequestId (request ) -> Result :
230+ def eth_getRequestIds (request ) -> Result :
227231
228- serialzer = OperationSerialzer (data = request )
232+ serialzer = OperationSerialzer (data = request , many = True )
229233
230234 if serialzer .is_valid ():
231235 serialzer .save ()
@@ -237,11 +241,15 @@ def eth_getRequestId(request) -> Result:
237241 abi = [{"inputs" :[{"components" :[{"internalType" :"address" ,"name" :"sender" ,"type" :"address" },{"internalType" :"uint256" ,"name" :"nonce" ,"type" :"uint256" },{"internalType" :"bytes" ,"name" :"initCode" ,"type" :"bytes" },{"internalType" :"bytes" ,"name" :"callData" ,"type" :"bytes" },{"internalType" :"uint256" ,"name" :"callGas" ,"type" :"uint256" },{"internalType" :"uint256" ,"name" :"verificationGas" ,"type" :"uint256" },{"internalType" :"uint256" ,"name" :"preVerificationGas" ,"type" :"uint256" },{"internalType" :"uint256" ,"name" :"maxFeePerGas" ,"type" :"uint256" },{"internalType" :"uint256" ,"name" :"maxPriorityFeePerGas" ,"type" :"uint256" },{"internalType" :"address" ,"name" :"paymaster" ,"type" :"address" },{"internalType" :"bytes" ,"name" :"paymasterData" ,"type" :"bytes" },{"internalType" :"bytes" ,"name" :"signature" ,"type" :"bytes" }],"internalType" :"struct UserOperation" ,"name" :"userOp" ,"type" :"tuple" }],"name" :"getRequestId" ,"outputs" :[{"internalType" :"bytes32" ,"name" :"" ,"type" :"bytes32" }],"stateMutability" :"view" ,"type" :"function" },{"inputs" :[{"internalType" :"bytes" ,"name" :"initCode" ,"type" :"bytes" },{"internalType" :"uint256" ,"name" :"salt" ,"type" :"uint256" }],"name" :"getSenderAddress" ,"outputs" :[{"internalType" :"address" ,"name" :"" ,"type" :"address" }],"stateMutability" :"view" ,"type" :"function" }]
238242
239243 entryPoint = w3 .eth .contract (address = env ('entryPoint_add' ), abi = abi )
240- opDict = serialzer .data
241-
242- requestId = entryPoint .functions .getRequestId (opDict ).call ()
243244
244- return Success (requestId .hex ())
245+ ops = serialzer .data
246+ result = []
247+ for operation in ops :
248+ opDict = dict (operation )
249+ requestId = entryPoint .functions .getRequestId (opDict ).call ()
250+ result .append (requestId .hex ())
251+
252+ return Success (result )
245253
246254
247255@method
0 commit comments