@pimlico/alto 0.0.0-main.20240607T104359 → 0.0.0-staging.20240606T095015

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 (369) hide show
  1. package/lib/cli/config/bundler.js +73 -76
  2. package/lib/cli/config/bundler.js.map +1 -1
  3. package/lib/cli/config/index.js +2 -18
  4. package/lib/cli/config/index.js.map +1 -1
  5. package/lib/cli/config/options.js +10 -13
  6. package/lib/cli/config/options.js.map +1 -1
  7. package/lib/cli/customTransport.js +7 -11
  8. package/lib/cli/customTransport.js.map +1 -1
  9. package/lib/cli/handler.js +24 -28
  10. package/lib/cli/handler.js.map +1 -1
  11. package/lib/cli/index.d.ts +0 -1
  12. package/lib/cli/index.js +2 -19
  13. package/lib/cli/index.js.map +1 -1
  14. package/lib/cli/instrumentation.js +20 -22
  15. package/lib/cli/instrumentation.js.map +1 -1
  16. package/lib/cli/setupServer.js +17 -21
  17. package/lib/cli/setupServer.js.map +1 -1
  18. package/lib/cli/util.js +1 -5
  19. package/lib/cli/util.js.map +1 -1
  20. package/lib/executor/executor.js +56 -90
  21. package/lib/executor/executor.js.map +1 -1
  22. package/lib/executor/executorManager.js +7 -12
  23. package/lib/executor/executorManager.js.map +1 -1
  24. package/lib/executor/index.js +4 -20
  25. package/lib/executor/index.js.map +1 -1
  26. package/lib/executor/senderManager.js +8 -12
  27. package/lib/executor/senderManager.js.map +1 -1
  28. package/lib/executor/test/utils.js +22 -28
  29. package/lib/executor/test/utils.js.map +1 -1
  30. package/lib/executor/utils.js +32 -64
  31. package/lib/executor/utils.js.map +1 -1
  32. package/lib/index.d.ts +5 -1
  33. package/lib/index.js +91 -3
  34. package/lib/index.js.map +1 -1
  35. package/lib/mempool/index.js +4 -20
  36. package/lib/mempool/index.js.map +1 -1
  37. package/lib/mempool/mempool.js +55 -59
  38. package/lib/mempool/mempool.js.map +1 -1
  39. package/lib/mempool/monitoring.js +1 -5
  40. package/lib/mempool/monitoring.js.map +1 -1
  41. package/lib/mempool/nullMempool.js +1 -5
  42. package/lib/mempool/nullMempool.js.map +1 -1
  43. package/lib/mempool/reputationManager.js +44 -49
  44. package/lib/mempool/reputationManager.js.map +1 -1
  45. package/lib/mempool/store.js +1 -5
  46. package/lib/mempool/store.js.map +1 -1
  47. package/lib/rpc/EntryPointSimulationsV07.js +44 -50
  48. package/lib/rpc/EntryPointSimulationsV07.js.map +1 -1
  49. package/lib/rpc/ExecuteSimulator.js +2 -5
  50. package/lib/rpc/ExecuteSimulator.js.map +1 -1
  51. package/lib/rpc/gasEstimation.js +62 -69
  52. package/lib/rpc/gasEstimation.js.map +1 -1
  53. package/lib/rpc/index.js +4 -20
  54. package/lib/rpc/index.js.map +1 -1
  55. package/lib/rpc/nonceQueuer.js +16 -20
  56. package/lib/rpc/nonceQueuer.js.map +1 -1
  57. package/lib/rpc/rpcHandler.js +76 -103
  58. package/lib/rpc/rpcHandler.js.map +1 -1
  59. package/lib/rpc/server.js +27 -58
  60. package/lib/rpc/server.js.map +1 -1
  61. package/lib/rpc/validation/BundlerCollectorTracerV06.js +1 -5
  62. package/lib/rpc/validation/BundlerCollectorTracerV06.js.map +1 -1
  63. package/lib/rpc/validation/BundlerCollectorTracerV07.js +1 -5
  64. package/lib/rpc/validation/BundlerCollectorTracerV07.js.map +1 -1
  65. package/lib/rpc/validation/SafeValidator.js +65 -69
  66. package/lib/rpc/validation/SafeValidator.js.map +1 -1
  67. package/lib/rpc/validation/TracerResultParserV06.js +26 -30
  68. package/lib/rpc/validation/TracerResultParserV06.js.map +1 -1
  69. package/lib/rpc/validation/TracerResultParserV07.js +29 -36
  70. package/lib/rpc/validation/TracerResultParserV07.js.map +1 -1
  71. package/lib/rpc/validation/UnsafeValidator.js +46 -73
  72. package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
  73. package/lib/rpc/validation/index.js +2 -18
  74. package/lib/rpc/validation/index.js.map +1 -1
  75. package/lib/rpc/validation/tracer.js +7 -37
  76. package/lib/rpc/validation/tracer.js.map +1 -1
  77. package/lib/types/contracts/BundleBulker.js +1 -4
  78. package/lib/types/contracts/BundleBulker.js.map +1 -1
  79. package/lib/types/contracts/CallEngine.js +1 -4
  80. package/lib/types/contracts/CallEngine.js.map +1 -1
  81. package/lib/types/contracts/CodeHashGetter.js +2 -5
  82. package/lib/types/contracts/CodeHashGetter.js.map +1 -1
  83. package/lib/types/contracts/EntryPoint.js +4 -7
  84. package/lib/types/contracts/EntryPoint.js.map +1 -1
  85. package/lib/types/contracts/EntryPointSimulations.js +3 -6
  86. package/lib/types/contracts/EntryPointSimulations.js.map +1 -1
  87. package/lib/types/contracts/IOpInflator.js +1 -4
  88. package/lib/types/contracts/IOpInflator.js.map +1 -1
  89. package/lib/types/contracts/IPaymaster.js +1 -4
  90. package/lib/types/contracts/IPaymaster.js.map +1 -1
  91. package/lib/types/contracts/Inflator.js +1 -4
  92. package/lib/types/contracts/Inflator.js.map +1 -1
  93. package/lib/types/contracts/PerOpInflator.js +1 -4
  94. package/lib/types/contracts/PerOpInflator.js.map +1 -1
  95. package/lib/types/contracts/PimlicoEntryPointSimulations.js +2 -5
  96. package/lib/types/contracts/PimlicoEntryPointSimulations.js.map +1 -1
  97. package/lib/types/contracts/SenderCreator.js +2 -5
  98. package/lib/types/contracts/SenderCreator.js.map +1 -1
  99. package/lib/types/contracts/SimpleAccountFactory.js +2 -5
  100. package/lib/types/contracts/SimpleAccountFactory.js.map +1 -1
  101. package/lib/types/contracts/TestOpcodesAccount.js +2 -5
  102. package/lib/types/contracts/TestOpcodesAccount.js.map +1 -1
  103. package/lib/types/contracts/TestOpcodesAccountFactory.js +2 -5
  104. package/lib/types/contracts/TestOpcodesAccountFactory.js.map +1 -1
  105. package/lib/types/contracts/TestStorageAccount.js +2 -5
  106. package/lib/types/contracts/TestStorageAccount.js.map +1 -1
  107. package/lib/types/contracts/index.js +16 -32
  108. package/lib/types/contracts/index.js.map +1 -1
  109. package/lib/types/gasPrice.js +14 -17
  110. package/lib/types/gasPrice.js.map +1 -1
  111. package/lib/types/index.js +10 -26
  112. package/lib/types/index.js.map +1 -1
  113. package/lib/types/interfaces.js +1 -2
  114. package/lib/types/mempool.d.ts +1 -2
  115. package/lib/types/mempool.js +5 -10
  116. package/lib/types/mempool.js.map +1 -1
  117. package/lib/types/schemas.js +254 -284
  118. package/lib/types/schemas.js.map +1 -1
  119. package/lib/types/test/validationTestErrors.js +2 -5
  120. package/lib/types/test/validationTestErrors.js.map +1 -1
  121. package/lib/types/utils.js +5 -9
  122. package/lib/types/utils.js.map +1 -1
  123. package/lib/types/validation.js +139 -142
  124. package/lib/types/validation.js.map +1 -1
  125. package/lib/utils/bigInt.js +2 -7
  126. package/lib/utils/bigInt.js.map +1 -1
  127. package/lib/utils/compressionHandler.js +7 -11
  128. package/lib/utils/compressionHandler.js.map +1 -1
  129. package/lib/utils/gasPriceManager.js +30 -57
  130. package/lib/utils/gasPriceManager.js.map +1 -1
  131. package/lib/utils/helpers.js +5 -10
  132. package/lib/utils/helpers.js.map +1 -1
  133. package/lib/utils/index.js +9 -25
  134. package/lib/utils/index.js.map +1 -1
  135. package/lib/utils/logger.js +10 -19
  136. package/lib/utils/logger.js.map +1 -1
  137. package/lib/utils/metrics.js +20 -24
  138. package/lib/utils/metrics.js.map +1 -1
  139. package/lib/utils/rpc-reply.js +1 -3
  140. package/lib/utils/rpc-reply.js.map +1 -1
  141. package/lib/utils/test.js +36 -67
  142. package/lib/utils/test.js.map +1 -1
  143. package/lib/utils/userop.js +62 -107
  144. package/lib/utils/userop.js.map +1 -1
  145. package/lib/utils/validation.js +64 -99
  146. package/lib/utils/validation.js.map +1 -1
  147. package/package.json +68 -70
  148. package/esm/cli/alto.d.ts +0 -6
  149. package/esm/cli/alto.js +0 -92
  150. package/esm/cli/alto.js.map +0 -1
  151. package/esm/cli/config/bundler.d.ts +0 -391
  152. package/esm/cli/config/bundler.js +0 -132
  153. package/esm/cli/config/bundler.js.map +0 -1
  154. package/esm/cli/config/index.d.ts +0 -3
  155. package/esm/cli/config/index.js +0 -3
  156. package/esm/cli/config/index.js.map +0 -1
  157. package/esm/cli/config/options.d.ts +0 -11
  158. package/esm/cli/config/options.js +0 -336
  159. package/esm/cli/config/options.js.map +0 -1
  160. package/esm/cli/customTransport.d.ts +0 -14
  161. package/esm/cli/customTransport.js +0 -53
  162. package/esm/cli/customTransport.js.map +0 -1
  163. package/esm/cli/handler.d.ts +0 -3
  164. package/esm/cli/handler.js +0 -116
  165. package/esm/cli/handler.js.map +0 -1
  166. package/esm/cli/index.d.ts +0 -4
  167. package/esm/cli/index.js +0 -4
  168. package/esm/cli/index.js.map +0 -1
  169. package/esm/cli/instrumentation.d.ts +0 -2
  170. package/esm/cli/instrumentation.js +0 -39
  171. package/esm/cli/instrumentation.js.map +0 -1
  172. package/esm/cli/setupServer.d.ts +0 -17
  173. package/esm/cli/setupServer.js +0 -155
  174. package/esm/cli/setupServer.js.map +0 -1
  175. package/esm/cli/util.d.ts +0 -22
  176. package/esm/cli/util.js +0 -30
  177. package/esm/cli/util.js.map +0 -1
  178. package/esm/executor/executor.d.ts +0 -54
  179. package/esm/executor/executor.js +0 -643
  180. package/esm/executor/executor.js.map +0 -1
  181. package/esm/executor/executorManager.d.ts +0 -34
  182. package/esm/executor/executorManager.js +0 -402
  183. package/esm/executor/executorManager.js.map +0 -1
  184. package/esm/executor/index.d.ts +0 -5
  185. package/esm/executor/index.js +0 -5
  186. package/esm/executor/index.js.map +0 -1
  187. package/esm/executor/senderManager.d.ts +0 -17
  188. package/esm/executor/senderManager.js +0 -160
  189. package/esm/executor/senderManager.js.map +0 -1
  190. package/esm/executor/test/utils.d.ts +0 -13
  191. package/esm/executor/test/utils.js +0 -75
  192. package/esm/executor/test/utils.js.map +0 -1
  193. package/esm/executor/utils.d.ts +0 -32
  194. package/esm/executor/utils.js +0 -241
  195. package/esm/executor/utils.js.map +0 -1
  196. package/esm/index.d.ts +0 -2
  197. package/esm/index.js +0 -2
  198. package/esm/index.js.map +0 -1
  199. package/esm/mempool/index.d.ts +0 -5
  200. package/esm/mempool/index.js +0 -5
  201. package/esm/mempool/index.js.map +0 -1
  202. package/esm/mempool/mempool.d.ts +0 -64
  203. package/esm/mempool/mempool.js +0 -489
  204. package/esm/mempool/mempool.js.map +0 -1
  205. package/esm/mempool/monitoring.d.ts +0 -10
  206. package/esm/mempool/monitoring.js +0 -34
  207. package/esm/mempool/monitoring.js.map +0 -1
  208. package/esm/mempool/nullMempool.d.ts +0 -15
  209. package/esm/mempool/nullMempool.js +0 -36
  210. package/esm/mempool/nullMempool.js.map +0 -1
  211. package/esm/mempool/reputationManager.d.ts +0 -115
  212. package/esm/mempool/reputationManager.js +0 -397
  213. package/esm/mempool/reputationManager.js.map +0 -1
  214. package/esm/mempool/store.d.ts +0 -22
  215. package/esm/mempool/store.js +0 -123
  216. package/esm/mempool/store.js.map +0 -1
  217. package/esm/rpc/EntryPointSimulationsV07.d.ts +0 -58
  218. package/esm/rpc/EntryPointSimulationsV07.js +0 -407
  219. package/esm/rpc/EntryPointSimulationsV07.js.map +0 -1
  220. package/esm/rpc/ExecuteSimulator.d.ts +0 -37
  221. package/esm/rpc/ExecuteSimulator.js +0 -48
  222. package/esm/rpc/ExecuteSimulator.js.map +0 -1
  223. package/esm/rpc/gasEstimation.d.ts +0 -17
  224. package/esm/rpc/gasEstimation.js +0 -410
  225. package/esm/rpc/gasEstimation.js.map +0 -1
  226. package/esm/rpc/index.d.ts +0 -5
  227. package/esm/rpc/index.js +0 -5
  228. package/esm/rpc/index.js.map +0 -1
  229. package/esm/rpc/nonceQueuer.d.ts +0 -25
  230. package/esm/rpc/nonceQueuer.js +0 -135
  231. package/esm/rpc/nonceQueuer.js.map +0 -1
  232. package/esm/rpc/rpcHandler.d.ts +0 -64
  233. package/esm/rpc/rpcHandler.js +0 -727
  234. package/esm/rpc/rpcHandler.js.map +0 -1
  235. package/esm/rpc/server.d.ts +0 -31
  236. package/esm/rpc/server.js +0 -239
  237. package/esm/rpc/server.js.map +0 -1
  238. package/esm/rpc/validation/BundlerCollectorTracerV06.d.ts +0 -102
  239. package/esm/rpc/validation/BundlerCollectorTracerV06.js +0 -255
  240. package/esm/rpc/validation/BundlerCollectorTracerV06.js.map +0 -1
  241. package/esm/rpc/validation/BundlerCollectorTracerV07.d.ts +0 -102
  242. package/esm/rpc/validation/BundlerCollectorTracerV07.js +0 -254
  243. package/esm/rpc/validation/BundlerCollectorTracerV07.js.map +0 -1
  244. package/esm/rpc/validation/SafeValidator.d.ts +0 -35
  245. package/esm/rpc/validation/SafeValidator.js +0 -487
  246. package/esm/rpc/validation/SafeValidator.js.map +0 -1
  247. package/esm/rpc/validation/TracerResultParserV06.d.ts +0 -13
  248. package/esm/rpc/validation/TracerResultParserV06.js +0 -578
  249. package/esm/rpc/validation/TracerResultParserV06.js.map +0 -1
  250. package/esm/rpc/validation/TracerResultParserV07.d.ts +0 -33
  251. package/esm/rpc/validation/TracerResultParserV07.js +0 -557
  252. package/esm/rpc/validation/TracerResultParserV07.js.map +0 -1
  253. package/esm/rpc/validation/UnsafeValidator.d.ts +0 -63
  254. package/esm/rpc/validation/UnsafeValidator.js +0 -257
  255. package/esm/rpc/validation/UnsafeValidator.js.map +0 -1
  256. package/esm/rpc/validation/index.d.ts +0 -3
  257. package/esm/rpc/validation/index.js +0 -3
  258. package/esm/rpc/validation/index.js.map +0 -1
  259. package/esm/rpc/validation/tracer.d.ts +0 -122
  260. package/esm/rpc/validation/tracer.js +0 -82
  261. package/esm/rpc/validation/tracer.js.map +0 -1
  262. package/esm/types/contracts/BundleBulker.d.ts +0 -120
  263. package/esm/types/contracts/BundleBulker.js +0 -157
  264. package/esm/types/contracts/BundleBulker.js.map +0 -1
  265. package/esm/types/contracts/CallEngine.d.ts +0 -28
  266. package/esm/types/contracts/CallEngine.js +0 -37
  267. package/esm/types/contracts/CallEngine.js.map +0 -1
  268. package/esm/types/contracts/CodeHashGetter.d.ts +0 -37
  269. package/esm/types/contracts/CodeHashGetter.js +0 -45
  270. package/esm/types/contracts/CodeHashGetter.js.map +0 -1
  271. package/esm/types/contracts/EntryPoint.d.ts +0 -1789
  272. package/esm/types/contracts/EntryPoint.js +0 -2304
  273. package/esm/types/contracts/EntryPoint.js.map +0 -1
  274. package/esm/types/contracts/EntryPointSimulations.d.ts +0 -153
  275. package/esm/types/contracts/EntryPointSimulations.js +0 -15
  276. package/esm/types/contracts/EntryPointSimulations.js.map +0 -1
  277. package/esm/types/contracts/IOpInflator.d.ts +0 -61
  278. package/esm/types/contracts/IOpInflator.js +0 -80
  279. package/esm/types/contracts/IOpInflator.js.map +0 -1
  280. package/esm/types/contracts/IPaymaster.d.ts +0 -3
  281. package/esm/types/contracts/IPaymaster.js +0 -117
  282. package/esm/types/contracts/IPaymaster.js.map +0 -1
  283. package/esm/types/contracts/Inflator.d.ts +0 -65
  284. package/esm/types/contracts/Inflator.js +0 -84
  285. package/esm/types/contracts/Inflator.js.map +0 -1
  286. package/esm/types/contracts/PerOpInflator.d.ts +0 -176
  287. package/esm/types/contracts/PerOpInflator.js +0 -229
  288. package/esm/types/contracts/PerOpInflator.js.map +0 -1
  289. package/esm/types/contracts/PimlicoEntryPointSimulations.d.ts +0 -23
  290. package/esm/types/contracts/PimlicoEntryPointSimulations.js +0 -33
  291. package/esm/types/contracts/PimlicoEntryPointSimulations.js.map +0 -1
  292. package/esm/types/contracts/SenderCreator.d.ts +0 -4
  293. package/esm/types/contracts/SenderCreator.js +0 -23
  294. package/esm/types/contracts/SenderCreator.js.map +0 -1
  295. package/esm/types/contracts/SimpleAccountFactory.d.ts +0 -57
  296. package/esm/types/contracts/SimpleAccountFactory.js +0 -76
  297. package/esm/types/contracts/SimpleAccountFactory.js.map +0 -1
  298. package/esm/types/contracts/TestOpcodesAccount.d.ts +0 -4
  299. package/esm/types/contracts/TestOpcodesAccount.js +0 -281
  300. package/esm/types/contracts/TestOpcodesAccount.js.map +0 -1
  301. package/esm/types/contracts/TestOpcodesAccountFactory.d.ts +0 -4
  302. package/esm/types/contracts/TestOpcodesAccountFactory.js +0 -23
  303. package/esm/types/contracts/TestOpcodesAccountFactory.js.map +0 -1
  304. package/esm/types/contracts/TestStorageAccount.d.ts +0 -4
  305. package/esm/types/contracts/TestStorageAccount.js +0 -313
  306. package/esm/types/contracts/TestStorageAccount.js.map +0 -1
  307. package/esm/types/contracts/index.d.ts +0 -17
  308. package/esm/types/contracts/index.js +0 -17
  309. package/esm/types/contracts/index.js.map +0 -1
  310. package/esm/types/gasPrice.d.ts +0 -110
  311. package/esm/types/gasPrice.js +0 -52
  312. package/esm/types/gasPrice.js.map +0 -1
  313. package/esm/types/index.d.ts +0 -11
  314. package/esm/types/index.js +0 -11
  315. package/esm/types/index.js.map +0 -1
  316. package/esm/types/interfaces.d.ts +0 -26
  317. package/esm/types/interfaces.js +0 -2
  318. package/esm/types/interfaces.js.map +0 -1
  319. package/esm/types/mempool.d.ts +0 -79
  320. package/esm/types/mempool.js +0 -16
  321. package/esm/types/mempool.js.map +0 -1
  322. package/esm/types/schemas.d.ts +0 -4791
  323. package/esm/types/schemas.js +0 -497
  324. package/esm/types/schemas.js.map +0 -1
  325. package/esm/types/test/validationTestErrors.d.ts +0 -3
  326. package/esm/types/test/validationTestErrors.js +0 -229
  327. package/esm/types/test/validationTestErrors.js.map +0 -1
  328. package/esm/types/utils.d.ts +0 -24
  329. package/esm/types/utils.js +0 -30
  330. package/esm/types/utils.js.map +0 -1
  331. package/esm/types/validation.d.ts +0 -14327
  332. package/esm/types/validation.js +0 -304
  333. package/esm/types/validation.js.map +0 -1
  334. package/esm/utils/bigInt.d.ts +0 -3
  335. package/esm/utils/bigInt.js +0 -9
  336. package/esm/utils/bigInt.js.map +0 -1
  337. package/esm/utils/compressionHandler.d.ts +0 -11
  338. package/esm/utils/compressionHandler.js +0 -39
  339. package/esm/utils/compressionHandler.js.map +0 -1
  340. package/esm/utils/gasPriceManager.d.ts +0 -34
  341. package/esm/utils/gasPriceManager.js +0 -338
  342. package/esm/utils/gasPriceManager.js.map +0 -1
  343. package/esm/utils/helpers.d.ts +0 -4
  344. package/esm/utils/helpers.js +0 -13
  345. package/esm/utils/helpers.js.map +0 -1
  346. package/esm/utils/index.d.ts +0 -11
  347. package/esm/utils/index.js +0 -10
  348. package/esm/utils/index.js.map +0 -1
  349. package/esm/utils/logger.d.ts +0 -6
  350. package/esm/utils/logger.js +0 -76
  351. package/esm/utils/logger.js.map +0 -1
  352. package/esm/utils/metrics.d.ts +0 -22
  353. package/esm/utils/metrics.js +0 -150
  354. package/esm/utils/metrics.js.map +0 -1
  355. package/esm/utils/rpc-reply.d.ts +0 -17
  356. package/esm/utils/rpc-reply.js +0 -41
  357. package/esm/utils/rpc-reply.js.map +0 -1
  358. package/esm/utils/test.d.ts +0 -17
  359. package/esm/utils/test.js +0 -130
  360. package/esm/utils/test.js.map +0 -1
  361. package/esm/utils/userop.d.ts +0 -49
  362. package/esm/utils/userop.js +0 -408
  363. package/esm/utils/userop.js.map +0 -1
  364. package/esm/utils/validation.d.ts +0 -65
  365. package/esm/utils/validation.js +0 -461
  366. package/esm/utils/validation.js.map +0 -1
  367. package/lib/cli/alto.d.ts +0 -6
  368. package/lib/cli/alto.js +0 -123
  369. package/lib/cli/alto.js.map +0 -1
@@ -1,160 +0,0 @@
1
- import { CallEngineAbi } from "../types/index.js";
2
- import { Semaphore } from "async-mutex";
3
- import { formatEther, getContract } from "viem";
4
- const waitForTransactionReceipt = async (publicClient, tx) => {
5
- try {
6
- return await publicClient.waitForTransactionReceipt({ hash: tx });
7
- }
8
- catch {
9
- return await waitForTransactionReceipt(publicClient, tx);
10
- }
11
- };
12
- export class SenderManager {
13
- wallets;
14
- utilityAccount;
15
- availableWallets;
16
- logger;
17
- metrics;
18
- legacyTransactions;
19
- semaphore;
20
- gasPriceManager;
21
- constructor(wallets, utilityAccount, logger, metrics, legacyTransactions, gasPriceManager, maxSigners) {
22
- if (maxSigners !== undefined && wallets.length > maxSigners) {
23
- this.wallets = wallets.slice(0, maxSigners);
24
- this.availableWallets = wallets.slice(0, maxSigners);
25
- }
26
- else {
27
- this.wallets = wallets;
28
- this.availableWallets = wallets;
29
- }
30
- this.utilityAccount = utilityAccount;
31
- this.logger = logger;
32
- this.metrics = metrics;
33
- this.legacyTransactions = legacyTransactions;
34
- metrics.walletsAvailable.set(this.availableWallets.length);
35
- metrics.walletsTotal.set(this.wallets.length);
36
- this.semaphore = new Semaphore(this.availableWallets.length);
37
- this.gasPriceManager = gasPriceManager;
38
- }
39
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
40
- async validateAndRefillWallets(publicClient, walletClient, minBalance) {
41
- if (!(minBalance && this.utilityAccount)) {
42
- return;
43
- }
44
- const utilityWalletBalance = await publicClient.getBalance({
45
- address: this.utilityAccount.address
46
- });
47
- const balancesMissing = {};
48
- const balanceRequestPromises = this.availableWallets.map(async (wallet) => {
49
- const balance = await publicClient.getBalance({
50
- address: wallet.address
51
- });
52
- if (balance < minBalance) {
53
- const missingBalance = (minBalance * 6n) / 5n - balance;
54
- balancesMissing[wallet.address] = missingBalance;
55
- }
56
- });
57
- await Promise.all(balanceRequestPromises);
58
- const totalBalanceMissing = Object.values(balancesMissing).reduce((a, b) => a + b, 0n);
59
- if (utilityWalletBalance < (totalBalanceMissing * 11n) / 10n) {
60
- this.logger.info({ balancesMissing, totalBalanceMissing }, "balances missing");
61
- this.logger.error({
62
- minBalance,
63
- utilityWalletBalance,
64
- totalBalanceMissing,
65
- utilityAccount: this.utilityAccount.address
66
- }, "utility wallet has insufficient balance to refill wallets");
67
- throw new Error(`utility wallet ${this.utilityAccount.address} has insufficient balance ${formatEther(utilityWalletBalance)} < ${formatEther(totalBalanceMissing)}`);
68
- }
69
- if (Object.keys(balancesMissing).length > 0) {
70
- const { maxFeePerGas, maxPriorityFeePerGas } = await this.gasPriceManager.getGasPrice();
71
- if (walletClient.chain.id === 59140 ||
72
- walletClient.chain.id === 137 ||
73
- walletClient.chain.id === 10) {
74
- const instructions = [];
75
- for (const [address, missingBalance] of Object.entries(balancesMissing)) {
76
- instructions.push({
77
- to: address,
78
- value: missingBalance,
79
- data: "0x"
80
- });
81
- }
82
- let refillAddress;
83
- if (walletClient.chain.id === 59140) {
84
- refillAddress = "0xEad1aC3DF6F96b91491d6396F4d1610C5638B4Db";
85
- }
86
- else if (walletClient.chain.id === 137) {
87
- refillAddress = "0x3402DB43152dAB9ab72fa805fdD5f391cD3E3822";
88
- }
89
- else {
90
- refillAddress = "0x3402DB43152dAB9ab72fa805fdD5f391cD3E3822";
91
- }
92
- const callEngine = getContract({
93
- abi: CallEngineAbi,
94
- address: refillAddress,
95
- client: {
96
- public: publicClient,
97
- wallet: walletClient
98
- }
99
- });
100
- const tx = await callEngine.write.execute([instructions], {
101
- account: this.utilityAccount,
102
- value: totalBalanceMissing,
103
- maxFeePerGas: maxFeePerGas * 2n,
104
- maxPriorityFeePerGas: maxPriorityFeePerGas * 2n
105
- });
106
- await waitForTransactionReceipt(publicClient, tx);
107
- for (const [address, missingBalance] of Object.entries(balancesMissing)) {
108
- this.logger.info({ tx, executor: address, missingBalance }, "refilled wallet");
109
- }
110
- }
111
- else {
112
- for (const [address, missingBalance] of Object.entries(balancesMissing)) {
113
- const tx = await walletClient.sendTransaction({
114
- account: this.utilityAccount,
115
- // @ts-ignore
116
- to: address,
117
- value: missingBalance,
118
- maxFeePerGas: this.legacyTransactions
119
- ? undefined
120
- : maxFeePerGas,
121
- maxPriorityFeePerGas: this.legacyTransactions
122
- ? undefined
123
- : maxPriorityFeePerGas,
124
- gasPrice: this.legacyTransactions
125
- ? maxFeePerGas
126
- : undefined
127
- });
128
- await waitForTransactionReceipt(publicClient, tx);
129
- this.logger.info({ tx, executor: address, missingBalance }, "refilled wallet");
130
- }
131
- }
132
- }
133
- else {
134
- this.logger.info("no wallets need to be refilled");
135
- }
136
- }
137
- async getWallet() {
138
- this.logger.trace(`waiting for semaphore with count ${this.semaphore.getValue()}`);
139
- await this.semaphore.waitForUnlock();
140
- await this.semaphore.acquire();
141
- const wallet = this.availableWallets.shift();
142
- // should never happen because of semaphore
143
- if (!wallet) {
144
- this.semaphore.release();
145
- this.logger.error("no more wallets");
146
- throw new Error("no more wallets");
147
- }
148
- this.logger.trace({ executor: wallet.address }, "got wallet from sender manager");
149
- this.metrics.walletsAvailable.set(this.availableWallets.length);
150
- return wallet;
151
- }
152
- pushWallet(wallet) {
153
- this.availableWallets.push(wallet);
154
- this.semaphore.release();
155
- this.logger.trace({ executor: wallet.address }, "pushed wallet to sender manager");
156
- this.metrics.walletsAvailable.set(this.availableWallets.length);
157
- return;
158
- }
159
- }
160
- //# sourceMappingURL=senderManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"senderManager.js","sourceRoot":"","sources":["../../executor/senderManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EAIhB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EACH,WAAW,EACX,WAAW,EAOd,MAAM,MAAM,CAAA;AAEb,MAAM,yBAAyB,GAAG,KAAK,EACnC,YAA0B,EAC1B,EAAa,EACc,EAAE;IAC7B,IAAI,CAAC;QACD,OAAO,MAAM,YAAY,CAAC,yBAAyB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;IACrE,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,MAAM,yBAAyB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;IAC5D,CAAC;AACL,CAAC,CAAA;AAED,MAAM,OAAO,aAAa;IACtB,OAAO,CAAW;IAClB,cAAc,CAAqB;IACnC,gBAAgB,CAAW;IACnB,MAAM,CAAQ;IACd,OAAO,CAAS;IAChB,kBAAkB,CAAS;IAC3B,SAAS,CAAW;IACpB,eAAe,CAAiB;IAExC,YACI,OAAkB,EAClB,cAAmC,EACnC,MAAc,EACd,OAAgB,EAChB,kBAA2B,EAC3B,eAAgC,EAChC,UAAmB;QAEnB,IAAI,UAAU,KAAK,SAAS,IAAI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SAAS;QACX,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,oCAAoC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAClE,CAAA;QACD,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAA;QACpC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAA;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAA;QAE5C,2CAA2C;QAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAA;YACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;YACpC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACtC,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,EAC5B,gCAAgC,CACnC,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;QAE/D,OAAO,MAAM,CAAA;IACjB,CAAC;IAED,UAAU,CAAC,MAAe;QACtB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAClC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAA;QACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,EAC5B,iCAAiC,CACpC,CAAA;QACD,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;QAC/D,OAAM;IACV,CAAC;CACJ"}
@@ -1,13 +0,0 @@
1
- import { type Address, type HexData, UserOperationV06 } from "../../types/index.js";
2
- import { type Clients } from "../../utils/index.js";
3
- import { type Account } from "viem";
4
- export declare const TEST_OP: UserOperationV06;
5
- export declare function getSender(entryPoint: Address, initCode: HexData, clients: Clients): Promise<Address>;
6
- export declare function createOp(entryPoint: Address, simpleAccountFactory: Address, signer: Account, clients: Clients, maxFeePerGas?: bigint, nonce?: bigint): Promise<UserOperationV06>;
7
- export declare const generateAccounts: (clients: Clients) => Promise<(import("viem").CustomSource & {
8
- address: `0x${string}`;
9
- publicKey: `0x${string}`;
10
- source: "privateKey";
11
- type: "local";
12
- })[]>;
13
- //# sourceMappingURL=utils.d.ts.map
@@ -1,75 +0,0 @@
1
- import { EntryPointV06Abi } from "../../types/index.js";
2
- import { SimpleAccountFactoryAbi } from "../../types/index.js";
3
- import { getUserOpHash, parseSenderAddressError } from "../../utils/index.js";
4
- import { concat, encodeFunctionData, getContract, parseEther } from "viem";
5
- import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
6
- import { foundry } from "viem/chains";
7
- export const TEST_OP = {
8
- sender: "0x0000000000000000000000000000000000000000",
9
- nonce: 0n,
10
- initCode: "0x",
11
- callData: "0x",
12
- callGasLimit: 100000n,
13
- verificationGasLimit: 1000000n,
14
- preVerificationGas: 60000n,
15
- maxFeePerGas: 1n,
16
- maxPriorityFeePerGas: 1n,
17
- paymasterAndData: "0x",
18
- signature: "0x"
19
- };
20
- export async function getSender(entryPoint, initCode, clients) {
21
- const entryPointContract = getContract({
22
- address: entryPoint,
23
- abi: EntryPointV06Abi,
24
- client: {
25
- public: clients.public
26
- }
27
- });
28
- const sender = await entryPointContract.simulate
29
- .getSenderAddress([initCode])
30
- .then((_) => {
31
- throw new Error("Expected error");
32
- })
33
- .catch((e) => {
34
- return parseSenderAddressError(e);
35
- });
36
- await clients.test.setBalance({ address: sender, value: parseEther("1") });
37
- return sender;
38
- }
39
- export async function createOp(entryPoint, simpleAccountFactory, signer, clients, maxFeePerGas, nonce) {
40
- const initCode = concat([
41
- simpleAccountFactory,
42
- encodeFunctionData({
43
- abi: SimpleAccountFactoryAbi,
44
- functionName: "createAccount",
45
- args: [signer.address, 0n]
46
- })
47
- ]);
48
- const sender = await getSender(entryPoint, initCode, clients);
49
- const op = Object.assign({}, TEST_OP);
50
- op.sender = sender;
51
- op.initCode = initCode;
52
- op.nonce = nonce ?? 0n;
53
- op.maxFeePerGas = maxFeePerGas ?? (await clients.public.getGasPrice());
54
- const opHash = getUserOpHash(op, entryPoint, foundry.id);
55
- const signature = await clients.wallet.signMessage({
56
- account: signer,
57
- message: { raw: opHash }
58
- });
59
- op.signature = signature;
60
- return op;
61
- }
62
- export const generateAccounts = async (clients) => {
63
- const accountsPromises = [...Array(10)].map(async (_) => {
64
- const privateKey = generatePrivateKey();
65
- const account = privateKeyToAccount(privateKey);
66
- await clients.test.setBalance({
67
- address: account.address,
68
- value: parseEther("100")
69
- });
70
- return account;
71
- });
72
- const accounts = await Promise.all(accountsPromises);
73
- return accounts;
74
- };
75
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../executor/test/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,gBAAgB,EAGnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAEH,aAAa,EACb,uBAAuB,EAC1B,MAAM,aAAa,CAAA;AACpB,OAAO,EAEH,MAAM,EACN,kBAAkB,EAClB,WAAW,EACX,UAAU,EACb,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,MAAM,CAAC,MAAM,OAAO,GAAqB;IACrC,MAAM,EAAE,4CAA4C;IACpD,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,OAAQ;IACtB,oBAAoB,EAAE,QAAU;IAChC,kBAAkB,EAAE,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AC,CAAA;IACpD,OAAO,QAAQ,CAAA;AACnB,CAAC,CAAA"}
@@ -1,32 +0,0 @@
1
- import type { InterfaceReputationManager } from "../mempool/index.js";
2
- import { type BundleResult, type CompressedUserOperation, EntryPointV06Abi, EntryPointV07Abi, type TransactionInfo, type UserOperationWithHash } from "../types/index.js";
3
- import type { Logger } from "../utils/index.js";
4
- import { type Account, type Address, type Chain, type GetContractReturnType, type Hex, type PublicClient, type Transport, type WalletClient } from "viem";
5
- export declare function simulatedOpsToResults(simulatedOps: {
6
- owh: UserOperationWithHash;
7
- reason: string | undefined;
8
- }[], transactionInfo: TransactionInfo): BundleResult[];
9
- export type DefaultFilterOpsAndEstimateGasParams = {
10
- ep: GetContractReturnType<typeof EntryPointV06Abi | typeof EntryPointV07Abi, {
11
- public: PublicClient;
12
- wallet: WalletClient;
13
- }>;
14
- type: "default";
15
- };
16
- export type CompressedFilterOpsAndEstimateGasParams = {
17
- publicClient: PublicClient;
18
- bundleBulker: Address;
19
- perOpInflatorId: number;
20
- type: "compressed";
21
- };
22
- export declare function createCompressedCalldata(compressedOps: CompressedUserOperation[], perOpInflatorId: number): Hex;
23
- export declare function filterOpsAndEstimateGas(entryPoint: Address, callContext: DefaultFilterOpsAndEstimateGasParams | CompressedFilterOpsAndEstimateGasParams, wallet: Account, ops: UserOperationWithHash[], nonce: number, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint, blockTag: "latest" | "pending", onlyPre1559: boolean, fixedGasLimitForEstimation: bigint | undefined, reputationManager: InterfaceReputationManager, logger: Logger): Promise<{
24
- simulatedOps: {
25
- owh: UserOperationWithHash;
26
- reason: string | undefined;
27
- }[];
28
- gasLimit: bigint;
29
- resubmitAllOps: boolean;
30
- }>;
31
- export declare function flushStuckTransaction(publicClient: PublicClient, walletClient: WalletClient<Transport, Chain, Account | undefined>, wallet: Account, gasPrice: bigint, logger: Logger, entryPoint: Address): Promise<void>;
32
- //# sourceMappingURL=utils.d.ts.map
@@ -1,241 +0,0 @@
1
- import { EntryPointV06Abi, EntryPointV07Abi, deriveUserOperation, failedOpErrorSchema, failedOpWithRevertErrorSchema } from "../types/index.js";
2
- import { getRevertErrorData, isVersion06, parseViemError, toPackedUserOperation, transactionIncluded } from "../utils/index.js";
3
- import * as sentry from "@sentry/node";
4
- import { ContractFunctionRevertedError, EstimateGasExecutionError, FeeCapTooLowError, concat, decodeErrorResult, hexToBytes, numberToHex } from "viem";
5
- export function simulatedOpsToResults(simulatedOps, transactionInfo) {
6
- return simulatedOps.map((sop) => {
7
- if (sop.reason === undefined) {
8
- return {
9
- status: "success",
10
- value: {
11
- userOperation: {
12
- entryPoint: transactionInfo.entryPoint,
13
- mempoolUserOperation: sop.owh.mempoolUserOperation,
14
- userOperationHash: sop.owh.userOperationHash,
15
- lastReplaced: Date.now(),
16
- firstSubmitted: Date.now()
17
- },
18
- transactionInfo
19
- }
20
- };
21
- }
22
- return {
23
- status: "failure",
24
- error: {
25
- entryPoint: transactionInfo.entryPoint,
26
- userOperation: sop.owh.mempoolUserOperation,
27
- userOpHash: sop.owh.userOperationHash,
28
- reason: sop.reason
29
- }
30
- };
31
- });
32
- }
33
- export function createCompressedCalldata(compressedOps, perOpInflatorId) {
34
- const bundleBulkerPayload = numberToHex(perOpInflatorId, { size: 4 }); // bytes used in BundleBulker
35
- const perOpInflatorPayload = numberToHex(compressedOps.length, { size: 1 }); // bytes used in perOpInflator
36
- return compressedOps.reduce((currentCallData, op) => {
37
- const nextCallData = concat([
38
- numberToHex(op.inflatorId, { size: 4 }),
39
- numberToHex(hexToBytes(op.compressedCalldata).length, {
40
- size: 2
41
- }),
42
- op.compressedCalldata
43
- ]);
44
- return concat([currentCallData, nextCallData]);
45
- }, concat([bundleBulkerPayload, perOpInflatorPayload]));
46
- }
47
- export async function filterOpsAndEstimateGas(entryPoint, callContext, wallet, ops, nonce, maxFeePerGas, maxPriorityFeePerGas, blockTag, onlyPre1559, fixedGasLimitForEstimation, reputationManager, logger) {
48
- const simulatedOps = ops.map((owh) => {
49
- return { owh, reason: undefined };
50
- });
51
- let gasLimit;
52
- // TODO compressed ops are not supported in V07
53
- const isUserOpV06 = callContext.type === "default"
54
- ? isVersion06(simulatedOps[0].owh.mempoolUserOperation)
55
- : true;
56
- while (simulatedOps.filter((op) => op.reason === undefined).length > 0) {
57
- try {
58
- const gasOptions = onlyPre1559
59
- ? { gasPrice: maxFeePerGas }
60
- : { maxFeePerGas, maxPriorityFeePerGas };
61
- if (callContext.type === "default") {
62
- const ep = callContext.ep;
63
- const opsToSend = simulatedOps
64
- .filter((op) => op.reason === undefined)
65
- .map((op) => {
66
- return isUserOpV06
67
- ? op.owh.mempoolUserOperation
68
- : toPackedUserOperation(op.owh
69
- .mempoolUserOperation);
70
- });
71
- gasLimit = await ep.estimateGas.handleOps(
72
- // @ts-ignore - ep is set correctly for opsToSend, but typescript doesn't know that
73
- [opsToSend, wallet.address], {
74
- account: wallet,
75
- nonce: nonce,
76
- blockTag,
77
- ...(fixedGasLimitForEstimation !== undefined && {
78
- gas: fixedGasLimitForEstimation
79
- }),
80
- ...gasOptions
81
- });
82
- }
83
- else {
84
- const { publicClient, bundleBulker, perOpInflatorId } = callContext;
85
- const opsToSend = simulatedOps
86
- .filter((op) => op.reason === undefined)
87
- .map((op) => op.owh
88
- .mempoolUserOperation);
89
- gasLimit = await publicClient.estimateGas({
90
- to: bundleBulker,
91
- account: wallet,
92
- data: createCompressedCalldata(opsToSend, perOpInflatorId),
93
- gas: fixedGasLimitForEstimation,
94
- nonce: nonce,
95
- blockTag,
96
- ...gasOptions
97
- });
98
- }
99
- return { simulatedOps, gasLimit, resubmitAllOps: false };
100
- }
101
- catch (err) {
102
- logger.error({ err }, "error estimating gas");
103
- const e = parseViemError(err);
104
- if (e instanceof ContractFunctionRevertedError) {
105
- const failedOpError = failedOpErrorSchema.safeParse(e.data);
106
- const failedOpWithRevertError = failedOpWithRevertErrorSchema.safeParse(e.data);
107
- let errorData = undefined;
108
- if (failedOpError.success) {
109
- errorData = failedOpError.data.args;
110
- }
111
- if (failedOpWithRevertError.success) {
112
- errorData = failedOpWithRevertError.data.args;
113
- }
114
- if (errorData) {
115
- logger.debug({
116
- errorData,
117
- userOpHashes: simulatedOps
118
- .filter((op) => op.reason === undefined)
119
- .map((op) => op.owh.userOperationHash)
120
- }, "user op in batch invalid");
121
- const failingOp = simulatedOps.filter((op) => op.reason === undefined)[Number(errorData.opIndex)];
122
- failingOp.reason = `${errorData.reason}${errorData?.inner
123
- ? ` - ${errorData.inner}`
124
- : ""}`;
125
- reputationManager.crashedHandleOps(deriveUserOperation(failingOp.owh.mempoolUserOperation), entryPoint, failingOp.reason);
126
- }
127
- if (!(failedOpError.success || failedOpWithRevertError.success)) {
128
- sentry.captureException(err);
129
- logger.error({
130
- error: `${failedOpError.error} ${failedOpWithRevertError.error}`
131
- }, "failed to parse failedOpError");
132
- return {
133
- simulatedOps: [],
134
- gasLimit: 0n,
135
- resubmitAllOps: false
136
- };
137
- }
138
- }
139
- else if (e instanceof EstimateGasExecutionError ||
140
- err instanceof EstimateGasExecutionError) {
141
- if (e?.cause instanceof FeeCapTooLowError) {
142
- logger.info({ error: e.shortMessage }, "error estimating gas due to max fee < basefee");
143
- return {
144
- simulatedOps: simulatedOps,
145
- gasLimit: 0n,
146
- resubmitAllOps: true
147
- };
148
- }
149
- try {
150
- let errorHexData = "0x";
151
- if (err instanceof EstimateGasExecutionError) {
152
- errorHexData = getRevertErrorData(err);
153
- }
154
- else {
155
- errorHexData = e?.details.split("Reverted ")[1];
156
- }
157
- const errorResult = decodeErrorResult({
158
- abi: isUserOpV06 ? EntryPointV06Abi : EntryPointV07Abi,
159
- data: errorHexData
160
- });
161
- logger.debug({
162
- errorName: errorResult.errorName,
163
- args: errorResult.args,
164
- userOpHashes: simulatedOps
165
- .filter((op) => op.reason === undefined)
166
- .map((op) => op.owh.userOperationHash)
167
- }, "user op in batch invalid");
168
- if (errorResult.errorName !== "FailedOpWithRevert" &&
169
- errorResult.errorName !== "FailedOp") {
170
- logger.error({
171
- errorName: errorResult.errorName,
172
- args: errorResult.args
173
- }, "unexpected error result");
174
- return {
175
- simulatedOps: [],
176
- gasLimit: 0n,
177
- resubmitAllOps: false
178
- };
179
- }
180
- const failingOp = simulatedOps.filter((op) => op.reason === undefined)[Number(errorResult.args[0])];
181
- failingOp.reason = errorResult.args[1];
182
- }
183
- catch (e) {
184
- logger.error({ error: JSON.stringify(err) }, "failed to parse error result");
185
- return {
186
- simulatedOps: [],
187
- gasLimit: 0n,
188
- resubmitAllOps: false
189
- };
190
- }
191
- }
192
- else {
193
- sentry.captureException(err);
194
- logger.error({ error: JSON.stringify(err) }, "error estimating gas");
195
- return { simulatedOps: [], gasLimit: 0n, resubmitAllOps: false };
196
- }
197
- }
198
- }
199
- return { simulatedOps, gasLimit: 0n, resubmitAllOps: false };
200
- }
201
- export async function flushStuckTransaction(publicClient, walletClient, wallet, gasPrice, logger, entryPoint) {
202
- const latestNonce = await publicClient.getTransactionCount({
203
- address: wallet.address,
204
- blockTag: "latest"
205
- });
206
- const pendingNonce = await publicClient.getTransactionCount({
207
- address: wallet.address,
208
- blockTag: "pending"
209
- });
210
- logger.debug({ latestNonce, pendingNonce, wallet: wallet.address }, "checking for stuck transactions");
211
- // same nonce is okay
212
- if (latestNonce === pendingNonce) {
213
- return;
214
- }
215
- // one nonce ahead is also okay
216
- if (latestNonce + 1 === pendingNonce) {
217
- return;
218
- }
219
- logger.info({ latestNonce, pendingNonce, wallet: wallet.address }, "found stuck transaction, flushing");
220
- for (let nonceToFlush = latestNonce; nonceToFlush < pendingNonce; nonceToFlush++) {
221
- try {
222
- const txHash = await walletClient.sendTransaction({
223
- account: wallet,
224
- to: wallet.address,
225
- value: 0n,
226
- nonce: nonceToFlush,
227
- maxFeePerGas: gasPrice,
228
- maxPriorityFeePerGas: gasPrice
229
- });
230
- logger.debug({ txHash, nonce: nonceToFlush, wallet: wallet.address }, "flushed stuck transaction");
231
- // TODO: We don't know if the entrypoint is the V06 or V07. So we try and catch both.
232
- await transactionIncluded(true, txHash, publicClient, entryPoint);
233
- await transactionIncluded(false, txHash, publicClient, entryPoint);
234
- }
235
- catch (e) {
236
- sentry.captureException(e);
237
- logger.warn({ error: e }, "error flushing stuck transaction");
238
- }
239
- }
240
- }
241
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../executor/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,gBAAgB,EAChB,gBAAgB,EAOhB,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAChC,MAAM,aAAa,CAAA;AAEpB,OAAO,EACH,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAIH,6BAA6B,EAC7B,yBAAyB,EACzB,iBAAiB,EAMjB,MAAM,EACN,iBAAiB,EACjB,UAAU,EACV,WAAW,EACd,MAAM,MAAM,CAAA;AAEb,MAAM,UAAU,qBAAqB,CACjC,YAGG,EACH,eAAgC;IAEhC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAC5B,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO;gBACH,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE;oBACH,aAAa,EAAE;wBACX,UAAU,EAAE,eAAe,CAAC,UAAU;wBACtC,oBAAoB,EAAE,GAAG,CAAC,GAAG,CAAC,oBAAoB;wBAClD,iBAAiB,EAAE,GAAG,CAAC,GAAG,CAAC,iBAAiB;wBAC5C,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;wBACxB,cAAc,EAAE,IAAI,CAAC,GAAG,EAAE;qBAC7B;oBACD,eAAe;iBAClB;aACJ,CAAA;QACL,CAAC;QACD,OAAO;YACH,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE;gBACH,UAA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BACnB,YAAY,EAAE,QAAQ;gBACtB,oBAAoB,EAAE,QAAQ;aACjC,CAAC,CAAA;YAEF,MAAM,CAAC,KAAK,CACR,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,EACvD,2BAA2B,CAC9B,CAAA;YAED,qFAAqF;YACrF,MAAM,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;YACjE,MAAM,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;QACtE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;YAC1B,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,kCAAkC,CAAC,CAAA;QACjE,CAAC;IACL,CAAC;AACL,CAAC"}
package/esm/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import "./cli/alto.js";
2
- //# sourceMappingURL=index.d.ts.map
package/esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- import "./cli/alto.js";
2
- //# sourceMappingURL=index.js.map
package/esm/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAA"}
@@ -1,5 +0,0 @@
1
- export * from "./mempool.js";
2
- export * from "./monitoring.js";
3
- export * from "./reputationManager.js";
4
- export * from "./nullMempool.js";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1,5 +0,0 @@
1
- export * from "./mempool.js";
2
- export * from "./monitoring.js";
3
- export * from "./reputationManager.js";
4
- export * from "./nullMempool.js";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../mempool/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
@@ -1,64 +0,0 @@
1
- import type { Metrics } from "../utils/index.js";
2
- import { type InterfaceValidator, type MempoolUserOperation, type ReferencedCodeHashes, type StorageMap, type SubmittedUserOperation, type TransactionInfo, type UserOperation, type UserOperationInfo } from "../types/index.js";
3
- import type { HexData32 } from "../types/index.js";
4
- import type { Logger } from "../utils/index.js";
5
- import { type Address, type Chain, type PublicClient, type Transport } from "viem";
6
- import type { Monitor } from "./monitoring.js";
7
- import { type InterfaceReputationManager } from "./reputationManager.js";
8
- export declare class MemoryMempool {
9
- private monitor;
10
- private publicClient;
11
- private reputationManager;
12
- private store;
13
- private throttledEntityBundleCount;
14
- private logger;
15
- private validator;
16
- private safeMode;
17
- private parallelUserOpsMaxSize;
18
- private queuedUserOpsMaxSize;
19
- private onlyUniqueSendersPerBundle;
20
- constructor(monitor: Monitor, reputationManager: InterfaceReputationManager, validator: InterfaceValidator, publicClient: PublicClient<Transport, Chain>, safeMode: boolean, logger: Logger, metrics: Metrics, parallelUserOpsMaxSize: number, queuedUserOpsMaxSize: number, onlyUniqueSendersPerBundle: boolean, throttledEntityBundleCount?: number);
21
- replaceSubmitted(userOperation: UserOperationInfo, transactionInfo: TransactionInfo): void;
22
- markSubmitted(userOpHash: `0x${string}`, transactionInfo: TransactionInfo): void;
23
- dumpOutstanding(): UserOperationInfo[];
24
- dumpProcessing(): UserOperationInfo[];
25
- dumpSubmittedOps(): SubmittedUserOperation[];
26
- removeSubmitted(userOpHash: `0x${string}`): void;
27
- removeProcessing(userOpHash: `0x${string}`): void;
28
- checkEntityMultipleRoleViolation(op: UserOperation): Promise<void>;
29
- getKnownEntities(): {
30
- sender: Set<Address>;
31
- paymasters: Set<Address>;
32
- factories: Set<Address>;
33
- };
34
- add(mempoolUserOperation: MempoolUserOperation, entryPoint: Address, referencedContracts?: ReferencedCodeHashes): boolean;
35
- shouldSkip(opInfo: UserOperationInfo, paymasterDeposit: {
36
- [paymaster: string]: bigint;
37
- }, stakedEntityCount: {
38
- [addr: string]: number;
39
- }, knownEntities: {
40
- sender: Set<`0x${string}`>;
41
- paymasters: Set<`0x${string}`>;
42
- factories: Set<`0x${string}`>;
43
- }, senders: Set<string>, storageMap: StorageMap): Promise<{
44
- skip: boolean;
45
- paymasterDeposit: {
46
- [paymaster: string]: bigint;
47
- };
48
- stakedEntityCount: {
49
- [addr: string]: number;
50
- };
51
- knownEntities: {
52
- sender: Set<`0x${string}`>;
53
- paymasters: Set<`0x${string}`>;
54
- factories: Set<`0x${string}`>;
55
- };
56
- senders: Set<string>;
57
- storageMap: StorageMap;
58
- }>;
59
- process(maxGasLimit: bigint, minOps?: number): Promise<UserOperationInfo[]>;
60
- get(opHash: HexData32): UserOperation | null;
61
- getQueuedUserOperations(userOperation: UserOperation, entryPoint: Address, _currentNonceValue?: bigint): Promise<UserOperation[]>;
62
- clear(): void;
63
- }
64
- //# sourceMappingURL=mempool.d.ts.map