Requests gas and coverage for a UserOperation
. Returns paymasterAndData
and gas parameters if approved, errors if not. Optionally accepts fee parameter overrides to be used in the UserOperation
.
Supported EntryPoints
alchemy_requestGasAndPaymasterAndData
supports versions v0.6 and v0.7 of ERC-4337. Check our FAQs to determine which version you should use.
Dummy Signature
This endpoint requires a dummy signature in the
userOp
. Check our FAQs to learn what a dummy signature is and which dummy signature you should use.
Parameters
-
Object
: This object contains all necessary fields to estimate gas and coverage:-
policyId
(string
): The gas policy ID. -
entryPoint
(string
): The address where the request should be sent through. This must be one of the entry points returned by thesupportedEntryPoints
RPC call and should match the version of the user operation. -
dummySignature
(string
): A dummy signature for the operation. This helps estimate gas costs. -
userOperation
(object
): An object containing optional gas parameters,paymasterAndData
, and signature fields. It can be either a v0.6 or v0.7 user operation but must match the version of the entry point at the specifiedentryPoint
. -
overrides
(object
): Optional fields that override our gas and fee estimates. Use this parameter to optionally override available fields:maxFeePerGas
,maxPriorityFeePerGas
,callGasLimit
,verificationGasLimit
, orpreVerificationGas
. 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 themaxPriorityFeePerGas
field, then a 1.1 multiplier, or a 10% increase, is applied to the estimatedmaxPriorityFeePerGas
of the userOp.
These overrides will be applied for every userOp sent with this provider. 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 }, }
⚠️Deprecated: previous override using "percentage" has been deprecated in favor of "multiplier" values
-
stateOverrideSet
(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. Each address maps to an object containing:
FIELD TYPE BYTES DESCRIPTION balance
Quantity
(Hex string
)≤32 Fake balance to set for the account before executing the call. nonce
Quantity
(Hex string
)≤8 Fake nonce to set for the account before executing the call. code
Binary
(Hex string
)any Fake EVM bytecode to inject into the account before executing the call. state
Object
any Fake key-value mapping to override all slots in the account storage before executing the call. stateDiff
Object
any Fake key-value mapping to override individual slots in the account storage before executing the call.
-