@pimlico/alto 0.0.0-main.20250307T203608 → 0.0.0-main.20250324T173034

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 (289) hide show
  1. package/esm/cli/alto.js +5 -3
  2. package/esm/cli/alto.js.map +1 -1
  3. package/esm/cli/config/bundler.d.ts +87 -36
  4. package/esm/cli/config/bundler.js +15 -3
  5. package/esm/cli/config/bundler.js.map +1 -1
  6. package/esm/cli/config/options.d.ts +2 -1
  7. package/esm/cli/config/options.js +59 -5
  8. package/esm/cli/config/options.js.map +1 -1
  9. package/esm/cli/handler.js +3 -4
  10. package/esm/cli/handler.js.map +1 -1
  11. package/esm/cli/setupServer.d.ts +1 -1
  12. package/esm/cli/setupServer.js +109 -49
  13. package/esm/cli/setupServer.js.map +1 -1
  14. package/esm/createConfig.d.ts +1 -0
  15. package/esm/createConfig.js +1 -0
  16. package/esm/createConfig.js.map +1 -1
  17. package/esm/executor/executor.d.ts +3 -3
  18. package/esm/executor/executor.js +1 -3
  19. package/esm/executor/executor.js.map +1 -1
  20. package/esm/executor/executorManager.d.ts +14 -12
  21. package/esm/executor/executorManager.js +131 -97
  22. package/esm/executor/executorManager.js.map +1 -1
  23. package/esm/executor/index.d.ts +1 -1
  24. package/esm/executor/index.js +1 -1
  25. package/esm/executor/senderManager/createMemorySenderManager.d.ts +8 -0
  26. package/esm/executor/senderManager/createMemorySenderManager.js +41 -0
  27. package/esm/executor/senderManager/createMemorySenderManager.js.map +1 -0
  28. package/esm/executor/senderManager/createRedisSenderManager.d.ts +8 -0
  29. package/esm/executor/senderManager/createRedisSenderManager.js +78 -0
  30. package/esm/executor/senderManager/createRedisSenderManager.js.map +1 -0
  31. package/esm/executor/senderManager/flushOnStartUp.d.ts +9 -0
  32. package/esm/executor/senderManager/flushOnStartUp.js +33 -0
  33. package/esm/executor/senderManager/flushOnStartUp.js.map +1 -0
  34. package/esm/executor/senderManager/index.d.ts +15 -0
  35. package/esm/executor/senderManager/index.js +20 -0
  36. package/esm/executor/senderManager/index.js.map +1 -0
  37. package/esm/executor/senderManager/validateAndRefill.d.ts +11 -0
  38. package/esm/executor/senderManager/validateAndRefill.js +111 -0
  39. package/esm/executor/senderManager/validateAndRefill.js.map +1 -0
  40. package/esm/executor/utils.d.ts +8 -2
  41. package/esm/executor/utils.js +9 -1
  42. package/esm/executor/utils.js.map +1 -1
  43. package/esm/handlers/arbitrumGasPriceManager.d.ts +7 -4
  44. package/esm/handlers/arbitrumGasPriceManager.js +19 -13
  45. package/esm/handlers/arbitrumGasPriceManager.js.map +1 -1
  46. package/esm/handlers/eventManager.js +5 -4
  47. package/esm/handlers/eventManager.js.map +1 -1
  48. package/esm/handlers/gasPriceManager.d.ts +1 -4
  49. package/esm/handlers/gasPriceManager.js +81 -48
  50. package/esm/handlers/gasPriceManager.js.map +1 -1
  51. package/esm/handlers/mantleGasPriceManager.d.ts +6 -3
  52. package/esm/handlers/mantleGasPriceManager.js +23 -11
  53. package/esm/handlers/mantleGasPriceManager.js.map +1 -1
  54. package/esm/handlers/optimismManager.d.ts +5 -2
  55. package/esm/handlers/optimismManager.js +8 -5
  56. package/esm/handlers/optimismManager.js.map +1 -1
  57. package/esm/mempool/index.d.ts +0 -1
  58. package/esm/mempool/index.js +0 -1
  59. package/esm/mempool/index.js.map +1 -1
  60. package/esm/mempool/mempool.d.ts +95 -27
  61. package/esm/mempool/mempool.js +132 -252
  62. package/esm/mempool/mempool.js.map +1 -1
  63. package/esm/mempool/monitoring.d.ts +8 -4
  64. package/esm/mempool/monitoring.js +72 -9
  65. package/esm/mempool/monitoring.js.map +1 -1
  66. package/esm/rpc/estimation/gasEstimationHandler.d.ts +10 -4
  67. package/esm/rpc/estimation/gasEstimationHandler.js +16 -19
  68. package/esm/rpc/estimation/gasEstimationHandler.js.map +1 -1
  69. package/esm/rpc/estimation/gasEstimationsV07.d.ts +7 -0
  70. package/esm/rpc/estimation/gasEstimationsV07.js +69 -4
  71. package/esm/rpc/estimation/gasEstimationsV07.js.map +1 -1
  72. package/esm/rpc/methods/debug_bundler_clearReputation.js.map +1 -1
  73. package/esm/rpc/methods/debug_bundler_dumpMempool.js +2 -2
  74. package/esm/rpc/methods/debug_bundler_dumpMempool.js.map +1 -1
  75. package/esm/rpc/methods/debug_bundler_setBundlingMode.js.map +1 -1
  76. package/esm/rpc/methods/eth_chainId.js +1 -1
  77. package/esm/rpc/methods/eth_chainId.js.map +1 -1
  78. package/esm/rpc/methods/eth_sendUserOperation.js +2 -2
  79. package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
  80. package/esm/rpc/methods/index.js +0 -5
  81. package/esm/rpc/methods/index.js.map +1 -1
  82. package/esm/rpc/methods/pimlico_sendUserOperationNow.js +2 -3
  83. package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
  84. package/esm/rpc/rpcHandler.d.ts +4 -7
  85. package/esm/rpc/rpcHandler.js +37 -37
  86. package/esm/rpc/rpcHandler.js.map +1 -1
  87. package/esm/rpc/validation/SafeValidator.js +2 -2
  88. package/esm/rpc/validation/SafeValidator.js.map +1 -1
  89. package/esm/rpc/validation/UnsafeValidator.d.ts +7 -2
  90. package/esm/rpc/validation/UnsafeValidator.js +20 -4
  91. package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
  92. package/esm/store/createMemoryOutstandingStore.d.ts +28 -0
  93. package/esm/store/createMemoryOutstandingStore.js +221 -0
  94. package/esm/store/createMemoryOutstandingStore.js.map +1 -0
  95. package/esm/store/createMempoolStore.d.ts +8 -0
  96. package/esm/store/createMempoolStore.js +193 -0
  97. package/esm/store/createMempoolStore.js.map +1 -0
  98. package/esm/store/createRedisOutstandingStore.d.ts +27 -0
  99. package/esm/store/createRedisOutstandingStore.js +344 -0
  100. package/esm/store/createRedisOutstandingStore.js.map +1 -0
  101. package/esm/store/createRedisStore.d.ts +9 -0
  102. package/esm/store/createRedisStore.js +131 -0
  103. package/esm/store/createRedisStore.js.map +1 -0
  104. package/esm/store/createStore.d.ts +6 -0
  105. package/esm/store/createStore.js +66 -0
  106. package/esm/store/createStore.js.map +1 -0
  107. package/esm/store/index.d.ts +81 -0
  108. package/esm/store/index.js +2 -0
  109. package/esm/store/index.js.map +1 -0
  110. package/esm/types/interfaces.d.ts +7 -3
  111. package/esm/types/mempool.d.ts +2 -15
  112. package/esm/types/mempool.js.map +1 -1
  113. package/esm/types/schemas.d.ts +4617 -7632
  114. package/esm/types/schemas.js +19 -42
  115. package/esm/types/schemas.js.map +1 -1
  116. package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.d.ts +6 -0
  117. package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.js +53 -0
  118. package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.js.map +1 -0
  119. package/esm/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +7 -0
  120. package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js +98 -0
  121. package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js.map +1 -0
  122. package/esm/utils/minMaxQueue/index.d.ts +12 -0
  123. package/esm/utils/minMaxQueue/index.js +12 -0
  124. package/esm/utils/minMaxQueue/index.js.map +1 -0
  125. package/esm/utils/validation.js +8 -10
  126. package/esm/utils/validation.js.map +1 -1
  127. package/lib/cli/alto.js +3 -1
  128. package/lib/cli/alto.js.map +1 -1
  129. package/lib/cli/config/bundler.d.ts +87 -36
  130. package/lib/cli/config/bundler.js +16 -4
  131. package/lib/cli/config/bundler.js.map +1 -1
  132. package/lib/cli/config/options.d.ts +2 -1
  133. package/lib/cli/config/options.js +60 -6
  134. package/lib/cli/config/options.js.map +1 -1
  135. package/lib/cli/handler.js +3 -4
  136. package/lib/cli/handler.js.map +1 -1
  137. package/lib/cli/setupServer.d.ts +1 -1
  138. package/lib/cli/setupServer.js +108 -48
  139. package/lib/cli/setupServer.js.map +1 -1
  140. package/lib/createConfig.d.ts +1 -0
  141. package/lib/createConfig.js +1 -0
  142. package/lib/createConfig.js.map +1 -1
  143. package/lib/executor/executor.d.ts +3 -3
  144. package/lib/executor/executor.js +1 -3
  145. package/lib/executor/executor.js.map +1 -1
  146. package/lib/executor/executorManager.d.ts +14 -12
  147. package/lib/executor/executorManager.js +131 -97
  148. package/lib/executor/executorManager.js.map +1 -1
  149. package/lib/executor/index.d.ts +1 -1
  150. package/lib/executor/index.js +1 -1
  151. package/lib/executor/senderManager/createMemorySenderManager.d.ts +8 -0
  152. package/lib/executor/senderManager/createMemorySenderManager.js +45 -0
  153. package/lib/executor/senderManager/createMemorySenderManager.js.map +1 -0
  154. package/lib/executor/senderManager/createRedisSenderManager.d.ts +8 -0
  155. package/lib/executor/senderManager/createRedisSenderManager.js +85 -0
  156. package/lib/executor/senderManager/createRedisSenderManager.js.map +1 -0
  157. package/lib/executor/senderManager/flushOnStartUp.d.ts +9 -0
  158. package/lib/executor/senderManager/flushOnStartUp.js +37 -0
  159. package/lib/executor/senderManager/flushOnStartUp.js.map +1 -0
  160. package/lib/executor/senderManager/index.d.ts +15 -0
  161. package/lib/executor/senderManager/index.js +25 -0
  162. package/lib/executor/senderManager/index.js.map +1 -0
  163. package/lib/executor/senderManager/validateAndRefill.d.ts +11 -0
  164. package/lib/executor/senderManager/validateAndRefill.js +115 -0
  165. package/lib/executor/senderManager/validateAndRefill.js.map +1 -0
  166. package/lib/executor/utils.d.ts +8 -2
  167. package/lib/executor/utils.js +9 -1
  168. package/lib/executor/utils.js.map +1 -1
  169. package/lib/handlers/arbitrumGasPriceManager.d.ts +7 -4
  170. package/lib/handlers/arbitrumGasPriceManager.js +19 -13
  171. package/lib/handlers/arbitrumGasPriceManager.js.map +1 -1
  172. package/lib/handlers/eventManager.js +5 -4
  173. package/lib/handlers/eventManager.js.map +1 -1
  174. package/lib/handlers/gasPriceManager.d.ts +1 -4
  175. package/lib/handlers/gasPriceManager.js +81 -48
  176. package/lib/handlers/gasPriceManager.js.map +1 -1
  177. package/lib/handlers/mantleGasPriceManager.d.ts +6 -3
  178. package/lib/handlers/mantleGasPriceManager.js +23 -11
  179. package/lib/handlers/mantleGasPriceManager.js.map +1 -1
  180. package/lib/handlers/optimismManager.d.ts +5 -2
  181. package/lib/handlers/optimismManager.js +8 -5
  182. package/lib/handlers/optimismManager.js.map +1 -1
  183. package/lib/mempool/index.d.ts +0 -1
  184. package/lib/mempool/index.js +0 -1
  185. package/lib/mempool/index.js.map +1 -1
  186. package/lib/mempool/mempool.d.ts +95 -27
  187. package/lib/mempool/mempool.js +133 -253
  188. package/lib/mempool/mempool.js.map +1 -1
  189. package/lib/mempool/monitoring.d.ts +8 -4
  190. package/lib/mempool/monitoring.js +72 -9
  191. package/lib/mempool/monitoring.js.map +1 -1
  192. package/lib/rpc/estimation/gasEstimationHandler.d.ts +10 -4
  193. package/lib/rpc/estimation/gasEstimationHandler.js +15 -18
  194. package/lib/rpc/estimation/gasEstimationHandler.js.map +1 -1
  195. package/lib/rpc/estimation/gasEstimationsV07.d.ts +7 -0
  196. package/lib/rpc/estimation/gasEstimationsV07.js +69 -4
  197. package/lib/rpc/estimation/gasEstimationsV07.js.map +1 -1
  198. package/lib/rpc/methods/debug_bundler_clearReputation.js.map +1 -1
  199. package/lib/rpc/methods/debug_bundler_dumpMempool.js +2 -2
  200. package/lib/rpc/methods/debug_bundler_dumpMempool.js.map +1 -1
  201. package/lib/rpc/methods/debug_bundler_setBundlingMode.js.map +1 -1
  202. package/lib/rpc/methods/eth_chainId.js +1 -1
  203. package/lib/rpc/methods/eth_chainId.js.map +1 -1
  204. package/lib/rpc/methods/eth_sendUserOperation.js +2 -2
  205. package/lib/rpc/methods/eth_sendUserOperation.js.map +1 -1
  206. package/lib/rpc/methods/index.js +0 -5
  207. package/lib/rpc/methods/index.js.map +1 -1
  208. package/lib/rpc/methods/pimlico_sendUserOperationNow.js +2 -3
  209. package/lib/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
  210. package/lib/rpc/rpcHandler.d.ts +4 -7
  211. package/lib/rpc/rpcHandler.js +37 -37
  212. package/lib/rpc/rpcHandler.js.map +1 -1
  213. package/lib/rpc/validation/SafeValidator.js +2 -2
  214. package/lib/rpc/validation/SafeValidator.js.map +1 -1
  215. package/lib/rpc/validation/UnsafeValidator.d.ts +7 -2
  216. package/lib/rpc/validation/UnsafeValidator.js +20 -4
  217. package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
  218. package/lib/store/createMemoryOutstandingStore.d.ts +28 -0
  219. package/lib/store/createMemoryOutstandingStore.js +226 -0
  220. package/lib/store/createMemoryOutstandingStore.js.map +1 -0
  221. package/lib/store/createMempoolStore.d.ts +8 -0
  222. package/lib/store/createMempoolStore.js +197 -0
  223. package/lib/store/createMempoolStore.js.map +1 -0
  224. package/lib/store/createRedisOutstandingStore.d.ts +27 -0
  225. package/lib/store/createRedisOutstandingStore.js +349 -0
  226. package/lib/store/createRedisOutstandingStore.js.map +1 -0
  227. package/lib/store/createRedisStore.d.ts +9 -0
  228. package/lib/store/createRedisStore.js +138 -0
  229. package/lib/store/createRedisStore.js.map +1 -0
  230. package/lib/store/createStore.d.ts +6 -0
  231. package/lib/store/createStore.js +70 -0
  232. package/lib/store/createStore.js.map +1 -0
  233. package/lib/store/index.d.ts +81 -0
  234. package/lib/store/index.js +6 -0
  235. package/lib/store/index.js.map +1 -0
  236. package/lib/types/interfaces.d.ts +7 -3
  237. package/lib/types/mempool.d.ts +2 -15
  238. package/lib/types/mempool.js.map +1 -1
  239. package/lib/types/schemas.d.ts +4617 -7632
  240. package/lib/types/schemas.js +24 -47
  241. package/lib/types/schemas.js.map +1 -1
  242. package/lib/utils/minMaxQueue/createMemoryMinMaxQueue.d.ts +6 -0
  243. package/lib/utils/minMaxQueue/createMemoryMinMaxQueue.js +57 -0
  244. package/lib/utils/minMaxQueue/createMemoryMinMaxQueue.js.map +1 -0
  245. package/lib/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +7 -0
  246. package/lib/utils/minMaxQueue/createRedisMinMaxQueue.js +105 -0
  247. package/lib/utils/minMaxQueue/createRedisMinMaxQueue.js.map +1 -0
  248. package/lib/utils/minMaxQueue/index.d.ts +12 -0
  249. package/lib/utils/minMaxQueue/index.js +16 -0
  250. package/lib/utils/minMaxQueue/index.js.map +1 -0
  251. package/lib/utils/validation.js +8 -10
  252. package/lib/utils/validation.js.map +1 -1
  253. package/package.json +2 -2
  254. package/esm/executor/senderManager.d.ts +0 -26
  255. package/esm/executor/senderManager.js +0 -216
  256. package/esm/executor/senderManager.js.map +0 -1
  257. package/esm/mempool/nonceQueuer.d.ts +0 -32
  258. package/esm/mempool/nonceQueuer.js +0 -143
  259. package/esm/mempool/nonceQueuer.js.map +0 -1
  260. package/esm/mempool/store.d.ts +0 -22
  261. package/esm/mempool/store.js +0 -124
  262. package/esm/mempool/store.js.map +0 -1
  263. package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.d.ts +0 -979
  264. package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js +0 -22
  265. package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js.map +0 -1
  266. package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.d.ts +0 -422
  267. package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.js +0 -19
  268. package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.js.map +0 -1
  269. package/esm/utils/slidingWindowTimedQueue.d.ts +0 -12
  270. package/esm/utils/slidingWindowTimedQueue.js +0 -48
  271. package/esm/utils/slidingWindowTimedQueue.js.map +0 -1
  272. package/lib/executor/senderManager.d.ts +0 -26
  273. package/lib/executor/senderManager.js +0 -220
  274. package/lib/executor/senderManager.js.map +0 -1
  275. package/lib/mempool/nonceQueuer.d.ts +0 -32
  276. package/lib/mempool/nonceQueuer.js +0 -147
  277. package/lib/mempool/nonceQueuer.js.map +0 -1
  278. package/lib/mempool/store.d.ts +0 -22
  279. package/lib/mempool/store.js +0 -128
  280. package/lib/mempool/store.js.map +0 -1
  281. package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.d.ts +0 -979
  282. package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js +0 -25
  283. package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js.map +0 -1
  284. package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.d.ts +0 -422
  285. package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.js +0 -22
  286. package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.js.map +0 -1
  287. package/lib/utils/slidingWindowTimedQueue.d.ts +0 -12
  288. package/lib/utils/slidingWindowTimedQueue.js +0 -52
  289. package/lib/utils/slidingWindowTimedQueue.js.map +0 -1
@@ -1,216 +0,0 @@
1
- import { CallEngineAbi } from "../types/index.js";
2
- import { Semaphore } from "async-mutex";
3
- import { formatEther, getContract } from "viem";
4
- import { flushStuckTransaction } from "./utils.js";
5
- const waitForTransactionReceipt = async (publicClient, tx) => {
6
- try {
7
- return await publicClient.waitForTransactionReceipt({ hash: tx });
8
- }
9
- catch {
10
- return await waitForTransactionReceipt(publicClient, tx);
11
- }
12
- };
13
- export class SenderManager {
14
- config;
15
- wallets;
16
- utilityAccount;
17
- availableWallets;
18
- metrics;
19
- semaphore;
20
- gasPriceManager;
21
- logger;
22
- walletProcessingTime = new Map();
23
- constructor({ config, metrics, gasPriceManager }) {
24
- this.config = config;
25
- this.logger = config.getLogger({ module: "executor" }, {
26
- level: config.executorLogLevel || config.logLevel
27
- });
28
- const maxSigners = config.maxExecutors;
29
- const wallets = config.executorPrivateKeys;
30
- if (maxSigners !== undefined && wallets.length > maxSigners) {
31
- this.wallets = wallets.slice(0, maxSigners);
32
- this.availableWallets = wallets.slice(0, maxSigners);
33
- }
34
- else {
35
- this.wallets = wallets;
36
- this.availableWallets = wallets;
37
- }
38
- this.utilityAccount = this.config.utilityPrivateKey;
39
- this.metrics = metrics;
40
- metrics.walletsAvailable.set(this.availableWallets.length);
41
- metrics.walletsTotal.set(this.wallets.length);
42
- this.semaphore = new Semaphore(this.availableWallets.length);
43
- this.gasPriceManager = gasPriceManager;
44
- }
45
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
46
- async validateAndRefillWallets() {
47
- const minBalance = this.config.minExecutorBalance;
48
- if (!(minBalance && this.utilityAccount)) {
49
- return;
50
- }
51
- const utilityWalletBalance = await this.config.publicClient.getBalance({
52
- address: this.utilityAccount.address
53
- });
54
- const balancesMissing = {};
55
- const balanceRequestPromises = this.availableWallets.map(async (wallet) => {
56
- const balance = await this.config.publicClient.getBalance({
57
- address: wallet.address
58
- });
59
- this.metrics.executorWalletsBalances.set({
60
- wallet: wallet.address
61
- }, Number.parseFloat(formatEther(balance)));
62
- if (balance < minBalance) {
63
- const missingBalance = (minBalance * 6n) / 5n - balance;
64
- balancesMissing[wallet.address] = missingBalance;
65
- }
66
- });
67
- await Promise.all(balanceRequestPromises);
68
- const totalBalanceMissing = Object.values(balancesMissing).reduce((a, b) => a + b, 0n);
69
- if (utilityWalletBalance < (totalBalanceMissing * 11n) / 10n) {
70
- this.logger.info({ balancesMissing, totalBalanceMissing }, "balances missing");
71
- this.metrics.utilityWalletInsufficientBalance.set(1);
72
- this.logger.error({
73
- minBalance: formatEther(minBalance),
74
- utilityWalletBalance: formatEther(utilityWalletBalance),
75
- totalBalanceMissing: formatEther(totalBalanceMissing),
76
- minRefillAmount: formatEther(totalBalanceMissing - utilityWalletBalance),
77
- utilityAccount: this.utilityAccount.address
78
- }, "utility wallet has insufficient balance to refill wallets");
79
- return;
80
- // throw new Error(
81
- // `utility wallet ${
82
- // this.utilityAccount.address
83
- // } has insufficient balance ${formatEther(
84
- // utilityWalletBalance
85
- // )} < ${formatEther(totalBalanceMissing)}`
86
- // )
87
- }
88
- this.metrics.utilityWalletInsufficientBalance.set(0);
89
- if (Object.keys(balancesMissing).length > 0) {
90
- let maxFeePerGas;
91
- let maxPriorityFeePerGas;
92
- try {
93
- const gasPriceParameters = await this.gasPriceManager.tryGetNetworkGasPrice();
94
- maxFeePerGas = gasPriceParameters.maxFeePerGas;
95
- maxPriorityFeePerGas = gasPriceParameters.maxPriorityFeePerGas;
96
- }
97
- catch (e) {
98
- this.logger.error(e, "No gas price available");
99
- return;
100
- }
101
- if (this.config.refillHelperContract) {
102
- const instructions = [];
103
- for (const [address, missingBalance] of Object.entries(balancesMissing)) {
104
- instructions.push({
105
- to: address,
106
- value: missingBalance,
107
- data: "0x"
108
- });
109
- }
110
- const callEngine = getContract({
111
- abi: CallEngineAbi,
112
- address: this.config.refillHelperContract,
113
- client: {
114
- public: this.config.publicClient,
115
- wallet: this.config.walletClient
116
- }
117
- });
118
- const tx = await callEngine.write.execute([instructions], {
119
- account: this.utilityAccount,
120
- value: totalBalanceMissing,
121
- maxFeePerGas: maxFeePerGas * 2n,
122
- maxPriorityFeePerGas: maxPriorityFeePerGas * 2n
123
- });
124
- await waitForTransactionReceipt(this.config.publicClient, tx);
125
- for (const [address, missingBalance] of Object.entries(balancesMissing)) {
126
- this.logger.info({ tx, executor: address, missingBalance }, "refilled wallet");
127
- }
128
- }
129
- else {
130
- for (const [address, missingBalance] of Object.entries(balancesMissing)) {
131
- const tx = await this.config.walletClient.sendTransaction({
132
- account: this.utilityAccount,
133
- // @ts-ignore
134
- to: address,
135
- value: missingBalance,
136
- maxFeePerGas: this.config.legacyTransactions
137
- ? undefined
138
- : maxFeePerGas,
139
- maxPriorityFeePerGas: this.config.legacyTransactions
140
- ? undefined
141
- : maxPriorityFeePerGas,
142
- gasPrice: this.config.legacyTransactions
143
- ? maxFeePerGas
144
- : undefined
145
- });
146
- await waitForTransactionReceipt(this.config.publicClient, tx);
147
- this.logger.info({ tx, executor: address, missingBalance }, "refilled wallet");
148
- }
149
- }
150
- }
151
- else {
152
- this.logger.info("no wallets need to be refilled");
153
- }
154
- }
155
- async getWallet() {
156
- this.logger.trace(`waiting for semaphore with count ${this.semaphore.getValue()}`);
157
- await this.semaphore.waitForUnlock();
158
- await this.semaphore.acquire();
159
- const wallet = this.availableWallets.shift();
160
- // should never happen because of semaphore
161
- if (!wallet) {
162
- this.semaphore.release();
163
- this.logger.error("no more wallets");
164
- throw new Error("no more wallets");
165
- }
166
- this.logger.trace({ executor: wallet.address }, "got wallet from sender manager");
167
- this.metrics.walletsAvailable.set(this.availableWallets.length);
168
- this.walletProcessingTime.set(wallet.address, new Date());
169
- return wallet;
170
- }
171
- pushWallet(wallet) {
172
- this.availableWallets.push(wallet);
173
- this.semaphore.release();
174
- this.logger.trace({ executor: wallet.address }, "pushed wallet to sender manager");
175
- const processingTime = this.walletProcessingTime.get(wallet.address);
176
- if (processingTime) {
177
- const time = Date.now() - processingTime.getTime();
178
- this.metrics.walletsProcessingTime.observe(time / 1000);
179
- this.walletProcessingTime.delete(wallet.address);
180
- }
181
- this.metrics.walletsAvailable.set(this.availableWallets.length);
182
- return;
183
- }
184
- markWalletProcessed(executor) {
185
- if (!this.availableWallets.includes(executor)) {
186
- this.pushWallet(executor);
187
- }
188
- return Promise.resolve();
189
- }
190
- async flushOnStartUp() {
191
- const allWallets = new Set(this.wallets);
192
- const utilityWallet = this.utilityAccount;
193
- if (utilityWallet) {
194
- allWallets.add(utilityWallet);
195
- }
196
- const wallets = Array.from(allWallets);
197
- let gasPrice;
198
- try {
199
- gasPrice = await this.gasPriceManager.tryGetNetworkGasPrice();
200
- }
201
- catch (e) {
202
- this.logger.error({ error: e }, "error flushing stuck transaction");
203
- return;
204
- }
205
- const promises = wallets.map((wallet) => {
206
- try {
207
- flushStuckTransaction(this.config.publicClient, this.config.walletClient, wallet, gasPrice.maxFeePerGas * 5n, this.logger);
208
- }
209
- catch (e) {
210
- this.logger.error({ error: e }, "error flushing stuck transaction");
211
- }
212
- });
213
- await Promise.all(promises);
214
- }
215
- }
216
- //# sourceMappingURL=senderManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"senderManager.js","sourceRoot":"","sources":["../../executor/senderManager.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,aAAa,EAGhB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,SAAS,EAAE,MA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ACD,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,qBAAqB,EAAE,CAAA;QACjE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,kCAAkC,CAAC,CAAA;YACnE,OAAM;QACV,CAAC;QAED,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACpC,IAAI,CAAC;gBACD,qBAAqB,CACjB,IAAI,CAAC,MAAM,CAAC,YAAY,EACxB,IAAI,CAAC,MAAM,CAAC,YAAY,EACxB,MAAM,EACN,QAAQ,CAAC,YAAY,GAAG,EAAE,EAC1B,IAAI,CAAC,MAAM,CACd,CAAA;YACL,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,EAAE,KAAK,EAAE,CAAC,EAAE,EACZ,kCAAkC,CACrC,CAAA;YACL,CAAC;QACL,CAAC,CAAC,CAAA;QAEF,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAC/B,CAAC;CACJ"}
@@ -1,32 +0,0 @@
1
- import type { EventManager } from "../handlers/index.js";
2
- import type { MemoryMempool } from "./index.js";
3
- import { UserOperation } from "../types/index.js";
4
- import type { Logger } from "../utils/index.js";
5
- import { type Address, type Hash, type PublicClient } from "viem";
6
- import type { AltoConfig } from "../createConfig.js";
7
- type QueuedUserOperation = {
8
- entryPoint: Address;
9
- userOperationHash: Hash;
10
- userOperation: UserOperation;
11
- nonceKey: bigint;
12
- nonceSequence: bigint;
13
- addedAt: number;
14
- };
15
- export declare class NonceQueuer {
16
- queuedUserOperations: QueuedUserOperation[];
17
- config: AltoConfig;
18
- mempool: MemoryMempool;
19
- logger: Logger;
20
- eventManager: EventManager;
21
- constructor({ config, mempool, eventManager }: {
22
- config: AltoConfig;
23
- mempool: MemoryMempool;
24
- eventManager: EventManager;
25
- });
26
- process(): Promise<void>;
27
- add(userOperation: UserOperation, entryPoint: Address): void;
28
- resubmitUserOperation(userOperation: UserOperation, entryPoint: Address): void;
29
- getAvailableUserOperations(publicClient: PublicClient): Promise<QueuedUserOperation[]>;
30
- }
31
- export {};
32
- //# sourceMappingURL=nonceQueuer.d.ts.map
@@ -1,143 +0,0 @@
1
- import { EntryPointV06Abi, EntryPointV07Abi } from "../types/index.js";
2
- import { encodeNonce, getNonceKeyAndSequence, getUserOperationHash, isVersion06 } from "../utils/index.js";
3
- import { getContract } from "viem";
4
- export class NonceQueuer {
5
- queuedUserOperations = [];
6
- config;
7
- mempool;
8
- logger;
9
- eventManager;
10
- constructor({ config, mempool, eventManager }) {
11
- this.config = config;
12
- this.mempool = mempool;
13
- this.logger = config.getLogger({ module: "nonce_queuer" }, {
14
- level: config.nonceQueuerLogLevel || config.logLevel
15
- });
16
- this.eventManager = eventManager;
17
- setInterval(() => {
18
- this.process();
19
- }, 2000);
20
- }
21
- async process() {
22
- // remove queued ops that have been in the queue for more than 15 minutes
23
- this.queuedUserOperations = this.queuedUserOperations.filter((qop) => {
24
- return qop.addedAt > Date.now() - 1000 * 60 * 15;
25
- });
26
- if (this.queuedUserOperations.length === 0) {
27
- return;
28
- }
29
- const availableOps = await this.getAvailableUserOperations(this.config.publicClient);
30
- if (availableOps.length === 0) {
31
- return;
32
- }
33
- this.queuedUserOperations = this.queuedUserOperations.filter((qop) => {
34
- return !availableOps.some((op) => {
35
- return op.userOperationHash === qop.userOperationHash;
36
- });
37
- });
38
- availableOps.map((op) => {
39
- this.resubmitUserOperation(op.userOperation, op.entryPoint);
40
- });
41
- this.logger.info({ availableOps: availableOps.map((qop) => qop.userOperationHash) }, "submitted user operations from nonce queue");
42
- }
43
- add(userOperation, entryPoint) {
44
- const [nonceKey, nonceSequence] = getNonceKeyAndSequence(userOperation.nonce);
45
- const userOperationHash = getUserOperationHash(userOperation, entryPoint, this.config.publicClient.chain.id);
46
- this.queuedUserOperations.push({
47
- entryPoint,
48
- userOperationHash,
49
- userOperation,
50
- nonceKey,
51
- nonceSequence,
52
- addedAt: Date.now()
53
- });
54
- this.eventManager.emitQueued(userOperationHash);
55
- }
56
- resubmitUserOperation(userOperation, entryPoint) {
57
- this.logger.info({ userOperation: userOperation }, "submitting user operation from nonce queue");
58
- const result = this.mempool.add(userOperation, entryPoint);
59
- if (result) {
60
- this.logger.info({ userOperation: userOperation, result: result }, "added user operation");
61
- }
62
- else {
63
- this.logger.error("error adding user operation");
64
- }
65
- }
66
- async getAvailableUserOperations(publicClient) {
67
- const queuedUserOperations = this.queuedUserOperations.slice();
68
- let results;
69
- try {
70
- results = await publicClient.multicall({
71
- contracts: queuedUserOperations.map((qop) => {
72
- const userOperation = qop.userOperation;
73
- const isUserOpV06 = isVersion06(userOperation);
74
- return {
75
- address: qop.entryPoint,
76
- abi: isUserOpV06 ? EntryPointV06Abi : EntryPointV07Abi,
77
- functionName: "getNonce",
78
- args: [userOperation.sender, qop.nonceKey]
79
- };
80
- }),
81
- blockTag: this.config.blockTagSupport ? "latest" : undefined
82
- });
83
- }
84
- catch (error) {
85
- this.logger.error({ error: JSON.stringify(error) }, "error fetching with multiCall");
86
- results = await Promise.all(queuedUserOperations.map(async (qop) => {
87
- const userOperation = qop.userOperation;
88
- try {
89
- const isUserOpV06 = isVersion06(userOperation);
90
- const entryPointContract = isUserOpV06
91
- ? getContract({
92
- abi: EntryPointV06Abi,
93
- address: qop.entryPoint,
94
- client: {
95
- public: publicClient
96
- }
97
- })
98
- : getContract({
99
- abi: EntryPointV07Abi,
100
- address: qop.entryPoint,
101
- client: {
102
- public: publicClient
103
- }
104
- });
105
- const nonce = await entryPointContract.read.getNonce([userOperation.sender, qop.nonceKey], { blockTag: "latest" });
106
- return {
107
- result: nonce,
108
- status: "success"
109
- };
110
- }
111
- catch (e) {
112
- return {
113
- error: e,
114
- status: "failure"
115
- };
116
- }
117
- }));
118
- }
119
- if (results.length !== queuedUserOperations.length) {
120
- this.logger.error("error fetching nonces");
121
- return [];
122
- }
123
- const currentOutstandingOps = [];
124
- for (let i = 0; i < queuedUserOperations.length; i++) {
125
- const qop = queuedUserOperations[i];
126
- const result = results[i];
127
- if (result.status !== "success") {
128
- this.logger.error({ error: result.error }, "error fetching nonce");
129
- continue;
130
- }
131
- const onchainNonce = result.result;
132
- const qopNonce = encodeNonce({
133
- nonceSequence: qop.nonceSequence,
134
- nonceKey: qop.nonceKey
135
- });
136
- if (onchainNonce === qopNonce) {
137
- currentOutstandingOps.push(qop);
138
- }
139
- }
140
- return currentOutstandingOps;
141
- }
142
- }
143
- //# sourceMappingURL=nonceQueuer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nonceQueuer.js","sourceRoot":"","sources":["../../mempool/nonceQueuer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAiB,MAAM,aAAa,CAAA;AAE/E,OAAO,EACH,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACd,MAAM,aAAa,CAAA;AACpB,OAAO,EAKH,WAAW,EACd,MAAM,MAAM,CAAA;AAYb,MAAM,OAAO,WAAW;IACpB,oBAAoB,GAA0B,EAAE,CAAA;IAEhD,MAAM,CAAY;IAClB,OAAO,CAAe;IACtB,MAAM,CAAQ;IACd,YAAY,CAAc;IAE1B,YAAY,EACR,MAAM,EACN,OAAO,EACP,YAAY,EAKf;QACG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAC1B,EAAE,MAAM,EAAE,cAAc,EAAE,EAC1B;YACI,KAAK,EAAE,MAAM,CAAC,mBAAmB,IAAI,MAAM,CAAC,QAAQ;SACvD,CACJ,CAAA;QACD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAEhC,WAAW,CAAC,GAAG,EAAE;YACb,IAAI,CAAC,OA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,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;gBAC5B,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACnC,CAAC;QACL,CAAC;QAED,OAAO,qBAAqB,CAAA;IAChC,CAAC;CACJ"}
@@ -1,22 +0,0 @@
1
- import type { HexData32, SubmittedUserOp, UserOpInfo } from "../types/index.js";
2
- import type { Metrics } from "../utils/index.js";
3
- import type { Logger } from "../utils/index.js";
4
- export declare class MemoryStore {
5
- private outstandingUserOperations;
6
- private processingUserOperations;
7
- private submittedUserOperations;
8
- private logger;
9
- private metrics;
10
- constructor(logger: Logger, metrics: Metrics);
11
- addOutstanding(userOpInfo: UserOpInfo): void;
12
- addProcessing(userOpInfo: UserOpInfo): void;
13
- addSubmitted(submittedInfo: SubmittedUserOp): void;
14
- removeOutstanding(userOpHash: HexData32): void;
15
- removeProcessing(userOpHash: HexData32): void;
16
- removeSubmitted(userOpHash: HexData32): void;
17
- dumpOutstanding(): UserOpInfo[];
18
- dumpProcessing(): UserOpInfo[];
19
- dumpSubmitted(): SubmittedUserOp[];
20
- clear(from: "outstanding" | "processing" | "submitted"): void;
21
- }
22
- //# sourceMappingURL=store.d.ts.map
@@ -1,124 +0,0 @@
1
- export class MemoryStore {
2
- // private monitoredTransactions: Map<HexData32, TransactionInfo> = new Map() // tx hash to info
3
- outstandingUserOperations = [];
4
- processingUserOperations = [];
5
- submittedUserOperations = [];
6
- logger;
7
- metrics;
8
- constructor(logger, metrics) {
9
- this.logger = logger;
10
- this.metrics = metrics;
11
- }
12
- addOutstanding(userOpInfo) {
13
- const store = this.outstandingUserOperations;
14
- store.push(userOpInfo);
15
- this.logger.debug({ userOpHash: userOpInfo.userOpHash, store: "outstanding" }, "added user op to mempool");
16
- this.metrics.userOperationsInMempool
17
- .labels({
18
- status: "outstanding"
19
- })
20
- .inc();
21
- }
22
- addProcessing(userOpInfo) {
23
- const store = this.processingUserOperations;
24
- store.push(userOpInfo);
25
- this.logger.debug({ userOpHash: userOpInfo.userOpHash, store: "processing" }, "added user op to mempool");
26
- this.metrics.userOperationsInMempool
27
- .labels({
28
- status: "processing"
29
- })
30
- .inc();
31
- }
32
- addSubmitted(submittedInfo) {
33
- const { userOpHash } = submittedInfo;
34
- const store = this.submittedUserOperations;
35
- store.push(submittedInfo);
36
- this.logger.debug({
37
- userOpHash,
38
- store: "submitted"
39
- }, "added user op to submitted mempool");
40
- this.metrics.userOperationsInMempool
41
- .labels({
42
- status: "submitted"
43
- })
44
- .inc();
45
- }
46
- removeOutstanding(userOpHash) {
47
- const index = this.outstandingUserOperations.findIndex((userOpInfo) => userOpInfo.userOpHash === userOpHash);
48
- if (index === -1) {
49
- this.logger.warn({ userOpHash, store: "outstanding" }, "tried to remove non-existent user op from mempool");
50
- return;
51
- }
52
- this.outstandingUserOperations.splice(index, 1);
53
- this.logger.debug({ userOpHash, store: "outstanding" }, "removed user op from mempool");
54
- this.metrics.userOperationsInMempool
55
- .labels({
56
- status: "outstanding"
57
- })
58
- .dec();
59
- }
60
- removeProcessing(userOpHash) {
61
- const index = this.processingUserOperations.findIndex((userOpInfo) => userOpInfo.userOpHash === userOpHash);
62
- if (index === -1) {
63
- this.logger.warn({ userOpHash, store: "outstanding" }, "tried to remove non-existent user op from mempool");
64
- return;
65
- }
66
- this.processingUserOperations.splice(index, 1);
67
- this.logger.debug({ userOpHash, store: "processing" }, "removed user op from mempool");
68
- this.metrics.userOperationsInMempool
69
- .labels({
70
- status: "processing"
71
- })
72
- .dec();
73
- }
74
- removeSubmitted(userOpHash) {
75
- const index = this.submittedUserOperations.findIndex((userOpInfo) => userOpInfo.userOpHash === userOpHash);
76
- if (index === -1) {
77
- this.logger.warn({ userOpHash, store: "submitted" }, "tried to remove non-existent user op from mempool");
78
- return;
79
- }
80
- this.submittedUserOperations.splice(index, 1);
81
- this.logger.debug({ userOpHash, store: "submitted" }, "removed user op from mempool");
82
- this.metrics.userOperationsInMempool
83
- .labels({
84
- status: "submitted"
85
- })
86
- .dec();
87
- }
88
- dumpOutstanding() {
89
- this.logger.trace({
90
- store: "outstanding",
91
- length: this.outstandingUserOperations.length
92
- }, "dumping mempool");
93
- return this.outstandingUserOperations;
94
- }
95
- dumpProcessing() {
96
- this.logger.trace({
97
- store: "processing",
98
- length: this.processingUserOperations.length
99
- }, "dumping mempool");
100
- return this.processingUserOperations;
101
- }
102
- dumpSubmitted() {
103
- this.logger.trace({ store: "submitted", length: this.submittedUserOperations.length }, "dumping mempool");
104
- return this.submittedUserOperations;
105
- }
106
- clear(from) {
107
- if (from === "outstanding") {
108
- this.outstandingUserOperations = [];
109
- this.logger.debug({ store: from, length: this.outstandingUserOperations.length }, "clearing mempool");
110
- }
111
- else if (from === "processing") {
112
- this.processingUserOperations = [];
113
- this.logger.debug({ store: from, length: this.processingUserOperations.length }, "clearing mempool");
114
- }
115
- else if (from === "submitted") {
116
- this.submittedUserOperations = [];
117
- this.logger.debug({ store: from, length: this.submittedUserOperations.length }, "clearing mempool");
118
- }
119
- else {
120
- throw new Error("unreachable");
121
- }
122
- }
123
- }
124
- //# sourceMappingURL=store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../../mempool/store.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,WAAW;IACpB,gGAAgG;IACxF,yBAAyB,GAAiB,EAAE,CAAA;IAC5C,wBAAwB,GAAiB,EAAE,CAAA;IAC3C,uBAAuB,GAAsB,EAAE,CAAA;IAE/C,MAAM,CAAQ;IACd,OAAO,CAAS;IAExB,YAAY,MAAc,EAAE,OAAgB;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IAC1B,CAAC;IAED,cAAc,CAAC,UAAsB;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,yBAAyB,CAAA;QAE5C,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,EAAE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