@pimlico/alto 0.0.0-main.20250428T212302 → 0.0.0-main.20250429T114818

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 (384) hide show
  1. package/contracts/EIP712.sol/EIP712.json +1 -0
  2. package/contracts/ERC165.sol/ERC165.json +1 -0
  3. package/contracts/Eip7702Support.sol/Eip7702Support.json +1 -0
  4. package/contracts/EntryPoint.sol/EntryPoint.json +1 -0
  5. package/contracts/EntryPointCodeOverride.sol/EntryPointCodeOverride.json +1 -0
  6. package/contracts/EntryPointSimulations.sol/EntryPointSimulations.json +1 -0
  7. package/contracts/Exec.sol/Exec.json +1 -0
  8. package/contracts/IAccount.sol/IAccount.json +1 -0
  9. package/contracts/IAccountExecute.sol/IAccountExecute.json +1 -0
  10. package/contracts/IAggregator.sol/IAggregator.json +1 -0
  11. package/contracts/IERC165.sol/IERC165.json +1 -0
  12. package/contracts/IERC5267.sol/IERC5267.json +1 -0
  13. package/contracts/IEntryPoint.sol/IEntryPoint.json +1 -0
  14. package/contracts/IEntryPointSimulations.sol/IEntryPointSimulations.json +1 -0
  15. package/contracts/INonceManager.sol/INonceManager.json +1 -0
  16. package/contracts/IPaymaster.sol/IPaymaster.json +1 -0
  17. package/contracts/ISenderCreator.sol/ISenderCreator.json +1 -0
  18. package/contracts/IStakeManager.sol/IStakeManager.json +1 -0
  19. package/contracts/Math.sol/Math.json +1 -0
  20. package/contracts/MessageHashUtils.sol/MessageHashUtils.json +1 -0
  21. package/contracts/NonceManager.sol/NonceManager.json +1 -0
  22. package/contracts/Panic.sol/Panic.json +1 -0
  23. package/contracts/PimlicoEntryPointSimulationsV7.sol/PimlicoEntryPointSimulationsV7.json +1 -0
  24. package/contracts/PimlicoEntryPointSimulationsV8.sol/PimlicoEntryPointSimulationsV8.json +1 -0
  25. package/contracts/ReentrancyGuard.sol/ReentrancyGuard.json +1 -0
  26. package/contracts/ReentrancyGuardTransient.sol/ReentrancyGuardTransient.json +1 -0
  27. package/contracts/SafeCast.sol/SafeCast.json +1 -0
  28. package/contracts/SenderCreator.sol/SenderCreator.json +1 -0
  29. package/contracts/ShortStrings.sol/ShortStrings.json +1 -0
  30. package/contracts/SignedMath.sol/SignedMath.json +1 -0
  31. package/contracts/StakeManager.sol/StakeManager.json +1 -0
  32. package/contracts/StorageSlot.sol/StorageSlot.json +1 -0
  33. package/contracts/Strings.sol/Strings.json +1 -0
  34. package/contracts/TransientSlot.sol/TransientSlot.json +1 -0
  35. package/contracts/UserOperation.sol/UserOperationLib.json +1 -0
  36. package/contracts/UserOperationLib.sol/UserOperationLib.json +1 -0
  37. package/contracts/build-info/0c52dc19c74a9a932ddddcca463ce398.json +1 -0
  38. package/contracts/build-info/a1d9af887789a0ade8ffbc8b045f0780.json +1 -0
  39. package/contracts/interfaces/IEntryPoint.sol/IEntryPoint.json +1 -0
  40. package/esm/cli/deploySimulationsContract.js +14 -5
  41. package/esm/cli/deploySimulationsContract.js.map +1 -1
  42. package/package.json +2 -1
  43. package/lib/cli/alto.d.ts +0 -7
  44. package/lib/cli/alto.js +0 -141
  45. package/lib/cli/alto.js.map +0 -1
  46. package/lib/cli/config/bundler.d.ts +0 -2872
  47. package/lib/cli/config/bundler.js +0 -242
  48. package/lib/cli/config/bundler.js.map +0 -1
  49. package/lib/cli/config/index.d.ts +0 -3
  50. package/lib/cli/config/index.js +0 -19
  51. package/lib/cli/config/index.js.map +0 -1
  52. package/lib/cli/config/options.d.ts +0 -13
  53. package/lib/cli/config/options.js +0 -587
  54. package/lib/cli/config/options.js.map +0 -1
  55. package/lib/cli/customTransport.d.ts +0 -14
  56. package/lib/cli/customTransport.js +0 -94
  57. package/lib/cli/customTransport.js.map +0 -1
  58. package/lib/cli/deploySimulationsContract.d.ts +0 -13
  59. package/lib/cli/deploySimulationsContract.js +0 -100
  60. package/lib/cli/deploySimulationsContract.js.map +0 -1
  61. package/lib/cli/handler.d.ts +0 -3
  62. package/lib/cli/handler.js +0 -157
  63. package/lib/cli/handler.js.map +0 -1
  64. package/lib/cli/index.d.ts +0 -4
  65. package/lib/cli/index.js +0 -20
  66. package/lib/cli/index.js.map +0 -1
  67. package/lib/cli/instrumentation.d.ts +0 -2
  68. package/lib/cli/instrumentation.js +0 -47
  69. package/lib/cli/instrumentation.js.map +0 -1
  70. package/lib/cli/parseArgs.d.ts +0 -8
  71. package/lib/cli/parseArgs.js +0 -25
  72. package/lib/cli/parseArgs.js.map +0 -1
  73. package/lib/cli/setupServer.d.ts +0 -13
  74. package/lib/cli/setupServer.js +0 -266
  75. package/lib/cli/setupServer.js.map +0 -1
  76. package/lib/cli/util.d.ts +0 -22
  77. package/lib/cli/util.js +0 -34
  78. package/lib/cli/util.js.map +0 -1
  79. package/lib/createConfig.d.ts +0 -16
  80. package/lib/createConfig.js +0 -13
  81. package/lib/createConfig.js.map +0 -1
  82. package/lib/executor/executor.d.ts +0 -65
  83. package/lib/executor/executor.js +0 -301
  84. package/lib/executor/executor.js.map +0 -1
  85. package/lib/executor/executorManager.d.ts +0 -108
  86. package/lib/executor/executorManager.js +0 -702
  87. package/lib/executor/executorManager.js.map +0 -1
  88. package/lib/executor/fastlane.d.ts +0 -9
  89. package/lib/executor/fastlane.js +0 -41
  90. package/lib/executor/fastlane.js.map +0 -1
  91. package/lib/executor/filterOpsAndEStimateGas.d.ts +0 -29
  92. package/lib/executor/filterOpsAndEStimateGas.js +0 -225
  93. package/lib/executor/filterOpsAndEStimateGas.js.map +0 -1
  94. package/lib/executor/index.d.ts +0 -5
  95. package/lib/executor/index.js +0 -21
  96. package/lib/executor/index.js.map +0 -1
  97. package/lib/executor/senderManager/createMemorySenderManager.d.ts +0 -8
  98. package/lib/executor/senderManager/createMemorySenderManager.js +0 -45
  99. package/lib/executor/senderManager/createMemorySenderManager.js.map +0 -1
  100. package/lib/executor/senderManager/createRedisSenderManager.d.ts +0 -8
  101. package/lib/executor/senderManager/createRedisSenderManager.js +0 -85
  102. package/lib/executor/senderManager/createRedisSenderManager.js.map +0 -1
  103. package/lib/executor/senderManager/flushOnStartUp.d.ts +0 -9
  104. package/lib/executor/senderManager/flushOnStartUp.js +0 -37
  105. package/lib/executor/senderManager/flushOnStartUp.js.map +0 -1
  106. package/lib/executor/senderManager/index.d.ts +0 -15
  107. package/lib/executor/senderManager/index.js +0 -25
  108. package/lib/executor/senderManager/index.js.map +0 -1
  109. package/lib/executor/senderManager/validateAndRefill.d.ts +0 -11
  110. package/lib/executor/senderManager/validateAndRefill.js +0 -115
  111. package/lib/executor/senderManager/validateAndRefill.js.map +0 -1
  112. package/lib/executor/utilityWalletMonitor.d.ts +0 -19
  113. package/lib/executor/utilityWalletMonitor.js +0 -42
  114. package/lib/executor/utilityWalletMonitor.js.map +0 -1
  115. package/lib/executor/utils.d.ts +0 -34
  116. package/lib/executor/utils.js +0 -167
  117. package/lib/executor/utils.js.map +0 -1
  118. package/lib/handlers/arbitrumGasPriceManager.d.ts +0 -14
  119. package/lib/handlers/arbitrumGasPriceManager.js +0 -39
  120. package/lib/handlers/arbitrumGasPriceManager.js.map +0 -1
  121. package/lib/handlers/eventManager.d.ts +0 -29
  122. package/lib/handlers/eventManager.js +0 -225
  123. package/lib/handlers/eventManager.js.map +0 -1
  124. package/lib/handlers/gasPriceManager.d.ts +0 -36
  125. package/lib/handlers/gasPriceManager.js +0 -391
  126. package/lib/handlers/gasPriceManager.js.map +0 -1
  127. package/lib/handlers/index.d.ts +0 -3
  128. package/lib/handlers/index.js +0 -19
  129. package/lib/handlers/index.js.map +0 -1
  130. package/lib/handlers/mantleGasPriceManager.d.ts +0 -23
  131. package/lib/handlers/mantleGasPriceManager.js +0 -44
  132. package/lib/handlers/mantleGasPriceManager.js.map +0 -1
  133. package/lib/handlers/optimismManager.d.ts +0 -10
  134. package/lib/handlers/optimismManager.js +0 -21
  135. package/lib/handlers/optimismManager.js.map +0 -1
  136. package/lib/index.d.ts +0 -2
  137. package/lib/index.js +0 -4
  138. package/lib/index.js.map +0 -1
  139. package/lib/mempool/index.d.ts +0 -4
  140. package/lib/mempool/index.js +0 -20
  141. package/lib/mempool/index.js.map +0 -1
  142. package/lib/mempool/mempool.d.ts +0 -191
  143. package/lib/mempool/mempool.js +0 -499
  144. package/lib/mempool/mempool.js.map +0 -1
  145. package/lib/mempool/monitoring.d.ts +0 -14
  146. package/lib/mempool/monitoring.js +0 -101
  147. package/lib/mempool/monitoring.js.map +0 -1
  148. package/lib/mempool/reputationManager.d.ts +0 -121
  149. package/lib/mempool/reputationManager.js +0 -472
  150. package/lib/mempool/reputationManager.js.map +0 -1
  151. package/lib/rpc/createMethodHandler.d.ts +0 -31
  152. package/lib/rpc/createMethodHandler.js +0 -34
  153. package/lib/rpc/createMethodHandler.js.map +0 -1
  154. package/lib/rpc/estimation/gasEstimationHandler.d.ts +0 -30
  155. package/lib/rpc/estimation/gasEstimationHandler.js +0 -50
  156. package/lib/rpc/estimation/gasEstimationHandler.js.map +0 -1
  157. package/lib/rpc/estimation/gasEstimationsV06.d.ts +0 -19
  158. package/lib/rpc/estimation/gasEstimationsV06.js +0 -148
  159. package/lib/rpc/estimation/gasEstimationsV06.js.map +0 -1
  160. package/lib/rpc/estimation/gasEstimationsV07.d.ts +0 -101
  161. package/lib/rpc/estimation/gasEstimationsV07.js +0 -727
  162. package/lib/rpc/estimation/gasEstimationsV07.js.map +0 -1
  163. package/lib/rpc/estimation/types.d.ts +0 -120
  164. package/lib/rpc/estimation/types.js +0 -125
  165. package/lib/rpc/estimation/types.js.map +0 -1
  166. package/lib/rpc/index.d.ts +0 -4
  167. package/lib/rpc/index.js +0 -20
  168. package/lib/rpc/index.js.map +0 -1
  169. package/lib/rpc/methods/debug_bundler_clearReputation.d.ts +0 -22
  170. package/lib/rpc/methods/debug_bundler_clearReputation.js +0 -15
  171. package/lib/rpc/methods/debug_bundler_clearReputation.js.map +0 -1
  172. package/lib/rpc/methods/debug_bundler_clearState.d.ts +0 -22
  173. package/lib/rpc/methods/debug_bundler_clearState.js +0 -16
  174. package/lib/rpc/methods/debug_bundler_clearState.js.map +0 -1
  175. package/lib/rpc/methods/debug_bundler_dumpMempool.d.ts +0 -973
  176. package/lib/rpc/methods/debug_bundler_dumpMempool.js +0 -16
  177. package/lib/rpc/methods/debug_bundler_dumpMempool.js.map +0 -1
  178. package/lib/rpc/methods/debug_bundler_dumpReputation.d.ts +0 -57
  179. package/lib/rpc/methods/debug_bundler_dumpReputation.js +0 -16
  180. package/lib/rpc/methods/debug_bundler_dumpReputation.js.map +0 -1
  181. package/lib/rpc/methods/debug_bundler_getStakeStatus.d.ts +0 -79
  182. package/lib/rpc/methods/debug_bundler_getStakeStatus.js +0 -25
  183. package/lib/rpc/methods/debug_bundler_getStakeStatus.js.map +0 -1
  184. package/lib/rpc/methods/debug_bundler_sendBundleNow.d.ts +0 -22
  185. package/lib/rpc/methods/debug_bundler_sendBundleNow.js +0 -15
  186. package/lib/rpc/methods/debug_bundler_sendBundleNow.js.map +0 -1
  187. package/lib/rpc/methods/debug_bundler_setBundlingMode.d.ts +0 -22
  188. package/lib/rpc/methods/debug_bundler_setBundlingMode.js +0 -16
  189. package/lib/rpc/methods/debug_bundler_setBundlingMode.js.map +0 -1
  190. package/lib/rpc/methods/debug_bundler_setReputation.d.ts +0 -46
  191. package/lib/rpc/methods/debug_bundler_setReputation.js +0 -16
  192. package/lib/rpc/methods/debug_bundler_setReputation.js.map +0 -1
  193. package/lib/rpc/methods/eth_chainId.d.ts +0 -22
  194. package/lib/rpc/methods/eth_chainId.js +0 -13
  195. package/lib/rpc/methods/eth_chainId.js.map +0 -1
  196. package/lib/rpc/methods/eth_estimateUserOperationGas.d.ts +0 -1891
  197. package/lib/rpc/methods/eth_estimateUserOperationGas.js +0 -26
  198. package/lib/rpc/methods/eth_estimateUserOperationGas.js.map +0 -1
  199. package/lib/rpc/methods/eth_getUserOperationByHash.d.ts +0 -1775
  200. package/lib/rpc/methods/eth_getUserOperationByHash.js +0 -101
  201. package/lib/rpc/methods/eth_getUserOperationByHash.js.map +0 -1
  202. package/lib/rpc/methods/eth_getUserOperationReceipt.d.ts +0 -412
  203. package/lib/rpc/methods/eth_getUserOperationReceipt.js +0 -14
  204. package/lib/rpc/methods/eth_getUserOperationReceipt.js.map +0 -1
  205. package/lib/rpc/methods/eth_sendUserOperation.d.ts +0 -878
  206. package/lib/rpc/methods/eth_sendUserOperation.js +0 -44
  207. package/lib/rpc/methods/eth_sendUserOperation.js.map +0 -1
  208. package/lib/rpc/methods/eth_supportedEntryPoints.d.ts +0 -22
  209. package/lib/rpc/methods/eth_supportedEntryPoints.js +0 -13
  210. package/lib/rpc/methods/eth_supportedEntryPoints.js.map +0 -1
  211. package/lib/rpc/methods/index.d.ts +0 -3
  212. package/lib/rpc/methods/index.js +0 -44
  213. package/lib/rpc/methods/index.js.map +0 -1
  214. package/lib/rpc/methods/pimlico_getUserOperationGasPrice.d.ts +0 -131
  215. package/lib/rpc/methods/pimlico_getUserOperationGasPrice.js +0 -33
  216. package/lib/rpc/methods/pimlico_getUserOperationGasPrice.js.map +0 -1
  217. package/lib/rpc/methods/pimlico_getUserOperationStatus.d.ts +0 -43
  218. package/lib/rpc/methods/pimlico_getUserOperationStatus.js +0 -14
  219. package/lib/rpc/methods/pimlico_getUserOperationStatus.js.map +0 -1
  220. package/lib/rpc/methods/pimlico_sendUserOperationNow.d.ts +0 -1268
  221. package/lib/rpc/methods/pimlico_sendUserOperationNow.js +0 -55
  222. package/lib/rpc/methods/pimlico_sendUserOperationNow.js.map +0 -1
  223. package/lib/rpc/rpcHandler.d.ts +0 -75
  224. package/lib/rpc/rpcHandler.js +0 -391
  225. package/lib/rpc/rpcHandler.js.map +0 -1
  226. package/lib/rpc/server.d.ts +0 -26
  227. package/lib/rpc/server.js +0 -283
  228. package/lib/rpc/server.js.map +0 -1
  229. package/lib/rpc/validation/BundlerCollectorTracerV06.d.ts +0 -102
  230. package/lib/rpc/validation/BundlerCollectorTracerV06.js +0 -262
  231. package/lib/rpc/validation/BundlerCollectorTracerV06.js.map +0 -1
  232. package/lib/rpc/validation/BundlerCollectorTracerV07.d.ts +0 -102
  233. package/lib/rpc/validation/BundlerCollectorTracerV07.js +0 -261
  234. package/lib/rpc/validation/BundlerCollectorTracerV07.js.map +0 -1
  235. package/lib/rpc/validation/SafeValidator.d.ts +0 -51
  236. package/lib/rpc/validation/SafeValidator.js +0 -327
  237. package/lib/rpc/validation/SafeValidator.js.map +0 -1
  238. package/lib/rpc/validation/TracerResultParserV06.d.ts +0 -13
  239. package/lib/rpc/validation/TracerResultParserV06.js +0 -582
  240. package/lib/rpc/validation/TracerResultParserV06.js.map +0 -1
  241. package/lib/rpc/validation/TracerResultParserV07.d.ts +0 -33
  242. package/lib/rpc/validation/TracerResultParserV07.js +0 -599
  243. package/lib/rpc/validation/TracerResultParserV07.js.map +0 -1
  244. package/lib/rpc/validation/UnsafeValidator.d.ts +0 -97
  245. package/lib/rpc/validation/UnsafeValidator.js +0 -303
  246. package/lib/rpc/validation/UnsafeValidator.js.map +0 -1
  247. package/lib/rpc/validation/index.d.ts +0 -3
  248. package/lib/rpc/validation/index.js +0 -19
  249. package/lib/rpc/validation/index.js.map +0 -1
  250. package/lib/rpc/validation/tracer.d.ts +0 -125
  251. package/lib/rpc/validation/tracer.js +0 -112
  252. package/lib/rpc/validation/tracer.js.map +0 -1
  253. package/lib/store/createMemoryOutstandingStore.d.ts +0 -28
  254. package/lib/store/createMemoryOutstandingStore.js +0 -236
  255. package/lib/store/createMemoryOutstandingStore.js.map +0 -1
  256. package/lib/store/createMempoolStore.d.ts +0 -8
  257. package/lib/store/createMempoolStore.js +0 -199
  258. package/lib/store/createMempoolStore.js.map +0 -1
  259. package/lib/store/createRedisOutstandingStore.d.ts +0 -27
  260. package/lib/store/createRedisOutstandingStore.js +0 -349
  261. package/lib/store/createRedisOutstandingStore.js.map +0 -1
  262. package/lib/store/createRedisStore.d.ts +0 -9
  263. package/lib/store/createRedisStore.js +0 -138
  264. package/lib/store/createRedisStore.js.map +0 -1
  265. package/lib/store/createStore.d.ts +0 -6
  266. package/lib/store/createStore.js +0 -70
  267. package/lib/store/createStore.js.map +0 -1
  268. package/lib/store/index.d.ts +0 -81
  269. package/lib/store/index.js +0 -6
  270. package/lib/store/index.js.map +0 -1
  271. package/lib/types/contracts/ArbitrumL1FeeAbi.d.ts +0 -32
  272. package/lib/types/contracts/ArbitrumL1FeeAbi.js +0 -45
  273. package/lib/types/contracts/ArbitrumL1FeeAbi.js.map +0 -1
  274. package/lib/types/contracts/CallEngine.d.ts +0 -28
  275. package/lib/types/contracts/CallEngine.js +0 -40
  276. package/lib/types/contracts/CallEngine.js.map +0 -1
  277. package/lib/types/contracts/CodeHashGetter.d.ts +0 -37
  278. package/lib/types/contracts/CodeHashGetter.js +0 -48
  279. package/lib/types/contracts/CodeHashGetter.js.map +0 -1
  280. package/lib/types/contracts/EntryPoint.d.ts +0 -1789
  281. package/lib/types/contracts/EntryPoint.js +0 -2307
  282. package/lib/types/contracts/EntryPoint.js.map +0 -1
  283. package/lib/types/contracts/EntryPointSimulationsV6.d.ts +0 -34
  284. package/lib/types/contracts/EntryPointSimulationsV6.js +0 -51
  285. package/lib/types/contracts/EntryPointSimulationsV6.js.map +0 -1
  286. package/lib/types/contracts/EntryPointSimulationsV7.d.ts +0 -2076
  287. package/lib/types/contracts/EntryPointSimulationsV7.js +0 -2678
  288. package/lib/types/contracts/EntryPointSimulationsV7.js.map +0 -1
  289. package/lib/types/contracts/IAccountExecute.d.ts +0 -53
  290. package/lib/types/contracts/IAccountExecute.js +0 -71
  291. package/lib/types/contracts/IAccountExecute.js.map +0 -1
  292. package/lib/types/contracts/IPaymaster.d.ts +0 -3
  293. package/lib/types/contracts/IPaymaster.js +0 -120
  294. package/lib/types/contracts/IPaymaster.js.map +0 -1
  295. package/lib/types/contracts/MantleBvmGasPriceOracle.d.ts +0 -219
  296. package/lib/types/contracts/MantleBvmGasPriceOracle.js +0 -180
  297. package/lib/types/contracts/MantleBvmGasPriceOracle.js.map +0 -1
  298. package/lib/types/contracts/OpL1FeeAbi.d.ts +0 -114
  299. package/lib/types/contracts/OpL1FeeAbi.js +0 -77
  300. package/lib/types/contracts/OpL1FeeAbi.js.map +0 -1
  301. package/lib/types/contracts/PimlicoEntryPointSimulations.d.ts +0 -25
  302. package/lib/types/contracts/PimlicoEntryPointSimulations.js +0 -42
  303. package/lib/types/contracts/PimlicoEntryPointSimulations.js.map +0 -1
  304. package/lib/types/contracts/SenderCreator.d.ts +0 -4
  305. package/lib/types/contracts/SenderCreator.js +0 -26
  306. package/lib/types/contracts/SenderCreator.js.map +0 -1
  307. package/lib/types/contracts/SimpleAccountFactory.d.ts +0 -57
  308. package/lib/types/contracts/SimpleAccountFactory.js +0 -79
  309. package/lib/types/contracts/SimpleAccountFactory.js.map +0 -1
  310. package/lib/types/contracts/TestOpcodesAccount.d.ts +0 -4
  311. package/lib/types/contracts/TestOpcodesAccount.js +0 -284
  312. package/lib/types/contracts/TestOpcodesAccount.js.map +0 -1
  313. package/lib/types/contracts/TestOpcodesAccountFactory.d.ts +0 -4
  314. package/lib/types/contracts/TestOpcodesAccountFactory.js +0 -26
  315. package/lib/types/contracts/TestOpcodesAccountFactory.js.map +0 -1
  316. package/lib/types/contracts/TestStorageAccount.d.ts +0 -4
  317. package/lib/types/contracts/TestStorageAccount.js +0 -316
  318. package/lib/types/contracts/TestStorageAccount.js.map +0 -1
  319. package/lib/types/contracts/index.d.ts +0 -17
  320. package/lib/types/contracts/index.js +0 -33
  321. package/lib/types/contracts/index.js.map +0 -1
  322. package/lib/types/gasPrice.d.ts +0 -110
  323. package/lib/types/gasPrice.js +0 -55
  324. package/lib/types/gasPrice.js.map +0 -1
  325. package/lib/types/index.d.ts +0 -11
  326. package/lib/types/index.js +0 -27
  327. package/lib/types/index.js.map +0 -1
  328. package/lib/types/interfaces.d.ts +0 -58
  329. package/lib/types/interfaces.js +0 -3
  330. package/lib/types/interfaces.js.map +0 -1
  331. package/lib/types/mempool.d.ts +0 -60
  332. package/lib/types/mempool.js +0 -11
  333. package/lib/types/mempool.js.map +0 -1
  334. package/lib/types/schemas.d.ts +0 -20785
  335. package/lib/types/schemas.js +0 -679
  336. package/lib/types/schemas.js.map +0 -1
  337. package/lib/types/utils.d.ts +0 -25
  338. package/lib/types/utils.js +0 -35
  339. package/lib/types/utils.js.map +0 -1
  340. package/lib/types/validation.d.ts +0 -14327
  341. package/lib/types/validation.js +0 -312
  342. package/lib/types/validation.js.map +0 -1
  343. package/lib/utils/asyncTimeout.d.ts +0 -5
  344. package/lib/utils/asyncTimeout.js +0 -51
  345. package/lib/utils/asyncTimeout.js.map +0 -1
  346. package/lib/utils/bigInt.d.ts +0 -8
  347. package/lib/utils/bigInt.js +0 -24
  348. package/lib/utils/bigInt.js.map +0 -1
  349. package/lib/utils/eip7702.d.ts +0 -4
  350. package/lib/utils/eip7702.js +0 -21
  351. package/lib/utils/eip7702.js.map +0 -1
  352. package/lib/utils/fastify-rpc-decorators.d.ts +0 -19
  353. package/lib/utils/fastify-rpc-decorators.js +0 -23
  354. package/lib/utils/fastify-rpc-decorators.js.map +0 -1
  355. package/lib/utils/helpers.d.ts +0 -15
  356. package/lib/utils/helpers.js +0 -59
  357. package/lib/utils/helpers.js.map +0 -1
  358. package/lib/utils/index.d.ts +0 -9
  359. package/lib/utils/index.js +0 -24
  360. package/lib/utils/index.js.map +0 -1
  361. package/lib/utils/logger.d.ts +0 -6
  362. package/lib/utils/logger.js +0 -85
  363. package/lib/utils/logger.js.map +0 -1
  364. package/lib/utils/metrics.d.ts +0 -29
  365. package/lib/utils/metrics.js +0 -199
  366. package/lib/utils/metrics.js.map +0 -1
  367. package/lib/utils/minMaxQueue/createMemoryMinMaxQueue.d.ts +0 -6
  368. package/lib/utils/minMaxQueue/createMemoryMinMaxQueue.js +0 -57
  369. package/lib/utils/minMaxQueue/createMemoryMinMaxQueue.js.map +0 -1
  370. package/lib/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +0 -7
  371. package/lib/utils/minMaxQueue/createRedisMinMaxQueue.js +0 -105
  372. package/lib/utils/minMaxQueue/createRedisMinMaxQueue.js.map +0 -1
  373. package/lib/utils/minMaxQueue/index.d.ts +0 -12
  374. package/lib/utils/minMaxQueue/index.js +0 -16
  375. package/lib/utils/minMaxQueue/index.js.map +0 -1
  376. package/lib/utils/rpc-reply.d.ts +0 -16
  377. package/lib/utils/rpc-reply.js +0 -41
  378. package/lib/utils/rpc-reply.js.map +0 -1
  379. package/lib/utils/userop.d.ts +0 -138
  380. package/lib/utils/userop.js +0 -620
  381. package/lib/utils/userop.js.map +0 -1
  382. package/lib/utils/validation.d.ts +0 -76
  383. package/lib/utils/validation.js +0 -491
  384. package/lib/utils/validation.js.map +0 -1
@@ -1,225 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.EventManager = void 0;
30
- const sentry = __importStar(require("@sentry/node"));
31
- const ioredis_1 = __importDefault(require("ioredis"));
32
- const bull_1 = __importDefault(require("bull"));
33
- const asyncTimeout_1 = require("../utils/asyncTimeout.js");
34
- class EventManager {
35
- chainId;
36
- logger;
37
- metrics;
38
- redisEventManagerQueue;
39
- constructor({ config, metrics }) {
40
- this.chainId = config.chainId;
41
- this.logger = config.getLogger({ module: "event_manager" }, {
42
- level: config.logLevel
43
- });
44
- this.metrics = metrics;
45
- if (config.redisQueueEndpoint && config.redisEventManagerQueueName) {
46
- this.logger.info(`Using redis with queue name ${config.redisEventManagerQueueName} for userOp event queue`);
47
- const redis = new ioredis_1.default(config.redisQueueEndpoint);
48
- this.redisEventManagerQueue = new bull_1.default(config.redisEventManagerQueueName, {
49
- createClient: () => {
50
- return redis;
51
- }
52
- });
53
- return;
54
- }
55
- }
56
- // emits when the userOperation was mined onchain but reverted during the callphase
57
- emitExecutionRevertedOnChain(userOperationHash, transactionHash, reason, blockNumber) {
58
- this.emitEvent({
59
- userOperationHash,
60
- event: {
61
- eventType: "execution_reverted_onchain",
62
- transactionHash,
63
- data: {
64
- blockNumber: Number(blockNumber),
65
- reason
66
- }
67
- }
68
- });
69
- }
70
- // emits when the userOperation was mined onchain but failed EntryPoint validation
71
- emitFailedOnChain(userOperationHash, transactionHash, blockNumber) {
72
- this.emitEvent({
73
- userOperationHash,
74
- event: {
75
- eventType: "failed_onchain",
76
- transactionHash,
77
- data: {
78
- blockNumber: Number(blockNumber)
79
- }
80
- }
81
- });
82
- }
83
- // emits when the userOperation has been included onchain but bundled by a frontrunner
84
- emitFrontranOnChain(userOperationHash, transactionHash, blockNumber) {
85
- this.emitEvent({
86
- userOperationHash,
87
- event: {
88
- eventType: "frontran_onchain",
89
- transactionHash,
90
- data: {
91
- blockNumber: Number(blockNumber)
92
- }
93
- }
94
- });
95
- }
96
- // emits when the userOperation is included onchain
97
- emitIncludedOnChain(userOperationHash, transactionHash, blockNumber) {
98
- this.emitEvent({
99
- userOperationHash,
100
- event: {
101
- eventType: "included_onchain",
102
- transactionHash,
103
- data: {
104
- blockNumber: Number(blockNumber)
105
- }
106
- }
107
- });
108
- }
109
- // emits when the userOperation is placed in the nonce queue
110
- emitQueued(userOperationHash) {
111
- this.emitEvent({
112
- userOperationHash,
113
- event: {
114
- eventType: "queued"
115
- }
116
- });
117
- }
118
- // emits when the userOperation is first seen
119
- emitReceived(userOperationHash, timestamp) {
120
- this.emitEvent({
121
- userOperationHash,
122
- event: {
123
- eventType: "received"
124
- },
125
- timestamp
126
- });
127
- }
128
- // emits when the userOperation failed to get added to the mempool
129
- emitFailedValidation(userOperationHash, reason, aaError) {
130
- this.emitEvent({
131
- userOperationHash,
132
- event: {
133
- eventType: "failed_validation",
134
- data: {
135
- reason,
136
- aaError
137
- }
138
- }
139
- });
140
- }
141
- // emits when the userOperation has been submitted to the network
142
- emitSubmitted({ userOpHashes, transactionHash }) {
143
- for (const hash of userOpHashes) {
144
- this.emitEvent({
145
- userOperationHash: hash,
146
- event: {
147
- eventType: "submitted",
148
- transactionHash
149
- }
150
- });
151
- }
152
- }
153
- // emits when the userOperation was dropped from the internal mempool
154
- emitDropped(userOperationHash, reason, aaError) {
155
- this.emitEvent({
156
- userOperationHash,
157
- event: {
158
- eventType: "dropped",
159
- data: {
160
- reason,
161
- aaError
162
- }
163
- }
164
- });
165
- }
166
- // emits when the userOperation was added to the internal mempool
167
- emitAddedToMempool(userOperationHash) {
168
- this.emitEvent({
169
- userOperationHash,
170
- event: {
171
- eventType: "added_to_mempool"
172
- }
173
- });
174
- }
175
- emitEvent({ userOperationHash, event, timestamp }) {
176
- if (!this.redisEventManagerQueue) {
177
- return;
178
- }
179
- const entry = {
180
- userOperationHash,
181
- eventTimestamp: timestamp ?? Date.now(),
182
- chainId: this.chainId,
183
- ...event
184
- };
185
- this.emitWithTimeout(entry, event.eventType);
186
- }
187
- emitWithTimeout(entry, eventType) {
188
- (0, asyncTimeout_1.asyncCallWithTimeout)(this.redisEventManagerQueue.add(entry, {
189
- removeOnComplete: true,
190
- removeOnFail: true
191
- }), 500 // 500ms timeout
192
- )
193
- .then(() => {
194
- this.metrics.emittedOpEvents
195
- .labels({
196
- event_type: eventType,
197
- status: "success"
198
- })
199
- .inc();
200
- })
201
- .catch((err) => {
202
- if (err instanceof asyncTimeout_1.AsyncTimeoutError) {
203
- this.logger.warn({ userOpHash: entry.userOperationHash, eventType }, "Event emission timed out after 500ms");
204
- this.metrics.emittedOpEvents
205
- .labels({
206
- event_type: eventType,
207
- status: "timeout"
208
- })
209
- .inc();
210
- }
211
- else {
212
- this.logger.error({ err }, "Failed to send userOperation status event");
213
- sentry.captureException(err);
214
- this.metrics.emittedOpEvents
215
- .labels({
216
- event_type: eventType,
217
- status: "failed"
218
- })
219
- .inc();
220
- }
221
- });
222
- }
223
- }
224
- exports.EventManager = EventManager;
225
- //# sourceMappingURL=eventManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eventManager.js","sourceRoot":"","sources":["../../handlers/eventManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAsC;AACtC,sDAA2B;AAI3B,gDAAqD;AACrD,wDAA+E;AAQ/E,MAAa,YAAY;IACb,OAAO,CAAQ;IACf,MAAM,CAAQ;IACd,OAAO,CAAS;IAChB,sBAAsB,CAA0B;IAExD,YAAY,EACR,MAAM,EACN,OAAO,EAIV;QACG,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAE7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAC1B,EAAE,MAAM,EAAE,eAAe,EAAE,EAC3B;YACI,KAAK,EAAE,MAAM,CAAC,QAAQ;SACzB,CACJ,CAAA;QACD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtB,IAAI,MAAM,CAAC,kBAAkB,IAAI,MAAM,CAAC,0BAA0B,EAAE,CAAC;YACjE,IAAI,CAAC,MAAM,CAAC,IAAI,CACZ,+BAA+B,MAAM,CAAC,0BAA0B,yBAAyB,CAC5F,CAAA;YACD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SAAS;oBACrB,MAAM,EAAE,SAAS;iBACpB,CAAC;qBACD,GAAG,EAAE,CAAA;YACd,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,EAAE,GAAG,EAAE,EACP,2CAA2C,CAC9C,CAAA;gBACD,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAA;gBAC5B,IAAI,CAAC,OAAO,CAAC,eAAe;qBACvB,MAAM,CAAC;oBACJ,UAAU,EAAE,SAAS;oBACrB,MAAM,EAAE,QAAQ;iBACnB,CAAC;qBACD,GAAG,EAAE,CAAA;YACd,CAAC;QACL,CAAC,CAAC,CAAA;IACV,CAAC;CACJ;AAxQD,oCAwQC"}
@@ -1,36 +0,0 @@
1
- import { type GasPriceParameters } from "../types/index.js";
2
- import type { AltoConfig } from "../createConfig.js";
3
- import { ArbitrumManager } from "./arbitrumGasPriceManager.js";
4
- import { MantleManager } from "./mantleGasPriceManager.js";
5
- import { OptimismManager } from "./optimismManager.js";
6
- export declare class GasPriceManager {
7
- private readonly config;
8
- private baseFeePerGasQueue;
9
- private maxFeePerGasQueue;
10
- private maxPriorityFeePerGasQueue;
11
- private logger;
12
- arbitrumManager: ArbitrumManager;
13
- mantleManager: MantleManager;
14
- optimismManager: OptimismManager;
15
- constructor(config: AltoConfig);
16
- init(): Promise<void>;
17
- private getDefaultGasFee;
18
- private getPolygonGasPriceParameters;
19
- private bumpTheGasPrice;
20
- private getFallBackMaxPriorityFeePerGas;
21
- private getLegacyTransactionGasPrice;
22
- private estimateGasPrice;
23
- private innerGetGasPrice;
24
- private updateBaseFee;
25
- getBaseFee(): Promise<bigint>;
26
- private tryUpdateGasPrice;
27
- getGasPrice(): Promise<GasPriceParameters>;
28
- tryGetNetworkGasPrice(): Promise<GasPriceParameters>;
29
- getMaxBaseFeePerGas(): Promise<bigint>;
30
- getHighestMaxFeePerGas(): Promise<bigint>;
31
- getHighestMaxPriorityFeePerGas(): Promise<bigint>;
32
- private getMinMaxFeePerGas;
33
- private getMinMaxPriorityFeePerGas;
34
- validateGasPrice(gasPrice: GasPriceParameters): Promise<void>;
35
- }
36
- //# sourceMappingURL=gasPriceManager.d.ts.map
@@ -1,391 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.GasPriceManager = void 0;
27
- const types_1 = require("../types/index.js");
28
- const utils_1 = require("../utils/index.js");
29
- const sentry = __importStar(require("@sentry/node"));
30
- const viem_1 = require("viem");
31
- const chains_1 = require("viem/chains");
32
- const minMaxQueue_1 = require("../utils/minMaxQueue/index.js");
33
- const arbitrumGasPriceManager_1 = require("./arbitrumGasPriceManager.js");
34
- const mantleGasPriceManager_1 = require("./mantleGasPriceManager.js");
35
- const optimismManager_1 = require("./optimismManager.js");
36
- class GasPriceManager {
37
- config;
38
- baseFeePerGasQueue;
39
- maxFeePerGasQueue;
40
- maxPriorityFeePerGasQueue;
41
- logger;
42
- arbitrumManager;
43
- mantleManager;
44
- optimismManager;
45
- constructor(config) {
46
- this.config = config;
47
- this.logger = config.getLogger({ module: "gas_price_manager" }, {
48
- level: config.publicClientLogLevel || config.logLevel
49
- });
50
- this.baseFeePerGasQueue = (0, minMaxQueue_1.createMinMaxQueue)({
51
- config,
52
- keyPrefix: "base-fee-per-gas-queue"
53
- });
54
- this.maxFeePerGasQueue = (0, minMaxQueue_1.createMinMaxQueue)({
55
- config,
56
- keyPrefix: "max-fee-per-gas-queue"
57
- });
58
- this.maxPriorityFeePerGasQueue = (0, minMaxQueue_1.createMinMaxQueue)({
59
- config,
60
- keyPrefix: "max-priority-fee-per-gas-queue"
61
- });
62
- // Periodically update gas prices if specified
63
- if (this.config.gasPriceRefreshInterval > 0) {
64
- setInterval(() => {
65
- try {
66
- if (this.config.legacyTransactions === false) {
67
- this.updateBaseFee();
68
- }
69
- this.tryUpdateGasPrice();
70
- }
71
- catch (error) {
72
- this.logger.error({ error }, "Error updating gas prices in interval");
73
- sentry.captureException(error);
74
- }
75
- }, this.config.gasPriceRefreshInterval * 1000);
76
- }
77
- this.arbitrumManager = new arbitrumGasPriceManager_1.ArbitrumManager({ config });
78
- this.mantleManager = new mantleGasPriceManager_1.MantleManager({ config });
79
- this.optimismManager = new optimismManager_1.OptimismManager({ config });
80
- }
81
- async init() {
82
- try {
83
- await Promise.all([
84
- this.tryUpdateGasPrice(),
85
- this.config.legacyTransactions === false
86
- ? this.updateBaseFee()
87
- : Promise.resolve()
88
- ]);
89
- }
90
- catch (error) {
91
- this.logger.error(error, "Error during gas price initialization");
92
- }
93
- }
94
- getDefaultGasFee(chainId) {
95
- switch (chainId) {
96
- case chains_1.polygon.id:
97
- return (0, viem_1.parseGwei)("31");
98
- default:
99
- return 0n;
100
- }
101
- }
102
- async getPolygonGasPriceParameters() {
103
- const gasStationUrl = "https://gasstation.polygon.technology/v2";
104
- try {
105
- const data = await (await fetch(gasStationUrl)).json();
106
- // take the standard speed here, SDK options will define the extra tip
107
- const parsedData = types_1.gasStationResult.parse(data);
108
- return parsedData.fast;
109
- }
110
- catch (e) {
111
- this.logger.error({ error: e }, "failed to get gas price from gas station, using default");
112
- return null;
113
- }
114
- }
115
- bumpTheGasPrice(gasPriceParameters) {
116
- const bumpAmount = this.config.gasPriceBump;
117
- const maxPriorityFeePerGas = (0, utils_1.maxBigInt)(gasPriceParameters.maxPriorityFeePerGas, this.getDefaultGasFee(this.config.chainId));
118
- const maxFeePerGas = (0, utils_1.maxBigInt)(gasPriceParameters.maxFeePerGas, maxPriorityFeePerGas);
119
- const result = {
120
- maxFeePerGas: (maxFeePerGas * bumpAmount) / 100n,
121
- maxPriorityFeePerGas: (maxPriorityFeePerGas * bumpAmount) / 100n
122
- };
123
- if (this.config.floorMaxFeePerGas ||
124
- this.config.floorMaxPriorityFeePerGas) {
125
- const maxFeePerGas = this.config.floorMaxFeePerGas
126
- ? (0, utils_1.maxBigInt)(this.config.floorMaxFeePerGas, result.maxFeePerGas)
127
- : result.maxFeePerGas;
128
- const maxPriorityFeePerGas = this.config.floorMaxPriorityFeePerGas
129
- ? (0, utils_1.maxBigInt)(this.config.floorMaxPriorityFeePerGas, result.maxPriorityFeePerGas)
130
- : result.maxPriorityFeePerGas;
131
- return {
132
- // Ensure that maxFeePerGas is always greater or equal than maxPriorityFeePerGas
133
- maxFeePerGas: (0, utils_1.maxBigInt)(maxFeePerGas, maxPriorityFeePerGas),
134
- maxPriorityFeePerGas
135
- };
136
- }
137
- return result;
138
- }
139
- async getFallBackMaxPriorityFeePerGas(publicClient, gasPrice) {
140
- const feeHistory = await publicClient.getFeeHistory({
141
- blockCount: 10,
142
- rewardPercentiles: [20],
143
- blockTag: "latest"
144
- });
145
- if (feeHistory.reward === undefined || feeHistory.reward === null) {
146
- return gasPrice;
147
- }
148
- const feeAverage = feeHistory.reward.reduce((acc, cur) => cur[0] + acc, 0n) / 10n;
149
- return (0, utils_1.minBigInt)(feeAverage, gasPrice);
150
- }
151
- async getLegacyTransactionGasPrice() {
152
- let gasPrice;
153
- try {
154
- const gasInfo = await this.config.publicClient.estimateFeesPerGas({
155
- chain: this.config.publicClient.chain,
156
- type: "legacy"
157
- });
158
- gasPrice = gasInfo.gasPrice;
159
- }
160
- catch (e) {
161
- sentry.captureException(e);
162
- this.logger.error("failed to fetch legacy gasPrices from estimateFeesPerGas", { error: e });
163
- gasPrice = undefined;
164
- }
165
- if (gasPrice === undefined) {
166
- this.logger.warn("gasPrice is undefined, using fallback value");
167
- try {
168
- gasPrice = await this.config.publicClient.getGasPrice();
169
- }
170
- catch (e) {
171
- this.logger.error("failed to get fallback gasPrice");
172
- sentry.captureException(e);
173
- throw e;
174
- }
175
- }
176
- return {
177
- maxFeePerGas: gasPrice,
178
- maxPriorityFeePerGas: gasPrice
179
- };
180
- }
181
- async estimateGasPrice() {
182
- let maxFeePerGas;
183
- let maxPriorityFeePerGas;
184
- try {
185
- const fees = await this.config.publicClient.estimateFeesPerGas({
186
- chain: this.config.publicClient.chain
187
- });
188
- maxFeePerGas = fees.maxFeePerGas;
189
- maxPriorityFeePerGas = fees.maxPriorityFeePerGas;
190
- }
191
- catch (e) {
192
- sentry.captureException(e);
193
- this.logger.error("failed to fetch eip-1559 gasPrices from estimateFeesPerGas", { error: e });
194
- maxFeePerGas = undefined;
195
- maxPriorityFeePerGas = undefined;
196
- }
197
- if (maxPriorityFeePerGas === undefined) {
198
- this.logger.warn("maxPriorityFeePerGas is undefined, using fallback value");
199
- try {
200
- maxPriorityFeePerGas =
201
- await this.getFallBackMaxPriorityFeePerGas(this.config.publicClient, maxFeePerGas ?? 0n);
202
- }
203
- catch (e) {
204
- this.logger.error("failed to get fallback maxPriorityFeePerGas");
205
- sentry.captureException(e);
206
- throw e;
207
- }
208
- }
209
- if (maxFeePerGas === undefined) {
210
- this.logger.warn("maxFeePerGas is undefined, using fallback value");
211
- try {
212
- maxFeePerGas =
213
- (await this.config.publicClient.getGasPrice()) +
214
- maxPriorityFeePerGas;
215
- }
216
- catch (e) {
217
- this.logger.error("failed to get fallback maxFeePerGas");
218
- sentry.captureException(e);
219
- throw e;
220
- }
221
- }
222
- if (maxPriorityFeePerGas === 0n) {
223
- maxPriorityFeePerGas = maxFeePerGas / 200n;
224
- }
225
- return { maxFeePerGas, maxPriorityFeePerGas };
226
- }
227
- // This method throws if it can't get a valid RPC response.
228
- async innerGetGasPrice() {
229
- let maxFeePerGas = 0n;
230
- let maxPriorityFeePerGas = 0n;
231
- if (this.config.chainId === chains_1.polygon.id) {
232
- const polygonEstimate = await this.getPolygonGasPriceParameters();
233
- if (polygonEstimate) {
234
- const gasPrice = this.bumpTheGasPrice({
235
- maxFeePerGas: polygonEstimate.maxFeePerGas,
236
- maxPriorityFeePerGas: polygonEstimate.maxPriorityFeePerGas
237
- });
238
- return {
239
- maxFeePerGas: (0, utils_1.maxBigInt)(gasPrice.maxFeePerGas, maxFeePerGas),
240
- maxPriorityFeePerGas: (0, utils_1.maxBigInt)(gasPrice.maxPriorityFeePerGas, maxPriorityFeePerGas)
241
- };
242
- }
243
- }
244
- if (this.config.legacyTransactions) {
245
- const gasPrice = this.bumpTheGasPrice(await this.getLegacyTransactionGasPrice());
246
- return {
247
- maxFeePerGas: (0, utils_1.maxBigInt)(gasPrice.maxFeePerGas, maxFeePerGas),
248
- maxPriorityFeePerGas: (0, utils_1.maxBigInt)(gasPrice.maxPriorityFeePerGas, maxPriorityFeePerGas)
249
- };
250
- }
251
- const estimatedPrice = await this.estimateGasPrice();
252
- maxFeePerGas = estimatedPrice.maxFeePerGas;
253
- maxPriorityFeePerGas = estimatedPrice.maxPriorityFeePerGas;
254
- const gasPrice = this.bumpTheGasPrice({
255
- maxFeePerGas,
256
- maxPriorityFeePerGas
257
- });
258
- return {
259
- maxFeePerGas: (0, utils_1.maxBigInt)(gasPrice.maxFeePerGas, maxFeePerGas),
260
- maxPriorityFeePerGas: (0, utils_1.maxBigInt)(gasPrice.maxPriorityFeePerGas, maxPriorityFeePerGas)
261
- };
262
- }
263
- async updateBaseFee() {
264
- try {
265
- const latestBlock = await this.config.publicClient.getBlock();
266
- if (latestBlock.baseFeePerGas === null) {
267
- throw new types_1.RpcError("block does not have baseFeePerGas");
268
- }
269
- const baseFee = latestBlock.baseFeePerGas;
270
- this.baseFeePerGasQueue.saveValue(baseFee);
271
- return baseFee;
272
- }
273
- catch (e) {
274
- this.logger.error(e, "Failed to update base fee");
275
- throw e;
276
- }
277
- }
278
- async getBaseFee() {
279
- try {
280
- if (this.config.legacyTransactions) {
281
- throw new types_1.RpcError("baseFee is not available for legacy transactions");
282
- }
283
- if (this.config.gasPriceRefreshInterval === 0) {
284
- return await this.updateBaseFee();
285
- }
286
- let baseFee = await this.baseFeePerGasQueue.getLatestValue();
287
- if (!baseFee) {
288
- baseFee = await this.updateBaseFee();
289
- }
290
- return baseFee;
291
- }
292
- catch (e) {
293
- this.logger.error(e, "Failed to get base fee");
294
- throw new types_1.RpcError("Failed to get base fee");
295
- }
296
- }
297
- // This method throws if it can't get a valid RPC response.
298
- async tryUpdateGasPrice() {
299
- const gasPrice = await this.innerGetGasPrice();
300
- this.maxFeePerGasQueue.saveValue(gasPrice.maxFeePerGas);
301
- this.maxPriorityFeePerGasQueue.saveValue(gasPrice.maxPriorityFeePerGas);
302
- return gasPrice;
303
- }
304
- async getGasPrice() {
305
- if (this.config.isGasFreeChain) {
306
- return {
307
- maxFeePerGas: 0n,
308
- maxPriorityFeePerGas: 0n
309
- };
310
- }
311
- if (this.config.gasPriceRefreshInterval === 0) {
312
- try {
313
- return await this.tryUpdateGasPrice();
314
- }
315
- catch (e) {
316
- this.logger.error(e, "No gas price available");
317
- throw new types_1.RpcError("No gas price available");
318
- }
319
- }
320
- const [maxFeePerGas, maxPriorityFeePerGas] = await Promise.all([
321
- this.maxFeePerGasQueue.getLatestValue(),
322
- this.maxPriorityFeePerGasQueue.getLatestValue()
323
- ]);
324
- if (!maxFeePerGas || !maxPriorityFeePerGas) {
325
- throw new types_1.RpcError("No gas price available");
326
- }
327
- return {
328
- maxFeePerGas,
329
- maxPriorityFeePerGas
330
- };
331
- }
332
- // This method throws if it can't get a valid RPC response.
333
- async tryGetNetworkGasPrice() {
334
- return await this.innerGetGasPrice();
335
- }
336
- async getMaxBaseFeePerGas() {
337
- let maxBaseFeePerGas = await this.baseFeePerGasQueue.getMaxValue();
338
- if (!maxBaseFeePerGas) {
339
- maxBaseFeePerGas = await this.getBaseFee();
340
- }
341
- return maxBaseFeePerGas;
342
- }
343
- async getHighestMaxFeePerGas() {
344
- let highestMaxFeePerGas = await this.maxFeePerGasQueue.getMaxValue();
345
- if (!highestMaxFeePerGas) {
346
- const gasPrice = await this.getGasPrice();
347
- highestMaxFeePerGas = gasPrice.maxFeePerGas;
348
- }
349
- return highestMaxFeePerGas;
350
- }
351
- async getHighestMaxPriorityFeePerGas() {
352
- let highestMaxPriorityFeePerGas = await this.maxPriorityFeePerGasQueue.getMaxValue();
353
- if (!highestMaxPriorityFeePerGas) {
354
- const gasPrice = await this.getGasPrice();
355
- highestMaxPriorityFeePerGas = gasPrice.maxPriorityFeePerGas;
356
- }
357
- return highestMaxPriorityFeePerGas;
358
- }
359
- async getMinMaxFeePerGas() {
360
- let minMaxFeePerGas = await this.maxFeePerGasQueue.getMinValue();
361
- if (!minMaxFeePerGas) {
362
- const gasPrice = await this.getGasPrice();
363
- minMaxFeePerGas = gasPrice.maxFeePerGas;
364
- }
365
- return minMaxFeePerGas;
366
- }
367
- async getMinMaxPriorityFeePerGas() {
368
- let minMaxPriorityFeePerGas = await this.maxPriorityFeePerGasQueue.getMinValue();
369
- if (!minMaxPriorityFeePerGas) {
370
- const gasPrices = await this.getGasPrice();
371
- minMaxPriorityFeePerGas = gasPrices.maxPriorityFeePerGas;
372
- }
373
- return minMaxPriorityFeePerGas;
374
- }
375
- async validateGasPrice(gasPrice) {
376
- let lowestMaxFeePerGas = await this.getMinMaxFeePerGas();
377
- let lowestMaxPriorityFeePerGas = await this.getMinMaxPriorityFeePerGas();
378
- if (this.config.chainType === "hedera") {
379
- lowestMaxFeePerGas /= 10n ** 9n;
380
- lowestMaxPriorityFeePerGas /= 10n ** 9n;
381
- }
382
- if (gasPrice.maxFeePerGas < lowestMaxFeePerGas) {
383
- throw new types_1.RpcError(`maxFeePerGas must be at least ${lowestMaxFeePerGas} (current maxFeePerGas: ${gasPrice.maxFeePerGas}) - use pimlico_getUserOperationGasPrice to get the current gas price`);
384
- }
385
- if (gasPrice.maxPriorityFeePerGas < lowestMaxPriorityFeePerGas) {
386
- throw new types_1.RpcError(`maxPriorityFeePerGas must be at least ${lowestMaxPriorityFeePerGas} (current maxPriorityFeePerGas: ${gasPrice.maxPriorityFeePerGas}) - use pimlico_getUserOperationGasPrice to get the current gas price`);
387
- }
388
- }
389
- }
390
- exports.GasPriceManager = GasPriceManager;
391
- //# sourceMappingURL=gasPriceManager.js.map