Skip to content

Commit

Permalink
remove override if not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless0x committed Dec 2, 2024
1 parent 113ab8f commit 0e4cd8e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/rpc/estimation/gasEstimationsV06.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ export class GasEstimatorV06 {
}
}

// Remove state override if not supported by network.
if (!this.config.balanceOverride) {
stateOverrides = undefined
}

try {
await publicClient.request({
method: "eth_call",
Expand Down Expand Up @@ -180,9 +185,7 @@ export class GasEstimatorV06 {
} as const
}

const cause = err.walk(
(err) => err instanceof RpcRequestError
)
const cause = err.walk((err) => err instanceof RpcRequestError)

const causeParseResult = z
.union([
Expand Down
5 changes: 5 additions & 0 deletions src/rpc/estimation/gasEstimationsV07.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,11 @@ export class GasEstimatorV07 {
args: [entryPoint, entryPointSimulationsCallData]
})

// Remove state override if not supported by network.
if (!this.config.balanceOverride) {
stateOverrides = undefined
}

const result = (await publicClient.request({
method: "eth_call",
params: [
Expand Down
5 changes: 0 additions & 5 deletions src/rpc/rpcHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,6 @@ export class RpcHandler implements IRpcEndpoint {
): Promise<EstimateUserOperationGasResponseResult> {
this.ensureEntryPointIsSupported(entryPoint)

// Remove state override if not supported by network.
if (!this.config.balanceOverride) {
stateOverrides = undefined
}

if (userOperation.maxFeePerGas === 0n) {
throw new RpcError(
"user operation max fee per gas must be larger than 0 during gas estimation"
Expand Down

0 comments on commit 0e4cd8e

Please sign in to comment.