@pimlico/alto 0.0.0-staging.20240606T101054 → 0.0.0-staging.20240606T102147

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.
Files changed (220) hide show
  1. package/esm/cli/alto.d.ts +6 -0
  2. package/esm/cli/alto.js +92 -0
  3. package/esm/cli/alto.js.map +1 -0
  4. package/esm/cli/config/bundler.d.ts +391 -0
  5. package/esm/cli/config/bundler.js +132 -0
  6. package/esm/cli/config/bundler.js.map +1 -0
  7. package/esm/cli/config/index.d.ts +3 -0
  8. package/esm/cli/config/index.js +3 -0
  9. package/esm/cli/config/index.js.map +1 -0
  10. package/esm/cli/config/options.d.ts +11 -0
  11. package/esm/cli/config/options.js +336 -0
  12. package/esm/cli/config/options.js.map +1 -0
  13. package/esm/cli/customTransport.d.ts +14 -0
  14. package/esm/cli/customTransport.js +53 -0
  15. package/esm/cli/customTransport.js.map +1 -0
  16. package/esm/cli/handler.d.ts +3 -0
  17. package/esm/cli/handler.js +116 -0
  18. package/esm/cli/handler.js.map +1 -0
  19. package/esm/cli/index.d.ts +4 -0
  20. package/esm/cli/index.js +4 -0
  21. package/esm/cli/index.js.map +1 -0
  22. package/esm/cli/instrumentation.d.ts +2 -0
  23. package/esm/cli/instrumentation.js +39 -0
  24. package/esm/cli/instrumentation.js.map +1 -0
  25. package/esm/cli/setupServer.d.ts +17 -0
  26. package/esm/cli/setupServer.js +155 -0
  27. package/esm/cli/setupServer.js.map +1 -0
  28. package/esm/cli/util.d.ts +22 -0
  29. package/esm/cli/util.js +30 -0
  30. package/esm/cli/util.js.map +1 -0
  31. package/esm/executor/executor.d.ts +54 -0
  32. package/esm/executor/executor.js +637 -0
  33. package/esm/executor/executor.js.map +1 -0
  34. package/esm/executor/executorManager.d.ts +34 -0
  35. package/esm/executor/executorManager.js +401 -0
  36. package/esm/executor/executorManager.js.map +1 -0
  37. package/esm/executor/index.d.ts +5 -0
  38. package/esm/executor/index.js +5 -0
  39. package/esm/executor/index.js.map +1 -0
  40. package/esm/executor/senderManager.d.ts +17 -0
  41. package/esm/executor/senderManager.js +160 -0
  42. package/esm/executor/senderManager.js.map +1 -0
  43. package/esm/executor/test/utils.d.ts +13 -0
  44. package/esm/executor/test/utils.js +75 -0
  45. package/esm/executor/test/utils.js.map +1 -0
  46. package/esm/executor/utils.d.ts +32 -0
  47. package/esm/executor/utils.js +239 -0
  48. package/esm/executor/utils.js.map +1 -0
  49. package/esm/index.d.ts +2 -0
  50. package/esm/index.js +2 -0
  51. package/esm/index.js.map +1 -0
  52. package/esm/mempool/index.d.ts +5 -0
  53. package/esm/mempool/index.js +5 -0
  54. package/esm/mempool/index.js.map +1 -0
  55. package/esm/mempool/mempool.d.ts +64 -0
  56. package/esm/mempool/mempool.js +489 -0
  57. package/esm/mempool/mempool.js.map +1 -0
  58. package/esm/mempool/monitoring.d.ts +10 -0
  59. package/esm/mempool/monitoring.js +34 -0
  60. package/esm/mempool/monitoring.js.map +1 -0
  61. package/esm/mempool/nullMempool.d.ts +15 -0
  62. package/esm/mempool/nullMempool.js +36 -0
  63. package/esm/mempool/nullMempool.js.map +1 -0
  64. package/esm/mempool/reputationManager.d.ts +115 -0
  65. package/esm/mempool/reputationManager.js +397 -0
  66. package/esm/mempool/reputationManager.js.map +1 -0
  67. package/esm/mempool/store.d.ts +22 -0
  68. package/esm/mempool/store.js +123 -0
  69. package/esm/mempool/store.js.map +1 -0
  70. package/esm/rpc/EntryPointSimulationsV07.d.ts +58 -0
  71. package/esm/rpc/EntryPointSimulationsV07.js +407 -0
  72. package/esm/rpc/EntryPointSimulationsV07.js.map +1 -0
  73. package/esm/rpc/ExecuteSimulator.d.ts +37 -0
  74. package/esm/rpc/ExecuteSimulator.js +48 -0
  75. package/esm/rpc/ExecuteSimulator.js.map +1 -0
  76. package/esm/rpc/gasEstimation.d.ts +17 -0
  77. package/esm/rpc/gasEstimation.js +410 -0
  78. package/esm/rpc/gasEstimation.js.map +1 -0
  79. package/esm/rpc/index.d.ts +5 -0
  80. package/esm/rpc/index.js +5 -0
  81. package/esm/rpc/index.js.map +1 -0
  82. package/esm/rpc/nonceQueuer.d.ts +25 -0
  83. package/esm/rpc/nonceQueuer.js +135 -0
  84. package/esm/rpc/nonceQueuer.js.map +1 -0
  85. package/esm/rpc/rpcHandler.d.ts +64 -0
  86. package/esm/rpc/rpcHandler.js +727 -0
  87. package/esm/rpc/rpcHandler.js.map +1 -0
  88. package/esm/rpc/server.d.ts +31 -0
  89. package/esm/rpc/server.js +238 -0
  90. package/esm/rpc/server.js.map +1 -0
  91. package/esm/rpc/validation/BundlerCollectorTracerV06.d.ts +102 -0
  92. package/esm/rpc/validation/BundlerCollectorTracerV06.js +255 -0
  93. package/esm/rpc/validation/BundlerCollectorTracerV06.js.map +1 -0
  94. package/esm/rpc/validation/BundlerCollectorTracerV07.d.ts +102 -0
  95. package/esm/rpc/validation/BundlerCollectorTracerV07.js +254 -0
  96. package/esm/rpc/validation/BundlerCollectorTracerV07.js.map +1 -0
  97. package/esm/rpc/validation/SafeValidator.d.ts +35 -0
  98. package/esm/rpc/validation/SafeValidator.js +487 -0
  99. package/esm/rpc/validation/SafeValidator.js.map +1 -0
  100. package/esm/rpc/validation/TracerResultParserV06.d.ts +13 -0
  101. package/esm/rpc/validation/TracerResultParserV06.js +578 -0
  102. package/esm/rpc/validation/TracerResultParserV06.js.map +1 -0
  103. package/esm/rpc/validation/TracerResultParserV07.d.ts +33 -0
  104. package/esm/rpc/validation/TracerResultParserV07.js +557 -0
  105. package/esm/rpc/validation/TracerResultParserV07.js.map +1 -0
  106. package/esm/rpc/validation/UnsafeValidator.d.ts +63 -0
  107. package/esm/rpc/validation/UnsafeValidator.js +257 -0
  108. package/esm/rpc/validation/UnsafeValidator.js.map +1 -0
  109. package/esm/rpc/validation/index.d.ts +3 -0
  110. package/esm/rpc/validation/index.js +3 -0
  111. package/esm/rpc/validation/index.js.map +1 -0
  112. package/esm/rpc/validation/tracer.d.ts +122 -0
  113. package/esm/rpc/validation/tracer.js +82 -0
  114. package/esm/rpc/validation/tracer.js.map +1 -0
  115. package/esm/types/contracts/BundleBulker.d.ts +120 -0
  116. package/esm/types/contracts/BundleBulker.js +157 -0
  117. package/esm/types/contracts/BundleBulker.js.map +1 -0
  118. package/esm/types/contracts/CallEngine.d.ts +28 -0
  119. package/esm/types/contracts/CallEngine.js +37 -0
  120. package/esm/types/contracts/CallEngine.js.map +1 -0
  121. package/esm/types/contracts/CodeHashGetter.d.ts +37 -0
  122. package/esm/types/contracts/CodeHashGetter.js +45 -0
  123. package/esm/types/contracts/CodeHashGetter.js.map +1 -0
  124. package/esm/types/contracts/EntryPoint.d.ts +1789 -0
  125. package/esm/types/contracts/EntryPoint.js +2304 -0
  126. package/esm/types/contracts/EntryPoint.js.map +1 -0
  127. package/esm/types/contracts/EntryPointSimulations.d.ts +153 -0
  128. package/esm/types/contracts/EntryPointSimulations.js +15 -0
  129. package/esm/types/contracts/EntryPointSimulations.js.map +1 -0
  130. package/esm/types/contracts/IOpInflator.d.ts +61 -0
  131. package/esm/types/contracts/IOpInflator.js +80 -0
  132. package/esm/types/contracts/IOpInflator.js.map +1 -0
  133. package/esm/types/contracts/IPaymaster.d.ts +3 -0
  134. package/esm/types/contracts/IPaymaster.js +117 -0
  135. package/esm/types/contracts/IPaymaster.js.map +1 -0
  136. package/esm/types/contracts/Inflator.d.ts +65 -0
  137. package/esm/types/contracts/Inflator.js +84 -0
  138. package/esm/types/contracts/Inflator.js.map +1 -0
  139. package/esm/types/contracts/PerOpInflator.d.ts +176 -0
  140. package/esm/types/contracts/PerOpInflator.js +229 -0
  141. package/esm/types/contracts/PerOpInflator.js.map +1 -0
  142. package/esm/types/contracts/PimlicoEntryPointSimulations.d.ts +23 -0
  143. package/esm/types/contracts/PimlicoEntryPointSimulations.js +33 -0
  144. package/esm/types/contracts/PimlicoEntryPointSimulations.js.map +1 -0
  145. package/esm/types/contracts/SenderCreator.d.ts +4 -0
  146. package/esm/types/contracts/SenderCreator.js +23 -0
  147. package/esm/types/contracts/SenderCreator.js.map +1 -0
  148. package/esm/types/contracts/SimpleAccountFactory.d.ts +57 -0
  149. package/esm/types/contracts/SimpleAccountFactory.js +76 -0
  150. package/esm/types/contracts/SimpleAccountFactory.js.map +1 -0
  151. package/esm/types/contracts/TestOpcodesAccount.d.ts +4 -0
  152. package/esm/types/contracts/TestOpcodesAccount.js +281 -0
  153. package/esm/types/contracts/TestOpcodesAccount.js.map +1 -0
  154. package/esm/types/contracts/TestOpcodesAccountFactory.d.ts +4 -0
  155. package/esm/types/contracts/TestOpcodesAccountFactory.js +23 -0
  156. package/esm/types/contracts/TestOpcodesAccountFactory.js.map +1 -0
  157. package/esm/types/contracts/TestStorageAccount.d.ts +4 -0
  158. package/esm/types/contracts/TestStorageAccount.js +313 -0
  159. package/esm/types/contracts/TestStorageAccount.js.map +1 -0
  160. package/esm/types/contracts/index.d.ts +17 -0
  161. package/esm/types/contracts/index.js +17 -0
  162. package/esm/types/contracts/index.js.map +1 -0
  163. package/esm/types/gasPrice.d.ts +110 -0
  164. package/esm/types/gasPrice.js +52 -0
  165. package/esm/types/gasPrice.js.map +1 -0
  166. package/esm/types/index.d.ts +11 -0
  167. package/esm/types/index.js +11 -0
  168. package/esm/types/index.js.map +1 -0
  169. package/esm/types/interfaces.d.ts +26 -0
  170. package/esm/types/interfaces.js +2 -0
  171. package/esm/types/interfaces.js.map +1 -0
  172. package/esm/types/mempool.d.ts +78 -0
  173. package/esm/types/mempool.js +16 -0
  174. package/esm/types/mempool.js.map +1 -0
  175. package/esm/types/schemas.d.ts +4791 -0
  176. package/esm/types/schemas.js +497 -0
  177. package/esm/types/schemas.js.map +1 -0
  178. package/esm/types/test/validationTestErrors.d.ts +3 -0
  179. package/esm/types/test/validationTestErrors.js +229 -0
  180. package/esm/types/test/validationTestErrors.js.map +1 -0
  181. package/esm/types/utils.d.ts +24 -0
  182. package/esm/types/utils.js +30 -0
  183. package/esm/types/utils.js.map +1 -0
  184. package/esm/types/validation.d.ts +14327 -0
  185. package/esm/types/validation.js +304 -0
  186. package/esm/types/validation.js.map +1 -0
  187. package/esm/utils/bigInt.d.ts +3 -0
  188. package/esm/utils/bigInt.js +9 -0
  189. package/esm/utils/bigInt.js.map +1 -0
  190. package/esm/utils/compressionHandler.d.ts +11 -0
  191. package/esm/utils/compressionHandler.js +39 -0
  192. package/esm/utils/compressionHandler.js.map +1 -0
  193. package/esm/utils/gasPriceManager.d.ts +34 -0
  194. package/esm/utils/gasPriceManager.js +338 -0
  195. package/esm/utils/gasPriceManager.js.map +1 -0
  196. package/esm/utils/helpers.d.ts +4 -0
  197. package/esm/utils/helpers.js +13 -0
  198. package/esm/utils/helpers.js.map +1 -0
  199. package/esm/utils/index.d.ts +11 -0
  200. package/esm/utils/index.js +10 -0
  201. package/esm/utils/index.js.map +1 -0
  202. package/esm/utils/logger.d.ts +6 -0
  203. package/esm/utils/logger.js +76 -0
  204. package/esm/utils/logger.js.map +1 -0
  205. package/esm/utils/metrics.d.ts +22 -0
  206. package/esm/utils/metrics.js +150 -0
  207. package/esm/utils/metrics.js.map +1 -0
  208. package/esm/utils/rpc-reply.d.ts +17 -0
  209. package/esm/utils/rpc-reply.js +41 -0
  210. package/esm/utils/rpc-reply.js.map +1 -0
  211. package/esm/utils/test.d.ts +17 -0
  212. package/esm/utils/test.js +130 -0
  213. package/esm/utils/test.js.map +1 -0
  214. package/esm/utils/userop.d.ts +49 -0
  215. package/esm/utils/userop.js +408 -0
  216. package/esm/utils/userop.js.map +1 -0
  217. package/esm/utils/validation.d.ts +65 -0
  218. package/esm/utils/validation.js +461 -0
  219. package/esm/utils/validation.js.map +1 -0
  220. package/package.json +4 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../cli/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { CliCommand, CliCommandOptions } from "../util.js";
2
+ import type { IBundleCompressionArgsInput, IBundlerArgsInput, ICompatibilityArgsInput, IDebugArgsInput, ILogArgsInput, IOptionsInput, IRpcArgsInput, IServerArgsInput } from "./bundler.js";
3
+ export declare const bundlerOptions: CliCommandOptions<IBundlerArgsInput>;
4
+ export declare const compatibilityOptions: CliCommandOptions<ICompatibilityArgsInput>;
5
+ export declare const serverOptions: CliCommandOptions<IServerArgsInput>;
6
+ export declare const rpcOptions: CliCommandOptions<IRpcArgsInput>;
7
+ export declare const bundleCompressionOptions: CliCommandOptions<IBundleCompressionArgsInput>;
8
+ export declare const logOptions: CliCommandOptions<ILogArgsInput>;
9
+ export declare const debugOptions: CliCommandOptions<IDebugArgsInput>;
10
+ export declare const bundlerCommand: CliCommand<IOptionsInput>;
11
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1,336 @@
1
+ import { bundlerHandler } from "../handler.js";
2
+ export const bundlerOptions = {
3
+ entrypoints: {
4
+ description: "EntryPoint contract addresses split by commas",
5
+ type: "string",
6
+ alias: "e",
7
+ require: true
8
+ },
9
+ "entrypoint-simulation-contract": {
10
+ description: "Address of the EntryPoint simulations contract",
11
+ type: "string",
12
+ alias: "c",
13
+ require: false
14
+ },
15
+ "executor-private-keys": {
16
+ description: "Private keys of the executor accounts split by commas",
17
+ type: "string",
18
+ alias: "x",
19
+ require: true
20
+ },
21
+ "utility-private-key": {
22
+ description: "Private key of the utility account",
23
+ type: "string",
24
+ alias: "u",
25
+ require: false
26
+ },
27
+ "max-executors": {
28
+ description: "Maximum number of executor accounts to use from the list of executor private keys",
29
+ type: "number",
30
+ require: false
31
+ },
32
+ "min-executor-balance": {
33
+ description: "Minimum balance required for each executor account (below which the utility account will refill)",
34
+ type: "string"
35
+ },
36
+ "executor-refill-interval": {
37
+ description: "Interval to refill the signer balance (seconds)",
38
+ type: "number",
39
+ require: true,
40
+ default: 60 * 20
41
+ },
42
+ "min-entity-stake": {
43
+ description: "Minimum stake required for a relay (in 10e18)",
44
+ type: "number",
45
+ require: true,
46
+ default: 1
47
+ },
48
+ "min-entity-unstake-delay": {
49
+ description: "Minimum unstake delay (seconds)",
50
+ type: "number",
51
+ require: true,
52
+ default: 1
53
+ },
54
+ "max-bundle-wait": {
55
+ description: "Maximum time to wait for a bundle to be submitted (ms)",
56
+ type: "number",
57
+ require: true,
58
+ default: 1000
59
+ },
60
+ "max-bundle-size": {
61
+ description: "Maximum number of operations allowed in the mempool before a bundle is submitted",
62
+ type: "number",
63
+ require: true,
64
+ default: 10
65
+ },
66
+ "safe-mode": {
67
+ description: "Enable safe mode (enforcing all ERC-4337 rules)",
68
+ type: "boolean",
69
+ require: true,
70
+ default: true
71
+ },
72
+ "gas-price-bump": {
73
+ description: "Amount to multiply the gas prices fetched from the node",
74
+ type: "string",
75
+ require: false,
76
+ default: "100"
77
+ },
78
+ "gas-price-floor-percent": {
79
+ description: "The minimum percentage of incoming user operation gas prices compared to the gas price used by the bundler to submit bundles",
80
+ type: "number",
81
+ require: true,
82
+ default: 101
83
+ },
84
+ "gas-price-expiry": {
85
+ description: "Maximum that the gas prices fetched using pimlico_getUserOperationGasPrice will be accepted for (seconds)",
86
+ type: "number",
87
+ require: false,
88
+ default: 10
89
+ },
90
+ "gas-price-multipliers": {
91
+ description: "Amount to multiply the gas prices fetched using pimlico_getUserOperationGasPrice (format: slow,standard,fast)",
92
+ type: "string",
93
+ require: false,
94
+ default: "105,110,115"
95
+ },
96
+ "mempool-max-parallel-ops": {
97
+ description: "Maximum amount of parallel user ops to keep in the meempool (same sender, different nonce keys)",
98
+ type: "number",
99
+ require: false,
100
+ default: 10
101
+ },
102
+ "mempool-max-queued-ops": {
103
+ description: "Maximum amount of sequential user ops to keep in the mempool (same sender and nonce key, different nonce values)",
104
+ type: "number",
105
+ require: false,
106
+ default: 0
107
+ },
108
+ "enforce-unique-senders-per-bundle": {
109
+ description: "Include user ops with the same sender in the single bundle",
110
+ type: "boolean",
111
+ require: false,
112
+ default: true
113
+ },
114
+ "max-gas-per-bundle": {
115
+ description: "Maximum amount of gas per bundle",
116
+ type: "string",
117
+ require: false,
118
+ default: "5000000"
119
+ }
120
+ };
121
+ export const compatibilityOptions = {
122
+ "chain-type": {
123
+ description: "Indicates weather the chain is a OP stack chain, arbitrum chain, or default EVM chain",
124
+ type: "string",
125
+ choices: ["default", "op-stack", "arbitrum"],
126
+ default: "default"
127
+ },
128
+ "legacy-transactions": {
129
+ description: "Send a legacy transactions instead of an EIP-1559 transactions",
130
+ type: "boolean",
131
+ require: true,
132
+ default: false
133
+ },
134
+ "balance-override": {
135
+ description: "Override the sender native token balance during estimation",
136
+ type: "boolean",
137
+ require: true,
138
+ default: true
139
+ },
140
+ "local-gas-limit-calculation": {
141
+ description: "Calculate the bundle transaction gas limits locally instead of using the RPC gas limit estimation",
142
+ type: "boolean",
143
+ require: true,
144
+ default: false
145
+ },
146
+ "flush-stuck-transactions-during-startup": {
147
+ description: "Flush stuck transactions with old nonces during bundler startup",
148
+ type: "boolean",
149
+ require: true,
150
+ default: false
151
+ },
152
+ "fixed-gas-limit-for-estimation": {
153
+ description: "Use a fixed value for gas limits during bundle transaction gas limit estimations",
154
+ type: "string",
155
+ require: false
156
+ },
157
+ "api-version": {
158
+ description: "API version (used for internal Pimlico versioning compatibility)",
159
+ type: "string",
160
+ require: true,
161
+ default: "v1,v2"
162
+ },
163
+ "default-api-version": {
164
+ description: "Default API version",
165
+ type: "string",
166
+ require: false,
167
+ default: "v1"
168
+ },
169
+ "paymaster-gas-limit-multiplier": {
170
+ description: "Amount to multiply the paymaster gas limits fetched from simulations",
171
+ type: "string",
172
+ require: true,
173
+ default: "110"
174
+ }
175
+ };
176
+ export const serverOptions = {
177
+ port: {
178
+ description: "Port to listen on",
179
+ type: "number",
180
+ require: true,
181
+ default: 3000
182
+ },
183
+ timeout: {
184
+ description: "Timeout for incoming requests (in ms)",
185
+ type: "number",
186
+ require: false
187
+ },
188
+ "websocket-max-payload-size": {
189
+ description: "Maximum payload size for websocket messages in bytes (default to 1MB)",
190
+ type: "number",
191
+ require: false
192
+ },
193
+ websocket: {
194
+ description: "Enable websocket server",
195
+ type: "boolean",
196
+ require: false
197
+ }
198
+ };
199
+ export const rpcOptions = {
200
+ "rpc-url": {
201
+ description: "RPC url to connect to",
202
+ type: "string",
203
+ alias: "r",
204
+ require: true
205
+ },
206
+ "send-transaction-rpc-url": {
207
+ description: "RPC url to send transactions to (e.g. flashbots relay)",
208
+ type: "string",
209
+ require: false
210
+ },
211
+ "polling-interval": {
212
+ description: "Polling interval for querying for new blocks (ms)",
213
+ type: "number",
214
+ require: true,
215
+ default: 1000
216
+ },
217
+ "max-block-range": {
218
+ description: "Max block range for getLogs calls",
219
+ type: "number",
220
+ require: false
221
+ }
222
+ };
223
+ export const bundleCompressionOptions = {
224
+ "bundle-bulker-address": {
225
+ description: "Address of the BundleBulker contract",
226
+ type: "string",
227
+ require: false
228
+ },
229
+ "per-op-inflator-address": {
230
+ description: "Address of the PerOpInflator contract",
231
+ type: "string",
232
+ require: false
233
+ }
234
+ };
235
+ export const logOptions = {
236
+ json: {
237
+ description: "Log in JSON format",
238
+ type: "boolean",
239
+ require: true,
240
+ default: false
241
+ },
242
+ "network-name": {
243
+ description: "Name of the network (used for metrics)",
244
+ type: "string",
245
+ require: true,
246
+ default: "localhost"
247
+ },
248
+ "log-level": {
249
+ description: "Default log level",
250
+ type: "string",
251
+ require: true,
252
+ choices: ["trace", "debug", "info", "warn", "error", "fatal"],
253
+ default: "info"
254
+ },
255
+ "public-client-log-level": {
256
+ description: "Log level for the publicClient module",
257
+ type: "string",
258
+ choices: ["trace", "debug", "info", "warn", "error", "fatal"],
259
+ require: false
260
+ },
261
+ "wallet-client-log-level": {
262
+ description: "Log level for the walletClient module",
263
+ type: "string",
264
+ choices: ["trace", "debug", "info", "warn", "error", "fatal"],
265
+ require: false
266
+ },
267
+ "rpc-log-level": {
268
+ description: "Log level for the rpc module",
269
+ type: "string",
270
+ choices: ["trace", "debug", "info", "warn", "error", "fatal"],
271
+ require: false
272
+ },
273
+ "mempool-log-level": {
274
+ description: "Log level for the mempool module",
275
+ type: "string",
276
+ choices: ["trace", "debug", "info", "warn", "error", "fatal"],
277
+ require: false
278
+ },
279
+ "executor-log-level": {
280
+ description: "Log level for the executor module",
281
+ type: "string",
282
+ choices: ["trace", "debug", "info", "warn", "error", "fatal"],
283
+ require: false
284
+ },
285
+ "reputation-manager-log-level": {
286
+ description: "Log level for the executor module",
287
+ type: "string",
288
+ choices: ["trace", "debug", "info", "warn", "error", "fatal"],
289
+ require: false
290
+ },
291
+ "nonce-queuer-log-level": {
292
+ description: "Log level for the executor module",
293
+ type: "string",
294
+ choices: ["trace", "debug", "info", "warn", "error", "fatal"],
295
+ require: false
296
+ }
297
+ };
298
+ export const debugOptions = {
299
+ "bundle-mode": {
300
+ description: "Set if the bundler bundle user operations automatically or only when calling debug_bundler_sendBundleNow.",
301
+ type: "string",
302
+ require: true,
303
+ default: "auto",
304
+ choices: ["auto", "manual"]
305
+ },
306
+ "enable-debug-endpoints": {
307
+ description: "Enable debug endpoints",
308
+ type: "boolean",
309
+ require: true,
310
+ default: false
311
+ },
312
+ "expiration-check": {
313
+ description: "Should the node make expiration checks",
314
+ type: "boolean",
315
+ require: true,
316
+ default: true
317
+ },
318
+ "dangerous-skip-user-operation-validation": {
319
+ description: "Skip user operation validation, use with caution",
320
+ type: "boolean",
321
+ require: true,
322
+ default: false
323
+ },
324
+ tenderly: {
325
+ description: "RPC url follows the tenderly format",
326
+ type: "boolean",
327
+ require: true,
328
+ default: false
329
+ }
330
+ };
331
+ export const bundlerCommand = {
332
+ command: "$0",
333
+ describe: "Starts the bundler",
334
+ handler: bundlerHandler
335
+ };
336
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../cli/config/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAa3C,MAAM,CAAC,MAAM,cAAc,GAAyC;IAChE,WAAW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,EAAE,oBAAoB;IAC9B,OAAO,EAAE,cAAc;CAC1B,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { Logger } from "../utils/index.js";
2
+ import { type HttpTransport, type HttpTransportConfig } from "viem";
3
+ export type RpcRequest = {
4
+ jsonrpc?: "2.0" | undefined;
5
+ method: string;
6
+ params?: any | undefined;
7
+ id?: number | undefined;
8
+ };
9
+ export declare function customTransport(
10
+ /** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */
11
+ url_: string, config: HttpTransportConfig & {
12
+ logger: Logger;
13
+ }): HttpTransport;
14
+ //# sourceMappingURL=customTransport.d.ts.map
@@ -0,0 +1,53 @@
1
+ import { RpcRequestError, UrlRequiredError, createTransport } from "viem";
2
+ import { rpc } from "viem/utils";
3
+ export function customTransport(
4
+ /** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */
5
+ url_, config) {
6
+ const { fetchOptions, key = "http", name = "HTTP JSON-RPC", retryDelay, logger } = config;
7
+ return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => {
8
+ const retryCount = config.retryCount ?? retryCount_;
9
+ const timeout = timeout_ ?? config.timeout ?? 10_000;
10
+ const url = url_ || chain?.rpcUrls.default.http[0];
11
+ if (!url) {
12
+ throw new UrlRequiredError();
13
+ }
14
+ return createTransport({
15
+ key,
16
+ name,
17
+ async request({ method, params }) {
18
+ const body = { method, params };
19
+ const fn = async (body) => {
20
+ return [
21
+ await rpc.http(url, {
22
+ body,
23
+ fetchOptions,
24
+ timeout
25
+ })
26
+ ];
27
+ };
28
+ const [{ error, result }] = await fn(body);
29
+ if (error) {
30
+ logger.error({
31
+ error,
32
+ body
33
+ }, "Received error response");
34
+ throw new RpcRequestError({
35
+ body,
36
+ error,
37
+ url: url
38
+ });
39
+ }
40
+ logger.info({ body, result }, "Received response");
41
+ return result;
42
+ },
43
+ retryCount,
44
+ retryDelay,
45
+ timeout,
46
+ type: "http"
47
+ }, {
48
+ fetchOptions,
49
+ url
50
+ });
51
+ };
52
+ }
53
+ //# sourceMappingURL=customTransport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customTransport.js","sourceRoot":"","sources":["../../cli/customTransport.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,eAAe,EACf,gBAAgB,EAChB,eAAe,EAClB,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAShC,MAAM,UAAU,eAAe;AAC3B,uEAAuE;AACvE,IAAY,EACZ,MAAgD;IAEhD,MAAM,EACF,YAAY,EACZ,GAAG,GAAG,MAAM,EACZ,IAAI,GAAG,eAAe,EACtB,UAAU,EACV,MAAM,EACT,GAAG,MAAM,CAAA;IAEV,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC7D,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,WAAW,CAAA;QACnD,MAAM,OAAO,GAAG,QAAQ,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAA;QACpD,MAAM,GAAG,GAAG,IAAI,IAAI,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAClD,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,MAAM,IAAI,gBAAgB,EAAE,CAAA;QAChC,CAAC;QAED,OAAO,eAAe,CAClB;YACI,GAAG;YACH,IAAI;YACJ,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE;gBAC5B,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;gBAC/B,MAAM,EAAE,GAAG,KAAK,EAAE,IAAgB,EAAE,EAAE;oBAClC,OAAO;wBACH,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE;4BAChB,IAAI;4BACJ,YAAY;4BACZ,OAAO;yBACV,CAAC;qBACL,CAAA;gBACL,CAAC,CAAA;gBAED,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,CAAA;gBAC1C,IAAI,KAAK,EAAE,CAAC;oBACR,MAAM,CAAC,KAAK,CACR;wBACI,KAAK;wBACL,IAAI;qBACP,EACD,yBAAyB,CAC5B,CAAA;oBACD,MAAM,IAAI,eAAe,CAAC;wBACtB,IAAI;wBACJ,KAAK;wBACL,GAAG,EAAE,GAAG;qBACX,CAAC,CAAA;gBACN,CAAC;gBACD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,mBAAmB,CAAC,CAAA;gBAClD,OAAO,MAAM,CAAA;YACjB,CAAC;YACD,UAAU;YACV,UAAU;YACV,OAAO;YACP,IAAI,EAAE,MAAM;SACf,EACD;YACI,YAAY;YACZ,GAAG;SACN,CACJ,CAAA;IACL,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type IOptionsInput } from "./config/index.js";
2
+ export declare function bundlerHandler(args: IOptionsInput): Promise<void>;
3
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1,116 @@
1
+ import { SenderManager } from "../executor/index.js";
2
+ import { GasPriceManager, createMetrics, initDebugLogger, initProductionLogger } from "../utils/index.js";
3
+ import { Registry } from "prom-client";
4
+ import { createPublicClient, createWalletClient } from "viem";
5
+ import { fromZodError } from "zod-validation-error";
6
+ import { optionArgsSchema } from "./config/index.js";
7
+ import { customTransport } from "./customTransport.js";
8
+ import { setupServer } from "./setupServer.js";
9
+ const parseArgs = (args) => {
10
+ // validate every arg, make type safe so if i add a new arg i have to validate it
11
+ const parsing = optionArgsSchema.safeParse(args);
12
+ if (!parsing.success) {
13
+ const error = fromZodError(parsing.error);
14
+ throw new Error(error.message);
15
+ }
16
+ return parsing.data;
17
+ };
18
+ const preFlightChecks = async (publicClient, parsedArgs) => {
19
+ for (const entrypoint of parsedArgs.entrypoints) {
20
+ const entryPointCode = await publicClient.getBytecode({
21
+ address: entrypoint
22
+ });
23
+ if (entryPointCode === "0x") {
24
+ throw new Error(`entry point ${entrypoint} does not exist`);
25
+ }
26
+ }
27
+ if (parsedArgs["entrypoint-simulation-contract"]) {
28
+ const simulations = parsedArgs["entrypoint-simulation-contract"];
29
+ const simulationsCode = await publicClient.getBytecode({
30
+ address: simulations
31
+ });
32
+ if (simulationsCode === undefined || simulationsCode === "0x") {
33
+ throw new Error(`EntryPointSimulations contract ${simulations} does not exist`);
34
+ }
35
+ }
36
+ };
37
+ export async function bundlerHandler(args) {
38
+ const parsedArgs = parseArgs(args);
39
+ let logger;
40
+ if (parsedArgs.json) {
41
+ logger = initProductionLogger(parsedArgs["log-level"]);
42
+ }
43
+ else {
44
+ logger = initDebugLogger(parsedArgs["log-level"]);
45
+ }
46
+ const rootLogger = logger.child({ module: "root" }, { level: parsedArgs["log-level"] });
47
+ const getChainId = async () => {
48
+ const client = createPublicClient({
49
+ transport: customTransport(args["rpc-url"], {
50
+ logger: logger.child({ module: "public_client" }, {
51
+ level: parsedArgs["public-client-log-level"] ||
52
+ parsedArgs["log-level"]
53
+ })
54
+ })
55
+ });
56
+ return await client.getChainId();
57
+ };
58
+ const chainId = await getChainId();
59
+ const chain = {
60
+ id: chainId,
61
+ name: args["network-name"],
62
+ nativeCurrency: {
63
+ name: "ETH",
64
+ symbol: "ETH",
65
+ decimals: 18
66
+ },
67
+ rpcUrls: {
68
+ default: { http: [args["rpc-url"]] },
69
+ public: { http: [args["rpc-url"]] }
70
+ }
71
+ };
72
+ const client = createPublicClient({
73
+ transport: customTransport(args["rpc-url"], {
74
+ logger: logger.child({ module: "public_client" }, {
75
+ level: parsedArgs["public-client-log-level"] ||
76
+ parsedArgs["log-level"]
77
+ })
78
+ }),
79
+ chain
80
+ });
81
+ const gasPriceManager = new GasPriceManager(chain, client, parsedArgs["legacy-transactions"], logger.child({ module: "gas_price_manager" }, {
82
+ level: parsedArgs["public-client-log-level"] ||
83
+ parsedArgs["log-level"]
84
+ }), parsedArgs["gas-price-bump"], parsedArgs["gas-price-expiry"]);
85
+ const registry = new Registry();
86
+ registry.setDefaultLabels({
87
+ network: chain.name,
88
+ chainId
89
+ });
90
+ const metrics = createMetrics(registry);
91
+ await preFlightChecks(client, parsedArgs);
92
+ const walletClient = createWalletClient({
93
+ transport: customTransport(parsedArgs["send-transaction-rpc-url"] ?? args["rpc-url"], {
94
+ logger: logger.child({ module: "wallet_client" }, {
95
+ level: parsedArgs["wallet-client-log-level"] ||
96
+ parsedArgs["log-level"]
97
+ })
98
+ }),
99
+ chain
100
+ });
101
+ const senderManager = new SenderManager(parsedArgs["executor-private-keys"], parsedArgs["utility-private-key"], logger.child({ module: "executor" }, {
102
+ level: parsedArgs["executor-log-level"] || parsedArgs["log-level"]
103
+ }), metrics, parsedArgs["legacy-transactions"], gasPriceManager, parsedArgs["max-executors"]);
104
+ await setupServer({
105
+ client,
106
+ walletClient,
107
+ parsedArgs,
108
+ logger,
109
+ rootLogger,
110
+ registry,
111
+ metrics,
112
+ senderManager,
113
+ gasPriceManager
114
+ });
115
+ }
116
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../cli/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EACH,eAAe,EACf,aAAa,EACb,eAAe,EACf,oBAAoB,EAEvB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EACH,kBAAkB,EAClB,kBAAkB,EAIrB,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EACH,gBAAgB,EAInB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,SAAS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AAC,qBAAqB,CAAC,EACjC,MAAM,CAAC,KAAK,CACR,EAAE,MAAM,EAAE,UAAU,EAAE,EACtB;QACI,KAAK,EACD,UAAU,CAAC,oBAAoB,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC;KAClE,CACJ,EACD,OAAO,EACP,UAAU,CAAC,qBAAqB,CAAC,EACjC,eAAe,EACf,UAAU,CAAC,eAAe,CAAC,CAC9B,CAAA;IAED,MAAM,WAAW,CAAC;QACd,MAAM;QACN,YAAY;QACZ,UAAU;QACV,MAAM;QACN,UAAU;QACV,QAAQ;QACR,OAAO;QACP,aAAa;QACb,eAAe;KAClB,CAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./config/index.js";
2
+ export * from "./alto.js";
3
+ export * from "./util.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from "./config/index.js";
2
+ export * from "./alto.js";
3
+ export * from "./util.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../cli/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=instrumentation.d.ts.map
@@ -0,0 +1,39 @@
1
+ import { SpanKind } from "@opentelemetry/api";
2
+ import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
3
+ import { FastifyInstrumentation } from "@opentelemetry/instrumentation-fastify";
4
+ import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
5
+ import { PinoInstrumentation } from "@opentelemetry/instrumentation-pino";
6
+ import { NodeSDK } from "@opentelemetry/sdk-node";
7
+ import { ParentBasedSampler, SamplingDecision } from "@opentelemetry/sdk-trace-base";
8
+ import { SemanticAttributes } from "@opentelemetry/semantic-conventions";
9
+ import { FetchInstrumentation } from "opentelemetry-instrumentation-fetch-node";
10
+ class CustomSampler {
11
+ shouldSample(_context, _traceId, _spanName, spanKind, attributes) {
12
+ const ignoredRoutes = ["/metrics", "/health"];
13
+ const httpTarget = attributes[SemanticAttributes.HTTP_TARGET];
14
+ if (spanKind === SpanKind.SERVER &&
15
+ httpTarget &&
16
+ ignoredRoutes.includes(httpTarget.toString())) {
17
+ return { decision: SamplingDecision.NOT_RECORD };
18
+ }
19
+ // fallback
20
+ return { decision: SamplingDecision.RECORD_AND_SAMPLED };
21
+ }
22
+ toString() {
23
+ return "CustomSampler";
24
+ }
25
+ }
26
+ const sdk = new NodeSDK({
27
+ traceExporter: new OTLPTraceExporter(),
28
+ instrumentations: [
29
+ new HttpInstrumentation({
30
+ requireParentforOutgoingSpans: true
31
+ }),
32
+ new FetchInstrumentation({}),
33
+ new FastifyInstrumentation(),
34
+ new PinoInstrumentation()
35
+ ],
36
+ sampler: new ParentBasedSampler({ root: new CustomSampler() })
37
+ });
38
+ sdk.start();
39
+ //# sourceMappingURL=instrumentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../cli/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAA;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EACH,kBAAkB,EAElB,gBAAgB,EACnB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAA;AAE/E,MAAM,aAAa;IACf,YAAY,CACR,QAAiB,EACjB,QAAgB,EAChB,SAAiB,EACjB,QAAkB,EAClB,UAAsB;QAEtB,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;QAE7C,MAAM,UAAU,GAAG,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAA;QAE7D,IACI,QAAQ,KAAK,QAAQ,CAAC,MAAM;YAC5B,UAAU;YACV,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAC/C,CAAC;YACC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC,UAAU,EAAE,CAAA;QACpD,CAAC;QACD,WAAW;QACX,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC,kBAAkB,EAAE,CAAA;IAC5D,CAAC;IACD,QAAQ;QACJ,OAAO,eAAe,CAAA;IAC1B,CAAC;CACJ;AAED,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC;IACpB,aAAa,EAAE,IAAI,iBAAiB,EAAE;IACtC,gBAAgB,EAAE;QACd,IAAI,mBAAmB,CAAC;YACpB,6BAA6B,EAAE,IAAI;SACtC,CAAC;QACF,IAAI,oBAAoB,CAAC,EAAE,CAAC;QAC5B,IAAI,sBAAsB,EAAE;QAC5B,IAAI,mBAAmB,EAAE;KAC5B;IACD,OAAO,EAAE,IAAI,kBAAkB,CAAC,EAAE,IAAI,EAAE,IAAI,aAAa,EAAE,EAAE,CAAC;CACjE,CAAC,CAAA;AAEF,GAAG,CAAC,KAAK,EAAE,CAAA"}
@@ -0,0 +1,17 @@
1
+ import type { SenderManager } from "../executor/index.js";
2
+ import type { GasPriceManager, Logger, Metrics } from "../utils/index.js";
3
+ import type { Registry } from "prom-client";
4
+ import type { Chain, PublicClient, Transport, WalletClient } from "viem";
5
+ import type { IOptions } from "./config/index.js";
6
+ export declare const setupServer: ({ client, walletClient, parsedArgs, logger, rootLogger, registry, metrics, senderManager, gasPriceManager }: {
7
+ client: PublicClient<Transport, Chain>;
8
+ walletClient: WalletClient<Transport, Chain>;
9
+ parsedArgs: IOptions;
10
+ logger: Logger;
11
+ rootLogger: Logger;
12
+ registry: Registry;
13
+ metrics: Metrics;
14
+ senderManager: SenderManager;
15
+ gasPriceManager: GasPriceManager;
16
+ }) => Promise<void>;
17
+ //# sourceMappingURL=setupServer.d.ts.map