MCPcopy
hub / github.com/eth-infinitism/account-abstraction / findSimulationUserOpWithMin

Function findSimulationUserOpWithMin

test/testutils.ts:447–461  ·  view source on GitHub ↗
(f: (n: number) => Promise<UserOperation>, entryPoint: EntryPoint, min: number, max: number, delta = 2)

Source from the content-addressed store, hash-verified

445}
446
447export async function findSimulationUserOpWithMin (f: (n: number) => Promise<UserOperation>, entryPoint: EntryPoint, min: number, max: number, delta = 2): Promise<number> {
448 return await findMin(
449 async n => {
450 try {
451 const userOp = await f(n)
452 await simulateValidation(packUserOp(userOp), entryPoint.address)
453 // console.log('sim', n, 'ok')
454 return true
455 } catch (e) {
456 // console.log('sim', n, 'ex=', decodeRevertReason(e as Error))
457 return false
458 }
459 }, min, max, delta
460 )
461}
462
463// call entryPoint.getUserOpHash, but use state-override to run it with specific code (e.g. eip-7702 delegate) on the sender's code.
464export async function callGetUserOpHashWithCode (entryPoint: EntryPoint, userop: UserOperation, senderCode: any): Promise<string> {

Callers 1

Calls 3

simulateValidationFunction · 0.90
packUserOpFunction · 0.90
findMinFunction · 0.85

Tested by

no test coverage detected