Skip to content

Commit

Permalink
fix for v0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless-eth committed Oct 4, 2024
1 parent 49c4093 commit 13a2bdd
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/rpc/estimation/gasEstimationsV07.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,23 @@ export class GasEstimatorV07 {
gasAllowance
})

const cause = await this.callPimlicoEntryPointSimulations({
let cause = await this.callPimlicoEntryPointSimulations({
entryPoint,
entryPointSimulationsCallData: [simulateCallData]
})

cause = cause.map((data: Hex) => {
const decodedDelegateAndError = decodeErrorResult({
abi: EntryPointV07Abi,
data: data
})

if (!decodedDelegateAndError?.args?.[1]) {
throw new Error("Unexpected error")
}
return decodedDelegateAndError.args[1] as Hex
})

const simulateCallDataResult = validateTargetCallDataResult(
cause[0]
)
Expand Down Expand Up @@ -290,7 +302,7 @@ export class GasEstimatorV07 {
queuedUserOperations
})

const cause = await this.callPimlicoEntryPointSimulations({
let cause = await this.callPimlicoEntryPointSimulations({
entryPoint,
entryPointSimulationsCallData: [
simulateHandleOpLast,
Expand All @@ -299,6 +311,22 @@ export class GasEstimatorV07 {
stateOverrides
})

cause = cause.map((data: Hex) => {
const decodedDelegateAndError = decodeErrorResult({
abi: EntryPointV07Abi,
data: data
})

const delegateAndRevertResponseBytes =
decodedDelegateAndError?.args?.[1]

if (!delegateAndRevertResponseBytes) {
throw new Error("Unexpected error")
}

return delegateAndRevertResponseBytes as Hex
})

try {
const simulateHandleOpLastResult = getSimulateHandleOpResult(
cause[0]
Expand Down

0 comments on commit 13a2bdd

Please sign in to comment.