Skip to content
Alchemy Logo

alchemy_requestGasAndPaymasterAndData

POST
/{apiKey}

Requests gas coverage for a UserOperation. Optionally accepts fee parameter overrides to be used in the UserOperation.

Path Parameters

stringrequireddefaults to docs-demo

For higher throughput, create your own API key

Request

string or string[]required

The Gas Manager Policy ID or list of Gas Manager Policy IDs.

object

Erc20 context, required to enable users to pay gas with ERC-20 tokens.

stringformat: "^0[xX][0-9a-fA-F]*$"required

The EntryPoint address the request should be sent through. This MUST be one of the EntryPoints returned by the supportedEntryPoints RPC call and match the version of the userOperation in the userOperation field.

stringrequired

Dummy signature for the userOperation. This is useful for estimating gas costs. Check our FAQs to learn what a dummy signature is.

objectrequired

An object containing optional gas parameters, paymasterAndData, and signature fields. It can be either a v0.6 or v0.7 userOperation but must match the version of the EntryPoint at the specified entryPoint.

object

Optional fields that override our gas and fee estimates. Use this parameter to override: maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, or preVerificationGas.

This will apply either:

  • absolutes overrides (using a hex string) simply overriding estimated values entirely OR
  • multiplier overrides relative to our estimates (in the format of { "multiplier": number } with max precision of 4 decimal places). For example, if the override value is { multiplier: 1.1 } for the maxPriorityFeePerGas field, then a 1.1 multiplier, or a 10% increase, is applied to the estimated maxPriorityFeePerGas of the userOp.

A higher buffer may give userOps a better chance to mine if the L1/L2 gas and fees change.

"overrides": {
  "maxFeePerGas": "hex string" | { "multiplier": number },
  "maxPriorityFeePerGas": "hex string" | { "multiplier": number },
  "callGasLimit": "hex string" | { "multiplier": number },
  "verificationGasLimit": "hex string" | { "multiplier": number },
  "preVerificationGas": "hex string" | { "multiplier": number },
}

object

Allows changes to the state of a contract before executing the call. For example, you can modify variable values (like balances or approvals) for that call without changing the contract itself on the blockchain.

In more technical terms, the state override set is an optional parameter that allows executing the call against a modified chain state. It is an address-to-state mapping, where each entry specifies some state to be overridden prior to executing the call.

string

Additional data you can include in the request, such as proof of humanity, if you have enabled custom rules in your Gas Manager policy.

Responses

200

The response object may be one of two types:

Was this page helpful?