@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,435 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSimulateValidationResult = exports.parseFailedOpWithRevert = exports.GasEstimatorV07 = void 0;
4
+ const types_1 = require("../../types/index.js");
5
+ const utils_1 = require("../../utils/index.js");
6
+ const viem_1 = require("viem");
7
+ const IAccountExecute_1 = require("../../types/contracts/IAccountExecute.js");
8
+ const types_2 = require("./types.js");
9
+ class GasEstimatorV07 {
10
+ config;
11
+ constructor(config) {
12
+ this.config = config;
13
+ }
14
+ async simulateValidation({ entryPoint, userOperation, queuedUserOperations }) {
15
+ const userOperations = [...queuedUserOperations, userOperation];
16
+ const packedUserOperations = userOperations.map((uo) => (0, utils_1.toPackedUserOperation)(uo));
17
+ const simulateValidationLast = (0, viem_1.encodeFunctionData)({
18
+ abi: types_1.EntryPointV07SimulationsAbi,
19
+ functionName: "simulateValidationLast",
20
+ args: [packedUserOperations]
21
+ });
22
+ const errorResult = await this.callPimlicoEntryPointSimulations({
23
+ entryPoint,
24
+ entryPointSimulationsCallData: [simulateValidationLast]
25
+ });
26
+ return {
27
+ simulateValidationResult: getSimulateValidationResult(errorResult[0])
28
+ };
29
+ }
30
+ encodeUserOperationCalldata({ op, entryPoint }) {
31
+ const packedOp = (0, utils_1.toPackedUserOperation)(op);
32
+ const executeUserOpMethodSig = (0, viem_1.toFunctionSelector)(IAccountExecute_1.AccountExecuteAbi[0]);
33
+ const callDataMethodSig = (0, viem_1.slice)(packedOp.callData, 0, 4);
34
+ if (executeUserOpMethodSig === callDataMethodSig) {
35
+ return (0, viem_1.encodeFunctionData)({
36
+ abi: IAccountExecute_1.AccountExecuteAbi,
37
+ functionName: "executeUserOp",
38
+ args: [
39
+ packedOp,
40
+ (0, utils_1.getUserOperationHash)(op, entryPoint, this.config.publicClient.chain.id)
41
+ ]
42
+ });
43
+ }
44
+ return packedOp.callData;
45
+ }
46
+ encodeSimulateHandleOpLast({ userOperation, queuedUserOperations, entryPoint }) {
47
+ const userOperations = [...queuedUserOperations, userOperation];
48
+ const packedUserOperations = userOperations.map((uop) => ({
49
+ packedUserOperation: (0, utils_1.toPackedUserOperation)(uop),
50
+ userOperation: uop,
51
+ userOperationHash: (0, utils_1.getUserOperationHash)(uop, entryPoint, this.config.publicClient.chain.id)
52
+ }));
53
+ const simulateHandleOpCallData = (0, viem_1.encodeFunctionData)({
54
+ abi: types_1.EntryPointV07SimulationsAbi,
55
+ functionName: "simulateHandleOpLast",
56
+ args: [packedUserOperations.map((uop) => uop.packedUserOperation)]
57
+ });
58
+ return simulateHandleOpCallData;
59
+ }
60
+ encodeSimulateCallData({ userOperation, queuedUserOperations, entryPoint, gasAllowance = this.config.binarySearchGasAllowance, initialMinGas = 0n }) {
61
+ const queuedOps = queuedUserOperations.map((op) => ({
62
+ op: (0, utils_1.toPackedUserOperation)(op),
63
+ target: op.sender,
64
+ targetCallData: this.encodeUserOperationCalldata({
65
+ op,
66
+ entryPoint
67
+ })
68
+ }));
69
+ const targetOp = {
70
+ op: (0, utils_1.toPackedUserOperation)(userOperation),
71
+ target: userOperation.sender,
72
+ targetCallData: this.encodeUserOperationCalldata({
73
+ op: userOperation,
74
+ entryPoint
75
+ })
76
+ };
77
+ const simulateTargetCallData = (0, viem_1.encodeFunctionData)({
78
+ abi: types_1.EntryPointV07SimulationsAbi,
79
+ functionName: "simulateCallData",
80
+ args: [
81
+ queuedOps,
82
+ targetOp,
83
+ entryPoint,
84
+ initialMinGas,
85
+ this.config.binarySearchToleranceDelta,
86
+ gasAllowance
87
+ ]
88
+ });
89
+ return simulateTargetCallData;
90
+ }
91
+ // Try to get the calldata gas again if the initial simulation reverted due to hitting the eth_call gasLimit.
92
+ async retryGetCallDataGas({ entryPoint, optimalGas, minGas, targetOp, queuedOps, stateOverrides, simulateHandleOpLastResult }) {
93
+ const maxRetries = 3;
94
+ let retryCount = 0;
95
+ let currentOptimalGas = optimalGas;
96
+ let currentMinGas = minGas;
97
+ while (retryCount < maxRetries) {
98
+ // OptimalGas represents the current lowest gasLimit, so we set the gasAllowance to search range minGas <-> optimalGas
99
+ const gasAllowance = currentOptimalGas - currentMinGas;
100
+ const simulateCallData = this.encodeSimulateCallData({
101
+ entryPoint,
102
+ userOperation: targetOp,
103
+ queuedUserOperations: queuedOps,
104
+ initialMinGas: currentMinGas,
105
+ gasAllowance
106
+ });
107
+ let cause = await this.callPimlicoEntryPointSimulations({
108
+ entryPoint,
109
+ entryPointSimulationsCallData: [simulateCallData],
110
+ stateOverrides
111
+ });
112
+ cause = cause.map((data) => {
113
+ const decodedDelegateAndError = (0, viem_1.decodeErrorResult)({
114
+ abi: types_1.EntryPointV07Abi,
115
+ data: data
116
+ });
117
+ if (!decodedDelegateAndError?.args?.[1]) {
118
+ throw new Error("Unexpected error");
119
+ }
120
+ return decodedDelegateAndError.args[1];
121
+ });
122
+ const simulateCallDataResult = validateTargetCallDataResult(cause[0]);
123
+ if (simulateCallDataResult.result === "failed") {
124
+ return simulateCallDataResult;
125
+ }
126
+ if (simulateCallDataResult.result === "retry") {
127
+ currentOptimalGas = simulateCallDataResult.optimalGas;
128
+ currentMinGas = simulateCallDataResult.minGas;
129
+ retryCount++;
130
+ continue;
131
+ }
132
+ // If we reach here, it means we have a successful result
133
+ return {
134
+ result: "execution",
135
+ data: {
136
+ callDataResult: simulateCallDataResult.data,
137
+ executionResult: simulateHandleOpLastResult.data.executionResult
138
+ }
139
+ };
140
+ }
141
+ // If we've exhausted all retries, return a failure result
142
+ return {
143
+ result: "failed",
144
+ data: "Max retries reached for getting call data gas",
145
+ code: types_1.ValidationErrors.SimulateValidation
146
+ };
147
+ }
148
+ async simulateHandleOpV07({ entryPoint, userOperation, queuedUserOperations, stateOverrides = undefined }) {
149
+ const simulateHandleOpLast = this.encodeSimulateHandleOpLast({
150
+ entryPoint,
151
+ userOperation,
152
+ queuedUserOperations
153
+ });
154
+ const simulateCallData = this.encodeSimulateCallData({
155
+ entryPoint,
156
+ userOperation,
157
+ queuedUserOperations
158
+ });
159
+ let cause;
160
+ if (this.config.chainType === "hedera") {
161
+ // due to Hedera specific restrictions, we can't combine these two calls.
162
+ const [simulateHandleOpLastCause, simulateCallDataCause] = await Promise.all([
163
+ this.callPimlicoEntryPointSimulations({
164
+ entryPoint,
165
+ entryPointSimulationsCallData: [simulateHandleOpLast],
166
+ stateOverrides
167
+ }),
168
+ this.callPimlicoEntryPointSimulations({
169
+ entryPoint,
170
+ entryPointSimulationsCallData: [simulateCallData],
171
+ stateOverrides
172
+ })
173
+ ]);
174
+ cause = [simulateHandleOpLastCause[0], simulateCallDataCause[0]];
175
+ }
176
+ else {
177
+ cause = await this.callPimlicoEntryPointSimulations({
178
+ entryPoint,
179
+ entryPointSimulationsCallData: [
180
+ simulateHandleOpLast,
181
+ simulateCallData
182
+ ],
183
+ stateOverrides
184
+ });
185
+ }
186
+ cause = cause.map((data) => {
187
+ const decodedDelegateAndError = (0, viem_1.decodeErrorResult)({
188
+ abi: types_1.EntryPointV07Abi,
189
+ data: data
190
+ });
191
+ const delegateAndRevertResponseBytes = decodedDelegateAndError?.args?.[1];
192
+ if (!delegateAndRevertResponseBytes) {
193
+ throw new Error("Unexpected error");
194
+ }
195
+ return delegateAndRevertResponseBytes;
196
+ });
197
+ try {
198
+ const simulateHandleOpLastResult = getSimulateHandleOpResult(cause[0]);
199
+ if (simulateHandleOpLastResult.result === "failed") {
200
+ return simulateHandleOpLastResult;
201
+ }
202
+ const simulateCallDataResult = validateTargetCallDataResult(cause[1]);
203
+ if (simulateCallDataResult.result === "failed") {
204
+ return simulateCallDataResult;
205
+ }
206
+ if (simulateCallDataResult.result === "retry") {
207
+ const { optimalGas, minGas } = simulateCallDataResult;
208
+ return await this.retryGetCallDataGas({
209
+ entryPoint,
210
+ optimalGas,
211
+ minGas,
212
+ targetOp: userOperation,
213
+ queuedOps: queuedUserOperations,
214
+ simulateHandleOpLastResult: simulateHandleOpLastResult,
215
+ stateOverrides
216
+ });
217
+ }
218
+ return {
219
+ result: "execution",
220
+ data: {
221
+ callDataResult: simulateCallDataResult.data,
222
+ executionResult: simulateHandleOpLastResult.data.executionResult
223
+ }
224
+ };
225
+ }
226
+ catch (_e) {
227
+ return {
228
+ result: "failed",
229
+ data: "Unknown error, could not parse simulate handle op result.",
230
+ code: types_1.ValidationErrors.SimulateValidation
231
+ };
232
+ }
233
+ }
234
+ async callPimlicoEntryPointSimulations({ entryPoint, entryPointSimulationsCallData, stateOverrides }) {
235
+ const publicClient = this.config.publicClient;
236
+ const blockTagSupport = this.config.blockTagSupport;
237
+ const utilityWalletAddress = this.config.utilityPrivateKey?.address ??
238
+ "0x4337000c2828F5260d8921fD25829F606b9E8680";
239
+ const entryPointSimulationsAddress = this.config.entrypointSimulationContract;
240
+ const fixedGasLimitForEstimation = this.config.fixedGasLimitForEstimation;
241
+ if (!entryPointSimulationsAddress) {
242
+ throw new types_1.RpcError("entryPointSimulationsAddress must be provided for V07 UserOperation", types_1.ValidationErrors.InvalidFields);
243
+ }
244
+ const callData = (0, viem_1.encodeFunctionData)({
245
+ abi: types_1.PimlicoEntryPointSimulationsAbi,
246
+ functionName: "simulateEntryPoint",
247
+ args: [entryPoint, entryPointSimulationsCallData]
248
+ });
249
+ const result = (await publicClient.request({
250
+ method: "eth_call",
251
+ params: [
252
+ {
253
+ to: entryPointSimulationsAddress,
254
+ from: utilityWalletAddress,
255
+ data: callData,
256
+ ...(fixedGasLimitForEstimation !== undefined && {
257
+ gas: `0x${fixedGasLimitForEstimation.toString(16)}`
258
+ })
259
+ },
260
+ blockTagSupport
261
+ ? "latest"
262
+ : (0, viem_1.toHex)(await publicClient.getBlockNumber()),
263
+ // @ts-ignore
264
+ ...(stateOverrides ? [stateOverrides] : [])
265
+ ]
266
+ }));
267
+ const returnBytes = (0, viem_1.decodeAbiParameters)([{ name: "ret", type: "bytes[]" }], result);
268
+ return returnBytes[0];
269
+ }
270
+ }
271
+ exports.GasEstimatorV07 = GasEstimatorV07;
272
+ const panicCodes = {
273
+ // from https://docs.soliditylang.org/en/v0.8.0/control-structures.html
274
+ 1: "assert(false)",
275
+ 17: "arithmetic overflow/underflow",
276
+ 18: "divide by zero",
277
+ 33: "invalid enum value",
278
+ 34: "storage byte array that is incorrectly encoded",
279
+ 49: ".pop() on an empty array.",
280
+ 50: "array sout-of-bounds or negative index",
281
+ 65: "memory overflow",
282
+ 81: "zero-initialized variable of internal function type"
283
+ };
284
+ function parseFailedOpWithRevert(data) {
285
+ const methodSig = data.slice(0, 10);
286
+ const dataParams = `0x${data.slice(10)}`;
287
+ if (methodSig === "0x08c379a0") {
288
+ const [err] = (0, viem_1.decodeAbiParameters)([
289
+ {
290
+ name: "err",
291
+ type: "string"
292
+ }
293
+ ], dataParams);
294
+ return err;
295
+ }
296
+ if (methodSig === "0x4e487b71") {
297
+ const [code] = (0, viem_1.decodeAbiParameters)([
298
+ {
299
+ name: "err",
300
+ type: "uint256"
301
+ }
302
+ ], dataParams);
303
+ return panicCodes[Number(code)] ?? `${code}`;
304
+ }
305
+ return data;
306
+ }
307
+ exports.parseFailedOpWithRevert = parseFailedOpWithRevert;
308
+ function getSimulateValidationResult(errorData) {
309
+ const decodedDelegateAndError = (0, viem_1.decodeErrorResult)({
310
+ abi: types_1.EntryPointV07Abi,
311
+ data: errorData
312
+ });
313
+ if (!decodedDelegateAndError?.args?.[1]) {
314
+ throw new Error("Unexpected error");
315
+ }
316
+ try {
317
+ const decodedError = (0, viem_1.decodeErrorResult)({
318
+ abi: types_1.EntryPointV07SimulationsAbi,
319
+ data: decodedDelegateAndError.args[1]
320
+ });
321
+ if (decodedError &&
322
+ decodedError.errorName === "FailedOp" &&
323
+ decodedError.args) {
324
+ return {
325
+ status: "failed",
326
+ data: decodedError.args[1]
327
+ };
328
+ }
329
+ if (decodedError &&
330
+ decodedError.errorName === "FailedOpWithRevert" &&
331
+ decodedError.args) {
332
+ return {
333
+ status: "failed",
334
+ data: `${decodedError.args?.[1]} - ${parseFailedOpWithRevert(decodedError.args?.[2])}`
335
+ };
336
+ }
337
+ }
338
+ catch {
339
+ const decodedResult = (0, viem_1.decodeAbiParameters)(types_2.simulationValidationResultStruct, decodedDelegateAndError.args[1])[0];
340
+ return {
341
+ status: "validation",
342
+ data: decodedResult
343
+ };
344
+ }
345
+ throw new Error("Unexpected error - errorName is not ValidationResult or ValidationResultWithAggregation");
346
+ }
347
+ exports.getSimulateValidationResult = getSimulateValidationResult;
348
+ function validateTargetCallDataResult(data) {
349
+ try {
350
+ const targetCallResult = (0, viem_1.decodeFunctionResult)({
351
+ abi: types_1.EntryPointV07SimulationsAbi,
352
+ functionName: "simulateCallData",
353
+ data: data
354
+ });
355
+ const parsedTargetCallResult = types_1.targetCallResultSchema.parse(targetCallResult);
356
+ if (parsedTargetCallResult.success) {
357
+ return {
358
+ result: "success",
359
+ data: parsedTargetCallResult
360
+ };
361
+ }
362
+ return {
363
+ result: "failed",
364
+ data: parsedTargetCallResult.returnData,
365
+ code: types_1.ExecutionErrors.UserOperationReverted
366
+ };
367
+ }
368
+ catch (_e) {
369
+ // Check if the result hit eth_call gasLimit.
370
+ const simulationOutOfGasSelector = (0, viem_1.toFunctionSelector)("SimulationOutOfGas(uint256 optimalGas, uint256 minGas, uint256 maxGas)");
371
+ if ((0, viem_1.slice)(data, 0, 4) === simulationOutOfGasSelector) {
372
+ const res = (0, viem_1.decodeErrorResult)({
373
+ abi: types_1.EntryPointV07SimulationsAbi,
374
+ data: data
375
+ });
376
+ if (res.errorName === "SimulationOutOfGas") {
377
+ const [optimalGas, minGas, maxGas] = res.args;
378
+ return {
379
+ result: "retry",
380
+ optimalGas,
381
+ minGas,
382
+ maxGas
383
+ };
384
+ }
385
+ }
386
+ // no error we go the result
387
+ return {
388
+ result: "failed",
389
+ data: "Unknown error, could not parse target call data result.",
390
+ code: types_1.ExecutionErrors.UserOperationReverted
391
+ };
392
+ }
393
+ }
394
+ function getSimulateHandleOpResult(data) {
395
+ try {
396
+ const decodedError = (0, viem_1.decodeErrorResult)({
397
+ abi: types_1.EntryPointV07SimulationsAbi,
398
+ data: data
399
+ });
400
+ if (decodedError &&
401
+ decodedError.errorName === "FailedOp" &&
402
+ decodedError.args) {
403
+ return {
404
+ result: "failed",
405
+ data: decodedError.args[1],
406
+ code: types_1.ValidationErrors.SimulateValidation
407
+ };
408
+ }
409
+ if (decodedError &&
410
+ decodedError.errorName === "FailedOpWithRevert" &&
411
+ decodedError.args) {
412
+ return {
413
+ result: "failed",
414
+ data: `${decodedError.args[1]} ${parseFailedOpWithRevert(decodedError.args?.[2])}`,
415
+ code: types_1.ValidationErrors.SimulateValidation
416
+ };
417
+ }
418
+ }
419
+ catch {
420
+ // no error we go the result
421
+ const decodedResult = (0, viem_1.decodeFunctionResult)({
422
+ abi: types_1.EntryPointV07SimulationsAbi,
423
+ functionName: "simulateHandleOp",
424
+ data
425
+ });
426
+ return {
427
+ result: "execution",
428
+ data: {
429
+ executionResult: decodedResult
430
+ }
431
+ };
432
+ }
433
+ throw new Error("Unexpected error");
434
+ }
435
+ //# sourceMappingURL=gasEstimationsV07.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gasEstimationsV07.js","sourceRoot":"","sources":["../../../rpc/estimation/gasEstimationsV07.ts"],"names":[],"mappings":";;;AAAA,uCAaoB;AACpB,uCAAyE;AAEzE,+BASa;AACb,2EAAyE;AACzE,mCAGgB;AAGhB,MAAa,eAAe;IAChB,MAAM,CAAY;IAE1B,YAAY,MAAkB;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,E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MAAM,YAAY,GAAG,IAAA,wBAAiB,EAAC;YACnC,GAAG,EAAE,mCAA2B;YAChC,IAAI,EAAE,IAAI;SACb,CAAC,CAAA;QAEF,IACI,YAAY;YACZ,YAAY,CAAC,SAAS,KAAK,UAAU;YACrC,YAAY,CAAC,IAAI,EACnB,CAAC;YACC,OAAO;gBACH,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAW;gBACpC,IAAI,EAAE,wBAAgB,CAAC,kBAAkB;aACnC,CAAA;QACd,CAAC;QAED,IACI,YAAY;YACZ,YAAY,CAAC,SAAS,KAAK,oBAAoB;YAC/C,YAAY,CAAC,IAAI,EACnB,CAAC;YACC,OAAO;gBACH,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,uBAAuB,CACpD,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,CAAQ,CAChC,EAAE;gBACH,IAAI,EAAE,wBAAgB,CAAC,kBAAkB;aACnC,CAAA;QACd,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACL,4BAA4B;QAC5B,MAAM,aAAa,GAAoB,IAAA,2BAAoB,EAAC;YACxD,GAAG,EAAE,mCAA2B;YAChC,YAAY,EAAE,kBAAkB;YAChC,IAAI;SACP,CAA+B,CAAA;QAEhC,OAAO;YACH,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE;gBACF,eAAe,EAAE,aAAa;aACxB;SACb,CAAA;IACL,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;AACvC,CAAC"}
@@ -0,0 +1,113 @@
1
+ import type { Address, ExecutionResult, PackedUserOperation, TargetCallResult } from "../../types/index.js";
2
+ import type { Hex } from "viem";
3
+ export type SimulateHandleOpResult<TypeResult extends "failed" | "execution" = "failed" | "execution"> = {
4
+ result: TypeResult;
5
+ data: TypeResult extends "failed" ? string : {
6
+ callDataResult?: TargetCallResult;
7
+ executionResult: ExecutionResult;
8
+ };
9
+ code?: TypeResult extends "failed" ? number : undefined;
10
+ };
11
+ export type CallDataSimulationArgs = {
12
+ op: PackedUserOperation;
13
+ target: Address;
14
+ targetCallData: Hex;
15
+ };
16
+ export type SimulationOutOfGasResult = {
17
+ optimalGas: bigint;
18
+ minGas: bigint;
19
+ maxGas: bigint;
20
+ };
21
+ export declare const simulationValidationResultStruct: readonly [{
22
+ readonly components: readonly [{
23
+ readonly components: readonly [{
24
+ readonly internalType: "uint256";
25
+ readonly name: "preOpGas";
26
+ readonly type: "uint256";
27
+ }, {
28
+ readonly internalType: "uint256";
29
+ readonly name: "prefund";
30
+ readonly type: "uint256";
31
+ }, {
32
+ readonly internalType: "uint256";
33
+ readonly name: "accountValidationData";
34
+ readonly type: "uint256";
35
+ }, {
36
+ readonly internalType: "uint256";
37
+ readonly name: "paymasterValidationData";
38
+ readonly type: "uint256";
39
+ }, {
40
+ readonly internalType: "bytes";
41
+ readonly name: "paymasterContext";
42
+ readonly type: "bytes";
43
+ }];
44
+ readonly internalType: "struct IEntryPoint.ReturnInfo";
45
+ readonly name: "returnInfo";
46
+ readonly type: "tuple";
47
+ }, {
48
+ readonly components: readonly [{
49
+ readonly internalType: "uint256";
50
+ readonly name: "stake";
51
+ readonly type: "uint256";
52
+ }, {
53
+ readonly internalType: "uint256";
54
+ readonly name: "unstakeDelaySec";
55
+ readonly type: "uint256";
56
+ }];
57
+ readonly internalType: "struct IStakeManager.StakeInfo";
58
+ readonly name: "senderInfo";
59
+ readonly type: "tuple";
60
+ }, {
61
+ readonly components: readonly [{
62
+ readonly internalType: "uint256";
63
+ readonly name: "stake";
64
+ readonly type: "uint256";
65
+ }, {
66
+ readonly internalType: "uint256";
67
+ readonly name: "unstakeDelaySec";
68
+ readonly type: "uint256";
69
+ }];
70
+ readonly internalType: "struct IStakeManager.StakeInfo";
71
+ readonly name: "factoryInfo";
72
+ readonly type: "tuple";
73
+ }, {
74
+ readonly components: readonly [{
75
+ readonly internalType: "uint256";
76
+ readonly name: "stake";
77
+ readonly type: "uint256";
78
+ }, {
79
+ readonly internalType: "uint256";
80
+ readonly name: "unstakeDelaySec";
81
+ readonly type: "uint256";
82
+ }];
83
+ readonly internalType: "struct IStakeManager.StakeInfo";
84
+ readonly name: "paymasterInfo";
85
+ readonly type: "tuple";
86
+ }, {
87
+ readonly components: readonly [{
88
+ readonly internalType: "address";
89
+ readonly name: "aggregator";
90
+ readonly type: "address";
91
+ }, {
92
+ readonly components: readonly [{
93
+ readonly internalType: "uint256";
94
+ readonly name: "stake";
95
+ readonly type: "uint256";
96
+ }, {
97
+ readonly internalType: "uint256";
98
+ readonly name: "unstakeDelaySec";
99
+ readonly type: "uint256";
100
+ }];
101
+ readonly internalType: "struct IStakeManager.StakeInfo";
102
+ readonly name: "stakeInfo";
103
+ readonly type: "tuple";
104
+ }];
105
+ readonly internalType: "struct IEntryPoint.AggregatorStakeInfo";
106
+ readonly name: "aggregatorInfo";
107
+ readonly type: "tuple";
108
+ }];
109
+ readonly internalType: "struct IEntryPointSimulations.ValidationResult";
110
+ readonly name: "";
111
+ readonly type: "tuple";
112
+ }];
113
+ //# sourceMappingURL=types.d.ts.map