@pimlico/alto 0.0.0-prool.20240609T212524 → 0.0.0-prool.20240609T213054

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.
@@ -0,0 +1,449 @@
1
+ export type AltoParameters = {
2
+ /**
3
+ * API version (used for internal Pimlico versioning compatibility).
4
+ */
5
+ apiVersion?: readonly string[] | undefined;
6
+ /**
7
+ * Override the sender native token balance during estimation
8
+ */
9
+ balanceOverride?: boolean | undefined;
10
+ /**
11
+ * Binary path of the `alto` executable.
12
+ */
13
+ binary?: string | undefined;
14
+ /**
15
+ * Address of the `BundleBulker` contract.
16
+ */
17
+ bundleBulkerAddress?: `0x${string}` | undefined;
18
+ /**
19
+ * Set if the bundler bundle user operations automatically or only when calling `debug_bundler_sendBundleNow`.
20
+ * @default "auto"
21
+ */
22
+ bundleMode?: "auto" | "manual" | undefined;
23
+ /**
24
+ * Indicates weather the chain is a OP stack chain, arbitrum chain, or default EVM chain.
25
+ */
26
+ chainType?: "default" | "op-stack" | "arbitrum" | undefined;
27
+ /**
28
+ * Path to JSON config file.
29
+ */
30
+ config?: string | undefined;
31
+ /**
32
+ * Skip user operation validation, use with caution.
33
+ */
34
+ dangerousSkipUserOperationValidation?: boolean | undefined;
35
+ /**
36
+ * Default API version.
37
+ */
38
+ defaultApiVersion?: string | undefined;
39
+ /**
40
+ * Enable debug endpoints.
41
+ * @default false
42
+ */
43
+ enableDebugEndpoints?: boolean | undefined;
44
+ /**
45
+ * Include user ops with the same sender in the single bundle.
46
+ * @default true
47
+ */
48
+ enforceUniqueSendersPerBundle?: boolean | undefined;
49
+ /**
50
+ * EntryPoint contract addresses.
51
+ */
52
+ entrypoints: readonly `0x${string}`[];
53
+ /**
54
+ * Address of the EntryPoint simulations contract.
55
+ */
56
+ entrypointSimulationContract?: `0x${string}` | undefined;
57
+ /**
58
+ * Private keys of the executor accounts.
59
+ */
60
+ executorPrivateKeys?: readonly `0x${string}`[];
61
+ /**
62
+ * Interval to refill the signer balance (seconds).
63
+ * @default 1200
64
+ */
65
+ executorRefillInterval?: number | undefined;
66
+ /**
67
+ * Should the node make expiration checks.
68
+ * @default true
69
+ */
70
+ expirationCheck?: boolean | undefined;
71
+ /**
72
+ * Amount to multiply the gas prices fetched from the node.
73
+ * @default "100"
74
+ */
75
+ gasPriceBump?: string | undefined;
76
+ /**
77
+ * Maximum that the gas prices fetched using pimlico_getUserOperationGasPrice will be accepted for (seconds).
78
+ * @default 10
79
+ */
80
+ gasPriceExpiry?: number | undefined;
81
+ /**
82
+ * The minimum percentage of incoming user operation gas prices compared to the gas price used by the bundler to submit bundles.
83
+ * @default 101
84
+ */
85
+ gasPriceFloorPercent?: number | undefined;
86
+ /**
87
+ * Amount to multiply the gas prices fetched using `pimlico_getUserOperationGasPrice`.
88
+ * @default "105,110,115"
89
+ */
90
+ gasPriceMultipliers?: readonly string[] | undefined;
91
+ /**
92
+ * Use a fixed value for gas limits during bundle transaction gas limit estimations
93
+ */
94
+ fixedGasLimitForEstimation?: string | undefined;
95
+ /**
96
+ * Flush stuck transactions with old nonces during bundler startup.
97
+ */
98
+ flushStuckTransactionsDuringStartup?: boolean | undefined;
99
+ /**
100
+ * Log in JSON format.
101
+ */
102
+ json?: boolean | undefined;
103
+ /**
104
+ * Send legacy transactions instead of an EIP-1559 transactions.
105
+ * @default false
106
+ */
107
+ legacyTransactions?: boolean | undefined;
108
+ /**
109
+ * Calculate the bundle transaction gas limits locally instead of using the RPC gas limit estimation.
110
+ */
111
+ localGasLimitCalculation?: boolean | undefined;
112
+ /**
113
+ * Default log level.
114
+ */
115
+ logLevel?: "trace" | "debug" | "info" | "warn" | "error" | "fatal" | undefined;
116
+ /**
117
+ * Max block range for `eth_getLogs` calls.
118
+ */
119
+ maxBlockRange?: number | undefined;
120
+ /**
121
+ * Maximum number of operations allowed in the mempool before a bundle is submitted.
122
+ * @default 10
123
+ */
124
+ maxBundleSize?: number | undefined;
125
+ /**
126
+ * Maximum time to wait for a bundle to be submitted (ms).
127
+ * @default 1000
128
+ */
129
+ maxBundleWait?: number | undefined;
130
+ /**
131
+ * Maximum amount of gas per bundle.
132
+ * @default "5000000"
133
+ */
134
+ maxGasPerBundle?: string | undefined;
135
+ /**
136
+ * Maximum number of executor accounts to use from the list of executor private keys.
137
+ */
138
+ maxExecutors?: number | undefined;
139
+ /**
140
+ * Maximum amount of parallel user ops to keep in the meempool (same sender, different nonce keys).
141
+ * @default 10
142
+ */
143
+ mempoolMaxParallelOps?: number | undefined;
144
+ /**
145
+ * Maximum amount of sequential user ops to keep in the mempool (same sender and nonce key, different nonce values).
146
+ * @default 0
147
+ */
148
+ mempoolMaxQueuedOps?: number | undefined;
149
+ /**
150
+ * Minimum stake required for a relay (in 10e18).
151
+ * @default 1
152
+ */
153
+ minEntityStake?: number | undefined;
154
+ /**
155
+ * Minimum unstake delay (seconds).
156
+ * @default 1
157
+ */
158
+ minEntityUnstakeDelay?: number | undefined;
159
+ /**
160
+ * Minimum balance required for each executor account (below which the utility account will refill).
161
+ */
162
+ minExecutorBalance?: string | undefined;
163
+ /**
164
+ * Name of the network (used for metrics).
165
+ * @default "localhost"
166
+ */
167
+ networkName?: string | undefined;
168
+ /**
169
+ * Amount to multiply the paymaster gas limits fetched from simulations.
170
+ */
171
+ paymasterGasLimitMultiplier?: string | undefined;
172
+ /**
173
+ * Address of the `PerOpInflator` contract.
174
+ */
175
+ perOpInflatorAddress?: `0x${string}` | undefined;
176
+ /**
177
+ * Polling interval for querying for new blocks (ms).
178
+ * @default 1000
179
+ */
180
+ pollingInterval?: number | undefined;
181
+ /**
182
+ * Port to listen on.
183
+ * @default 3000
184
+ */
185
+ port?: number | undefined;
186
+ /**
187
+ * RPC url to connect to.
188
+ */
189
+ rpcUrl: string;
190
+ /**
191
+ * Enable safe mode (enforcing all ERC-4337 rules).
192
+ * @default true
193
+ */
194
+ safeMode?: boolean | undefined;
195
+ /**
196
+ * RPC url to send transactions to (e.g. flashbots relay).
197
+ */
198
+ sendTransactionRpcUrl?: string | undefined;
199
+ /**
200
+ * Timeout for incoming requests (in ms).
201
+ */
202
+ timeout?: number | undefined;
203
+ /**
204
+ * Private key of the utility account.
205
+ */
206
+ utilityPrivateKey?: string | undefined;
207
+ /**
208
+ * Maximum payload size for websocket messages in bytes (default to 1MB).
209
+ */
210
+ websocketMaxPayloadSize?: number | undefined;
211
+ /**
212
+ * Enable websocket server.
213
+ */
214
+ websocket?: boolean | undefined;
215
+ };
216
+ /**
217
+ * Defines an Alto instance.
218
+ *
219
+ * @example
220
+ * ```ts
221
+ * const instance = alto({
222
+ * entrypoints: ['0x0000000071727De22E5E9d8BAf0edAc6f37da032'],
223
+ * rpcUrl: `http://localhost:8545`,
224
+ * executorPrivateKeys: ['0x...'],
225
+ * })
226
+ * await instance.start()
227
+ * // ...
228
+ * await instance.stop()
229
+ * ```
230
+ */
231
+ export declare const alto: import("prool").DefineInstanceReturnType<{
232
+ args: {
233
+ /**
234
+ * API version (used for internal Pimlico versioning compatibility).
235
+ */
236
+ apiVersion?: readonly string[] | undefined;
237
+ /**
238
+ * Override the sender native token balance during estimation
239
+ */
240
+ balanceOverride?: boolean | undefined;
241
+ /**
242
+ * Binary path of the `alto` executable.
243
+ */
244
+ binary?: string | undefined;
245
+ /**
246
+ * Address of the `BundleBulker` contract.
247
+ */
248
+ bundleBulkerAddress?: `0x${string}` | undefined;
249
+ /**
250
+ * Set if the bundler bundle user operations automatically or only when calling `debug_bundler_sendBundleNow`.
251
+ * @default "auto"
252
+ */
253
+ bundleMode?: "auto" | "manual" | undefined;
254
+ /**
255
+ * Indicates weather the chain is a OP stack chain, arbitrum chain, or default EVM chain.
256
+ */
257
+ chainType?: "default" | "op-stack" | "arbitrum" | undefined;
258
+ /**
259
+ * Path to JSON config file.
260
+ */
261
+ config?: string | undefined;
262
+ /**
263
+ * Skip user operation validation, use with caution.
264
+ */
265
+ dangerousSkipUserOperationValidation?: boolean | undefined;
266
+ /**
267
+ * Default API version.
268
+ */
269
+ defaultApiVersion?: string | undefined;
270
+ /**
271
+ * Enable debug endpoints.
272
+ * @default false
273
+ */
274
+ enableDebugEndpoints?: boolean | undefined;
275
+ /**
276
+ * Include user ops with the same sender in the single bundle.
277
+ * @default true
278
+ */
279
+ enforceUniqueSendersPerBundle?: boolean | undefined;
280
+ /**
281
+ * EntryPoint contract addresses.
282
+ */
283
+ entrypoints: readonly `0x${string}`[];
284
+ /**
285
+ * Address of the EntryPoint simulations contract.
286
+ */
287
+ entrypointSimulationContract?: `0x${string}` | undefined;
288
+ /**
289
+ * Private keys of the executor accounts.
290
+ */
291
+ executorPrivateKeys?: readonly `0x${string}`[] | undefined;
292
+ /**
293
+ * Interval to refill the signer balance (seconds).
294
+ * @default 1200
295
+ */
296
+ executorRefillInterval?: number | undefined;
297
+ /**
298
+ * Should the node make expiration checks.
299
+ * @default true
300
+ */
301
+ expirationCheck?: boolean | undefined;
302
+ /**
303
+ * Amount to multiply the gas prices fetched from the node.
304
+ * @default "100"
305
+ */
306
+ gasPriceBump?: string | undefined;
307
+ /**
308
+ * Maximum that the gas prices fetched using pimlico_getUserOperationGasPrice will be accepted for (seconds).
309
+ * @default 10
310
+ */
311
+ gasPriceExpiry?: number | undefined;
312
+ /**
313
+ * The minimum percentage of incoming user operation gas prices compared to the gas price used by the bundler to submit bundles.
314
+ * @default 101
315
+ */
316
+ gasPriceFloorPercent?: number | undefined;
317
+ /**
318
+ * Amount to multiply the gas prices fetched using `pimlico_getUserOperationGasPrice`.
319
+ * @default "105,110,115"
320
+ */
321
+ gasPriceMultipliers?: readonly string[] | undefined;
322
+ /**
323
+ * Use a fixed value for gas limits during bundle transaction gas limit estimations
324
+ */
325
+ fixedGasLimitForEstimation?: string | undefined;
326
+ /**
327
+ * Flush stuck transactions with old nonces during bundler startup.
328
+ */
329
+ flushStuckTransactionsDuringStartup?: boolean | undefined;
330
+ /**
331
+ * Log in JSON format.
332
+ */
333
+ json?: boolean | undefined;
334
+ /**
335
+ * Send legacy transactions instead of an EIP-1559 transactions.
336
+ * @default false
337
+ */
338
+ legacyTransactions?: boolean | undefined;
339
+ /**
340
+ * Calculate the bundle transaction gas limits locally instead of using the RPC gas limit estimation.
341
+ */
342
+ localGasLimitCalculation?: boolean | undefined;
343
+ /**
344
+ * Default log level.
345
+ */
346
+ logLevel?: "trace" | "debug" | "info" | "warn" | "error" | "fatal" | undefined;
347
+ /**
348
+ * Max block range for `eth_getLogs` calls.
349
+ */
350
+ maxBlockRange?: number | undefined;
351
+ /**
352
+ * Maximum number of operations allowed in the mempool before a bundle is submitted.
353
+ * @default 10
354
+ */
355
+ maxBundleSize?: number | undefined;
356
+ /**
357
+ * Maximum time to wait for a bundle to be submitted (ms).
358
+ * @default 1000
359
+ */
360
+ maxBundleWait?: number | undefined;
361
+ /**
362
+ * Maximum amount of gas per bundle.
363
+ * @default "5000000"
364
+ */
365
+ maxGasPerBundle?: string | undefined;
366
+ /**
367
+ * Maximum number of executor accounts to use from the list of executor private keys.
368
+ */
369
+ maxExecutors?: number | undefined;
370
+ /**
371
+ * Maximum amount of parallel user ops to keep in the meempool (same sender, different nonce keys).
372
+ * @default 10
373
+ */
374
+ mempoolMaxParallelOps?: number | undefined;
375
+ /**
376
+ * Maximum amount of sequential user ops to keep in the mempool (same sender and nonce key, different nonce values).
377
+ * @default 0
378
+ */
379
+ mempoolMaxQueuedOps?: number | undefined;
380
+ /**
381
+ * Minimum stake required for a relay (in 10e18).
382
+ * @default 1
383
+ */
384
+ minEntityStake?: number | undefined;
385
+ /**
386
+ * Minimum unstake delay (seconds).
387
+ * @default 1
388
+ */
389
+ minEntityUnstakeDelay?: number | undefined;
390
+ /**
391
+ * Minimum balance required for each executor account (below which the utility account will refill).
392
+ */
393
+ minExecutorBalance?: string | undefined;
394
+ /**
395
+ * Name of the network (used for metrics).
396
+ * @default "localhost"
397
+ */
398
+ networkName?: string | undefined;
399
+ /**
400
+ * Amount to multiply the paymaster gas limits fetched from simulations.
401
+ */
402
+ paymasterGasLimitMultiplier?: string | undefined;
403
+ /**
404
+ * Address of the `PerOpInflator` contract.
405
+ */
406
+ perOpInflatorAddress?: `0x${string}` | undefined;
407
+ /**
408
+ * Polling interval for querying for new blocks (ms).
409
+ * @default 1000
410
+ */
411
+ pollingInterval?: number | undefined;
412
+ /**
413
+ * Port to listen on.
414
+ * @default 3000
415
+ */
416
+ port?: number | undefined;
417
+ /**
418
+ * RPC url to connect to.
419
+ */
420
+ rpcUrl: string;
421
+ /**
422
+ * Enable safe mode (enforcing all ERC-4337 rules).
423
+ * @default true
424
+ */
425
+ safeMode?: boolean | undefined;
426
+ /**
427
+ * RPC url to send transactions to (e.g. flashbots relay).
428
+ */
429
+ sendTransactionRpcUrl?: string | undefined;
430
+ /**
431
+ * Timeout for incoming requests (in ms).
432
+ */
433
+ timeout?: number | undefined;
434
+ /**
435
+ * Private key of the utility account.
436
+ */
437
+ utilityPrivateKey?: string | undefined;
438
+ /**
439
+ * Maximum payload size for websocket messages in bytes (default to 1MB).
440
+ */
441
+ websocketMaxPayloadSize?: number | undefined;
442
+ /**
443
+ * Enable websocket server.
444
+ */
445
+ websocket?: boolean | undefined;
446
+ };
447
+ readonly process: import("prool/processes").Process_internal;
448
+ }, AltoParameters | undefined>;
449
+ //# sourceMappingURL=index.d.mts.map
package/esm/index.mjs ADDED
@@ -0,0 +1,64 @@
1
+ import { resolve } from "node:path";
2
+ import { defineInstance } from "prool";
3
+ import { execa } from "prool/processes";
4
+ import { toArgs } from "./utils/toArgs.js";
5
+ /**
6
+ * Defines an Alto instance.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const instance = alto({
11
+ * entrypoints: ['0x0000000071727De22E5E9d8BAf0edAc6f37da032'],
12
+ * rpcUrl: `http://localhost:8545`,
13
+ * executorPrivateKeys: ['0x...'],
14
+ * })
15
+ * await instance.start()
16
+ * // ...
17
+ * await instance.stop()
18
+ * ```
19
+ */
20
+ export const alto = defineInstance((parameters) => {
21
+ const { ...args } = (parameters || {});
22
+ const name = "alto";
23
+ const process = execa({ name });
24
+ return {
25
+ _internal: {
26
+ args,
27
+ get process() {
28
+ return process._internal.process;
29
+ }
30
+ },
31
+ host: "localhost",
32
+ name,
33
+ port: args.port ?? 3000,
34
+ async start({ port = args.port ?? 3000 }, options) {
35
+ const binary = (() => {
36
+ if (args.binary) {
37
+ return [args.binary];
38
+ }
39
+ return ["node", resolve(__dirname, "./cli/alto.js")];
40
+ })();
41
+ await process.start(($) => $ `${binary} ${toArgs({
42
+ port,
43
+ ...args,
44
+ safeMode: args.safeMode ?? false
45
+ })}`, {
46
+ ...options,
47
+ // Resolve when the process is listening via a "Server listening at" message.
48
+ resolver({ process, reject, resolve }) {
49
+ process.stdout.on("data", (data) => {
50
+ const message = data.toString();
51
+ if (message.includes("Server listening at")) {
52
+ resolve();
53
+ }
54
+ });
55
+ process.stderr.on("data", reject);
56
+ }
57
+ });
58
+ },
59
+ async stop() {
60
+ await process.stop();
61
+ }
62
+ };
63
+ });
64
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../index.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAiO1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,cAAc,CAAC,CAAC,UAA2B,EAAE,EAAE;IAC/D,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,UAAU,IAAI,EAAE,CAAmB,CAAA;IAExD,MAAM,IAAI,GAAG,MAAM,CAAA;IACnB,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IAE/B,OAAO;QACH,SAAS,EAAE;YACP,IAAI;YACJ,IAAI,OAAO;g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AC,IAAI,EAAE,CAAA;QACxB,CAAC;KACJ,CAAA;AACL,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pimlico/alto",
3
- "version": "0.0.0-prool.20240609T212524",
3
+ "version": "0.0.0-prool.20240609T213054",
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",
@@ -11,6 +11,9 @@
11
11
  "esm/**/*.d.ts",
12
12
  "esm/**/*.js",
13
13
  "esm/**/*.js.map",
14
+ "esm/**/*.mjs.map",
15
+ "esm/**/*.mjs",
16
+ "esm/**/*.d.mts",
14
17
  "lib/**/*.d.ts",
15
18
  "lib/**/*.js",
16
19
  "lib/**/*.js.map",