estimateUserOperationGas
Estimate the gas limits for a User Operation.
Usage
example.ts
import { bundlerClient } from "./client"
const gasEstimate = await bundlerClient.estimateUserOperationGas({
userOperation: {
sender: "0x0C123D90Da0a640fFE54a2359D159629065775C5",
nonce: 3n,
initCode: "0x",
callData: "0x18dfb3c7000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000d2f598c826429eee7c071c02735549acd88f2c09000000000000000000000000d2f598c826429eee7c071c02735549acd88f2c090000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000043a4eacb7839f202d9cab465dbdd77d4fabe0a1800000000000000000000000000000000000000000000000003782dace9d90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb000000000000000000000000982e148216e3aa6b38f9d901ef578b5c06dd750200000000000000000000000000000000000000000000000005d423c655aa000000000000000000000000000000000000000000000000000000000000",
callGasLimit: 50305n,
maxPriorityFeePerGas: 113000100n,
paymasterAndData: "0xe93eca6595fe94091dc1af46aac2a8b5d79907700000000000000000000000000000000000000000000000000000000065133b6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005d3d07ae8973ba1b8a26d0d72d8882dfa97622942a63c4b655f4928385ce587f6aa2fa1ab347e615d5f39e1214d18f426375da8a01514fb126eb0bb29f0c319d1b",
signature: "0xf1513a8537a079a4d728bb87099b2c901e2c9034e60c95a4d41ac1ed75d6ee90270d52b48af30aa036e9a205ea008e1c62b317e7b3f88b3f302d45fb1ba76a191b"
},
entryPoint: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
})
/**
* {
* preVerificationGas: 56135n,
* verificationGasLimit: 132202n,
* callGasLimit: 74900n
* }
*/
Returns
-
Type:
EstimateUserOperationGasReturnType
-
preVerificationGas:
bigint
-
verificationGasLimit:
bigint
-
callGasLimit:
bigint
The estimated User Operation gas limits.
Parameters
userOperation
- Type:
UserOperation
The User Operation object, with callGasLimit
, preVerificationGas
and verificationGasLimit
being optional.
entryPoint
- Type:
Address
The address of the entry point contract.