@pimlico/alto 0.0.0-main.20250624T123240 → 0.0.0-main.20250626T085447

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  export * from "./logger.js";
2
2
  export * from "./metrics.js";
3
3
  export * from "./bigInt.js";
4
- export * from "./validation.js";
4
+ export * from "./preVerificationGasCalulator.js";
5
5
  export * from "./userop.js";
6
6
  export * from "./helpers.js";
7
7
  export * from "./asyncTimeout.js";
@@ -1,7 +1,7 @@
1
1
  export * from "./logger.js";
2
2
  export * from "./metrics.js";
3
3
  export * from "./bigInt.js";
4
- export * from "./validation.js";
4
+ export * from "./preVerificationGasCalulator.js";
5
5
  export * from "./userop.js";
6
6
  export * from "./helpers.js";
7
7
  export * from "./asyncTimeout.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,+BAA+B,CAAA;AAC7C,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,42 @@
1
+ import type { GasPriceManager } from "../handlers/index.js";
2
+ import { type Address, type UserOperation } from "../types/index.js";
3
+ import type { AltoConfig } from "../createConfig.js";
4
+ export declare function encodeUserOp(userOp: UserOperation): Uint8Array;
5
+ export interface GasOverheads {
6
+ perUserOp: bigint;
7
+ zeroByte: bigint;
8
+ nonZeroByte: bigint;
9
+ bundleSize: bigint;
10
+ sigSize: bigint;
11
+ eip7702AuthGas: bigint;
12
+ executeUserOpGasOverhead: bigint;
13
+ executeUserOpPerWordGasOverhead: bigint;
14
+ perUserOpWordGasOverhead: bigint;
15
+ fixedGasOverhead: bigint;
16
+ expectedBundleSize: bigint;
17
+ transactionGasStipend: bigint;
18
+ standardTokenGasCost: bigint;
19
+ tokensPerNonzeroByte: bigint;
20
+ floorPerTokenGasCost: bigint;
21
+ }
22
+ export declare function fillUserOpWithDummyData(userOperation: UserOperation): UserOperation;
23
+ export declare function calcExecutionPvgComponent({ userOp, supportsEip7623, config }: {
24
+ userOp: UserOperation;
25
+ supportsEip7623: boolean;
26
+ config: AltoConfig;
27
+ }): bigint;
28
+ export declare function calcL2PvgComponent({ config, userOperation, entryPoint, gasPriceManager, validate }: {
29
+ config: AltoConfig;
30
+ userOperation: UserOperation;
31
+ entryPoint: Address;
32
+ gasPriceManager: GasPriceManager;
33
+ validate: boolean;
34
+ }): Promise<bigint>;
35
+ export declare function getSerializedHandleOpsTx({ userOps, entryPoint, chainId, removeZeros, randomizeSignature }: {
36
+ userOps: UserOperation[];
37
+ entryPoint: Address;
38
+ chainId: number;
39
+ removeZeros?: boolean;
40
+ randomizeSignature?: boolean;
41
+ }): `0x02${string}` | `0x01${string}` | `0x03${string}` | `0x04${string}` | import("viem").TransactionSerializedLegacy;
42
+ //# sourceMappingURL=preVerificationGasCalulator.d.ts.map
@@ -0,0 +1,423 @@
1
+ import { MantleBvmGasPriceOracleAbi, OpL1FeeAbi } from "../types/index.js";
2
+ import { bytesToHex, encodeAbiParameters, getContract, serializeTransaction, maxUint64, parseEther, maxUint256, toHex, size, concat, slice, toBytes, maxUint128 } from "viem";
3
+ import { maxBigInt, minBigInt, randomBigInt, unscaleBigIntByPercent } from "./bigInt.js";
4
+ import { isVersion06, isVersion07, toPackedUserOperation } from "./userop.js";
5
+ import { ArbitrumL1FeeAbi } from "../types/contracts/ArbitrumL1FeeAbi.js";
6
+ import { encodeHandleOpsCalldata } from "../executor/utils.js";
7
+ import crypto from "crypto";
8
+ // Encodes a user operation into bytes for gas calculation
9
+ export function encodeUserOp(userOp) {
10
+ const p = fillUserOpWithDummyData(userOp);
11
+ if (isVersion06(userOp)) {
12
+ return toBytes(encodeAbiParameters([
13
+ {
14
+ components: [
15
+ { name: "sender", type: "address" },
16
+ { name: "nonce", type: "uint256" },
17
+ { name: "initCode", type: "bytes" },
18
+ { name: "callData", type: "bytes" },
19
+ { name: "callGasLimit", type: "uint256" },
20
+ { name: "verificationGasLimit", type: "uint256" },
21
+ { name: "preVerificationGas", type: "uint256" },
22
+ { name: "maxFeePerGas", type: "uint256" },
23
+ { name: "maxPriorityFeePerGas", type: "uint256" },
24
+ { name: "paymasterAndData", type: "bytes" },
25
+ { name: "signature", type: "bytes" }
26
+ ],
27
+ name: "userOperation",
28
+ type: "tuple"
29
+ }
30
+ ], [p]));
31
+ }
32
+ else {
33
+ // For v0.7, we need to pack the user operation
34
+ const packedOp = toPackedUserOperation(p);
35
+ return toBytes(encodeAbiParameters([
36
+ {
37
+ components: [
38
+ { name: "sender", type: "address" },
39
+ { name: "nonce", type: "uint256" },
40
+ { name: "initCode", type: "bytes" },
41
+ { name: "callData", type: "bytes" },
42
+ { name: "accountGasLimits", type: "bytes32" },
43
+ { name: "preVerificationGas", type: "uint256" },
44
+ { name: "gasFees", type: "bytes32" },
45
+ { name: "paymasterAndData", type: "bytes" },
46
+ { name: "signature", type: "bytes" }
47
+ ],
48
+ name: "userOperation",
49
+ type: "tuple"
50
+ }
51
+ ], [packedOp]));
52
+ }
53
+ }
54
+ const defaultOverHeads = {
55
+ tokensPerNonzeroByte: 4n,
56
+ fixedGasOverhead: 9830n,
57
+ transactionGasStipend: 21000n,
58
+ perUserOp: 7260n,
59
+ standardTokenGasCost: 4n,
60
+ zeroByte: 4n,
61
+ nonZeroByte: 16n,
62
+ bundleSize: 1n,
63
+ sigSize: 65n,
64
+ eip7702AuthGas: 25000n,
65
+ executeUserOpGasOverhead: 1610n,
66
+ executeUserOpPerWordGasOverhead: 8200n, // 8.2 * 1000 to avoid decimals
67
+ perUserOpWordGasOverhead: 9200n, // 9.2 * 1000 to avoid decimals
68
+ expectedBundleSize: 1n,
69
+ floorPerTokenGasCost: 10n
70
+ };
71
+ export function fillUserOpWithDummyData(userOperation) {
72
+ if (isVersion06(userOperation)) {
73
+ return {
74
+ ...userOperation,
75
+ callGasLimit: maxUint128,
76
+ verificationGasLimit: maxUint128,
77
+ preVerificationGas: maxUint256,
78
+ maxFeePerGas: maxUint128,
79
+ maxPriorityFeePerGas: maxUint128,
80
+ paymasterAndData: bytesToHex(new Uint8Array(userOperation.paymasterAndData.length).fill(255)),
81
+ signature: bytesToHex(new Uint8Array(userOperation.signature.length).fill(255))
82
+ };
83
+ }
84
+ // For v0.7
85
+ const hasPaymaster = !!userOperation.paymaster;
86
+ return {
87
+ ...userOperation,
88
+ callGasLimit: maxUint128,
89
+ verificationGasLimit: maxUint128,
90
+ preVerificationGas: maxUint256,
91
+ maxFeePerGas: maxUint128,
92
+ maxPriorityFeePerGas: maxUint128,
93
+ ...(hasPaymaster && {
94
+ paymasterVerificationGasLimit: maxUint128,
95
+ paymasterPostOpGasLimit: maxUint128,
96
+ paymasterData: bytesToHex(new Uint8Array(size(userOperation.paymasterData || "0x")).fill(255))
97
+ }),
98
+ signature: bytesToHex(new Uint8Array(size(userOperation.signature)).fill(255))
99
+ };
100
+ }
101
+ // Calculate the execution gas component of preVerificationGas
102
+ export function calcExecutionPvgComponent({ userOp, supportsEip7623, config }) {
103
+ const oh = { ...defaultOverHeads };
104
+ const packed = encodeUserOp(userOp);
105
+ const tokenCount = BigInt(packed
106
+ .map((x) => (x === 0 ? 1 : Number(oh.tokensPerNonzeroByte)))
107
+ .reduce((sum, x) => sum + x));
108
+ const userOpWordsLength = BigInt(Math.floor((size(packed) + 31) / 32));
109
+ let callDataOverhead = 0n;
110
+ let perUserOpOverhead = oh.perUserOp;
111
+ if (userOp.eip7702Auth) {
112
+ perUserOpOverhead += oh.eip7702AuthGas;
113
+ }
114
+ // If callData starts with executeUserOp method selector
115
+ if (slice(userOp.callData, 0, 4) === "0x8dd7712f") {
116
+ perUserOpOverhead +=
117
+ oh.executeUserOpGasOverhead +
118
+ (oh.executeUserOpPerWordGasOverhead * userOpWordsLength) / 1000n;
119
+ }
120
+ else {
121
+ callDataOverhead =
122
+ (BigInt(Math.ceil(size(userOp.callData) / 32)) *
123
+ oh.perUserOpWordGasOverhead) /
124
+ 1000n;
125
+ }
126
+ const userOpSpecificOverhead = perUserOpOverhead + callDataOverhead;
127
+ const userOpShareOfBundleCost = oh.fixedGasOverhead / oh.expectedBundleSize;
128
+ const userOpShareOfStipend = oh.transactionGasStipend / oh.expectedBundleSize;
129
+ if (supportsEip7623) {
130
+ const calculatedGasUsed = getUserOpGasUsed({
131
+ userOp,
132
+ config
133
+ });
134
+ const preVerificationGas = getEip7623transactionGasCost({
135
+ stipendGasCost: userOpShareOfStipend,
136
+ tokenGasCount: tokenCount,
137
+ oh,
138
+ executionGasCost: userOpShareOfBundleCost +
139
+ userOpSpecificOverhead +
140
+ calculatedGasUsed
141
+ }) - calculatedGasUsed;
142
+ return preVerificationGas;
143
+ }
144
+ else {
145
+ // Not using EIP-7623.
146
+ return (oh.standardTokenGasCost * tokenCount +
147
+ userOpShareOfStipend +
148
+ userOpShareOfBundleCost +
149
+ userOpSpecificOverhead);
150
+ }
151
+ }
152
+ // Based on the formula in https://eips.ethereum.org/EIPS/eip-7623#specification
153
+ function getEip7623transactionGasCost({ stipendGasCost, tokenGasCount, executionGasCost, oh }) {
154
+ const standardCost = oh.standardTokenGasCost * tokenGasCount + executionGasCost;
155
+ const floorCost = oh.floorPerTokenGasCost * tokenGasCount;
156
+ return stipendGasCost + maxBigInt(standardCost, floorCost);
157
+ }
158
+ // during validation, collect only the gas known to be paid: the actual validation and 10% of execution gas.
159
+ function getUserOpGasUsed({ userOp, config }) {
160
+ // Extract all multipliers from config
161
+ const { v6CallGasLimitMultiplier, v6VerificationGasLimitMultiplier, v7CallGasLimitMultiplier, v7PaymasterPostOpGasLimitMultiplier } = config;
162
+ if (isVersion06(userOp)) {
163
+ const realCallGasLimit = unscaleBigIntByPercent(userOp.callGasLimit, BigInt(v6CallGasLimitMultiplier));
164
+ const realVerificationGasLimit = unscaleBigIntByPercent(userOp.verificationGasLimit, BigInt(v6VerificationGasLimitMultiplier));
165
+ return (realCallGasLimit + realVerificationGasLimit) / 10n;
166
+ }
167
+ else if (isVersion07(userOp)) {
168
+ const realCallGasLimit = unscaleBigIntByPercent(userOp.callGasLimit, BigInt(v7CallGasLimitMultiplier));
169
+ const realPaymasterPostOpGasLimit = unscaleBigIntByPercent(userOp.paymasterPostOpGasLimit ?? 0n, BigInt(v7PaymasterPostOpGasLimitMultiplier));
170
+ return (realCallGasLimit + realPaymasterPostOpGasLimit) / 10n;
171
+ }
172
+ throw new Error("Invalid user operation version");
173
+ }
174
+ // Helper function to serialize transaction with default values
175
+ function serializeTxWithDefaults(txParams) {
176
+ // Default values for required fields
177
+ txParams.nonce = 999999;
178
+ txParams.gasLimit = maxUint64;
179
+ txParams.maxFeePerGas = maxUint64;
180
+ txParams.maxPriorityFeePerGas = maxUint64;
181
+ // Always use EIP-1559 transaction
182
+ return serializeTransaction(txParams, {
183
+ r: "0x123451234512345123451234512345123451234512345123451234512345",
184
+ s: "0x123451234512345123451234512345123451234512345123451234512345",
185
+ yParity: 1
186
+ });
187
+ }
188
+ // Calculate the L2-specific gas component of preVerificationGas
189
+ export async function calcL2PvgComponent({ config, userOperation, entryPoint, gasPriceManager, validate }) {
190
+ let simulationUserOp = {
191
+ ...userOperation
192
+ };
193
+ // Add random gasFields during estimations
194
+ if (!validate) {
195
+ simulationUserOp = {
196
+ ...simulationUserOp,
197
+ callGasLimit: randomBigInt({ upper: 10000000n }),
198
+ verificationGasLimit: randomBigInt({ upper: 10000000n }),
199
+ preVerificationGas: randomBigInt({ upper: 10000000n })
200
+ };
201
+ if (isVersion07(simulationUserOp)) {
202
+ simulationUserOp = {
203
+ ...simulationUserOp,
204
+ paymasterVerificationGasLimit: randomBigInt({
205
+ upper: 10000000n
206
+ }),
207
+ paymasterPostOpGasLimit: randomBigInt({
208
+ upper: 10000000n
209
+ })
210
+ };
211
+ }
212
+ }
213
+ switch (config.chainType) {
214
+ case "op-stack":
215
+ return await calcOptimismPvg(config.publicClient, simulationUserOp, entryPoint, gasPriceManager, validate);
216
+ case "arbitrum":
217
+ return await calcArbitrumPvg(config.publicClient, simulationUserOp, entryPoint, gasPriceManager, validate);
218
+ case "mantle":
219
+ return await calcMantlePvg(config.publicClient, simulationUserOp, entryPoint, gasPriceManager, validate);
220
+ case "etherlink":
221
+ return await calcEtherlinkPvg(simulationUserOp, entryPoint, gasPriceManager, validate);
222
+ default:
223
+ return 0n;
224
+ }
225
+ }
226
+ // Returns a serialized transaction for the handleOps call
227
+ export function getSerializedHandleOpsTx({ userOps, entryPoint, chainId, removeZeros = true, randomizeSignature = false }) {
228
+ if (userOps.length === 0) {
229
+ throw new Error("No user operations provided");
230
+ }
231
+ // Process operations based on configuration
232
+ let processedOps = userOps;
233
+ if (randomizeSignature) {
234
+ processedOps = userOps.map((op) => {
235
+ const sigLength = size(op.signature);
236
+ let newSignature;
237
+ const randomizeBytes = (length) => toHex(crypto.randomBytes(length).toString("hex"));
238
+ if (sigLength < 65) {
239
+ // For short signatures, randomize the entire thing
240
+ newSignature = randomizeBytes(sigLength);
241
+ }
242
+ else {
243
+ // For longer signatures, only randomize the last 65 bytes
244
+ const originalPart = slice(op.signature, 0, sigLength - 65);
245
+ const randomPart = randomizeBytes(65);
246
+ newSignature = concat([originalPart, randomPart]);
247
+ }
248
+ return {
249
+ ...op,
250
+ signature: newSignature
251
+ };
252
+ });
253
+ }
254
+ // Apply removeZeros logic if needed
255
+ const finalOps = removeZeros
256
+ ? processedOps.map((op) => fillUserOpWithDummyData(op))
257
+ : processedOps;
258
+ const data = encodeHandleOpsCalldata({
259
+ userOps: finalOps,
260
+ beneficiary: entryPoint
261
+ });
262
+ // Prepare transaction parameters
263
+ const txParams = {
264
+ to: entryPoint,
265
+ chainId,
266
+ data
267
+ };
268
+ return serializeTxWithDefaults(txParams);
269
+ }
270
+ async function calcEtherlinkPvg(op, entryPoint, gasPriceManager, verify) {
271
+ const serializedTx = getSerializedHandleOpsTx({
272
+ userOps: [op],
273
+ entryPoint,
274
+ chainId: 128123 // Etherlink chain ID
275
+ });
276
+ // Etherlink calculates the inclusion fee (data availability fee) with:
277
+ // 0.000004 XTZ * (150 + tx.data.size() + tx.access_list.size())
278
+ // Get the size of serialized transaction in bytes
279
+ const dataSize = BigInt(size(serializedTx));
280
+ const baseConstant = 150n;
281
+ const xtzRate = parseEther("0.000004");
282
+ const inclusionFee = (baseConstant + dataSize) * xtzRate;
283
+ // Get the current gas price to convert the inclusion fee to gas units
284
+ const maxFeePerGas = await (verify
285
+ ? gasPriceManager.getHighestMaxFeePerGas()
286
+ : gasPriceManager.getGasPrice().then((res) => res.maxFeePerGas));
287
+ // Convert the inclusion fee to gas units
288
+ const inclusionFeeInGas = inclusionFee / maxFeePerGas;
289
+ return inclusionFeeInGas;
290
+ }
291
+ async function calcMantlePvg(publicClient, op, entryPoint, gasPriceManager, verify) {
292
+ const serializedTx = getSerializedHandleOpsTx({
293
+ userOps: [op],
294
+ entryPoint,
295
+ chainId: publicClient.chain.id
296
+ });
297
+ let tokenRatio;
298
+ let scalar;
299
+ let rollupDataGasAndOverhead;
300
+ let l1GasPrice;
301
+ const mantleManager = gasPriceManager.mantleManager;
302
+ if (verify) {
303
+ const minValues = await mantleManager.getMinMantleOracleValues();
304
+ tokenRatio = minValues.minTokenRatio;
305
+ scalar = minValues.minScalar;
306
+ rollupDataGasAndOverhead = minValues.minRollupDataGasAndOverhead;
307
+ l1GasPrice = minValues.minL1GasPrice;
308
+ }
309
+ else {
310
+ ;
311
+ [tokenRatio, scalar, rollupDataGasAndOverhead, l1GasPrice] =
312
+ await Promise.all([
313
+ publicClient.readContract({
314
+ address: "0x420000000000000000000000000000000000000F",
315
+ abi: MantleBvmGasPriceOracleAbi,
316
+ functionName: "tokenRatio"
317
+ }),
318
+ publicClient.readContract({
319
+ address: "0x420000000000000000000000000000000000000F",
320
+ abi: MantleBvmGasPriceOracleAbi,
321
+ functionName: "scalar"
322
+ }),
323
+ publicClient.readContract({
324
+ address: "0x420000000000000000000000000000000000000F",
325
+ abi: MantleBvmGasPriceOracleAbi,
326
+ functionName: "getL1GasUsed",
327
+ args: [serializedTx]
328
+ }),
329
+ publicClient.readContract({
330
+ address: "0x420000000000000000000000000000000000000F",
331
+ abi: MantleBvmGasPriceOracleAbi,
332
+ functionName: "l1BaseFee"
333
+ })
334
+ ]);
335
+ mantleManager.saveMantleOracleValues({
336
+ tokenRatio,
337
+ scalar,
338
+ rollupDataGasAndOverhead,
339
+ l1GasPrice
340
+ });
341
+ }
342
+ const mantleL1RollUpFeeDivisionFactor = 1000000n;
343
+ const l1RollupFee = (rollupDataGasAndOverhead * l1GasPrice * tokenRatio * scalar) /
344
+ mantleL1RollUpFeeDivisionFactor;
345
+ const maxFeePerGas = await (verify
346
+ ? gasPriceManager.getHighestMaxFeePerGas()
347
+ : gasPriceManager.getGasPrice().then((res) => res.maxFeePerGas));
348
+ const l2MaxFee = BigInt(maxFeePerGas);
349
+ return l1RollupFee / l2MaxFee;
350
+ }
351
+ async function calcOptimismPvg(publicClient, op, entryPoint, gasPriceManager, validate) {
352
+ const serializedTx = getSerializedHandleOpsTx({
353
+ userOps: [op],
354
+ entryPoint,
355
+ chainId: publicClient.chain.id,
356
+ removeZeros: false,
357
+ randomizeSignature: !validate
358
+ });
359
+ const opGasPriceOracle = getContract({
360
+ abi: OpL1FeeAbi,
361
+ address: "0x420000000000000000000000000000000000000F",
362
+ client: {
363
+ public: publicClient
364
+ }
365
+ });
366
+ const [l1Fee, baseFeePerGas] = await Promise.all([
367
+ validate
368
+ ? gasPriceManager.optimismManager.getMinL1Fee()
369
+ : opGasPriceOracle.read.getL1Fee([serializedTx]),
370
+ validate
371
+ ? gasPriceManager.getMaxBaseFeePerGas()
372
+ : gasPriceManager.getBaseFee()
373
+ ]);
374
+ let l2MaxFee;
375
+ let l2PriorityFee;
376
+ if (validate) {
377
+ l2MaxFee = await gasPriceManager.getHighestMaxFeePerGas();
378
+ l2PriorityFee =
379
+ baseFeePerGas +
380
+ (await gasPriceManager.getHighestMaxPriorityFeePerGas());
381
+ }
382
+ else {
383
+ const gasPrices = await gasPriceManager.getGasPrice();
384
+ l2MaxFee = gasPrices.maxFeePerGas;
385
+ l2PriorityFee = baseFeePerGas + gasPrices.maxPriorityFeePerGas;
386
+ }
387
+ const l2price = minBigInt(l2MaxFee, l2PriorityFee);
388
+ return l1Fee / l2price;
389
+ }
390
+ async function calcArbitrumPvg(publicClient, op, entryPoint, gasPriceManager, validate) {
391
+ const precompileAddress = "0x00000000000000000000000000000000000000C8";
392
+ const serializedTx = getSerializedHandleOpsTx({
393
+ userOps: [op],
394
+ entryPoint,
395
+ chainId: publicClient.chain?.id ?? 10
396
+ });
397
+ const arbGasPriceOracle = getContract({
398
+ abi: ArbitrumL1FeeAbi,
399
+ address: precompileAddress,
400
+ client: {
401
+ public: publicClient
402
+ }
403
+ });
404
+ const { result } = await arbGasPriceOracle.simulate.gasEstimateL1Component([
405
+ entryPoint,
406
+ false,
407
+ serializedTx
408
+ ]);
409
+ let [gasForL1, l2BaseFee, l1BaseFeeEstimate] = result;
410
+ const arbitrumManager = gasPriceManager.arbitrumManager;
411
+ arbitrumManager.saveL1BaseFee(l1BaseFeeEstimate);
412
+ arbitrumManager.saveL2BaseFee(l2BaseFee);
413
+ if (validate) {
414
+ const [maxL1Fee, minL1Fee, maxL2Fee] = await Promise.all([
415
+ l1BaseFeeEstimate || arbitrumManager.getMaxL1BaseFee(),
416
+ arbitrumManager.getMinL1BaseFee(),
417
+ arbitrumManager.getMaxL2BaseFee()
418
+ ]);
419
+ gasForL1 = (gasForL1 * l2BaseFee * minL1Fee) / (maxL1Fee * maxL2Fee);
420
+ }
421
+ return gasForL1;
422
+ }
423
+ //# sourceMappingURL=preVerificationGasCalulator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preVerificationGasCalulator.js","sourceRoot":"","sources":["../../utils/preVerificationGasCalulator.ts"],"names":[],"mappings":"AACA,OAAO,EAKH,0BAA0B,EAC1B,UAAU,EACb,MAAM,aAAa,CAAA;AACpB,OAAO,EAIH,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,UAAU,EACV,KAAK,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,OAAO,EACP,UAAU,EACb,MAAM,MAAM,CAAA;AACb,OAAO,EACH,SAAS,EACT,SAAS,EACT,YAAY,EACZ,sBAAsB,EACzB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAE1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,0DAA0D;AAC1D,MAAM,UAAU,YAAY,CAAC,MAAqB;IAC9C,MAAM,CAAC,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAA;IAEzC,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,OAAO,OAAO,CACV,mBAAmB,CACf;YACI;gBACI,UAAU,EAAE;oBACR,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;oBACnC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;oBAClC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE;oBACnC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE;oBACnC,EAAE,IA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AQ,CAAA;AACnB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pimlico/alto",
3
- "version": "0.0.0-main.20250624T123240",
3
+ "version": "0.0.0-main.20250626T085447",
4
4
  "description": "A performant and modular ERC-4337 Bundler written in Typescript",
5
5
  "repository": "https://github.com/pimlicolabs/alto.git",
6
6
  "author": "Pimlico",
@@ -1,58 +0,0 @@
1
- import type { GasPriceManager } from "../handlers/index.js";
2
- import { type Address, type PackedUserOperation, type UserOperation, type UserOperationV06 } from "../types/index.js";
3
- import { ContractFunctionRevertedError, EstimateGasExecutionError, FeeCapTooLowError, InsufficientFundsError, IntrinsicGasTooLowError, NonceTooLowError, InternalRpcError } from "viem";
4
- import type { AltoConfig } from "../createConfig.js";
5
- export interface GasOverheads {
6
- /**
7
- * fixed overhead for entire handleOp bundle.
8
- */
9
- fixed: number;
10
- /**
11
- * per userOp overhead, added on top of the above fixed per-bundle.
12
- */
13
- perUserOp: number;
14
- /**
15
- * overhead for userOp word (32 bytes) block
16
- */
17
- perUserOpWord: number;
18
- /**
19
- * zero byte cost, for calldata gas cost calculations
20
- */
21
- zeroByte: number;
22
- /**
23
- * non-zero byte cost, for calldata gas cost calculations
24
- */
25
- nonZeroByte: number;
26
- /**
27
- * expected bundle size, to split per-bundle overhead between all ops.
28
- */
29
- bundleSize: number;
30
- /**
31
- * expected length of the userOp signature.
32
- */
33
- sigSize: number;
34
- }
35
- export declare const DefaultGasOverheads: GasOverheads;
36
- /**
37
- * pack the userOperation
38
- * @param op
39
- * "false" to pack entire UserOp, for calculating the calldata cost of putting it on-chain.
40
- */
41
- export declare function packUserOpV06(op: UserOperationV06): `0x${string}`;
42
- export declare function removeZeroBytesFromUserOp<T extends UserOperation>(userOpearation: T): T extends UserOperationV06 ? UserOperationV06 : PackedUserOperation;
43
- export declare function packUserOpV07(op: PackedUserOperation): `0x${string}`;
44
- export declare function calcPreVerificationGas({ config, userOperation, entryPoint, gasPriceManager, validate, overheads }: {
45
- config: AltoConfig;
46
- userOperation: UserOperation;
47
- entryPoint: Address;
48
- gasPriceManager: GasPriceManager;
49
- validate: boolean;
50
- overheads?: GasOverheads;
51
- }): Promise<bigint>;
52
- export declare function getHandleOpsCallData({ userOps, entryPoint, removeZeros }: {
53
- userOps: UserOperation[];
54
- entryPoint: Address;
55
- removeZeros?: boolean;
56
- }): `0x${string}`;
57
- export declare function parseViemError(err: unknown): NonceTooLowError | FeeCapTooLowError | InsufficientFundsError | IntrinsicGasTooLowError | ContractFunctionRevertedError | EstimateGasExecutionError | InternalRpcError | undefined;
58
- //# sourceMappingURL=validation.d.ts.map