(f: (n: number) => Promise<UserOperation>, entryPoint: EntryPoint, min: number, max: number, delta = 2)
| 445 | } |
| 446 | |
| 447 | export 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. |
| 464 | export async function callGetUserOpHashWithCode (entryPoint: EntryPoint, userop: UserOperation, senderCode: any): Promise<string> { |
no test coverage detected