@pimlico/alto 0.0.19 → 0.0.20

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 (337) hide show
  1. package/contracts/EIP712.sol/EIP712.json +1 -1
  2. package/contracts/ERC165.sol/ERC165.json +1 -1
  3. package/contracts/ERC20.sol/ERC20.json +1 -1
  4. package/contracts/Eip7702Support.sol/Eip7702Support.json +1 -1
  5. package/contracts/EntryPoint.sol/EntryPoint.json +1 -1
  6. package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride06.json +1 -1
  7. package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride07.json +1 -1
  8. package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride08.json +1 -1
  9. package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride09.json +1 -0
  10. package/contracts/EntryPointGasEstimationOverride.sol/EntryPointGasEstimationOverride06.json +1 -1
  11. package/contracts/EntryPointSimulations.sol/EntryPointSimulations07.json +1 -1
  12. package/contracts/EntryPointSimulations.sol/EntryPointSimulations08.json +1 -1
  13. package/contracts/EntryPointSimulations.sol/EntryPointSimulations09.json +1 -0
  14. package/contracts/Exec.sol/Exec.json +1 -1
  15. package/contracts/IAccount.sol/IAccount.json +1 -1
  16. package/contracts/IAccountExecute.sol/IAccountExecute.json +1 -1
  17. package/contracts/IAggregator.sol/IAggregator.json +1 -1
  18. package/contracts/IERC165.sol/IERC165.json +1 -1
  19. package/contracts/IERC5267.sol/IERC5267.json +1 -1
  20. package/contracts/IEntryPoint.sol/IEntryPoint.json +1 -1
  21. package/contracts/IEntryPointFilterOpsOverride.sol/IEntryPointFilterOpsOverride08.json +1 -0
  22. package/contracts/IEntryPointFilterOpsOverride.sol/IEntryPointFilterOpsOverride09.json +1 -0
  23. package/contracts/IEntryPointSimulations.sol/IEntryPointSimulations.json +1 -1
  24. package/contracts/INonceManager.sol/INonceManager.json +1 -1
  25. package/contracts/IPaymaster.sol/IPaymaster.json +1 -1
  26. package/contracts/ISenderCreator.sol/ISenderCreator.json +1 -1
  27. package/contracts/IStakeManager.sol/IStakeManager.json +1 -1
  28. package/contracts/LibBytes.sol/LibBytes.json +1 -1
  29. package/contracts/Math.sol/Math.json +1 -1
  30. package/contracts/MessageHashUtils.sol/MessageHashUtils.json +1 -1
  31. package/contracts/NonceManager.sol/NonceManager.json +1 -1
  32. package/contracts/Panic.sol/Panic.json +1 -1
  33. package/contracts/PimlicoSimulations.sol/PimlicoSimulations.json +1 -1
  34. package/contracts/ReentrancyGuard.sol/ReentrancyGuard.json +1 -1
  35. package/contracts/ReentrancyGuardTransient.sol/ReentrancyGuardTransient.json +1 -1
  36. package/contracts/SafeCast.sol/SafeCast.json +1 -1
  37. package/contracts/SenderCreator.sol/SenderCreator.json +1 -1
  38. package/contracts/ShortStrings.sol/ShortStrings.json +1 -1
  39. package/contracts/SignedMath.sol/SignedMath.json +1 -1
  40. package/contracts/SimulationOverrideHelper.sol/SimulationOverrideHelper.json +1 -0
  41. package/contracts/StakeManager.sol/StakeManager.json +1 -1
  42. package/contracts/StorageSlot.sol/StorageSlot.json +1 -1
  43. package/contracts/Strings.sol/Strings.json +1 -1
  44. package/contracts/TransientSlot.sol/TransientSlot.json +1 -1
  45. package/contracts/UserOperation.sol/UserOperationLib.json +1 -1
  46. package/contracts/UserOperationLib.sol/UserOperationLib.json +1 -1
  47. package/contracts/account-abstraction-v9/contracts/interfaces/IAggregator.sol/IAggregator.json +1 -0
  48. package/contracts/account-abstraction-v9/contracts/interfaces/IEntryPoint.sol/IEntryPoint.json +1 -0
  49. package/contracts/account-abstraction-v9/contracts/interfaces/INonceManager.sol/INonceManager.json +1 -0
  50. package/contracts/account-abstraction-v9/contracts/interfaces/IStakeManager.sol/IStakeManager.json +1 -0
  51. package/contracts/build-info/338795fc743ca612.json +1 -0
  52. package/contracts/build-info/44a9648cfe32a468.json +1 -0
  53. package/contracts/build-info/{880955d5786bfdae.json → 8dbf8a4ad39019b5.json} +1 -1
  54. package/contracts/contracts/interfaces/IAggregator.sol/IAggregator.json +1 -1
  55. package/contracts/contracts/interfaces/IEntryPoint.sol/IEntryPoint.json +1 -1
  56. package/contracts/contracts/interfaces/INonceManager.sol/INonceManager.json +1 -1
  57. package/contracts/contracts/interfaces/IStakeManager.sol/IStakeManager.json +1 -1
  58. package/contracts/core/Eip7702Support.sol/Eip7702Support.json +1 -0
  59. package/contracts/core/NonceManager.sol/NonceManager.json +1 -0
  60. package/contracts/core/SenderCreator.sol/SenderCreator.json +1 -0
  61. package/contracts/core/StakeManager.sol/StakeManager.json +1 -0
  62. package/contracts/core/UserOperationLib.sol/UserOperationLib.json +1 -0
  63. package/contracts/interfaces/IAccount.sol/IAccount.json +1 -0
  64. package/contracts/interfaces/IAccountExecute.sol/IAccountExecute.json +1 -0
  65. package/contracts/interfaces/IAggregator.sol/IAggregator.json +1 -1
  66. package/contracts/interfaces/IEntryPoint.sol/IEntryPoint.json +1 -1
  67. package/contracts/interfaces/INonceManager.sol/INonceManager.json +1 -1
  68. package/contracts/interfaces/IPaymaster.sol/IPaymaster.json +1 -0
  69. package/contracts/interfaces/ISenderCreator.sol/ISenderCreator.json +1 -0
  70. package/contracts/interfaces/IStakeManager.sol/IStakeManager.json +1 -1
  71. package/contracts/overrides/Eip7702Support.sol/Eip7702Support.json +1 -0
  72. package/contracts/overrides/NonceManager.sol/NonceManager.json +1 -0
  73. package/contracts/overrides/SenderCreator.sol/SenderCreator.json +1 -0
  74. package/contracts/overrides/StakeManager.sol/StakeManager.json +1 -0
  75. package/contracts/overrides/UserOperationLib.sol/UserOperationLib.json +1 -0
  76. package/contracts/utils/Exec.sol/Exec.json +1 -1
  77. package/contracts/utils/StorageSlot.sol/StorageSlot.json +1 -0
  78. package/contracts/v09/EntryPoint.sol/EntryPoint.json +1 -0
  79. package/esm/cli/alto.js +13 -6
  80. package/esm/cli/alto.js.map +1 -1
  81. package/esm/cli/config/bundler.d.ts +190 -148
  82. package/esm/cli/config/bundler.js +72 -83
  83. package/esm/cli/config/bundler.js.map +1 -1
  84. package/esm/cli/config/options.d.ts +2 -1
  85. package/esm/cli/config/options.js +105 -68
  86. package/esm/cli/config/options.js.map +1 -1
  87. package/esm/cli/customTransport.d.ts +3 -3
  88. package/esm/cli/deploySimulationsContract.d.ts +1 -0
  89. package/esm/cli/deploySimulationsContract.js +41 -5
  90. package/esm/cli/deploySimulationsContract.js.map +1 -1
  91. package/esm/cli/handler.js +48 -52
  92. package/esm/cli/handler.js.map +1 -1
  93. package/esm/cli/setupServer.js +46 -47
  94. package/esm/cli/setupServer.js.map +1 -1
  95. package/esm/cli/shutDown.d.ts +20 -0
  96. package/esm/cli/shutDown.js +260 -0
  97. package/esm/cli/shutDown.js.map +1 -0
  98. package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride06.json +1 -1
  99. package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride07.json +1 -1
  100. package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride08.json +1 -1
  101. package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride09.json +1 -0
  102. package/esm/contracts/EntryPointGasEstimationOverride.sol/EntryPointGasEstimationOverride06.json +1 -1
  103. package/esm/contracts/EntryPointSimulations.sol/EntryPointSimulations07.json +1 -1
  104. package/esm/contracts/EntryPointSimulations.sol/EntryPointSimulations08.json +1 -1
  105. package/esm/contracts/EntryPointSimulations.sol/EntryPointSimulations09.json +1 -0
  106. package/esm/contracts/PimlicoSimulations.sol/PimlicoSimulations.json +1 -1
  107. package/esm/createConfig.d.ts +9 -2
  108. package/esm/createConfig.js.map +1 -1
  109. package/esm/executor/{userOpMonitor.d.ts → bundleManager.d.ts} +38 -32
  110. package/esm/executor/{userOpMonitor.js → bundleManager.js} +127 -99
  111. package/esm/executor/bundleManager.js.map +1 -0
  112. package/esm/executor/executor.d.ts +4 -3
  113. package/esm/executor/executor.js +33 -20
  114. package/esm/executor/executor.js.map +1 -1
  115. package/esm/executor/executorManager.d.ts +17 -15
  116. package/esm/executor/executorManager.js +130 -55
  117. package/esm/executor/executorManager.js.map +1 -1
  118. package/esm/executor/filterOpsAndEstimateGas.d.ts +17 -2
  119. package/esm/executor/filterOpsAndEstimateGas.js +100 -77
  120. package/esm/executor/filterOpsAndEstimateGas.js.map +1 -1
  121. package/esm/executor/index.d.ts +1 -0
  122. package/esm/executor/index.js +1 -0
  123. package/esm/executor/index.js.map +1 -1
  124. package/esm/executor/senderManager/createMemorySenderManager.js +13 -0
  125. package/esm/executor/senderManager/createMemorySenderManager.js.map +1 -1
  126. package/esm/executor/senderManager/createRedisSenderManager.d.ts +2 -1
  127. package/esm/executor/senderManager/createRedisSenderManager.js +3 -6
  128. package/esm/executor/senderManager/createRedisSenderManager.js.map +1 -1
  129. package/esm/executor/senderManager/flushOnStartUp.js +4 -4
  130. package/esm/executor/senderManager/flushOnStartUp.js.map +1 -1
  131. package/esm/executor/senderManager/index.d.ts +1 -0
  132. package/esm/executor/senderManager/index.js +6 -2
  133. package/esm/executor/senderManager/index.js.map +1 -1
  134. package/esm/executor/senderManager/validateAndRefill.js +2 -2
  135. package/esm/executor/senderManager/validateAndRefill.js.map +1 -1
  136. package/esm/executor/utilityWalletMonitor.d.ts +4 -4
  137. package/esm/executor/utilityWalletMonitor.js +1 -1
  138. package/esm/executor/utilityWalletMonitor.js.map +1 -1
  139. package/esm/executor/utils.d.ts +7 -2
  140. package/esm/executor/utils.js +57 -26
  141. package/esm/executor/utils.js.map +1 -1
  142. package/esm/handlers/arbitrumGasPriceManager.d.ts +3 -2
  143. package/esm/handlers/arbitrumGasPriceManager.js +6 -2
  144. package/esm/handlers/arbitrumGasPriceManager.js.map +1 -1
  145. package/esm/handlers/eventManager.d.ts +9 -9
  146. package/esm/handlers/eventManager.js +59 -60
  147. package/esm/handlers/eventManager.js.map +1 -1
  148. package/esm/handlers/gasPriceManager.d.ts +8 -9
  149. package/esm/handlers/gasPriceManager.js +68 -80
  150. package/esm/handlers/gasPriceManager.js.map +1 -1
  151. package/esm/handlers/mantleGasPriceManager.d.ts +4 -4
  152. package/esm/handlers/mantleGasPriceManager.js +4 -4
  153. package/esm/handlers/mantleGasPriceManager.js.map +1 -1
  154. package/esm/handlers/optimismManager.d.ts +1 -1
  155. package/esm/handlers/optimismManager.js +1 -1
  156. package/esm/handlers/optimismManager.js.map +1 -1
  157. package/esm/mempool/index.d.ts +1 -1
  158. package/esm/mempool/index.js +1 -1
  159. package/esm/mempool/index.js.map +1 -1
  160. package/esm/mempool/mempool.d.ts +57 -22
  161. package/esm/mempool/mempool.js +180 -134
  162. package/esm/mempool/mempool.js.map +1 -1
  163. package/esm/mempool/reputationManager.d.ts +14 -14
  164. package/esm/mempool/reputationManager.js +36 -39
  165. package/esm/mempool/reputationManager.js.map +1 -1
  166. package/esm/mempool/statusManager.d.ts +20 -0
  167. package/esm/mempool/statusManager.js +143 -0
  168. package/esm/mempool/statusManager.js.map +1 -0
  169. package/esm/receiptCache/createMemoryReceiptCache.d.ts +3 -0
  170. package/esm/receiptCache/createMemoryReceiptCache.js +30 -0
  171. package/esm/receiptCache/createMemoryReceiptCache.js.map +1 -0
  172. package/esm/receiptCache/createRedisReceiptCache.d.ts +10 -0
  173. package/esm/receiptCache/createRedisReceiptCache.js +56 -0
  174. package/esm/receiptCache/createRedisReceiptCache.js.map +1 -0
  175. package/esm/receiptCache/index.d.ts +11 -0
  176. package/esm/receiptCache/index.js +21 -0
  177. package/esm/receiptCache/index.js.map +1 -0
  178. package/esm/rpc/createMethodHandler.js.map +1 -1
  179. package/esm/rpc/estimation/gasEstimationHandler.d.ts +2 -4
  180. package/esm/rpc/estimation/gasEstimationHandler.js.map +1 -1
  181. package/esm/rpc/estimation/gasEstimations06.d.ts +6 -7
  182. package/esm/rpc/estimation/gasEstimations06.js +1 -5
  183. package/esm/rpc/estimation/gasEstimations06.js.map +1 -1
  184. package/esm/rpc/estimation/gasEstimations07.d.ts +13 -41
  185. package/esm/rpc/estimation/gasEstimations07.js +27 -34
  186. package/esm/rpc/estimation/gasEstimations07.js.map +1 -1
  187. package/esm/{utils/preVerificationGasCalulator.d.ts → rpc/estimation/preVerificationGasCalculator.d.ts} +20 -6
  188. package/esm/{utils/preVerificationGasCalulator.js → rpc/estimation/preVerificationGasCalculator.js} +95 -47
  189. package/esm/rpc/estimation/preVerificationGasCalculator.js.map +1 -0
  190. package/esm/rpc/estimation/types.d.ts +4 -2
  191. package/esm/rpc/estimation/utils.d.ts +10 -8
  192. package/esm/rpc/estimation/utils.js +54 -48
  193. package/esm/rpc/estimation/utils.js.map +1 -1
  194. package/esm/rpc/methods/boost_sendUserOperation.d.ts +304 -0
  195. package/esm/rpc/methods/debug_bundler_clearReputation.js +1 -1
  196. package/esm/rpc/methods/debug_bundler_clearReputation.js.map +1 -1
  197. package/esm/rpc/methods/debug_bundler_clearState.js +1 -1
  198. package/esm/rpc/methods/debug_bundler_clearState.js.map +1 -1
  199. package/esm/rpc/methods/debug_bundler_dumpMempool.d.ts +338 -0
  200. package/esm/rpc/methods/debug_bundler_dumpReputation.js +1 -1
  201. package/esm/rpc/methods/debug_bundler_dumpReputation.js.map +1 -1
  202. package/esm/rpc/methods/eth_estimateUserOperationGas.d.ts +622 -14
  203. package/esm/rpc/methods/eth_estimateUserOperationGas.js +50 -29
  204. package/esm/rpc/methods/eth_estimateUserOperationGas.js.map +1 -1
  205. package/esm/rpc/methods/eth_getUserOperationByHash.d.ts +621 -11
  206. package/esm/rpc/methods/eth_getUserOperationByHash.js.map +1 -1
  207. package/esm/rpc/methods/eth_getUserOperationReceipt.d.ts +26 -26
  208. package/esm/rpc/methods/eth_getUserOperationReceipt.js +1 -1
  209. package/esm/rpc/methods/eth_sendUserOperation.d.ts +305 -1
  210. package/esm/rpc/methods/eth_sendUserOperation.js +132 -36
  211. package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
  212. package/esm/rpc/methods/pimlico_getUserOperationStatus.js +1 -1
  213. package/esm/rpc/methods/pimlico_getUserOperationStatus.js.map +1 -1
  214. package/esm/rpc/methods/pimlico_sendUserOperationNow.d.ts +330 -26
  215. package/esm/rpc/methods/pimlico_sendUserOperationNow.js +15 -27
  216. package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
  217. package/esm/rpc/methods/pimlico_simulateAssetChange.d.ts +620 -12
  218. package/esm/rpc/methods/pimlico_simulateAssetChange.js +14 -19
  219. package/esm/rpc/methods/pimlico_simulateAssetChange.js.map +1 -1
  220. package/esm/rpc/rpcHandler.d.ts +21 -22
  221. package/esm/rpc/rpcHandler.js +15 -17
  222. package/esm/rpc/rpcHandler.js.map +1 -1
  223. package/esm/rpc/server.d.ts +5 -5
  224. package/esm/rpc/server.js +15 -11
  225. package/esm/rpc/server.js.map +1 -1
  226. package/esm/rpc/validation/BundlerCollectorTracerV06.js +1 -1
  227. package/esm/rpc/validation/BundlerCollectorTracerV06.js.map +1 -1
  228. package/esm/rpc/validation/BundlerCollectorTracerV07.js +1 -1
  229. package/esm/rpc/validation/BundlerCollectorTracerV07.js.map +1 -1
  230. package/esm/rpc/validation/SafeValidator.d.ts +13 -14
  231. package/esm/rpc/validation/SafeValidator.js +24 -24
  232. package/esm/rpc/validation/SafeValidator.js.map +1 -1
  233. package/esm/rpc/validation/TracerResultParserV06.d.ts +2 -2
  234. package/esm/rpc/validation/TracerResultParserV06.js +11 -11
  235. package/esm/rpc/validation/TracerResultParserV06.js.map +1 -1
  236. package/esm/rpc/validation/TracerResultParserV07.d.ts +2 -2
  237. package/esm/rpc/validation/TracerResultParserV07.js +13 -13
  238. package/esm/rpc/validation/TracerResultParserV07.js.map +1 -1
  239. package/esm/rpc/validation/UnsafeValidator.d.ts +18 -14
  240. package/esm/rpc/validation/UnsafeValidator.js +71 -40
  241. package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
  242. package/esm/store/createMempoolStore.d.ts +1 -1
  243. package/esm/store/createMempoolStore.js +63 -139
  244. package/esm/store/createMempoolStore.js.map +1 -1
  245. package/esm/store/index.d.ts +4 -75
  246. package/esm/store/index.js +4 -1
  247. package/esm/store/index.js.map +1 -1
  248. package/esm/store/outstanding/index.d.ts +13 -0
  249. package/esm/store/outstanding/index.js +16 -0
  250. package/esm/store/outstanding/index.js.map +1 -0
  251. package/esm/store/{createMemoryOutstandingStore.d.ts → outstanding/memory.d.ts} +14 -13
  252. package/esm/store/outstanding/memory.js +263 -0
  253. package/esm/store/outstanding/memory.js.map +1 -0
  254. package/esm/store/outstanding/redis.d.ts +11 -0
  255. package/esm/store/outstanding/redis.js +229 -0
  256. package/esm/store/outstanding/redis.js.map +1 -0
  257. package/esm/store/outstanding/types.d.ts +19 -0
  258. package/esm/store/outstanding/types.js +2 -0
  259. package/esm/store/outstanding/types.js.map +1 -0
  260. package/esm/store/processing/index.d.ts +11 -0
  261. package/esm/store/processing/index.js +17 -0
  262. package/esm/store/processing/index.js.map +1 -0
  263. package/esm/store/processing/memory.d.ts +16 -0
  264. package/esm/store/processing/memory.js +58 -0
  265. package/esm/store/processing/memory.js.map +1 -0
  266. package/esm/store/processing/redis.d.ts +23 -0
  267. package/esm/store/processing/redis.js +85 -0
  268. package/esm/store/processing/redis.js.map +1 -0
  269. package/esm/store/processing/types.d.ts +10 -0
  270. package/esm/store/processing/types.js +2 -0
  271. package/esm/store/processing/types.js.map +1 -0
  272. package/esm/store/types.d.ts +50 -0
  273. package/esm/store/types.js +2 -0
  274. package/esm/store/types.js.map +1 -0
  275. package/esm/types/contracts/PimlicoSimulations.d.ts +81 -0
  276. package/esm/types/contracts/PimlicoSimulations.js +105 -0
  277. package/esm/types/contracts/PimlicoSimulations.js.map +1 -1
  278. package/esm/types/gasPrice.js +0 -18
  279. package/esm/types/gasPrice.js.map +1 -1
  280. package/esm/types/interfaces.d.ts +15 -10
  281. package/esm/types/mempool.d.ts +3 -0
  282. package/esm/types/schemas.d.ts +13174 -4732
  283. package/esm/types/schemas.js +113 -25
  284. package/esm/types/schemas.js.map +1 -1
  285. package/esm/types/utils.d.ts +2 -5
  286. package/esm/types/utils.js +16 -18
  287. package/esm/types/utils.js.map +1 -1
  288. package/esm/types/validation.d.ts +7646 -6912
  289. package/esm/types/validation.js +122 -152
  290. package/esm/types/validation.js.map +1 -1
  291. package/esm/utils/eip7702.d.ts +2 -1
  292. package/esm/utils/eip7702.js +14 -8
  293. package/esm/utils/eip7702.js.map +1 -1
  294. package/esm/utils/entryPointOverrides.js +18 -4
  295. package/esm/utils/entryPointOverrides.js.map +1 -1
  296. package/esm/utils/helpers.d.ts +2 -1
  297. package/esm/utils/helpers.js +30 -11
  298. package/esm/utils/helpers.js.map +1 -1
  299. package/esm/utils/index.d.ts +0 -1
  300. package/esm/utils/index.js +0 -1
  301. package/esm/utils/index.js.map +1 -1
  302. package/esm/utils/metrics.d.ts +2 -1
  303. package/esm/utils/metrics.js +15 -8
  304. package/esm/utils/metrics.js.map +1 -1
  305. package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.js +8 -9
  306. package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.js.map +1 -1
  307. package/esm/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +24 -2
  308. package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js +85 -64
  309. package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js.map +1 -1
  310. package/esm/utils/minMaxQueue/index.d.ts +2 -2
  311. package/esm/utils/minMaxQueue/index.js +4 -3
  312. package/esm/utils/minMaxQueue/index.js.map +1 -1
  313. package/esm/utils/rpc-reply.d.ts +3 -3
  314. package/esm/utils/rpc-reply.js.map +1 -1
  315. package/esm/utils/toViemStateOverrides.js +7 -7
  316. package/esm/utils/toViemStateOverrides.js.map +1 -1
  317. package/esm/utils/userop.d.ts +87 -55
  318. package/esm/utils/userop.js +138 -248
  319. package/esm/utils/userop.js.map +1 -1
  320. package/package.json +4 -2
  321. package/contracts/build-info/7710b5a048396e70.json +0 -1
  322. package/esm/executor/userOpMonitor.js.map +0 -1
  323. package/esm/mempool/monitoring.d.ts +0 -15
  324. package/esm/mempool/monitoring.js +0 -118
  325. package/esm/mempool/monitoring.js.map +0 -1
  326. package/esm/store/createMemoryOutstandingStore.js +0 -240
  327. package/esm/store/createMemoryOutstandingStore.js.map +0 -1
  328. package/esm/store/createRedisOutstandingStore.d.ts +0 -27
  329. package/esm/store/createRedisOutstandingStore.js +0 -344
  330. package/esm/store/createRedisOutstandingStore.js.map +0 -1
  331. package/esm/store/createRedisStore.d.ts +0 -9
  332. package/esm/store/createRedisStore.js +0 -131
  333. package/esm/store/createRedisStore.js.map +0 -1
  334. package/esm/store/createStore.d.ts +0 -6
  335. package/esm/store/createStore.js +0 -66
  336. package/esm/store/createStore.js.map +0 -1
  337. package/esm/utils/preVerificationGasCalulator.js.map +0 -1
@@ -1,65 +1,92 @@
1
- import { type PackedUserOperation, type UserOperation, type UserOperationV06, type UserOperationV07 } from "../types/index.js";
2
- import { type Address, type Hex, type PublicClient, type TransactionReceipt } from "viem";
3
- export declare function isVersion06(operation: UserOperation): operation is UserOperationV06;
4
- export declare function isVersion07(operation: UserOperation): operation is UserOperationV07;
5
- export declare function isVersion08(operation: UserOperation, entryPointAddress: Address): operation is UserOperationV07;
6
- export declare function getInitCode(unpackedUserOp: UserOperationV07): `0x${string}`;
7
- export declare function unPackInitCode(initCode: Hex): {
8
- factory: null;
9
- factoryData: null;
10
- } | {
11
- factory: `0x${string}`;
12
- factoryData: `0x${string}` | null;
13
- };
14
- export declare function getAccountGasLimits(unpackedUserOp: UserOperationV07): `0x${string}`;
15
- export declare function unpackAccountGasLimits(accountGasLimits: Hex): {
16
- verificationGasLimit: bigint;
1
+ import { type PackedUserOperation, type UserOperation, type UserOperation06, type UserOperation07, type UserOperation08, type UserOperation09 } from "../types/index.js";
2
+ import { type Address, type Hex, type TransactionReceipt } from "viem";
3
+ import { type EntryPointVersion } from "viem/account-abstraction";
4
+ import type { AltoConfig } from "../createConfig.js";
5
+ export declare function isVersion06(operation: UserOperation): operation is UserOperation06;
6
+ export declare function isVersion07(operation: UserOperation): operation is UserOperation07;
7
+ export declare function isVersion08(operation: UserOperation, entryPointAddress: Address): operation is UserOperation07;
8
+ export declare function isVersion09(operation: UserOperation, entryPointAddress: Address): operation is UserOperation07;
9
+ export declare function isDeployment(userOp: UserOperation): boolean;
10
+ export declare function toViemUserOp(userOp: UserOperation07 | UserOperation08 | UserOperation09): {
11
+ paymaster: `0x${string}` | undefined;
12
+ paymasterData: `0x${string}` | undefined;
13
+ paymasterVerificationGasLimit: bigint | undefined;
14
+ paymasterPostOpGasLimit: bigint | undefined;
15
+ factory: `0x${string}` | undefined;
16
+ factoryData: `0x${string}` | undefined;
17
+ sender: `0x${string}`;
18
+ nonce: bigint;
19
+ callData: `0x${string}`;
17
20
  callGasLimit: bigint;
18
- };
19
- export declare function getGasLimits(unpackedUserOp: UserOperationV07): `0x${string}`;
20
- export declare function unpackGasLimits(gasLimits: Hex): {
21
- maxPriorityFeePerGas: bigint;
21
+ verificationGasLimit: bigint;
22
+ preVerificationGas: bigint;
22
23
  maxFeePerGas: bigint;
23
- };
24
- export declare function getPaymasterAndData(unpackedUserOp: UserOperationV07): `0x${string}`;
25
- export declare function unpackPaymasterAndData(paymasterAndData: Hex): {
26
- paymaster: null;
27
- paymasterVerificationGasLimit: null;
28
- paymasterPostOpGasLimit: null;
29
- paymasterData: null;
24
+ maxPriorityFeePerGas: bigint;
25
+ signature: `0x${string}`;
26
+ eip7702Auth?: {
27
+ nonce: number;
28
+ contractAddress: `0x${string}`;
29
+ chainId: number;
30
+ r: `0x${string}`;
31
+ s: `0x${string}`;
32
+ yParity: number;
33
+ v?: bigint | undefined;
34
+ } | {
35
+ address: `0x${string}`;
36
+ nonce: number;
37
+ chainId: number;
38
+ r: `0x${string}`;
39
+ s: `0x${string}`;
40
+ yParity: number;
41
+ v?: bigint | undefined;
42
+ } | null | undefined;
30
43
  } | {
31
- paymaster: `0x${string}`;
32
- paymasterVerificationGasLimit: bigint;
33
- paymasterPostOpGasLimit: bigint;
34
- paymasterData: `0x${string}` | null;
44
+ paymasterSignature: `0x${string}` | undefined;
45
+ paymaster: `0x${string}` | undefined;
46
+ paymasterData: `0x${string}` | undefined;
47
+ paymasterVerificationGasLimit: bigint | undefined;
48
+ paymasterPostOpGasLimit: bigint | undefined;
49
+ factory: `0x${string}` | undefined;
50
+ factoryData: `0x${string}` | undefined;
51
+ sender: `0x${string}`;
52
+ nonce: bigint;
53
+ callData: `0x${string}`;
54
+ callGasLimit: bigint;
55
+ verificationGasLimit: bigint;
56
+ preVerificationGas: bigint;
57
+ maxFeePerGas: bigint;
58
+ maxPriorityFeePerGas: bigint;
59
+ signature: `0x${string}`;
60
+ eip7702Auth?: {
61
+ nonce: number;
62
+ contractAddress: `0x${string}`;
63
+ chainId: number;
64
+ r: `0x${string}`;
65
+ s: `0x${string}`;
66
+ yParity: number;
67
+ v?: bigint | undefined;
68
+ } | {
69
+ address: `0x${string}`;
70
+ nonce: number;
71
+ chainId: number;
72
+ r: `0x${string}`;
73
+ s: `0x${string}`;
74
+ yParity: number;
75
+ v?: bigint | undefined;
76
+ } | null | undefined;
35
77
  };
36
- export declare function toPackedUserOp(unpackedUserOp: UserOperationV07): PackedUserOperation;
78
+ export declare function toPackedUserOp(unpacked: UserOperation07 | UserOperation08 | UserOperation09): PackedUserOperation;
37
79
  export declare function deepHexlify(obj: any): any;
38
80
  export declare function getAddressFromInitCodeOrPaymasterAndData(data: Hex): Address | null;
39
- export declare const getUserOpHashV06: ({ userOp, entryPointAddress, chainId }: {
40
- userOp: UserOperationV06;
41
- entryPointAddress: Address;
42
- chainId: number;
43
- }) => `0x${string}`;
44
- export declare const getUserOpHashV07: ({ userOp, entryPointAddress, chainId }: {
45
- userOp: PackedUserOperation;
46
- entryPointAddress: Address;
47
- chainId: number;
48
- }) => `0x${string}`;
49
- export declare const getUserOpHashV08: ({ userOp, entryPointAddress, publicClient }: {
50
- userOp: UserOperationV07;
51
- entryPointAddress: Address;
52
- chainId: number;
53
- publicClient: PublicClient;
54
- }) => Promise<`0x${string}`>;
55
- export declare const getUserOpHash: ({ userOp, entryPointAddress, chainId, publicClient }: {
81
+ export declare function getUserOpHash({ userOp, entryPointAddress, chainId }: {
56
82
  userOp: UserOperation;
57
83
  entryPointAddress: Address;
58
84
  chainId: number;
59
- publicClient: PublicClient;
60
- }) => `0x${string}` | Promise<`0x${string}`>;
85
+ }): Hex;
61
86
  export declare const getNonceKeyAndSequence: (nonce: bigint) => bigint[];
62
- export declare function toUnpackedUserOp(packedUserOp: PackedUserOperation): UserOperationV07;
87
+ export declare function hasPaymaster(userOp: UserOperation): boolean;
88
+ export declare function calculateRequiredPrefund(userOp: UserOperation): bigint;
89
+ export declare function toUnpackedUserOp(packedUserOp: PackedUserOperation): UserOperation07;
63
90
  export declare function parseUserOpReceipt(userOpHash: Hex, receipt: TransactionReceipt): {
64
91
  sender: `0x${string}`;
65
92
  userOpHash: `0x${string}`;
@@ -71,9 +98,9 @@ export declare function parseUserOpReceipt(userOpHash: Hex, receipt: Transaction
71
98
  logs: {
72
99
  address: `0x${string}`;
73
100
  data: `0x${string}`;
101
+ transactionHash: `0x${string}`;
74
102
  logIndex: bigint;
75
103
  transactionIndex: bigint;
76
- transactionHash: `0x${string}`;
77
104
  blockHash: `0x${string}`;
78
105
  blockNumber: bigint;
79
106
  topics: `0x${string}`[];
@@ -82,9 +109,9 @@ export declare function parseUserOpReceipt(userOpHash: Hex, receipt: Transaction
82
109
  to: `0x${string}` | null;
83
110
  gasUsed: bigint;
84
111
  status: bigint | null;
112
+ transactionHash: `0x${string}`;
85
113
  contractAddress: `0x${string}` | null;
86
114
  transactionIndex: bigint;
87
- transactionHash: `0x${string}`;
88
115
  blockHash: `0x${string}`;
89
116
  blockNumber: bigint;
90
117
  from: `0x${string}`;
@@ -92,9 +119,9 @@ export declare function parseUserOpReceipt(userOpHash: Hex, receipt: Transaction
92
119
  logs: {
93
120
  address: `0x${string}`;
94
121
  data: `0x${string}`;
122
+ transactionHash: `0x${string}`;
95
123
  logIndex: bigint;
96
124
  transactionIndex: bigint;
97
- transactionHash: `0x${string}`;
98
125
  blockHash: `0x${string}`;
99
126
  blockNumber: bigint;
100
127
  topics: `0x${string}`[];
@@ -105,4 +132,9 @@ export declare function parseUserOpReceipt(userOpHash: Hex, receipt: Transaction
105
132
  paymaster?: `0x${string}` | undefined;
106
133
  reason?: `0x${string}` | undefined;
107
134
  };
135
+ export declare const getViemEntryPointVersion: (userOp: UserOperation, entryPoint: Address) => EntryPointVersion;
136
+ export declare const getEntryPointSimulationsAddress: ({ version, config }: {
137
+ version: EntryPointVersion;
138
+ config: AltoConfig;
139
+ }) => Address | undefined;
108
140
  //# sourceMappingURL=userop.d.ts.map
@@ -1,34 +1,31 @@
1
1
  import { logSchema, receiptSchema } from "../types/index.js";
2
- import { concat, decodeEventLog, encodeAbiParameters, getAbiItem, getAddress, keccak256, pad, size, slice, toHex, zeroAddress } from "viem";
3
- import { entryPoint07Abi } from "viem/account-abstraction";
2
+ import { decodeEventLog, getAbiItem, getAddress, size, slice, toHex, zeroAddress } from "viem";
3
+ import { entryPoint07Abi, getUserOperationHash, toPackedUserOperation } from "viem/account-abstraction";
4
4
  import { z } from "zod";
5
- import { getAuthorizationStateOverrides } from "./helpers.js";
6
- // Type predicate check if the UserOperation is V06.
5
+ import { getEip7702AuthAddress } from "./eip7702.js";
6
+ // Type predicate check if the UserOperation is v0.6
7
7
  export function isVersion06(operation) {
8
8
  return "initCode" in operation && "paymasterAndData" in operation;
9
9
  }
10
- // Type predicate to check if the UserOperation is V07.
10
+ // Type predicate to check if the UserOperation is v0.7
11
11
  export function isVersion07(operation) {
12
12
  return "factory" in operation && "paymaster" in operation;
13
13
  }
14
- // Type predicate to check if the UserOperation is V07.
14
+ // Type predicate to check if the UserOperation is v0.8
15
15
  export function isVersion08(operation, entryPointAddress) {
16
- return entryPointAddress.startsWith("0x4337");
16
+ return entryPointAddress.startsWith("0x433708");
17
17
  }
18
- export function getInitCode(unpackedUserOp) {
19
- return unpackedUserOp.factory
20
- ? concat([
21
- unpackedUserOp.factory === "0x7702"
22
- ? pad(unpackedUserOp.factory, {
23
- dir: "right",
24
- size: 20
25
- })
26
- : unpackedUserOp.factory,
27
- unpackedUserOp.factoryData || "0x"
28
- ])
29
- : "0x";
18
+ // Type predicate to check if the UserOperation is v0.9
19
+ export function isVersion09(operation, entryPointAddress) {
20
+ return entryPointAddress.startsWith("0x433709");
30
21
  }
31
- export function unPackInitCode(initCode) {
22
+ // Check if a userOperation is a deployment operation
23
+ export function isDeployment(userOp) {
24
+ const isDeployment06 = isVersion06(userOp) && !!userOp.initCode && userOp.initCode !== "0x";
25
+ const isDeployment07 = isVersion07(userOp) && !!userOp.factory && userOp.factory !== "0x";
26
+ return isDeployment06 || isDeployment07;
27
+ }
28
+ function unPackInitCode(initCode) {
32
29
  if (initCode === "0x") {
33
30
  return {
34
31
  factory: null,
@@ -40,49 +37,19 @@ export function unPackInitCode(initCode) {
40
37
  factoryData: size(initCode) > 20 ? slice(initCode, 20) : null
41
38
  };
42
39
  }
43
- export function getAccountGasLimits(unpackedUserOp) {
44
- return concat([
45
- pad(toHex(unpackedUserOp.verificationGasLimit), {
46
- size: 16
47
- }),
48
- pad(toHex(unpackedUserOp.callGasLimit), { size: 16 })
49
- ]);
50
- }
51
- export function unpackAccountGasLimits(accountGasLimits) {
40
+ function unpackAccountGasLimits(accountGasLimits) {
52
41
  return {
53
42
  verificationGasLimit: BigInt(slice(accountGasLimits, 0, 16)),
54
43
  callGasLimit: BigInt(slice(accountGasLimits, 16))
55
44
  };
56
45
  }
57
- export function getGasLimits(unpackedUserOp) {
58
- return concat([
59
- pad(toHex(unpackedUserOp.maxPriorityFeePerGas), {
60
- size: 16
61
- }),
62
- pad(toHex(unpackedUserOp.maxFeePerGas), { size: 16 })
63
- ]);
64
- }
65
- export function unpackGasLimits(gasLimits) {
46
+ function unpackGasLimits(gasLimits) {
66
47
  return {
67
48
  maxPriorityFeePerGas: BigInt(slice(gasLimits, 0, 16)),
68
49
  maxFeePerGas: BigInt(slice(gasLimits, 16))
69
50
  };
70
51
  }
71
- export function getPaymasterAndData(unpackedUserOp) {
72
- return unpackedUserOp.paymaster
73
- ? concat([
74
- unpackedUserOp.paymaster,
75
- pad(toHex(unpackedUserOp.paymasterVerificationGasLimit || 0n), {
76
- size: 16
77
- }),
78
- pad(toHex(unpackedUserOp.paymasterPostOpGasLimit || 0n), {
79
- size: 16
80
- }),
81
- unpackedUserOp.paymasterData || "0x"
82
- ])
83
- : "0x";
84
- }
85
- export function unpackPaymasterAndData(paymasterAndData) {
52
+ function unpackPaymasterAndData(paymasterAndData) {
86
53
  if (paymasterAndData === "0x") {
87
54
  return {
88
55
  paymaster: null,
@@ -99,18 +66,28 @@ export function unpackPaymasterAndData(paymasterAndData) {
99
66
  paymasterData: paymasterAndDataSize > 52 ? slice(paymasterAndData, 52) : null
100
67
  };
101
68
  }
102
- export function toPackedUserOp(unpackedUserOp) {
103
- return {
104
- sender: unpackedUserOp.sender,
105
- nonce: unpackedUserOp.nonce,
106
- initCode: getInitCode(unpackedUserOp),
107
- callData: unpackedUserOp.callData,
108
- accountGasLimits: getAccountGasLimits(unpackedUserOp),
109
- preVerificationGas: unpackedUserOp.preVerificationGas,
110
- gasFees: getGasLimits(unpackedUserOp),
111
- paymasterAndData: getPaymasterAndData(unpackedUserOp),
112
- signature: unpackedUserOp.signature
69
+ // Convert Alto's UserOperation07/08/09 (with null) to viem's format (with undefined)
70
+ export function toViemUserOp(userOp) {
71
+ const base = {
72
+ ...userOp,
73
+ paymaster: userOp.paymaster ?? undefined,
74
+ paymasterData: userOp.paymasterData ?? undefined,
75
+ paymasterVerificationGasLimit: userOp.paymasterVerificationGasLimit ?? undefined,
76
+ paymasterPostOpGasLimit: userOp.paymasterPostOpGasLimit ?? undefined,
77
+ factory: userOp.factory ?? undefined,
78
+ factoryData: userOp.factoryData ?? undefined
113
79
  };
80
+ // UserOperation09 has paymasterSignature field
81
+ if ("paymasterSignature" in userOp) {
82
+ return {
83
+ ...base,
84
+ paymasterSignature: userOp.paymasterSignature ?? undefined
85
+ };
86
+ }
87
+ return base;
88
+ }
89
+ export function toPackedUserOp(unpacked) {
90
+ return toPackedUserOperation(toViemUserOp(unpacked));
114
91
  }
115
92
  // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
116
93
  export function deepHexlify(obj) {
@@ -145,205 +122,96 @@ export function getAddressFromInitCodeOrPaymasterAndData(data) {
145
122
  }
146
123
  return null;
147
124
  }
148
- export const getUserOpHashV06 = ({ userOp, entryPointAddress, chainId }) => {
149
- const hash = keccak256(encodeAbiParameters([
150
- {
151
- name: "sender",
152
- type: "address"
153
- },
154
- {
155
- name: "nonce",
156
- type: "uint256"
157
- },
158
- {
159
- name: "initCodeHash",
160
- type: "bytes32"
161
- },
162
- {
163
- name: "callDataHash",
164
- type: "bytes32"
165
- },
166
- {
167
- name: "callGasLimit",
168
- type: "uint256"
169
- },
170
- {
171
- name: "verificationGasLimit",
172
- type: "uint256"
173
- },
174
- {
175
- name: "preVerificationGas",
176
- type: "uint256"
177
- },
178
- {
179
- name: "maxFeePerGas",
180
- type: "uint256"
181
- },
182
- {
183
- name: "maxPriorityFeePerGas",
184
- type: "uint256"
185
- },
186
- {
187
- name: "paymasterAndDataHash",
188
- type: "bytes32"
189
- }
190
- ], [
191
- userOp.sender,
192
- userOp.nonce,
193
- keccak256(userOp.initCode),
194
- keccak256(userOp.callData),
195
- userOp.callGasLimit,
196
- userOp.verificationGasLimit,
197
- userOp.preVerificationGas,
198
- userOp.maxFeePerGas,
199
- userOp.maxPriorityFeePerGas,
200
- keccak256(userOp.paymasterAndData)
201
- ]));
202
- return keccak256(encodeAbiParameters([
203
- {
204
- name: "userOpHash",
205
- type: "bytes32"
206
- },
207
- {
208
- name: "entryPointAddress",
209
- type: "address"
210
- },
211
- {
212
- name: "chainId",
213
- type: "uint256"
214
- }
215
- ], [hash, entryPointAddress, BigInt(chainId)]));
216
- };
217
- export const getUserOpHashV07 = ({ userOp, entryPointAddress, chainId }) => {
218
- const hash = keccak256(encodeAbiParameters([
219
- {
220
- name: "sender",
221
- type: "address"
222
- },
223
- {
224
- name: "nonce",
225
- type: "uint256"
226
- },
227
- {
228
- name: "initCodeHash",
229
- type: "bytes32"
230
- },
231
- {
232
- name: "callDataHash",
233
- type: "bytes32"
234
- },
235
- {
236
- name: "accountGasLimits",
237
- type: "bytes32"
238
- },
239
- {
240
- name: "preVerificationGas",
241
- type: "uint256"
242
- },
243
- {
244
- name: "gasFees",
245
- type: "bytes32"
246
- },
247
- {
248
- name: "paymasterAndDataHash",
249
- type: "bytes32"
250
- }
251
- ], [
252
- userOp.sender,
253
- userOp.nonce,
254
- keccak256(userOp.initCode),
255
- keccak256(userOp.callData),
256
- userOp.accountGasLimits,
257
- userOp.preVerificationGas,
258
- userOp.gasFees,
259
- keccak256(userOp.paymasterAndData)
260
- ]));
261
- return keccak256(encodeAbiParameters([
262
- {
263
- name: "userOpHash",
264
- type: "bytes32"
265
- },
266
- {
267
- name: "entryPointAddress",
268
- type: "address"
269
- },
270
- {
271
- name: "chainId",
272
- type: "uint256"
273
- }
274
- ], [hash, entryPointAddress, BigInt(chainId)]));
275
- };
276
- export const getUserOpHashV08 = async ({ userOp, entryPointAddress, publicClient }) => {
277
- const packedUserOp = toPackedUserOp(userOp);
278
- // : concat(["0xef0100", code ?? "0x"])
279
- const stateOverrides = getAuthorizationStateOverrides({
280
- userOps: [userOp]
281
- });
282
- const hash = await publicClient.readContract({
283
- address: entryPointAddress,
284
- abi: [
285
- {
286
- inputs: [
287
- {
288
- components: [
289
- { name: "sender", type: "address" },
290
- { name: "nonce", type: "uint256" },
291
- { name: "initCode", type: "bytes" },
292
- { name: "callData", type: "bytes" },
293
- { name: "accountGasLimits", type: "bytes32" },
294
- { name: "preVerificationGas", type: "uint256" },
295
- { name: "gasFees", type: "bytes32" },
296
- { name: "paymasterAndData", type: "bytes" },
297
- { name: "signature", type: "bytes" }
298
- ],
299
- name: "userOp",
300
- type: "tuple"
301
- }
302
- ],
303
- name: "getUserOpHash",
304
- outputs: [{ name: "", type: "bytes32" }],
305
- stateMutability: "view",
306
- type: "function"
125
+ export function getUserOpHash({ userOp, entryPointAddress, chainId }) {
126
+ if (isVersion09(userOp, entryPointAddress)) {
127
+ const authorization = userOp.eip7702Auth
128
+ ? {
129
+ address: getEip7702AuthAddress(userOp.eip7702Auth),
130
+ chainId: userOp.eip7702Auth.chainId,
131
+ nonce: userOp.eip7702Auth.nonce,
132
+ r: userOp.eip7702Auth.r,
133
+ s: userOp.eip7702Auth.s,
134
+ yParity: userOp.eip7702Auth.yParity,
135
+ v: userOp.eip7702Auth.v
307
136
  }
308
- ],
309
- functionName: "getUserOpHash",
310
- args: [packedUserOp],
311
- stateOverride: [
312
- ...Object.keys(stateOverrides).map((address) => ({
313
- address: address,
314
- code: stateOverrides[address]?.code ?? "0x"
315
- }))
316
- ]
317
- });
318
- return hash;
319
- };
320
- export const getUserOpHash = ({ userOp, entryPointAddress, chainId, publicClient }) => {
321
- if (isVersion06(userOp)) {
322
- return getUserOpHashV06({
323
- userOp,
137
+ : undefined;
138
+ return getUserOperationHash({
139
+ chainId,
324
140
  entryPointAddress,
325
- chainId
141
+ entryPointVersion: "0.9",
142
+ userOperation: {
143
+ ...toViemUserOp(userOp),
144
+ authorization
145
+ }
326
146
  });
327
147
  }
328
148
  if (isVersion08(userOp, entryPointAddress)) {
329
- return getUserOpHashV08({
330
- userOp,
149
+ const authorization = userOp.eip7702Auth
150
+ ? {
151
+ address: getEip7702AuthAddress(userOp.eip7702Auth),
152
+ chainId: userOp.eip7702Auth.chainId,
153
+ nonce: userOp.eip7702Auth.nonce,
154
+ r: userOp.eip7702Auth.r,
155
+ s: userOp.eip7702Auth.s,
156
+ yParity: userOp.eip7702Auth.yParity,
157
+ v: userOp.eip7702Auth.v
158
+ }
159
+ : undefined;
160
+ return getUserOperationHash({
161
+ chainId,
331
162
  entryPointAddress,
163
+ entryPointVersion: "0.8",
164
+ userOperation: {
165
+ ...toViemUserOp(userOp),
166
+ authorization
167
+ }
168
+ });
169
+ }
170
+ if (isVersion07(userOp)) {
171
+ return getUserOperationHash({
332
172
  chainId,
333
- publicClient
173
+ entryPointAddress,
174
+ entryPointVersion: "0.7",
175
+ userOperation: toViemUserOp(userOp)
334
176
  });
335
177
  }
336
- return getUserOpHashV07({
337
- userOp: toPackedUserOp(userOp),
178
+ return getUserOperationHash({
179
+ chainId,
338
180
  entryPointAddress,
339
- chainId
181
+ entryPointVersion: "0.6",
182
+ userOperation: userOp
340
183
  });
341
- };
184
+ }
342
185
  export const getNonceKeyAndSequence = (nonce) => {
343
186
  const nonceKey = nonce >> 64n; // first 192 bits of nonce
344
187
  const nonceSequence = nonce & 0xffffffffffffffffn; // last 64 bits of nonce
345
188
  return [nonceKey, nonceSequence];
346
189
  };
190
+ // Check if a userOperation has a paymaster
191
+ export function hasPaymaster(userOp) {
192
+ if (isVersion06(userOp)) {
193
+ return !!userOp.paymasterAndData && userOp.paymasterAndData !== "0x";
194
+ }
195
+ return !!userOp.paymaster && userOp.paymaster !== "0x";
196
+ }
197
+ export function calculateRequiredPrefund(userOp) {
198
+ if (isVersion06(userOp)) {
199
+ const mul = hasPaymaster(userOp) ? 3n : 1n;
200
+ const requiredGas = userOp.callGasLimit +
201
+ userOp.verificationGasLimit * mul +
202
+ userOp.preVerificationGas;
203
+ return requiredGas * userOp.maxFeePerGas;
204
+ }
205
+ // v0.7/v0.8 logic: sum all gas limits directly
206
+ const paymasterVerificationGasLimit = userOp.paymasterVerificationGasLimit ?? 0n;
207
+ const paymasterPostOpGasLimit = userOp.paymasterPostOpGasLimit ?? 0n;
208
+ const requiredGas = userOp.verificationGasLimit +
209
+ userOp.callGasLimit +
210
+ paymasterVerificationGasLimit +
211
+ paymasterPostOpGasLimit +
212
+ userOp.preVerificationGas;
213
+ return requiredGas * userOp.maxFeePerGas;
214
+ }
347
215
  export function toUnpackedUserOp(packedUserOp) {
348
216
  const { factory, factoryData } = unPackInitCode(packedUserOp.initCode);
349
217
  const { callGasLimit, verificationGasLimit } = unpackAccountGasLimits(packedUserOp.accountGasLimits);
@@ -414,7 +282,7 @@ export function parseUserOpReceipt(userOpHash, receipt) {
414
282
  startIndex = index;
415
283
  }
416
284
  }
417
- catch (e) { }
285
+ catch { }
418
286
  }
419
287
  if (userOpEventIndex === -1 || startIndex === -1 || !userOpEventArgs) {
420
288
  throw new Error("fatal: no UserOpEvent in logs");
@@ -445,4 +313,26 @@ export function parseUserOpReceipt(userOpHash, receipt) {
445
313
  };
446
314
  return userOpReceipt;
447
315
  }
316
+ export const getViemEntryPointVersion = (userOp, entryPoint) => {
317
+ if (isVersion09(userOp, entryPoint)) {
318
+ return "0.9";
319
+ }
320
+ if (isVersion08(userOp, entryPoint)) {
321
+ return "0.8";
322
+ }
323
+ if (isVersion07(userOp)) {
324
+ return "0.7";
325
+ }
326
+ return "0.6";
327
+ };
328
+ export const getEntryPointSimulationsAddress = ({ version, config }) => {
329
+ switch (version) {
330
+ case "0.9":
331
+ return config.entrypointSimulationContractV9;
332
+ case "0.8":
333
+ return config.entrypointSimulationContractV8;
334
+ default:
335
+ return config.entrypointSimulationContractV7;
336
+ }
337
+ };
448
338
  //# sourceMappingURL=userop.js.map