@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,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GasEstimationHandler = void 0;
4
+ const utils_1 = require("../../utils/index.js");
5
+ const viem_1 = require("viem");
6
+ const gasEstimationsV06_1 = require("./gasEstimationsV06.js");
7
+ const gasEstimationsV07_1 = require("./gasEstimationsV07.js");
8
+ function getStateOverrides({ addSenderBalanceOverride, userOperation, stateOverride = {} }) {
9
+ const result = { ...stateOverride };
10
+ if (addSenderBalanceOverride) {
11
+ result[userOperation.sender] = {
12
+ ...(0, utils_1.deepHexlify)(stateOverride?.[userOperation.sender] || {}),
13
+ balance: (0, viem_1.toHex)(100000000000000000000000n)
14
+ };
15
+ }
16
+ return result;
17
+ }
18
+ class GasEstimationHandler {
19
+ gasEstimatorV06;
20
+ gasEstimatorV07;
21
+ constructor(config) {
22
+ this.gasEstimatorV06 = new gasEstimationsV06_1.GasEstimatorV06(config);
23
+ this.gasEstimatorV07 = new gasEstimationsV07_1.GasEstimatorV07(config);
24
+ }
25
+ simulateHandleOp({ userOperation, queuedUserOperations, addSenderBalanceOverride, entryPoint, targetAddress, targetCallData, balanceOverrideEnabled, stateOverrides = {} }) {
26
+ let finalStateOverride = undefined;
27
+ if (balanceOverrideEnabled) {
28
+ finalStateOverride = getStateOverrides({
29
+ userOperation,
30
+ addSenderBalanceOverride,
31
+ stateOverride: stateOverrides
32
+ });
33
+ }
34
+ if ((0, utils_1.isVersion06)(userOperation)) {
35
+ return this.gasEstimatorV06.simulateHandleOpV06({
36
+ userOperation,
37
+ entryPoint,
38
+ targetAddress,
39
+ targetCallData,
40
+ stateOverrides: finalStateOverride
41
+ });
42
+ }
43
+ return this.gasEstimatorV07.simulateHandleOpV07({
44
+ userOperation: userOperation,
45
+ queuedUserOperations: queuedUserOperations,
46
+ entryPoint,
47
+ stateOverrides: finalStateOverride
48
+ });
49
+ }
50
+ }
51
+ exports.GasEstimationHandler = GasEstimationHandler;
52
+ //# sourceMappingURL=gasEstimationHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gasEstimationHandler.js","sourceRoot":"","sources":["../../../rpc/estimation/gasEstimationHandler.ts"],"names":[],"mappings":";;;AAEA,uCAAsD;AAEtD,+BAA0C;AAC1C,2DAAqD;AACrD,2DAAqD;AAIrD,SAAS,iBAAiB,CAAC,EACvB,wBAAwB,EACxB,aAAa,EACb,aAAa,GAAG,EAAE,EAKrB;IACG,MAAM,MAAM,GAAmB,EAAE,GAAG,aAAa,EAAE,CAAA;IAEnD,IAAI,wBAAwB,EAAE,CAAC;QAC3B,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG;YAC3B,GAAG,IAAA,mBAAW,EAAC,aAAa,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAC3D,OAAO,EAAE,IAAA,YAAK,EAAC,yBAA0B,CAAC;SAC7C,CAAA;IACL,CAAC;IAED,OAAO,MAAM,CAAA;AACjB,CAAC;AAED,MAAa,oBAAoB;IAC7B,eAAe,CAAiB;IAChC,eAAe,CAAiB;IAEhC,YAAY,MAAkB;QAC1B,IAAI,CAAC,eAAe,GAAG,IAAI,mCAAe,CAAC,MAAM,CAAC,CAAA;QAElD,IAAI,CAAC,eAAe,GAAG,IAAI,mCAAe,CAAC,MAAM,CAAC,CAAA;IACtD,CAAC;IAED,gBAAgB,CAAC,EACb,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACxB,UAAU,EACV,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,cAAc,GAAG,EAAE,EAUtB;QACG,IAAI,kBAAkB,GAAG,SAAS,CAAA;QAElC,IAAI,sBAAsB,EAAE,CAAC;YACzB,kBAAkB,GAAG,iBAAiB,CAAC;gBACnC,aAAa;gBACb,wBAAwB;gBACxB,aAAa,EAAE,cAAc;aAChC,CAAC,CAAA;QACN,CAAC;QAED,IAAI,IAAA,mBAAW,EAAC,aAAa,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC;gBAC5C,aAAa;gBACb,UAAU;gBACV,aAAa;gBACb,cAAc;gBACd,cAAc,EAAE,kBAAkB;aACrC,CAAC,CAAA;QACN,CAAC;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC;YAC5C,aAAa,EAAE,aAAiC;YAChD,oBAAoB,EAAE,oBAA0C;YAChE,UAAU;YACV,cAAc,EAAE,kBAAkB;SACrC,CAAC,CAAA;IACN,CAAC;CACJ;AAxDD,oDAwDC"}
@@ -0,0 +1,19 @@
1
+ import type { StateOverrides, UserOperationV06 } from "../../types/index.js";
2
+ import type { Hex } from "viem";
3
+ import { type Address } from "viem";
4
+ import type { SimulateHandleOpResult } from "./types.js";
5
+ import type { AltoConfig } from "../../createConfig.js";
6
+ export declare class GasEstimatorV06 {
7
+ private config;
8
+ constructor(config: AltoConfig);
9
+ decodeSimulateHandleOpResult(data: Hex): SimulateHandleOpResult;
10
+ simulateHandleOpV06({ userOperation, targetAddress, targetCallData, entryPoint, useCodeOverride, stateOverrides }: {
11
+ userOperation: UserOperationV06;
12
+ targetAddress: Address;
13
+ targetCallData: Hex;
14
+ entryPoint: Address;
15
+ useCodeOverride?: boolean;
16
+ stateOverrides?: StateOverrides | undefined;
17
+ }): Promise<SimulateHandleOpResult>;
18
+ }
19
+ //# sourceMappingURL=gasEstimationsV06.d.ts.map
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GasEstimatorV06 = void 0;
4
+ const types_1 = require("../../types/index.js");
5
+ const viem_1 = require("viem");
6
+ const zod_1 = require("zod");
7
+ const userop_1 = require("../../utils/userop.js");
8
+ const gasEstimationsV07_1 = require("./gasEstimationsV07.js");
9
+ class GasEstimatorV06 {
10
+ config;
11
+ constructor(config) {
12
+ this.config = config;
13
+ }
14
+ decodeSimulateHandleOpResult(data) {
15
+ if (data === "0x") {
16
+ throw new types_1.RpcError("AA23 reverted: UserOperation called non-existant contract, or reverted with 0x", types_1.ValidationErrors.SimulateValidation);
17
+ }
18
+ const decodedError = (0, viem_1.decodeErrorResult)({
19
+ abi: [...types_1.EntryPointV06Abi, ...types_1.EntryPointV06SimulationsAbi],
20
+ data
21
+ });
22
+ if (decodedError &&
23
+ decodedError.errorName === "FailedOp" &&
24
+ decodedError.args) {
25
+ return {
26
+ result: "failed",
27
+ data: decodedError.args[1]
28
+ };
29
+ }
30
+ // custom error thrown by entryPoint if code override is used
31
+ if (decodedError &&
32
+ decodedError.errorName === "CallPhaseReverted" &&
33
+ decodedError.args) {
34
+ return {
35
+ result: "failed",
36
+ data: decodedError.args[0]
37
+ };
38
+ }
39
+ // custom error thrown by entryPoint if code override is used
40
+ if (decodedError &&
41
+ decodedError.errorName === "FailedOpWithRevert" &&
42
+ decodedError.args) {
43
+ return {
44
+ result: "failed",
45
+ data: `${decodedError.args?.[1]} ${(0, gasEstimationsV07_1.parseFailedOpWithRevert)(decodedError.args?.[2])}`
46
+ };
47
+ }
48
+ if (decodedError &&
49
+ decodedError.errorName === "Error" &&
50
+ decodedError.args) {
51
+ return {
52
+ result: "failed",
53
+ data: decodedError.args[0]
54
+ };
55
+ }
56
+ if (decodedError.errorName === "ExecutionResult") {
57
+ const parsedExecutionResult = types_1.executionResultSchema.parse(decodedError.args);
58
+ return {
59
+ result: "execution",
60
+ data: {
61
+ executionResult: parsedExecutionResult
62
+ }
63
+ };
64
+ }
65
+ throw new Error("Unexpected error whilst decoding simulateHandleOp result");
66
+ }
67
+ async simulateHandleOpV06({ userOperation, targetAddress, targetCallData, entryPoint, useCodeOverride = true, stateOverrides = undefined }) {
68
+ const publicClient = this.config.publicClient;
69
+ const blockTagSupport = this.config.blockTagSupport;
70
+ const utilityWalletAddress = this.config.utilityPrivateKey?.address ??
71
+ "0x4337000c2828F5260d8921fD25829F606b9E8680";
72
+ const fixedGasLimitForEstimation = this.config.fixedGasLimitForEstimation;
73
+ if (this.config.codeOverrideSupport && useCodeOverride) {
74
+ if (stateOverrides === undefined) {
75
+ stateOverrides = {};
76
+ }
77
+ stateOverrides[entryPoint] = {
78
+ ...(0, userop_1.deepHexlify)(stateOverrides?.[entryPoint] || {}),
79
+ code: types_1.ENTRYPOINT_V06_SIMULATION_OVERRIDE
80
+ };
81
+ }
82
+ try {
83
+ await publicClient.request({
84
+ method: "eth_call",
85
+ params: [
86
+ {
87
+ to: entryPoint,
88
+ from: utilityWalletAddress,
89
+ data: (0, viem_1.encodeFunctionData)({
90
+ abi: types_1.EntryPointV06Abi,
91
+ functionName: "simulateHandleOp",
92
+ args: [userOperation, targetAddress, targetCallData]
93
+ }),
94
+ ...(fixedGasLimitForEstimation !== undefined && {
95
+ gas: `0x${fixedGasLimitForEstimation.toString(16)}`
96
+ })
97
+ },
98
+ blockTagSupport
99
+ ? "latest"
100
+ : (0, viem_1.toHex)(await publicClient.getBlockNumber()),
101
+ // @ts-ignore
102
+ ...(stateOverrides ? [stateOverrides] : [])
103
+ ]
104
+ });
105
+ }
106
+ catch (e) {
107
+ const err = e;
108
+ if (/return data out of bounds.*|EVM error OutOfOffset.*/.test(err.details)) {
109
+ // out of bound (low level evm error) occurs when paymaster reverts with less than 32bytes
110
+ return {
111
+ result: "failed",
112
+ data: "AA50 postOp revert (paymaster revert data out of bounds)"
113
+ };
114
+ }
115
+ const causeParseResult = zod_1.z
116
+ .union([
117
+ zod_1.z.object({
118
+ code: zod_1.z.literal(3),
119
+ message: zod_1.z.string(),
120
+ data: types_1.hexDataSchema
121
+ }),
122
+ /* Fuse RPCs return in this format. */
123
+ zod_1.z.object({
124
+ code: zod_1.z.number(),
125
+ message: zod_1.z.string().regex(/VM execution error.*/),
126
+ data: zod_1.z
127
+ .string()
128
+ .transform((data) => data.replace("Reverted ", ""))
129
+ .pipe(types_1.hexDataSchema)
130
+ }),
131
+ zod_1.z.object({
132
+ code: zod_1.z.number(),
133
+ message: zod_1.z
134
+ .string()
135
+ .regex(/VM Exception while processing transaction:.*/),
136
+ data: types_1.hexDataSchema
137
+ })
138
+ ])
139
+ .safeParse(err.cause);
140
+ if (!causeParseResult.success) {
141
+ throw new Error(JSON.stringify(err.cause));
142
+ }
143
+ const data = causeParseResult.data.data;
144
+ return this.decodeSimulateHandleOpResult(data);
145
+ }
146
+ throw new Error("Unexpected error");
147
+ }
148
+ }
149
+ exports.GasEstimatorV06 = GasEstimatorV06;
150
+ //# sourceMappingURL=gasEstimationsV06.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gasEstimationsV06.js","sourceRoot":"","sources":["../../../rpc/estimation/gasEstimationsV06.ts"],"names":[],"mappings":";;;AAAA,uCAQoB;AAGpB,+BAKa;AACb,6BAAuB;AAGvB,+CAAgD;AAChD,2DAA6D;AAE7D,MAAa,eAAe;IAChB,MAAM,CAAY;IAE1B,YAAY,MAAkB;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,4BAA4B,CAAC,IAAS;QAClC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAChB,MAAM,IAAI,gBAAQ,CACd,gFAAgF,EAChF,wBAAgB,CAAC,kBAAkB,CACtC,CAAA;QACL,CAAC;QAED,MAAM,YAAY,GAAG,IAAA,wBAAiB,EAAC;YACnC,GAAG,EAAE,CAAC,GAAG,wBAAgB,EAAE,GAAG,mCAA2B,CAAC;YAC1D,IAAI;SACP,CAAC,CAAA;QAEF,IACI,YAAY;YACZ,YAAY,CAAC,SAAS,KAAK,UAAU;YACrC,YAAY,CAAC,IAAI,EACnB,CAAC;YACC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AC,OAAO,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;YAC9C,CAAC;YAED,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAA;YAEvC,OAAO,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAA;QAClD,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACvC,CAAC;CACJ;AApMD,0CAoMC"}
@@ -0,0 +1,88 @@
1
+ import { type StateOverrides, type UserOperationV07, type ValidationResultV07 } from "../../types/index.js";
2
+ import type { Hex } from "viem";
3
+ import { type Address } from "viem";
4
+ import { type SimulateHandleOpResult } from "./types.js";
5
+ import type { AltoConfig } from "../../createConfig.js";
6
+ export declare class GasEstimatorV07 {
7
+ private config;
8
+ constructor(config: AltoConfig);
9
+ simulateValidation({ entryPoint, userOperation, queuedUserOperations }: {
10
+ entryPoint: Address;
11
+ userOperation: UserOperationV07;
12
+ queuedUserOperations: UserOperationV07[];
13
+ }): Promise<{
14
+ simulateValidationResult: {
15
+ status: "validation" | "failed";
16
+ data: string | {
17
+ returnInfo: {
18
+ preOpGas: bigint;
19
+ prefund: bigint;
20
+ paymasterContext: `0x${string}`;
21
+ accountValidationData: bigint;
22
+ paymasterValidationData: bigint;
23
+ accountSigFailed?: boolean | undefined;
24
+ paymasterSigFailed?: boolean | undefined;
25
+ validAfter?: number | undefined;
26
+ validUntil?: number | undefined;
27
+ };
28
+ senderInfo: {
29
+ stake: bigint;
30
+ unstakeDelaySec: bigint;
31
+ addr?: string | undefined;
32
+ };
33
+ factoryInfo: {
34
+ stake: bigint;
35
+ unstakeDelaySec: bigint;
36
+ addr?: string | undefined;
37
+ } | undefined;
38
+ paymasterInfo: {
39
+ stake: bigint;
40
+ unstakeDelaySec: bigint;
41
+ addr?: string | undefined;
42
+ } | undefined;
43
+ };
44
+ };
45
+ }>;
46
+ encodeUserOperationCalldata({ op, entryPoint }: {
47
+ op: UserOperationV07;
48
+ entryPoint: Address;
49
+ }): `0x${string}`;
50
+ encodeSimulateHandleOpLast({ userOperation, queuedUserOperations, entryPoint }: {
51
+ userOperation: UserOperationV07;
52
+ queuedUserOperations: UserOperationV07[];
53
+ entryPoint: Address;
54
+ }): Hex;
55
+ encodeSimulateCallData({ userOperation, queuedUserOperations, entryPoint, gasAllowance, initialMinGas }: {
56
+ userOperation: UserOperationV07;
57
+ queuedUserOperations: UserOperationV07[];
58
+ entryPoint: Address;
59
+ initialMinGas?: bigint;
60
+ gasAllowance?: bigint;
61
+ }): Hex;
62
+ retryGetCallDataGas({ entryPoint, optimalGas, minGas, targetOp, queuedOps, stateOverrides, simulateHandleOpLastResult }: {
63
+ entryPoint: Address;
64
+ optimalGas: bigint;
65
+ minGas: bigint;
66
+ targetOp: UserOperationV07;
67
+ queuedOps: UserOperationV07[];
68
+ stateOverrides?: StateOverrides | undefined;
69
+ simulateHandleOpLastResult: SimulateHandleOpResult<"execution">;
70
+ }): Promise<SimulateHandleOpResult>;
71
+ simulateHandleOpV07({ entryPoint, userOperation, queuedUserOperations, stateOverrides }: {
72
+ entryPoint: Address;
73
+ userOperation: UserOperationV07;
74
+ queuedUserOperations: UserOperationV07[];
75
+ stateOverrides?: StateOverrides | undefined;
76
+ }): Promise<SimulateHandleOpResult>;
77
+ callPimlicoEntryPointSimulations({ entryPoint, entryPointSimulationsCallData, stateOverrides }: {
78
+ entryPoint: Address;
79
+ entryPointSimulationsCallData: Hex[];
80
+ stateOverrides?: StateOverrides;
81
+ }): Promise<readonly `0x${string}`[]>;
82
+ }
83
+ export declare function parseFailedOpWithRevert(data: Hex): string;
84
+ export declare function getSimulateValidationResult(errorData: Hex): {
85
+ status: "failed" | "validation";
86
+ data: ValidationResultV07 | Hex | string;
87
+ };
88
+ //# sourceMappingURL=gasEstimationsV07.d.ts.map