@pimlico/alto 0.0.6 → 0.0.8

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 (292) hide show
  1. package/esm/cli/alto.js +3 -1
  2. package/esm/cli/alto.js.map +1 -1
  3. package/esm/cli/config/bundler.d.ts +348 -306
  4. package/esm/cli/config/bundler.js +26 -7
  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 +46 -8
  8. package/esm/cli/config/options.js.map +1 -1
  9. package/esm/cli/customTransport.js +40 -7
  10. package/esm/cli/customTransport.js.map +1 -1
  11. package/esm/cli/deploySimulationsContract.d.ts +8 -0
  12. package/esm/cli/deploySimulationsContract.js +26 -0
  13. package/esm/cli/deploySimulationsContract.js.map +1 -0
  14. package/esm/cli/handler.d.ts +2 -2
  15. package/esm/cli/handler.js +67 -89
  16. package/esm/cli/handler.js.map +1 -1
  17. package/esm/cli/instrumentation.js +4 -2
  18. package/esm/cli/instrumentation.js.map +1 -1
  19. package/esm/cli/parseArgs.d.ts +8 -0
  20. package/esm/cli/parseArgs.js +21 -0
  21. package/esm/cli/parseArgs.js.map +1 -0
  22. package/esm/cli/setupServer.d.ts +4 -9
  23. package/esm/cli/setupServer.js +98 -82
  24. package/esm/cli/setupServer.js.map +1 -1
  25. package/esm/createConfig.d.ts +15 -0
  26. package/esm/createConfig.js +8 -0
  27. package/esm/createConfig.js.map +1 -0
  28. package/esm/executor/executor.d.ts +29 -13
  29. package/esm/executor/executor.js +110 -72
  30. package/esm/executor/executor.js.map +1 -1
  31. package/esm/executor/executorManager.d.ts +14 -10
  32. package/esm/executor/executorManager.js +42 -42
  33. package/esm/executor/executorManager.js.map +1 -1
  34. package/esm/executor/senderManager.d.ts +11 -6
  35. package/esm/executor/senderManager.js +25 -32
  36. package/esm/executor/senderManager.js.map +1 -1
  37. package/esm/executor/utilityWalletMonitor.d.ts +9 -5
  38. package/esm/executor/utilityWalletMonitor.js +8 -8
  39. package/esm/executor/utilityWalletMonitor.js.map +1 -1
  40. package/esm/executor/utils.d.ts +2 -1
  41. package/esm/executor/utils.js +7 -2
  42. package/esm/executor/utils.js.map +1 -1
  43. package/esm/handlers/arbitrumGasPriceManager.d.ts +11 -0
  44. package/esm/handlers/arbitrumGasPriceManager.js +29 -0
  45. package/esm/handlers/arbitrumGasPriceManager.js.map +1 -0
  46. package/esm/handlers/eventManager.d.ts +7 -3
  47. package/esm/handlers/eventManager.js +24 -16
  48. package/esm/handlers/eventManager.js.map +1 -1
  49. package/esm/handlers/gasPriceManager.d.ts +14 -27
  50. package/esm/handlers/gasPriceManager.js +81 -135
  51. package/esm/handlers/gasPriceManager.js.map +1 -1
  52. package/esm/handlers/mantleGasPriceManager.d.ts +20 -0
  53. package/esm/handlers/mantleGasPriceManager.js +28 -0
  54. package/esm/handlers/mantleGasPriceManager.js.map +1 -0
  55. package/esm/mempool/mempool.d.ts +13 -10
  56. package/esm/mempool/mempool.js +29 -26
  57. package/esm/mempool/mempool.js.map +1 -1
  58. package/esm/mempool/reputationManager.d.ts +4 -6
  59. package/esm/mempool/reputationManager.js +25 -29
  60. package/esm/mempool/reputationManager.js.map +1 -1
  61. package/esm/mempool/store.d.ts +1 -1
  62. package/esm/rpc/estimation/gasEstimationHandler.d.ts +24 -0
  63. package/esm/rpc/estimation/gasEstimationHandler.js +48 -0
  64. package/esm/rpc/estimation/gasEstimationHandler.js.map +1 -0
  65. package/esm/rpc/estimation/gasEstimationsV06.d.ts +19 -0
  66. package/esm/rpc/estimation/gasEstimationsV06.js +146 -0
  67. package/esm/rpc/estimation/gasEstimationsV06.js.map +1 -0
  68. package/esm/rpc/estimation/gasEstimationsV07.d.ts +88 -0
  69. package/esm/rpc/estimation/gasEstimationsV07.js +429 -0
  70. package/esm/rpc/estimation/gasEstimationsV07.js.map +1 -0
  71. package/esm/rpc/estimation/types.d.ts +113 -0
  72. package/esm/rpc/estimation/types.js +122 -0
  73. package/esm/rpc/estimation/types.js.map +1 -0
  74. package/esm/rpc/nonceQueuer.d.ts +10 -6
  75. package/esm/rpc/nonceQueuer.js +10 -10
  76. package/esm/rpc/nonceQueuer.js.map +1 -1
  77. package/esm/rpc/rpcHandler.d.ts +19 -16
  78. package/esm/rpc/rpcHandler.js +83 -72
  79. package/esm/rpc/rpcHandler.js.map +1 -1
  80. package/esm/rpc/server.d.ts +9 -7
  81. package/esm/rpc/server.js +27 -26
  82. package/esm/rpc/server.js.map +1 -1
  83. package/esm/rpc/validation/SafeValidator.d.ts +11 -6
  84. package/esm/rpc/validation/SafeValidator.js +16 -14
  85. package/esm/rpc/validation/SafeValidator.js.map +1 -1
  86. package/esm/rpc/validation/TracerResultParserV06.d.ts +1 -1
  87. package/esm/rpc/validation/TracerResultParserV06.js.map +1 -1
  88. package/esm/rpc/validation/TracerResultParserV07.d.ts +1 -1
  89. package/esm/rpc/validation/TracerResultParserV07.js +1 -1
  90. package/esm/rpc/validation/TracerResultParserV07.js.map +1 -1
  91. package/esm/rpc/validation/UnsafeValidator.d.ts +14 -17
  92. package/esm/rpc/validation/UnsafeValidator.js +49 -42
  93. package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
  94. package/esm/types/contracts/ArbitrumL1FeeAbi.d.ts +32 -0
  95. package/esm/types/contracts/ArbitrumL1FeeAbi.js +42 -0
  96. package/esm/types/contracts/ArbitrumL1FeeAbi.js.map +1 -0
  97. package/esm/types/contracts/EntryPointSimulationsV6.d.ts +34 -0
  98. package/esm/types/contracts/EntryPointSimulationsV6.js +48 -0
  99. package/esm/types/contracts/EntryPointSimulationsV6.js.map +1 -0
  100. package/esm/types/contracts/EntryPointSimulationsV7.d.ts +1370 -0
  101. package/esm/types/contracts/{EntryPointSimulations.js → EntryPointSimulationsV7.js} +197 -385
  102. package/esm/types/contracts/EntryPointSimulationsV7.js.map +1 -0
  103. package/esm/types/contracts/IAccountExecute.d.ts +53 -0
  104. package/esm/types/contracts/IAccountExecute.js +68 -0
  105. package/esm/types/contracts/IAccountExecute.js.map +1 -0
  106. package/esm/types/contracts/MantleBvmGasPriceOracle.d.ts +219 -0
  107. package/esm/types/contracts/MantleBvmGasPriceOracle.js +177 -0
  108. package/esm/types/contracts/MantleBvmGasPriceOracle.js.map +1 -0
  109. package/esm/types/contracts/OpL1FeeAbi.d.ts +26 -0
  110. package/esm/types/contracts/OpL1FeeAbi.js +29 -0
  111. package/esm/types/contracts/OpL1FeeAbi.js.map +1 -0
  112. package/esm/types/contracts/PimlicoEntryPointSimulations.d.ts +1 -1
  113. package/esm/types/contracts/PimlicoEntryPointSimulations.js +1 -1
  114. package/esm/types/contracts/PimlicoEntryPointSimulations.js.map +1 -1
  115. package/esm/types/contracts/index.d.ts +5 -1
  116. package/esm/types/contracts/index.js +5 -1
  117. package/esm/types/contracts/index.js.map +1 -1
  118. package/esm/types/interfaces.d.ts +2 -2
  119. package/esm/types/schemas.d.ts +94 -94
  120. package/esm/types/schemas.js +3 -3
  121. package/esm/types/schemas.js.map +1 -1
  122. package/esm/types/utils.d.ts +1 -1
  123. package/esm/utils/bigInt.js +2 -2
  124. package/esm/utils/bigInt.js.map +1 -1
  125. package/esm/utils/helpers.js +1 -1
  126. package/esm/utils/helpers.js.map +1 -1
  127. package/esm/utils/rpc-reply.d.ts +1 -1
  128. package/esm/utils/timedQueue.d.ts +12 -0
  129. package/esm/utils/timedQueue.js +51 -0
  130. package/esm/utils/timedQueue.js.map +1 -0
  131. package/esm/utils/userop.d.ts +2 -2
  132. package/esm/utils/userop.js +2 -2
  133. package/esm/utils/userop.js.map +1 -1
  134. package/esm/utils/validation.d.ts +14 -6
  135. package/esm/utils/validation.js +115 -132
  136. package/esm/utils/validation.js.map +1 -1
  137. package/lib/cli/alto.js +2 -0
  138. package/lib/cli/alto.js.map +1 -1
  139. package/lib/cli/config/bundler.d.ts +348 -306
  140. package/lib/cli/config/bundler.js +26 -7
  141. package/lib/cli/config/bundler.js.map +1 -1
  142. package/lib/cli/config/options.d.ts +2 -1
  143. package/lib/cli/config/options.js +47 -9
  144. package/lib/cli/config/options.js.map +1 -1
  145. package/lib/cli/customTransport.js +38 -5
  146. package/lib/cli/customTransport.js.map +1 -1
  147. package/lib/cli/deploySimulationsContract.d.ts +8 -0
  148. package/lib/cli/deploySimulationsContract.js +30 -0
  149. package/lib/cli/deploySimulationsContract.js.map +1 -0
  150. package/lib/cli/handler.d.ts +2 -2
  151. package/lib/cli/handler.js +66 -88
  152. package/lib/cli/handler.js.map +1 -1
  153. package/lib/cli/instrumentation.js +4 -2
  154. package/lib/cli/instrumentation.js.map +1 -1
  155. package/lib/cli/parseArgs.d.ts +8 -0
  156. package/lib/cli/parseArgs.js +25 -0
  157. package/lib/cli/parseArgs.js.map +1 -0
  158. package/lib/cli/setupServer.d.ts +4 -9
  159. package/lib/cli/setupServer.js +98 -82
  160. package/lib/cli/setupServer.js.map +1 -1
  161. package/lib/createConfig.d.ts +15 -0
  162. package/lib/createConfig.js +12 -0
  163. package/lib/createConfig.js.map +1 -0
  164. package/lib/executor/executor.d.ts +29 -13
  165. package/lib/executor/executor.js +106 -68
  166. package/lib/executor/executor.js.map +1 -1
  167. package/lib/executor/executorManager.d.ts +14 -10
  168. package/lib/executor/executorManager.js +40 -40
  169. package/lib/executor/executorManager.js.map +1 -1
  170. package/lib/executor/senderManager.d.ts +11 -6
  171. package/lib/executor/senderManager.js +25 -32
  172. package/lib/executor/senderManager.js.map +1 -1
  173. package/lib/executor/utilityWalletMonitor.d.ts +9 -5
  174. package/lib/executor/utilityWalletMonitor.js +8 -8
  175. package/lib/executor/utilityWalletMonitor.js.map +1 -1
  176. package/lib/executor/utils.d.ts +2 -1
  177. package/lib/executor/utils.js +9 -3
  178. package/lib/executor/utils.js.map +1 -1
  179. package/lib/handlers/arbitrumGasPriceManager.d.ts +11 -0
  180. package/lib/handlers/arbitrumGasPriceManager.js +33 -0
  181. package/lib/handlers/arbitrumGasPriceManager.js.map +1 -0
  182. package/lib/handlers/eventManager.d.ts +7 -3
  183. package/lib/handlers/eventManager.js +24 -16
  184. package/lib/handlers/eventManager.js.map +1 -1
  185. package/lib/handlers/gasPriceManager.d.ts +14 -27
  186. package/lib/handlers/gasPriceManager.js +80 -134
  187. package/lib/handlers/gasPriceManager.js.map +1 -1
  188. package/lib/handlers/mantleGasPriceManager.d.ts +20 -0
  189. package/lib/handlers/mantleGasPriceManager.js +32 -0
  190. package/lib/handlers/mantleGasPriceManager.js.map +1 -0
  191. package/lib/mempool/mempool.d.ts +13 -10
  192. package/lib/mempool/mempool.js +28 -25
  193. package/lib/mempool/mempool.js.map +1 -1
  194. package/lib/mempool/reputationManager.d.ts +4 -6
  195. package/lib/mempool/reputationManager.js +25 -29
  196. package/lib/mempool/reputationManager.js.map +1 -1
  197. package/lib/mempool/store.d.ts +1 -1
  198. package/lib/rpc/estimation/gasEstimationHandler.d.ts +24 -0
  199. package/lib/rpc/estimation/gasEstimationHandler.js +52 -0
  200. package/lib/rpc/estimation/gasEstimationHandler.js.map +1 -0
  201. package/lib/rpc/estimation/gasEstimationsV06.d.ts +19 -0
  202. package/lib/rpc/estimation/gasEstimationsV06.js +150 -0
  203. package/lib/rpc/estimation/gasEstimationsV06.js.map +1 -0
  204. package/lib/rpc/estimation/gasEstimationsV07.d.ts +88 -0
  205. package/lib/rpc/estimation/gasEstimationsV07.js +435 -0
  206. package/lib/rpc/estimation/gasEstimationsV07.js.map +1 -0
  207. package/lib/rpc/estimation/types.d.ts +113 -0
  208. package/lib/rpc/estimation/types.js +125 -0
  209. package/lib/rpc/estimation/types.js.map +1 -0
  210. package/lib/rpc/nonceQueuer.d.ts +10 -6
  211. package/lib/rpc/nonceQueuer.js +9 -9
  212. package/lib/rpc/nonceQueuer.js.map +1 -1
  213. package/lib/rpc/rpcHandler.d.ts +19 -16
  214. package/lib/rpc/rpcHandler.js +82 -71
  215. package/lib/rpc/rpcHandler.js.map +1 -1
  216. package/lib/rpc/server.d.ts +9 -7
  217. package/lib/rpc/server.js +26 -25
  218. package/lib/rpc/server.js.map +1 -1
  219. package/lib/rpc/validation/SafeValidator.d.ts +11 -6
  220. package/lib/rpc/validation/SafeValidator.js +16 -14
  221. package/lib/rpc/validation/SafeValidator.js.map +1 -1
  222. package/lib/rpc/validation/TracerResultParserV06.d.ts +1 -1
  223. package/lib/rpc/validation/TracerResultParserV07.d.ts +1 -1
  224. package/lib/rpc/validation/TracerResultParserV07.js +1 -1
  225. package/lib/rpc/validation/TracerResultParserV07.js.map +1 -1
  226. package/lib/rpc/validation/UnsafeValidator.d.ts +14 -17
  227. package/lib/rpc/validation/UnsafeValidator.js +49 -42
  228. package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
  229. package/lib/types/contracts/ArbitrumL1FeeAbi.d.ts +32 -0
  230. package/lib/types/contracts/ArbitrumL1FeeAbi.js +45 -0
  231. package/lib/types/contracts/ArbitrumL1FeeAbi.js.map +1 -0
  232. package/lib/types/contracts/EntryPointSimulationsV6.d.ts +34 -0
  233. package/lib/types/contracts/EntryPointSimulationsV6.js +51 -0
  234. package/lib/types/contracts/EntryPointSimulationsV6.js.map +1 -0
  235. package/lib/types/contracts/EntryPointSimulationsV7.d.ts +1370 -0
  236. package/lib/types/contracts/{EntryPointSimulations.js → EntryPointSimulationsV7.js} +198 -386
  237. package/lib/types/contracts/EntryPointSimulationsV7.js.map +1 -0
  238. package/lib/types/contracts/IAccountExecute.d.ts +53 -0
  239. package/lib/types/contracts/IAccountExecute.js +71 -0
  240. package/lib/types/contracts/IAccountExecute.js.map +1 -0
  241. package/lib/types/contracts/MantleBvmGasPriceOracle.d.ts +219 -0
  242. package/lib/types/contracts/MantleBvmGasPriceOracle.js +180 -0
  243. package/lib/types/contracts/MantleBvmGasPriceOracle.js.map +1 -0
  244. package/lib/types/contracts/OpL1FeeAbi.d.ts +26 -0
  245. package/lib/types/contracts/OpL1FeeAbi.js +32 -0
  246. package/lib/types/contracts/OpL1FeeAbi.js.map +1 -0
  247. package/lib/types/contracts/PimlicoEntryPointSimulations.d.ts +1 -1
  248. package/lib/types/contracts/PimlicoEntryPointSimulations.js +1 -1
  249. package/lib/types/contracts/PimlicoEntryPointSimulations.js.map +1 -1
  250. package/lib/types/contracts/index.d.ts +5 -1
  251. package/lib/types/contracts/index.js +5 -1
  252. package/lib/types/contracts/index.js.map +1 -1
  253. package/lib/types/interfaces.d.ts +2 -2
  254. package/lib/types/schemas.d.ts +94 -94
  255. package/lib/types/schemas.js +3 -3
  256. package/lib/types/schemas.js.map +1 -1
  257. package/lib/types/utils.d.ts +1 -1
  258. package/lib/utils/bigInt.js +2 -2
  259. package/lib/utils/bigInt.js.map +1 -1
  260. package/lib/utils/rpc-reply.d.ts +1 -1
  261. package/lib/utils/timedQueue.d.ts +12 -0
  262. package/lib/utils/timedQueue.js +55 -0
  263. package/lib/utils/timedQueue.js.map +1 -0
  264. package/lib/utils/userop.d.ts +2 -2
  265. package/lib/utils/userop.js +1 -1
  266. package/lib/utils/userop.js.map +1 -1
  267. package/lib/utils/validation.d.ts +14 -6
  268. package/lib/utils/validation.js +118 -134
  269. package/lib/utils/validation.js.map +1 -1
  270. package/package.json +1 -1
  271. package/esm/rpc/EntryPointSimulationsV07.d.ts +0 -62
  272. package/esm/rpc/EntryPointSimulationsV07.js +0 -410
  273. package/esm/rpc/EntryPointSimulationsV07.js.map +0 -1
  274. package/esm/rpc/ExecuteSimulator.d.ts +0 -37
  275. package/esm/rpc/ExecuteSimulator.js +0 -48
  276. package/esm/rpc/ExecuteSimulator.js.map +0 -1
  277. package/esm/rpc/gasEstimation.d.ts +0 -17
  278. package/esm/rpc/gasEstimation.js +0 -419
  279. package/esm/rpc/gasEstimation.js.map +0 -1
  280. package/esm/types/contracts/EntryPointSimulations.d.ts +0 -152
  281. package/esm/types/contracts/EntryPointSimulations.js.map +0 -1
  282. package/lib/rpc/EntryPointSimulationsV07.d.ts +0 -62
  283. package/lib/rpc/EntryPointSimulationsV07.js +0 -417
  284. package/lib/rpc/EntryPointSimulationsV07.js.map +0 -1
  285. package/lib/rpc/ExecuteSimulator.d.ts +0 -37
  286. package/lib/rpc/ExecuteSimulator.js +0 -51
  287. package/lib/rpc/ExecuteSimulator.js.map +0 -1
  288. package/lib/rpc/gasEstimation.d.ts +0 -17
  289. package/lib/rpc/gasEstimation.js +0 -426
  290. package/lib/rpc/gasEstimation.js.map +0 -1
  291. package/lib/types/contracts/EntryPointSimulations.d.ts +0 -152
  292. package/lib/types/contracts/EntryPointSimulations.js.map +0 -1
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.simulationValidationResultStruct = void 0;
4
+ exports.simulationValidationResultStruct = [
5
+ {
6
+ components: [
7
+ {
8
+ components: [
9
+ {
10
+ internalType: "uint256",
11
+ name: "preOpGas",
12
+ type: "uint256"
13
+ },
14
+ {
15
+ internalType: "uint256",
16
+ name: "prefund",
17
+ type: "uint256"
18
+ },
19
+ {
20
+ internalType: "uint256",
21
+ name: "accountValidationData",
22
+ type: "uint256"
23
+ },
24
+ {
25
+ internalType: "uint256",
26
+ name: "paymasterValidationData",
27
+ type: "uint256"
28
+ },
29
+ {
30
+ internalType: "bytes",
31
+ name: "paymasterContext",
32
+ type: "bytes"
33
+ }
34
+ ],
35
+ internalType: "struct IEntryPoint.ReturnInfo",
36
+ name: "returnInfo",
37
+ type: "tuple"
38
+ },
39
+ {
40
+ components: [
41
+ {
42
+ internalType: "uint256",
43
+ name: "stake",
44
+ type: "uint256"
45
+ },
46
+ {
47
+ internalType: "uint256",
48
+ name: "unstakeDelaySec",
49
+ type: "uint256"
50
+ }
51
+ ],
52
+ internalType: "struct IStakeManager.StakeInfo",
53
+ name: "senderInfo",
54
+ type: "tuple"
55
+ },
56
+ {
57
+ components: [
58
+ {
59
+ internalType: "uint256",
60
+ name: "stake",
61
+ type: "uint256"
62
+ },
63
+ {
64
+ internalType: "uint256",
65
+ name: "unstakeDelaySec",
66
+ type: "uint256"
67
+ }
68
+ ],
69
+ internalType: "struct IStakeManager.StakeInfo",
70
+ name: "factoryInfo",
71
+ type: "tuple"
72
+ },
73
+ {
74
+ components: [
75
+ {
76
+ internalType: "uint256",
77
+ name: "stake",
78
+ type: "uint256"
79
+ },
80
+ {
81
+ internalType: "uint256",
82
+ name: "unstakeDelaySec",
83
+ type: "uint256"
84
+ }
85
+ ],
86
+ internalType: "struct IStakeManager.StakeInfo",
87
+ name: "paymasterInfo",
88
+ type: "tuple"
89
+ },
90
+ {
91
+ components: [
92
+ {
93
+ internalType: "address",
94
+ name: "aggregator",
95
+ type: "address"
96
+ },
97
+ {
98
+ components: [
99
+ {
100
+ internalType: "uint256",
101
+ name: "stake",
102
+ type: "uint256"
103
+ },
104
+ {
105
+ internalType: "uint256",
106
+ name: "unstakeDelaySec",
107
+ type: "uint256"
108
+ }
109
+ ],
110
+ internalType: "struct IStakeManager.StakeInfo",
111
+ name: "stakeInfo",
112
+ type: "tuple"
113
+ }
114
+ ],
115
+ internalType: "struct IEntryPoint.AggregatorStakeInfo",
116
+ name: "aggregatorInfo",
117
+ type: "tuple"
118
+ }
119
+ ],
120
+ internalType: "struct IEntryPointSimulations.ValidationResult",
121
+ name: "",
122
+ type: "tuple"
123
+ }
124
+ ];
125
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../rpc/estimation/types.ts"],"names":[],"mappings":";;;AAsCa,QAAA,gCAAgC,GAAG;IAC5C;QACI,UAAU,EAAE;YACR;gBACI,UAAU,EAAE;oBACR;wBACI,YAAY,EAAE,SAAS;wBACvB,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,SAAS;qBAClB;oBACD;wBACI,YAAY,EAAE,SAAS;wBACvB,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,SAAS;qBAClB;oBACD;wBACI,YAAY,EAAE,SAAS;wBACvB,IAAI,EAAE,uBAAuB;wBAC7B,IAAI,EAAE,SAAS;qBAClB;oBACD;wBACI,YAAY,EAAE,SAAS;wBACvB,IA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AU,EAAE;4BACR;gCACI,YAAY,EAAE,SAAS;gCACvB,IAAI,EAAE,OAAO;gCACb,IAAI,EAAE,SAAS;6BAClB;4BACD;gCACI,YAAY,EAAE,SAAS;gCACvB,IAAI,EAAE,iBAAiB;gCACvB,IAAI,EAAE,SAAS;6BAClB;yBACJ;wBACD,YAAY,EAAE,gCAAgC;wBAC9C,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,OAAO;qBAChB;iBACJ;gBACD,YAAY,EAAE,wCAAwC;gBACtD,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,OAAO;aAChB;SACJ;QACD,YAAY,EAAE,gDAAgD;QAC9D,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,OAAO;KAChB;CACK,CAAA"}
@@ -1,8 +1,9 @@
1
+ import type { EventManager } from "../handlers/index.js";
2
+ import type { MemoryMempool } from "../mempool/index.js";
1
3
  import { type MempoolUserOperation } from "../types/index.js";
2
4
  import type { Logger } from "../utils/index.js";
3
- import { type Address, type Chain, type Hash, type PublicClient, type Transport } from "viem";
4
- import type { MemoryMempool } from "../mempool/index.js";
5
- import type { EventManager } from "../handlers/index.js";
5
+ import { type Address, type Hash, type PublicClient } from "viem";
6
+ import type { AltoConfig } from "../createConfig.js";
6
7
  type QueuedUserOperation = {
7
8
  entryPoint: Address;
8
9
  userOperationHash: Hash;
@@ -13,12 +14,15 @@ type QueuedUserOperation = {
13
14
  };
14
15
  export declare class NonceQueuer {
15
16
  queuedUserOperations: QueuedUserOperation[];
17
+ config: AltoConfig;
16
18
  mempool: MemoryMempool;
17
- publicClient: PublicClient<Transport, Chain>;
18
19
  logger: Logger;
19
- blockTagSupport: boolean;
20
20
  eventManager: EventManager;
21
- constructor(mempool: MemoryMempool, publicClient: PublicClient<Transport, Chain>, logger: Logger, blockTagSupport: boolean, eventManager: EventManager);
21
+ constructor({ config, mempool, eventManager }: {
22
+ config: AltoConfig;
23
+ mempool: MemoryMempool;
24
+ eventManager: EventManager;
25
+ });
22
26
  process(): Promise<void>;
23
27
  add(mempoolUserOperation: MempoolUserOperation, entryPoint: Address): void;
24
28
  resubmitUserOperation(mempoolUserOperation: MempoolUserOperation, entryPoint: Address): void;
@@ -6,16 +6,16 @@ const utils_1 = require("../utils/index.js");
6
6
  const viem_1 = require("viem");
7
7
  class NonceQueuer {
8
8
  queuedUserOperations = [];
9
+ config;
9
10
  mempool;
10
- publicClient;
11
11
  logger;
12
- blockTagSupport;
13
12
  eventManager;
14
- constructor(mempool, publicClient, logger, blockTagSupport, eventManager) {
13
+ constructor({ config, mempool, eventManager }) {
14
+ this.config = config;
15
15
  this.mempool = mempool;
16
- this.publicClient = publicClient;
17
- this.logger = logger;
18
- this.blockTagSupport = blockTagSupport;
16
+ this.logger = config.getLogger({ module: "nonce_queuer" }, {
17
+ level: config.nonceQueuerLogLevel || config.logLevel
18
+ });
19
19
  this.eventManager = eventManager;
20
20
  setInterval(() => {
21
21
  this.process();
@@ -29,7 +29,7 @@ class NonceQueuer {
29
29
  if (this.queuedUserOperations.length === 0) {
30
30
  return;
31
31
  }
32
- const availableOps = await this.getAvailableUserOperations(this.publicClient);
32
+ const availableOps = await this.getAvailableUserOperations(this.config.publicClient);
33
33
  if (availableOps.length === 0) {
34
34
  return;
35
35
  }
@@ -46,7 +46,7 @@ class NonceQueuer {
46
46
  add(mempoolUserOperation, entryPoint) {
47
47
  const userOperation = (0, types_1.deriveUserOperation)(mempoolUserOperation);
48
48
  const [nonceKey, nonceValue] = (0, utils_1.getNonceKeyAndValue)(userOperation.nonce);
49
- const hash = (0, utils_1.getUserOperationHash)((0, types_1.deriveUserOperation)(mempoolUserOperation), entryPoint, this.publicClient.chain.id);
49
+ const hash = (0, utils_1.getUserOperationHash)((0, types_1.deriveUserOperation)(mempoolUserOperation), entryPoint, this.config.publicClient.chain.id);
50
50
  this.queuedUserOperations.push({
51
51
  entryPoint,
52
52
  userOperationHash: hash,
@@ -83,7 +83,7 @@ class NonceQueuer {
83
83
  args: [userOperation.sender, qop.nonceKey]
84
84
  };
85
85
  }),
86
- blockTag: this.blockTagSupport ? "latest" : undefined
86
+ blockTag: this.config.blockTagSupport ? "latest" : undefined
87
87
  });
88
88
  }
89
89
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"nonceQueuer.js","sourceRoot":"","sources":["../../rpc/nonceQueuer.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AAEpB,uCAIoB;AACpB,+BAQa;AAab,MAAa,WAAW;IACpB,oBAAoB,GAA0B,EAAE,CAAA;IAEhD,OAAO,CAAe;IACtB,YAAY,CAAgC;IAC5C,MAAM,CAAQ;IACd,eAAe,CAAS;IACxB,YAAY,CAAc;IAE1B,YACI,OAAsB,EACtB,YAA4C,EAC5C,MAAc,EACd,eAAwB,EACxB,YAA0B;QAE1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;QACtC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAEhC,WAAW,CAAC,GAAG,EAAE;YACb,IAAI,CAAC,OAAO,EAAE,CAAA;QAClB,CAAC,EAAE,IAAI,CAAC,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,OAAO;QACT,yEAAyE;QACzE,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;YACjE,OAAO,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAA;QACpD,CAAC,CAAC,CAAA;QAEF,IAAI,IAAI,CAAC,oBAAoB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzC,OAAM;QACV,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,0BAA0B,CACtD,IAAI,CAAC,YAAY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O,CAAC,MAAM,KAAK,oBAAoB,CAAC,MAAM,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;YAC1C,OAAO,EAAE,CAAA;QACb,CAAC;QAED,MAAM,qBAAqB,GAA0B,EAAE,CAAA;QAEvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,oBAAoB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACnD,MAAM,GAAG,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAA;YACnC,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;YAEzB,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9B,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EACvB,sBAAsB,CACzB,CAAA;gBACD,SAAQ;YACZ,CAAC;YAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAA;YAEvC,IAAI,iBAAiB,KAAK,GAAG,CAAC,UAAU,EAAE,CAAC;gBACvC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACnC,CAAC;QACL,CAAC;QAED,OAAO,qBAAqB,CAAA;IAChC,CAAC;CACJ;AA9MD,kCA8MC"}
@@ -1,11 +1,12 @@
1
1
  import type { Executor, ExecutorManager } from "../executor/index.js";
2
+ import type { CompressionHandler, EventManager, GasPriceManager } from "../handlers/index.js";
2
3
  import type { InterfaceReputationManager, MemoryMempool, Monitor } from "../mempool/index.js";
3
- import type { ApiVersion, StateOverrides, GasPriceMultipliers, ChainType } from "../types/index.js";
4
+ import type { ApiVersion, StateOverrides } from "../types/index.js";
4
5
  import { type Address, type BundlerClearMempoolResponseResult, type BundlerClearStateResponseResult, type BundlerDumpMempoolResponseResult, type BundlerDumpReputationsResponseResult, type BundlerGetStakeStatusResponseResult, type BundlerRequest, type BundlerResponse, type BundlerSendBundleNowResponseResult, type BundlerSetBundlingModeResponseResult, type BundlerSetReputationsRequestParams, type BundlingMode, type ChainIdResponseResult, type EstimateUserOperationGasResponseResult, type GetUserOperationByHashResponseResult, type GetUserOperationReceiptResponseResult, type HexData32, type InterfaceValidator, type MempoolUserOperation, type PimlicoGetUserOperationGasPriceResponseResult, type PimlicoGetUserOperationStatusResponseResult, type SendUserOperationResponseResult, type SupportedEntryPointsResponseResult, type UserOperation } from "../types/index.js";
5
6
  import type { Logger, Metrics } from "../utils/index.js";
6
- import type { GasPriceManager, CompressionHandler, EventManager } from "../handlers/index.js";
7
- import { type Chain, type Hex, type PublicClient, type Transport } from "viem";
7
+ import { type Hex } from "viem";
8
8
  import type { NonceQueuer } from "./nonceQueuer.js";
9
+ import type { AltoConfig } from "../createConfig.js";
9
10
  export interface IRpcEndpoint {
10
11
  handleMethod(request: BundlerRequest, apiVersion: ApiVersion): Promise<BundlerResponse>;
11
12
  eth_chainId(): ChainIdResponseResult;
@@ -16,31 +17,33 @@ export interface IRpcEndpoint {
16
17
  eth_getUserOperationReceipt(userOperationHash: HexData32): Promise<GetUserOperationReceiptResponseResult>;
17
18
  }
18
19
  export declare class RpcHandler implements IRpcEndpoint {
19
- entryPoints: Address[];
20
- publicClient: PublicClient<Transport, Chain>;
20
+ config: AltoConfig;
21
21
  validator: InterfaceValidator;
22
22
  mempool: MemoryMempool;
23
23
  executor: Executor;
24
24
  monitor: Monitor;
25
25
  nonceQueuer: NonceQueuer;
26
- usingTenderly: boolean;
27
- rpcMaxBlockRange: number | undefined;
28
26
  logger: Logger;
29
27
  metrics: Metrics;
30
- chainId: number;
31
- chainType: ChainType;
32
- enableDebugEndpoints: boolean;
33
28
  executorManager: ExecutorManager;
34
29
  reputationManager: InterfaceReputationManager;
35
30
  compressionHandler: CompressionHandler | null;
36
- legacyTransactions: boolean;
37
- dangerousSkipUserOperationValidation: boolean;
38
31
  gasPriceManager: GasPriceManager;
39
- gasPriceMultipliers: GasPriceMultipliers;
40
- paymasterGasLimitMultiplier: bigint;
41
32
  eventManager: EventManager;
42
- enableInstantBundlingEndpoint: boolean;
43
- constructor(entryPoints: Address[], publicClient: PublicClient<Transport, Chain>, validator: InterfaceValidator, mempool: MemoryMempool, executor: Executor, monitor: Monitor, nonceQueuer: NonceQueuer, executorManager: ExecutorManager, reputationManager: InterfaceReputationManager, usingTenderly: boolean, rpcMaxBlockRange: number | undefined, logger: Logger, metrics: Metrics, enableDebugEndpoints: boolean, compressionHandler: CompressionHandler | null, legacyTransactions: boolean, gasPriceManager: GasPriceManager, gasPriceMultipliers: GasPriceMultipliers, chainType: ChainType, paymasterGasLimitMultiplier: bigint, eventManager: EventManager, enableInstantBundlingEndpoint: boolean, dangerousSkipUserOperationValidation?: boolean);
33
+ constructor({ config, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, metrics, compressionHandler, gasPriceManager, eventManager }: {
34
+ config: AltoConfig;
35
+ validator: InterfaceValidator;
36
+ mempool: MemoryMempool;
37
+ executor: Executor;
38
+ monitor: Monitor;
39
+ nonceQueuer: NonceQueuer;
40
+ executorManager: ExecutorManager;
41
+ reputationManager: InterfaceReputationManager;
42
+ metrics: Metrics;
43
+ compressionHandler: CompressionHandler | null;
44
+ eventManager: EventManager;
45
+ gasPriceManager: GasPriceManager;
46
+ });
44
47
  handleMethod(request: BundlerRequest, apiVersion: ApiVersion): Promise<BundlerResponse>;
45
48
  ensureEntryPointIsSupported(entryPoint: Address): void;
46
49
  ensureDebugEndpointsAreEnabled(methodName: string): void;
@@ -6,55 +6,34 @@ const utils_1 = require("../utils/index.js");
6
6
  const viem_1 = require("viem");
7
7
  const chains_1 = require("viem/chains");
8
8
  class RpcHandler {
9
- entryPoints;
10
- publicClient;
9
+ config;
11
10
  validator;
12
11
  mempool;
13
12
  executor;
14
13
  monitor;
15
14
  nonceQueuer;
16
- usingTenderly;
17
- rpcMaxBlockRange;
18
15
  logger;
19
16
  metrics;
20
- chainId;
21
- chainType;
22
- enableDebugEndpoints;
23
17
  executorManager;
24
18
  reputationManager;
25
19
  compressionHandler;
26
- legacyTransactions;
27
- dangerousSkipUserOperationValidation;
28
20
  gasPriceManager;
29
- gasPriceMultipliers;
30
- paymasterGasLimitMultiplier;
31
21
  eventManager;
32
- enableInstantBundlingEndpoint;
33
- constructor(entryPoints, publicClient, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, usingTenderly, rpcMaxBlockRange, logger, metrics, enableDebugEndpoints, compressionHandler, legacyTransactions, gasPriceManager, gasPriceMultipliers, chainType, paymasterGasLimitMultiplier, eventManager, enableInstantBundlingEndpoint, dangerousSkipUserOperationValidation = false) {
34
- this.entryPoints = entryPoints;
35
- this.publicClient = publicClient;
22
+ constructor({ config, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, metrics, compressionHandler, gasPriceManager, eventManager }) {
23
+ this.config = config;
36
24
  this.validator = validator;
37
25
  this.mempool = mempool;
38
26
  this.executor = executor;
39
27
  this.monitor = monitor;
40
28
  this.nonceQueuer = nonceQueuer;
41
- this.usingTenderly = usingTenderly;
42
- this.rpcMaxBlockRange = rpcMaxBlockRange;
43
- this.logger = logger;
29
+ this.logger = config.getLogger({ module: "rpc" }, {
30
+ level: config.rpcLogLevel || config.logLevel
31
+ });
44
32
  this.metrics = metrics;
45
- this.enableDebugEndpoints = enableDebugEndpoints;
46
- this.chainId = publicClient.chain.id;
47
33
  this.executorManager = executorManager;
48
34
  this.reputationManager = reputationManager;
49
35
  this.compressionHandler = compressionHandler;
50
- this.legacyTransactions = legacyTransactions;
51
- this.dangerousSkipUserOperationValidation =
52
- dangerousSkipUserOperationValidation;
53
- this.gasPriceMultipliers = gasPriceMultipliers;
54
- this.chainType = chainType;
55
36
  this.gasPriceManager = gasPriceManager;
56
- this.paymasterGasLimitMultiplier = paymasterGasLimitMultiplier;
57
- this.enableInstantBundlingEndpoint = enableInstantBundlingEndpoint;
58
37
  this.eventManager = eventManager;
59
38
  }
60
39
  async handleMethod(request, apiVersion) {
@@ -154,17 +133,17 @@ class RpcHandler {
154
133
  }
155
134
  }
156
135
  ensureEntryPointIsSupported(entryPoint) {
157
- if (!this.entryPoints.includes(entryPoint)) {
158
- throw new Error(`EntryPoint ${entryPoint} not supported, supported EntryPoints: ${this.entryPoints.join(", ")}`);
136
+ if (!this.config.entrypoints.includes(entryPoint)) {
137
+ throw new Error(`EntryPoint ${entryPoint} not supported, supported EntryPoints: ${this.config.entrypoints.join(", ")}`);
159
138
  }
160
139
  }
161
140
  ensureDebugEndpointsAreEnabled(methodName) {
162
- if (!this.enableDebugEndpoints) {
141
+ if (!this.config.enableDebugEndpoints) {
163
142
  throw new types_1.RpcError(`${methodName} is only available in development environment`);
164
143
  }
165
144
  }
166
145
  async preMempoolChecks(opHash, userOperation, apiVersion, entryPoint) {
167
- if (this.legacyTransactions &&
146
+ if (this.config.legacyTransactions &&
168
147
  userOperation.maxFeePerGas !== userOperation.maxPriorityFeePerGas) {
169
148
  const reason = "maxPriorityFeePerGas must equal maxFeePerGas on chains that don't support EIP-1559";
170
149
  this.eventManager.emitFailedValidation(opHash, reason);
@@ -190,24 +169,38 @@ class RpcHandler {
190
169
  }
191
170
  }
192
171
  eth_chainId() {
193
- return BigInt(this.chainId);
172
+ return BigInt(this.config.publicClient.chain.id);
194
173
  }
195
174
  eth_supportedEntryPoints() {
196
- return this.entryPoints;
175
+ return this.config.entrypoints;
197
176
  }
198
177
  async eth_estimateUserOperationGas(apiVersion, userOperation, entryPoint, stateOverrides) {
199
178
  this.ensureEntryPointIsSupported(entryPoint);
200
179
  if (userOperation.maxFeePerGas === 0n) {
201
180
  throw new types_1.RpcError("user operation max fee per gas must be larger than 0 during gas estimation");
202
181
  }
203
- const preVerificationGas = ((await (0, utils_1.calcPreVerificationGas)(this.publicClient, userOperation, entryPoint, this.chainId, this.chainType, this.gasPriceManager, false)) *
204
- 110n) /
205
- 100n;
206
- userOperation.preVerificationGas = 1000000n;
207
- userOperation.verificationGasLimit = 10000000n;
208
- userOperation.callGasLimit = 10000000n;
209
- if (this.chainId === chains_1.base.id) {
182
+ let preVerificationGas = await (0, utils_1.calcPreVerificationGas)({
183
+ config: this.config,
184
+ userOperation,
185
+ entryPoint,
186
+ gasPriceManager: this.gasPriceManager,
187
+ validate: false
188
+ });
189
+ preVerificationGas = (0, utils_1.scaleBigIntByPercent)(preVerificationGas, 110);
190
+ // biome-ignore lint/style/noParameterAssign: prepare userOperaiton for simulation
191
+ userOperation = {
192
+ ...userOperation,
193
+ preVerificationGas,
194
+ verificationGasLimit: 10000000n,
195
+ callGasLimit: 10000000n
196
+ };
197
+ if (this.config.publicClient.chain.id === chains_1.base.id) {
198
+ userOperation.verificationGasLimit = 5000000n;
199
+ }
200
+ if (this.config.chainType === "hedera") {
201
+ // The eth_call gasLimit is set to 12_500_000 on Hedera.
210
202
  userOperation.verificationGasLimit = 5000000n;
203
+ userOperation.callGasLimit = 4500000n;
211
204
  }
212
205
  if ((0, utils_1.isVersion07)(userOperation)) {
213
206
  userOperation.paymasterPostOpGasLimit = 2000000n;
@@ -238,8 +231,8 @@ class RpcHandler {
238
231
  throw new types_1.RpcError("UserOperation reverted during simulation with reason: AA25 invalid account nonce", types_1.ValidationErrors.InvalidFields);
239
232
  }
240
233
  }
241
- const executionResult = await this.validator.getExecutionResult(userOperation, entryPoint, queuedUserOperations, stateOverrides);
242
- let { verificationGasLimit, callGasLimit } = (0, utils_1.calcVerificationGasAndCallGasLimit)(userOperation, executionResult.data.executionResult, this.chainId, executionResult.data.callDataResult);
234
+ const executionResult = await this.validator.getExecutionResult(userOperation, entryPoint, queuedUserOperations, true, stateOverrides);
235
+ let { verificationGasLimit, callGasLimit } = (0, utils_1.calcVerificationGasAndCallGasLimit)(userOperation, executionResult.data.executionResult, this.config.publicClient.chain.id, executionResult.data.callDataResult);
243
236
  let paymasterVerificationGasLimit = 0n;
244
237
  let paymasterPostOpGasLimit = 0n;
245
238
  if ((0, utils_1.isVersion07)(userOperation) &&
@@ -253,21 +246,36 @@ class RpcHandler {
253
246
  paymasterPostOpGasLimit =
254
247
  executionResult.data.executionResult.paymasterPostOpGasLimit ||
255
248
  1n;
256
- const multiplier = this.paymasterGasLimitMultiplier;
257
- paymasterVerificationGasLimit =
258
- (paymasterVerificationGasLimit * multiplier) / 100n;
259
- paymasterPostOpGasLimit =
260
- (paymasterPostOpGasLimit * multiplier) / 100n;
249
+ const multiplier = Number(this.config.paymasterGasLimitMultiplier);
250
+ paymasterVerificationGasLimit = (0, utils_1.scaleBigIntByPercent)(paymasterVerificationGasLimit, multiplier);
251
+ paymasterPostOpGasLimit = (0, utils_1.scaleBigIntByPercent)(paymasterPostOpGasLimit, multiplier);
261
252
  }
262
- if (this.chainId === chains_1.base.id || this.chainId === chains_1.baseSepolia.id) {
253
+ if (this.config.publicClient.chain.id === chains_1.base.id ||
254
+ this.config.publicClient.chain.id === chains_1.baseSepolia.id) {
263
255
  callGasLimit += 10000n;
264
256
  }
265
- if (this.chainId === chains_1.base.id || this.chainId === chains_1.optimism.id) {
257
+ if (this.config.publicClient.chain.id === chains_1.base.id ||
258
+ this.config.publicClient.chain.id === chains_1.optimism.id) {
266
259
  callGasLimit = (0, utils_1.maxBigInt)(callGasLimit, 120000n);
267
260
  }
268
261
  if (userOperation.callData === "0x") {
269
262
  callGasLimit = 0n;
270
263
  }
264
+ if ((0, utils_1.isVersion06)(userOperation)) {
265
+ callGasLimit = (0, utils_1.scaleBigIntByPercent)(callGasLimit, Number(this.config.callGasLimitMultiplier));
266
+ }
267
+ // If a balance override is provided for the sender, perform an additional simulation
268
+ // to verify the userOperation succeeds with the specified balance.
269
+ if (stateOverrides?.[userOperation.sender]?.balance) {
270
+ await this.validator.getExecutionResult({
271
+ ...userOperation,
272
+ preVerificationGas,
273
+ verificationGasLimit,
274
+ callGasLimit,
275
+ paymasterVerificationGasLimit,
276
+ paymasterPostOpGasLimit
277
+ }, entryPoint, queuedUserOperations, false, (0, utils_1.deepHexlify)(stateOverrides));
278
+ }
271
279
  if ((0, utils_1.isVersion07)(userOperation)) {
272
280
  return {
273
281
  preVerificationGas,
@@ -292,7 +300,7 @@ class RpcHandler {
292
300
  };
293
301
  }
294
302
  async eth_sendUserOperation(apiVersion, userOperation, entryPoint) {
295
- const hash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.chainId);
303
+ const hash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.config.publicClient.chain.id);
296
304
  this.eventManager.emitReceived(hash);
297
305
  let status = "rejected";
298
306
  try {
@@ -317,18 +325,18 @@ class RpcHandler {
317
325
  abi: types_1.EntryPointV06Abi,
318
326
  name: "UserOperationEvent"
319
327
  });
320
- let fromBlock = undefined;
321
- let toBlock = undefined;
322
- if (this.rpcMaxBlockRange !== undefined) {
323
- const latestBlock = await this.publicClient.getBlockNumber();
324
- fromBlock = latestBlock - BigInt(this.rpcMaxBlockRange);
328
+ let fromBlock;
329
+ let toBlock;
330
+ if (this.config.maxBlockRange !== undefined) {
331
+ const latestBlock = await this.config.publicClient.getBlockNumber();
332
+ fromBlock = latestBlock - BigInt(this.config.maxBlockRange);
325
333
  if (fromBlock < 0n) {
326
334
  fromBlock = 0n;
327
335
  }
328
336
  toBlock = "latest";
329
337
  }
330
- const filterResult = await this.publicClient.getLogs({
331
- address: this.entryPoints,
338
+ const filterResult = await this.config.publicClient.getLogs({
339
+ address: this.config.entrypoints,
332
340
  event: userOperationEventAbiItem,
333
341
  fromBlock,
334
342
  toBlock,
@@ -347,7 +355,9 @@ class RpcHandler {
347
355
  }
348
356
  const getTransaction = async (txHash) => {
349
357
  try {
350
- return await this.publicClient.getTransaction({ hash: txHash });
358
+ return await this.config.publicClient.getTransaction({
359
+ hash: txHash
360
+ });
351
361
  }
352
362
  catch (e) {
353
363
  if (e instanceof viem_1.TransactionNotFoundError) {
@@ -454,11 +464,11 @@ class RpcHandler {
454
464
  }
455
465
  async pimlico_getUserOperationGasPrice() {
456
466
  let { maxFeePerGas, maxPriorityFeePerGas } = await this.gasPriceManager.getGasPrice();
457
- if (this.chainType === "hedera") {
467
+ if (this.config.chainType === "hedera") {
458
468
  maxFeePerGas /= 10n ** 9n;
459
469
  maxPriorityFeePerGas /= 10n ** 9n;
460
470
  }
461
- const { slow, standard, fast } = this.gasPriceMultipliers;
471
+ const { slow, standard, fast } = this.config.gasPriceMultipliers;
462
472
  return {
463
473
  slow: {
464
474
  maxFeePerGas: (maxFeePerGas * slow) / 100n,
@@ -478,7 +488,7 @@ class RpcHandler {
478
488
  async addToMempoolIfValid(op, entryPoint, apiVersion) {
479
489
  this.ensureEntryPointIsSupported(entryPoint);
480
490
  const userOperation = (0, types_1.deriveUserOperation)(op);
481
- const opHash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.chainId);
491
+ const opHash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.config.publicClient.chain.id);
482
492
  await this.preMempoolChecks(opHash, userOperation, apiVersion, entryPoint);
483
493
  const currentNonceValue = await this.getNonceValue(userOperation, entryPoint);
484
494
  const [, userOperationNonceValue] = (0, utils_1.getNonceKeyAndValue)(userOperation.nonce);
@@ -499,11 +509,11 @@ class RpcHandler {
499
509
  }
500
510
  if (userOperationNonceValue ===
501
511
  currentNonceValue + BigInt(queuedUserOperations.length)) {
502
- if (this.dangerousSkipUserOperationValidation) {
512
+ if (this.config.dangerousSkipUserOperationValidation) {
503
513
  const [success, errorReason] = this.mempool.add(op, entryPoint);
504
514
  if (!success) {
505
515
  this.eventManager.emitFailedValidation(opHash, errorReason, (0, utils_1.getAAError)(errorReason));
506
- throw new types_1.RpcError(`UserOperation reverted during simulation with reason: ${errorReason}`, types_1.ValidationErrors.InvalidFields);
516
+ throw new types_1.RpcError(errorReason, types_1.ValidationErrors.InvalidFields);
507
517
  }
508
518
  }
509
519
  else {
@@ -516,7 +526,7 @@ class RpcHandler {
516
526
  const [success, errorReason] = this.mempool.add(op, entryPoint, validationResult.referencedContracts);
517
527
  if (!success) {
518
528
  this.eventManager.emitFailedValidation(opHash, errorReason, (0, utils_1.getAAError)(errorReason));
519
- throw new types_1.RpcError(`UserOperation reverted during simulation with reason: ${errorReason}`, types_1.ValidationErrors.InvalidFields);
529
+ throw new types_1.RpcError(errorReason, types_1.ValidationErrors.InvalidFields);
520
530
  }
521
531
  return "added";
522
532
  }
@@ -525,11 +535,11 @@ class RpcHandler {
525
535
  return "queued";
526
536
  }
527
537
  async pimlico_sendUserOperationNow(apiVersion, userOperation, entryPoint) {
528
- if (!this.enableInstantBundlingEndpoint) {
538
+ if (!this.config.enableInstantBundlingEndpoint) {
529
539
  throw new types_1.RpcError("pimlico_sendUserOperationNow endpoint is not enabled", types_1.ValidationErrors.InvalidFields);
530
540
  }
531
541
  this.ensureEntryPointIsSupported(entryPoint);
532
- const opHash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.chainId);
542
+ const opHash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.config.publicClient.chain.id);
533
543
  await this.preMempoolChecks(opHash, userOperation, apiVersion, entryPoint);
534
544
  const result = (await this.executor.bundle(entryPoint, [userOperation]))[0];
535
545
  if (result.status === "failure") {
@@ -550,8 +560,9 @@ class RpcHandler {
550
560
  throw new types_1.RpcError(`userOperation reverted during simulation with reason: ${error.reason}`);
551
561
  }
552
562
  const res = result;
563
+ this.executor.markWalletProcessed(res.value.transactionInfo.executor);
553
564
  // wait for receipt
554
- const receipt = await this.publicClient.waitForTransactionReceipt({
565
+ const receipt = await this.config.publicClient.waitForTransactionReceipt({
555
566
  hash: res.value.transactionInfo.transactionHash,
556
567
  pollingInterval: 100
557
568
  });
@@ -563,7 +574,7 @@ class RpcHandler {
563
574
  let status = "rejected";
564
575
  try {
565
576
  const { inflatedOp, inflatorId } = await this.validateAndInflateCompressedUserOperation(inflatorAddress, compressedCalldata);
566
- const hash = (0, utils_1.getUserOperationHash)(inflatedOp, entryPoint, this.chainId);
577
+ const hash = (0, utils_1.getUserOperationHash)(inflatedOp, entryPoint, this.config.publicClient.chain.id);
567
578
  this.eventManager.emitReceived(hash, receivedTimestamp);
568
579
  const compressedUserOp = {
569
580
  compressedCalldata,
@@ -593,7 +604,7 @@ class RpcHandler {
593
604
  if (this.compressionHandler === null) {
594
605
  throw new types_1.RpcError("Endpoint not supported");
595
606
  }
596
- const inflatorId = await this.compressionHandler.getInflatorRegisteredId(inflatorAddress, this.publicClient);
607
+ const inflatorId = await this.compressionHandler.getInflatorRegisteredId(inflatorAddress, this.config.publicClient);
597
608
  if (inflatorId === 0) {
598
609
  throw new types_1.RpcError(`Inflator ${inflatorAddress} is not registered`, types_1.ValidationErrors.InvalidFields);
599
610
  }
@@ -602,7 +613,7 @@ class RpcHandler {
602
613
  address: inflatorAddress,
603
614
  abi: types_1.IOpInflatorAbi,
604
615
  client: {
605
- public: this.publicClient
616
+ public: this.config.publicClient
606
617
  }
607
618
  });
608
619
  let inflatedOp;
@@ -628,7 +639,7 @@ class RpcHandler {
628
639
  ? types_1.EntryPointV06Abi
629
640
  : types_1.EntryPointV07Abi,
630
641
  client: {
631
- public: this.publicClient
642
+ public: this.config.publicClient
632
643
  }
633
644
  });
634
645
  const [nonceKey] = (0, utils_1.getNonceKeyAndValue)(userOperation.nonce);