@pimlico/alto 0.0.19 → 0.0.21
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.
- package/contracts/EIP712.sol/EIP712.json +1 -1
- package/contracts/ERC165.sol/ERC165.json +1 -1
- package/contracts/ERC20.sol/ERC20.json +1 -1
- package/contracts/Eip7702Support.sol/Eip7702Support.json +1 -1
- package/contracts/EntryPoint.sol/EntryPoint.json +1 -1
- package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride06.json +1 -1
- package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride07.json +1 -1
- package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride08.json +1 -1
- package/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride09.json +1 -0
- package/contracts/EntryPointGasEstimationOverride.sol/EntryPointGasEstimationOverride06.json +1 -1
- package/contracts/EntryPointSimulations.sol/EntryPointSimulations07.json +1 -1
- package/contracts/EntryPointSimulations.sol/EntryPointSimulations08.json +1 -1
- package/contracts/EntryPointSimulations.sol/EntryPointSimulations09.json +1 -0
- package/contracts/Exec.sol/Exec.json +1 -1
- package/contracts/IAccount.sol/IAccount.json +1 -1
- package/contracts/IAccountExecute.sol/IAccountExecute.json +1 -1
- package/contracts/IAggregator.sol/IAggregator.json +1 -1
- package/contracts/IERC165.sol/IERC165.json +1 -1
- package/contracts/IERC5267.sol/IERC5267.json +1 -1
- package/contracts/IEntryPoint.sol/IEntryPoint.json +1 -1
- package/contracts/IEntryPointFilterOpsOverride.sol/IEntryPointFilterOpsOverride08.json +1 -0
- package/contracts/IEntryPointFilterOpsOverride.sol/IEntryPointFilterOpsOverride09.json +1 -0
- package/contracts/IEntryPointSimulations.sol/IEntryPointSimulations.json +1 -1
- package/contracts/INonceManager.sol/INonceManager.json +1 -1
- package/contracts/IPaymaster.sol/IPaymaster.json +1 -1
- package/contracts/ISenderCreator.sol/ISenderCreator.json +1 -1
- package/contracts/IStakeManager.sol/IStakeManager.json +1 -1
- package/contracts/LibBytes.sol/LibBytes.json +1 -1
- package/contracts/Math.sol/Math.json +1 -1
- package/contracts/MessageHashUtils.sol/MessageHashUtils.json +1 -1
- package/contracts/NonceManager.sol/NonceManager.json +1 -1
- package/contracts/Panic.sol/Panic.json +1 -1
- package/contracts/PimlicoSimulations.sol/PimlicoSimulations.json +1 -1
- package/contracts/ReentrancyGuard.sol/ReentrancyGuard.json +1 -1
- package/contracts/ReentrancyGuardTransient.sol/ReentrancyGuardTransient.json +1 -1
- package/contracts/SafeCast.sol/SafeCast.json +1 -1
- package/contracts/SenderCreator.sol/SenderCreator.json +1 -1
- package/contracts/ShortStrings.sol/ShortStrings.json +1 -1
- package/contracts/SignedMath.sol/SignedMath.json +1 -1
- package/contracts/SimulationOverrideHelper.sol/SimulationOverrideHelper.json +1 -0
- package/contracts/StakeManager.sol/StakeManager.json +1 -1
- package/contracts/StorageSlot.sol/StorageSlot.json +1 -1
- package/contracts/Strings.sol/Strings.json +1 -1
- package/contracts/TransientSlot.sol/TransientSlot.json +1 -1
- package/contracts/UserOperation.sol/UserOperationLib.json +1 -1
- package/contracts/UserOperationLib.sol/UserOperationLib.json +1 -1
- package/contracts/account-abstraction-v9/contracts/interfaces/IAggregator.sol/IAggregator.json +1 -0
- package/contracts/account-abstraction-v9/contracts/interfaces/IEntryPoint.sol/IEntryPoint.json +1 -0
- package/contracts/account-abstraction-v9/contracts/interfaces/INonceManager.sol/INonceManager.json +1 -0
- package/contracts/account-abstraction-v9/contracts/interfaces/IStakeManager.sol/IStakeManager.json +1 -0
- package/contracts/build-info/{880955d5786bfdae.json → 031b289b93191224.json} +1 -1
- package/contracts/build-info/181f3522c3744403.json +1 -0
- package/contracts/build-info/a2db592afab5c9de.json +1 -0
- package/contracts/contracts/interfaces/IAggregator.sol/IAggregator.json +1 -1
- package/contracts/contracts/interfaces/IEntryPoint.sol/IEntryPoint.json +1 -1
- package/contracts/contracts/interfaces/INonceManager.sol/INonceManager.json +1 -1
- package/contracts/contracts/interfaces/IStakeManager.sol/IStakeManager.json +1 -1
- package/contracts/core/Eip7702Support.sol/Eip7702Support.json +1 -0
- package/contracts/core/NonceManager.sol/NonceManager.json +1 -0
- package/contracts/core/SenderCreator.sol/SenderCreator.json +1 -0
- package/contracts/core/StakeManager.sol/StakeManager.json +1 -0
- package/contracts/core/UserOperationLib.sol/UserOperationLib.json +1 -0
- package/contracts/interfaces/IAccount.sol/IAccount.json +1 -0
- package/contracts/interfaces/IAccountExecute.sol/IAccountExecute.json +1 -0
- package/contracts/interfaces/IAggregator.sol/IAggregator.json +1 -1
- package/contracts/interfaces/IEntryPoint.sol/IEntryPoint.json +1 -1
- package/contracts/interfaces/INonceManager.sol/INonceManager.json +1 -1
- package/contracts/interfaces/IPaymaster.sol/IPaymaster.json +1 -0
- package/contracts/interfaces/ISenderCreator.sol/ISenderCreator.json +1 -0
- package/contracts/interfaces/IStakeManager.sol/IStakeManager.json +1 -1
- package/contracts/overrides/Eip7702Support.sol/Eip7702Support.json +1 -0
- package/contracts/overrides/NonceManager.sol/NonceManager.json +1 -0
- package/contracts/overrides/SenderCreator.sol/SenderCreator.json +1 -0
- package/contracts/overrides/StakeManager.sol/StakeManager.json +1 -0
- package/contracts/overrides/UserOperationLib.sol/UserOperationLib.json +1 -0
- package/contracts/utils/Exec.sol/Exec.json +1 -1
- package/contracts/utils/StorageSlot.sol/StorageSlot.json +1 -0
- package/contracts/v09/EntryPoint.sol/EntryPoint.json +1 -0
- package/esm/cli/alto.js +17 -6
- package/esm/cli/alto.js.map +1 -1
- package/esm/cli/config/bundler.d.ts +459 -321
- package/esm/cli/config/bundler.js +125 -91
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.d.ts +4 -1
- package/esm/cli/config/options.js +233 -106
- package/esm/cli/config/options.js.map +1 -1
- package/esm/cli/customTransport.d.ts +3 -3
- package/esm/cli/deploySimulationsContract.d.ts +1 -0
- package/esm/cli/deploySimulationsContract.js +41 -5
- package/esm/cli/deploySimulationsContract.js.map +1 -1
- package/esm/cli/handler.js +76 -80
- package/esm/cli/handler.js.map +1 -1
- package/esm/cli/multiRpcTransport.d.ts +7 -0
- package/esm/cli/multiRpcTransport.js +52 -0
- package/esm/cli/multiRpcTransport.js.map +1 -0
- package/esm/cli/setupServer.js +92 -70
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/cli/shutDown.d.ts +20 -0
- package/esm/cli/shutDown.js +285 -0
- package/esm/cli/shutDown.js.map +1 -0
- package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride06.json +1 -1
- package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride07.json +1 -1
- package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride08.json +1 -1
- package/esm/contracts/EntryPointFilterOpsOverride.sol/EntryPointFilterOpsOverride09.json +1 -0
- package/esm/contracts/EntryPointGasEstimationOverride.sol/EntryPointGasEstimationOverride06.json +1 -1
- package/esm/contracts/EntryPointSimulations.sol/EntryPointSimulations07.json +1 -1
- package/esm/contracts/EntryPointSimulations.sol/EntryPointSimulations08.json +1 -1
- package/esm/contracts/EntryPointSimulations.sol/EntryPointSimulations09.json +1 -0
- package/esm/contracts/PimlicoSimulations.sol/PimlicoSimulations.json +1 -1
- package/esm/createConfig.d.ts +9 -2
- package/esm/createConfig.js.map +1 -1
- package/esm/executor/{userOpMonitor.d.ts → bundleManager.d.ts} +56 -37
- package/esm/executor/bundleManager.js +393 -0
- package/esm/executor/bundleManager.js.map +1 -0
- package/esm/executor/executor.d.ts +4 -3
- package/esm/executor/executor.js +47 -23
- package/esm/executor/executor.js.map +1 -1
- package/esm/executor/executorManager.d.ts +20 -15
- package/esm/executor/executorManager.js +248 -67
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/executor/filterOpsAndEstimateGas.d.ts +17 -2
- package/esm/executor/filterOpsAndEstimateGas.js +100 -77
- package/esm/executor/filterOpsAndEstimateGas.js.map +1 -1
- package/esm/executor/getBundleStatus.d.ts +5 -1
- package/esm/executor/getBundleStatus.js.map +1 -1
- package/esm/executor/index.d.ts +1 -0
- package/esm/executor/index.js +1 -0
- package/esm/executor/index.js.map +1 -1
- package/esm/executor/senderManager/createMemorySenderManager.js +13 -0
- package/esm/executor/senderManager/createMemorySenderManager.js.map +1 -1
- package/esm/executor/senderManager/createRedisSenderManager.d.ts +2 -1
- package/esm/executor/senderManager/createRedisSenderManager.js +45 -26
- package/esm/executor/senderManager/createRedisSenderManager.js.map +1 -1
- package/esm/executor/senderManager/flushOnStartUp.js +7 -5
- package/esm/executor/senderManager/flushOnStartUp.js.map +1 -1
- package/esm/executor/senderManager/index.d.ts +1 -0
- package/esm/executor/senderManager/index.js +6 -2
- package/esm/executor/senderManager/index.js.map +1 -1
- package/esm/executor/senderManager/validateAndRefill.js +268 -85
- package/esm/executor/senderManager/validateAndRefill.js.map +1 -1
- package/esm/executor/utils.d.ts +8 -3
- package/esm/executor/utils.js +59 -27
- package/esm/executor/utils.js.map +1 -1
- package/esm/handlers/arbitrumGasPriceManager.d.ts +3 -2
- package/esm/handlers/arbitrumGasPriceManager.js +6 -2
- package/esm/handlers/arbitrumGasPriceManager.js.map +1 -1
- package/esm/handlers/citreaManager.d.ts +10 -0
- package/esm/handlers/citreaManager.js +17 -0
- package/esm/handlers/citreaManager.js.map +1 -0
- package/esm/handlers/eventManager.d.ts +9 -9
- package/esm/handlers/eventManager.js +59 -60
- package/esm/handlers/eventManager.js.map +1 -1
- package/esm/handlers/gasPriceManager.d.ts +17 -10
- package/esm/handlers/gasPriceManager.js +245 -99
- package/esm/handlers/gasPriceManager.js.map +1 -1
- package/esm/handlers/mantleGasPriceManager.d.ts +4 -4
- package/esm/handlers/mantleGasPriceManager.js +4 -4
- package/esm/handlers/mantleGasPriceManager.js.map +1 -1
- package/esm/handlers/optimismManager.d.ts +1 -1
- package/esm/handlers/optimismManager.js +1 -1
- package/esm/handlers/optimismManager.js.map +1 -1
- package/esm/mempool/index.d.ts +1 -1
- package/esm/mempool/index.js +1 -1
- package/esm/mempool/index.js.map +1 -1
- package/esm/mempool/mempool.d.ts +61 -22
- package/esm/mempool/mempool.js +223 -133
- package/esm/mempool/mempool.js.map +1 -1
- package/esm/mempool/reputationManager.d.ts +14 -14
- package/esm/mempool/reputationManager.js +36 -39
- package/esm/mempool/reputationManager.js.map +1 -1
- package/esm/mempool/statusManager.d.ts +20 -0
- package/esm/mempool/statusManager.js +143 -0
- package/esm/mempool/statusManager.js.map +1 -0
- package/esm/receiptCache/createMemoryReceiptCache.d.ts +3 -0
- package/esm/receiptCache/createMemoryReceiptCache.js +30 -0
- package/esm/receiptCache/createMemoryReceiptCache.js.map +1 -0
- package/esm/receiptCache/createRedisReceiptCache.d.ts +10 -0
- package/esm/receiptCache/createRedisReceiptCache.js +56 -0
- package/esm/receiptCache/createRedisReceiptCache.js.map +1 -0
- package/esm/receiptCache/index.d.ts +11 -0
- package/esm/receiptCache/index.js +21 -0
- package/esm/receiptCache/index.js.map +1 -0
- package/esm/rpc/createMethodHandler.js.map +1 -1
- package/esm/rpc/estimation/gasEstimationHandler.d.ts +2 -4
- package/esm/rpc/estimation/gasEstimationHandler.js.map +1 -1
- package/esm/rpc/estimation/gasEstimations06.d.ts +6 -7
- package/esm/rpc/estimation/gasEstimations06.js +1 -5
- package/esm/rpc/estimation/gasEstimations06.js.map +1 -1
- package/esm/rpc/estimation/gasEstimations07.d.ts +13 -41
- package/esm/rpc/estimation/gasEstimations07.js +27 -34
- package/esm/rpc/estimation/gasEstimations07.js.map +1 -1
- package/esm/{utils/preVerificationGasCalulator.d.ts → rpc/estimation/preVerificationGasCalculator.d.ts} +20 -6
- package/esm/{utils/preVerificationGasCalulator.js → rpc/estimation/preVerificationGasCalculator.js} +134 -48
- package/esm/rpc/estimation/preVerificationGasCalculator.js.map +1 -0
- package/esm/rpc/estimation/types.d.ts +4 -2
- package/esm/rpc/estimation/utils.d.ts +10 -8
- package/esm/rpc/estimation/utils.js +56 -53
- package/esm/rpc/estimation/utils.js.map +1 -1
- package/esm/rpc/methods/boost_sendUserOperation.d.ts +304 -0
- package/esm/rpc/methods/boost_sendUserOperation.js +1 -1
- package/esm/rpc/methods/boost_sendUserOperation.js.map +1 -1
- package/esm/rpc/methods/debug_bundler_clearReputation.js +1 -1
- package/esm/rpc/methods/debug_bundler_clearReputation.js.map +1 -1
- package/esm/rpc/methods/debug_bundler_clearState.js +1 -1
- package/esm/rpc/methods/debug_bundler_clearState.js.map +1 -1
- package/esm/rpc/methods/debug_bundler_dumpMempool.d.ts +338 -0
- package/esm/rpc/methods/debug_bundler_dumpReputation.js +1 -1
- package/esm/rpc/methods/debug_bundler_dumpReputation.js.map +1 -1
- package/esm/rpc/methods/eth_estimateUserOperationGas.d.ts +622 -14
- package/esm/rpc/methods/eth_estimateUserOperationGas.js +61 -30
- package/esm/rpc/methods/eth_estimateUserOperationGas.js.map +1 -1
- package/esm/rpc/methods/eth_getUserOperationByHash.d.ts +621 -11
- package/esm/rpc/methods/eth_getUserOperationByHash.js.map +1 -1
- package/esm/rpc/methods/eth_getUserOperationReceipt.d.ts +34 -34
- package/esm/rpc/methods/eth_getUserOperationReceipt.js +1 -1
- package/esm/rpc/methods/eth_sendUserOperation.d.ts +307 -3
- package/esm/rpc/methods/eth_sendUserOperation.js +153 -48
- package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
- package/esm/rpc/methods/pimlico_getUserOperationStatus.js +1 -1
- package/esm/rpc/methods/pimlico_getUserOperationStatus.js.map +1 -1
- package/esm/rpc/methods/pimlico_sendUserOperationNow.d.ts +338 -34
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js +26 -29
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
- package/esm/rpc/methods/pimlico_simulateAssetChange.d.ts +620 -12
- package/esm/rpc/methods/pimlico_simulateAssetChange.js +14 -19
- package/esm/rpc/methods/pimlico_simulateAssetChange.js.map +1 -1
- package/esm/rpc/rpcHandler.d.ts +38 -26
- package/esm/rpc/rpcHandler.js +97 -44
- package/esm/rpc/rpcHandler.js.map +1 -1
- package/esm/rpc/server.d.ts +5 -5
- package/esm/rpc/server.js +15 -11
- package/esm/rpc/server.js.map +1 -1
- package/esm/rpc/validation/BundlerCollectorTracerV06.js +1 -1
- package/esm/rpc/validation/BundlerCollectorTracerV06.js.map +1 -1
- package/esm/rpc/validation/BundlerCollectorTracerV07.js +1 -1
- package/esm/rpc/validation/BundlerCollectorTracerV07.js.map +1 -1
- package/esm/rpc/validation/SafeValidator.d.ts +13 -14
- package/esm/rpc/validation/SafeValidator.js +24 -24
- package/esm/rpc/validation/SafeValidator.js.map +1 -1
- package/esm/rpc/validation/TracerResultParserV06.d.ts +2 -2
- package/esm/rpc/validation/TracerResultParserV06.js +11 -11
- package/esm/rpc/validation/TracerResultParserV06.js.map +1 -1
- package/esm/rpc/validation/TracerResultParserV07.d.ts +2 -2
- package/esm/rpc/validation/TracerResultParserV07.js +13 -13
- package/esm/rpc/validation/TracerResultParserV07.js.map +1 -1
- package/esm/rpc/validation/UnsafeValidator.d.ts +18 -14
- package/esm/rpc/validation/UnsafeValidator.js +76 -41
- package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
- package/esm/store/createMempoolStore.d.ts +1 -1
- package/esm/store/createMempoolStore.js +79 -140
- package/esm/store/createMempoolStore.js.map +1 -1
- package/esm/store/index.d.ts +4 -75
- package/esm/store/index.js +4 -1
- package/esm/store/index.js.map +1 -1
- package/esm/store/outstanding/index.d.ts +13 -0
- package/esm/store/outstanding/index.js +16 -0
- package/esm/store/outstanding/index.js.map +1 -0
- package/esm/store/{createMemoryOutstandingStore.d.ts → outstanding/memory.d.ts} +14 -13
- package/esm/store/outstanding/memory.js +263 -0
- package/esm/store/outstanding/memory.js.map +1 -0
- package/esm/store/outstanding/redis.d.ts +11 -0
- package/esm/store/outstanding/redis.js +229 -0
- package/esm/store/outstanding/redis.js.map +1 -0
- package/esm/store/outstanding/types.d.ts +19 -0
- package/esm/store/outstanding/types.js +2 -0
- package/esm/store/outstanding/types.js.map +1 -0
- package/esm/store/processing/index.d.ts +11 -0
- package/esm/store/processing/index.js +17 -0
- package/esm/store/processing/index.js.map +1 -0
- package/esm/store/processing/memory.d.ts +19 -0
- package/esm/store/processing/memory.js +83 -0
- package/esm/store/processing/memory.js.map +1 -0
- package/esm/store/processing/redis.d.ts +26 -0
- package/esm/store/processing/redis.js +123 -0
- package/esm/store/processing/redis.js.map +1 -0
- package/esm/store/processing/types.d.ts +12 -0
- package/esm/store/processing/types.js +2 -0
- package/esm/store/processing/types.js.map +1 -0
- package/esm/store/types.d.ts +52 -0
- package/esm/store/types.js +2 -0
- package/esm/store/types.js.map +1 -0
- package/esm/types/contracts/Multicall3.d.ts +34 -0
- package/esm/types/contracts/Multicall3.js +31 -0
- package/esm/types/contracts/Multicall3.js.map +1 -0
- package/esm/types/contracts/PimlicoSimulations.d.ts +81 -0
- package/esm/types/contracts/PimlicoSimulations.js +105 -0
- package/esm/types/contracts/PimlicoSimulations.js.map +1 -1
- package/esm/types/contracts/index.d.ts +1 -1
- package/esm/types/contracts/index.js +1 -1
- package/esm/types/contracts/index.js.map +1 -1
- package/esm/types/gasPrice.js +0 -18
- package/esm/types/gasPrice.js.map +1 -1
- package/esm/types/interfaces.d.ts +15 -10
- package/esm/types/mempool.d.ts +3 -0
- package/esm/types/schemas.d.ts +13184 -4741
- package/esm/types/schemas.js +116 -27
- package/esm/types/schemas.js.map +1 -1
- package/esm/types/utils.d.ts +2 -5
- package/esm/types/utils.js +16 -18
- package/esm/types/utils.js.map +1 -1
- package/esm/types/validation.d.ts +7646 -6912
- package/esm/types/validation.js +122 -152
- package/esm/types/validation.js.map +1 -1
- package/esm/utils/eip7702.d.ts +2 -1
- package/esm/utils/eip7702.js +14 -8
- package/esm/utils/eip7702.js.map +1 -1
- package/esm/utils/entryPointOverrides.js +18 -4
- package/esm/utils/entryPointOverrides.js.map +1 -1
- package/esm/utils/helpers.d.ts +7 -1
- package/esm/utils/helpers.js +36 -11
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/index.d.ts +0 -1
- package/esm/utils/index.js +0 -1
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/metrics.d.ts +4 -1
- package/esm/utils/metrics.js +34 -7
- package/esm/utils/metrics.js.map +1 -1
- package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.js +8 -9
- package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.js.map +1 -1
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +24 -2
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js +85 -64
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js.map +1 -1
- package/esm/utils/minMaxQueue/index.d.ts +2 -2
- package/esm/utils/minMaxQueue/index.js +4 -3
- package/esm/utils/minMaxQueue/index.js.map +1 -1
- package/esm/utils/rpc-reply.d.ts +3 -3
- package/esm/utils/rpc-reply.js.map +1 -1
- package/esm/utils/toViemStateOverrides.js +7 -7
- package/esm/utils/toViemStateOverrides.js.map +1 -1
- package/esm/utils/userop.d.ts +110 -56
- package/esm/utils/userop.js +161 -249
- package/esm/utils/userop.js.map +1 -1
- package/package.json +4 -2
- package/contracts/build-info/7710b5a048396e70.json +0 -1
- package/esm/executor/userOpMonitor.js +0 -326
- package/esm/executor/userOpMonitor.js.map +0 -1
- package/esm/executor/utilityWalletMonitor.d.ts +0 -19
- package/esm/executor/utilityWalletMonitor.js +0 -38
- package/esm/executor/utilityWalletMonitor.js.map +0 -1
- package/esm/mempool/monitoring.d.ts +0 -15
- package/esm/mempool/monitoring.js +0 -118
- package/esm/mempool/monitoring.js.map +0 -1
- package/esm/store/createMemoryOutstandingStore.js +0 -240
- package/esm/store/createMemoryOutstandingStore.js.map +0 -1
- package/esm/store/createRedisOutstandingStore.d.ts +0 -27
- package/esm/store/createRedisOutstandingStore.js +0 -344
- package/esm/store/createRedisOutstandingStore.js.map +0 -1
- package/esm/store/createRedisStore.d.ts +0 -9
- package/esm/store/createRedisStore.js +0 -131
- package/esm/store/createRedisStore.js.map +0 -1
- package/esm/store/createStore.d.ts +0 -6
- package/esm/store/createStore.js +0 -66
- package/esm/store/createStore.js.map +0 -1
- package/esm/types/contracts/CallEngine.d.ts +0 -28
- package/esm/types/contracts/CallEngine.js +0 -37
- package/esm/types/contracts/CallEngine.js.map +0 -1
- package/esm/utils/preVerificationGasCalulator.js.map +0 -1
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
import { parseUserOpReceipt } from "../utils/index.js";
|
|
2
|
-
import { TransactionReceiptNotFoundError, decodeEventLog, getAbiItem, getAddress } from "viem";
|
|
3
|
-
import { entryPoint07Abi } from "viem/account-abstraction";
|
|
4
|
-
import { filterOpsAndEstimateGas } from "./filterOpsAndEstimateGas.js";
|
|
5
|
-
import { getBundleStatus } from "./getBundleStatus.js";
|
|
6
|
-
export class UserOpMonitor {
|
|
7
|
-
reputationManager;
|
|
8
|
-
config;
|
|
9
|
-
mempool;
|
|
10
|
-
monitor;
|
|
11
|
-
logger;
|
|
12
|
-
metrics;
|
|
13
|
-
eventManager;
|
|
14
|
-
senderManager;
|
|
15
|
-
cachedLatestBlock;
|
|
16
|
-
pendingBundles = new Map();
|
|
17
|
-
receiptCache = new Map();
|
|
18
|
-
receiptTtl = 5 * 60 * 1000; // 5 minutes
|
|
19
|
-
constructor({ config, mempool, monitor, metrics, reputationManager, eventManager, senderManager }) {
|
|
20
|
-
this.reputationManager = reputationManager;
|
|
21
|
-
this.config = config;
|
|
22
|
-
this.mempool = mempool;
|
|
23
|
-
this.monitor = monitor;
|
|
24
|
-
this.metrics = metrics;
|
|
25
|
-
this.eventManager = eventManager;
|
|
26
|
-
this.senderManager = senderManager;
|
|
27
|
-
this.cachedLatestBlock = null;
|
|
28
|
-
this.logger = config.getLogger({ module: "userop_monitor" }, {
|
|
29
|
-
level: config.executorLogLevel || config.logLevel
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
getPendingBundles() {
|
|
33
|
-
return Array.from(this.pendingBundles.values());
|
|
34
|
-
}
|
|
35
|
-
getReceipts(pendingBundles) {
|
|
36
|
-
return Promise.all(pendingBundles.map((bundle) => {
|
|
37
|
-
return getBundleStatus({
|
|
38
|
-
submittedBundle: bundle,
|
|
39
|
-
publicClient: this.config.publicClient,
|
|
40
|
-
logger: this.logger
|
|
41
|
-
});
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
async processIncludedBundle({ submittedBundle, bundleReceipt }) {
|
|
45
|
-
const { bundle } = submittedBundle;
|
|
46
|
-
const { userOps, entryPoint } = bundle;
|
|
47
|
-
const { transactionHash, blockNumber, userOpReceipts } = bundleReceipt;
|
|
48
|
-
// Cleanup bundle
|
|
49
|
-
await this.freeSubmittedBundle(submittedBundle);
|
|
50
|
-
// Log metric
|
|
51
|
-
this.metrics.userOpsOnChain
|
|
52
|
-
.labels({ status: "included" })
|
|
53
|
-
.inc(userOps.length);
|
|
54
|
-
// Process each userOp
|
|
55
|
-
// rest of the code is non-blocking
|
|
56
|
-
return (async () => {
|
|
57
|
-
for (const userOpInfo of userOps) {
|
|
58
|
-
const userOpReceipt = userOpReceipts[userOpInfo.userOpHash];
|
|
59
|
-
if (!userOpReceipt) {
|
|
60
|
-
throw new Error("userOpReceipt is undefined");
|
|
61
|
-
}
|
|
62
|
-
// Cache the receipt
|
|
63
|
-
this.cacheReceipt(userOpInfo.userOpHash, userOpReceipt);
|
|
64
|
-
await this.processIncludedUserOp(userOpInfo, userOpReceipt, transactionHash, blockNumber, entryPoint);
|
|
65
|
-
}
|
|
66
|
-
})();
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* The reasons for reverted bundles are:
|
|
70
|
-
* 1. complete bundle was frontrun -> cancel bundle -> need to wait for one more block to see if the userOp was frontrun
|
|
71
|
-
* 2. partial bundle was frontrun -> filter out non-frontrun userOps and resubmit -> need to wait for one more block to see if the userOp was frontrun
|
|
72
|
-
* 3. partial bundle was reverted -> filter out reverted userOps and resubmit
|
|
73
|
-
* 4. full bundle was reverted -> cancel bundle -> need to wait for one more block to see if the userOp was frontrun
|
|
74
|
-
*/
|
|
75
|
-
async processRevertedBundle({ submittedBundle, bundleReceipt, block }) {
|
|
76
|
-
const { bundle } = submittedBundle;
|
|
77
|
-
const { blockNumber, transactionHash } = bundleReceipt;
|
|
78
|
-
await this.freeSubmittedBundle(submittedBundle);
|
|
79
|
-
// make rest of the code non-blocking
|
|
80
|
-
return (async () => {
|
|
81
|
-
// Find userOps that can be resubmitted
|
|
82
|
-
const filterOpsResult = await filterOpsAndEstimateGas({
|
|
83
|
-
userOpBundle: bundle,
|
|
84
|
-
config: this.config,
|
|
85
|
-
logger: this.logger,
|
|
86
|
-
networkBaseFee: block.baseFeePerGas || 0n
|
|
87
|
-
});
|
|
88
|
-
// Resubmit any userOps that we can recover
|
|
89
|
-
if (filterOpsResult.status === "success") {
|
|
90
|
-
const { userOpsToBundle } = filterOpsResult;
|
|
91
|
-
await this.mempool.resubmitUserOps({
|
|
92
|
-
userOps: userOpsToBundle,
|
|
93
|
-
entryPoint: bundle.entryPoint,
|
|
94
|
-
reason: "sibling_op_reverted"
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
const { rejectedUserOps } = filterOpsResult;
|
|
98
|
-
// Fire and forget
|
|
99
|
-
// Check if any rejected userOps were frontruns, if not mark as reverted onchain.
|
|
100
|
-
rejectedUserOps.map(async (userOpInfo) => {
|
|
101
|
-
const wasFrontrun = await this.checkFrontrun(userOpInfo);
|
|
102
|
-
if (!wasFrontrun) {
|
|
103
|
-
const { userOpHash } = userOpInfo;
|
|
104
|
-
await this.monitor.setUserOpStatus(userOpHash, {
|
|
105
|
-
status: "failed",
|
|
106
|
-
transactionHash
|
|
107
|
-
});
|
|
108
|
-
this.eventManager.emitFailedOnChain(userOpHash, transactionHash, blockNumber);
|
|
109
|
-
this.logger.info({
|
|
110
|
-
userOpHash,
|
|
111
|
-
transactionHash
|
|
112
|
-
}, "user op failed onchain");
|
|
113
|
-
this.metrics.userOpsOnChain
|
|
114
|
-
.labels({ status: "reverted" })
|
|
115
|
-
.inc(1);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
})();
|
|
119
|
-
}
|
|
120
|
-
trackBundle(submittedBundle) {
|
|
121
|
-
this.pendingBundles.set(submittedBundle.uid, submittedBundle);
|
|
122
|
-
}
|
|
123
|
-
// Helpers //
|
|
124
|
-
async getLatestBlockWithCache() {
|
|
125
|
-
const now = Date.now();
|
|
126
|
-
const cache = this.cachedLatestBlock;
|
|
127
|
-
if (cache && now - cache.timestamp < this.config.blockNumberCacheTtl) {
|
|
128
|
-
return cache.value;
|
|
129
|
-
}
|
|
130
|
-
const latestBlock = await this.config.publicClient.getBlockNumber();
|
|
131
|
-
this.cachedLatestBlock = { value: latestBlock, timestamp: now };
|
|
132
|
-
return latestBlock;
|
|
133
|
-
}
|
|
134
|
-
cacheReceipt(userOpHash, receipt) {
|
|
135
|
-
this.pruneReceiptCache();
|
|
136
|
-
this.receiptCache.set(userOpHash, {
|
|
137
|
-
receipt,
|
|
138
|
-
timestamp: Date.now()
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
getCachedReceipt(userOpHash) {
|
|
142
|
-
const cached = this.receiptCache.get(userOpHash);
|
|
143
|
-
if (!cached) {
|
|
144
|
-
return undefined;
|
|
145
|
-
}
|
|
146
|
-
return cached.receipt;
|
|
147
|
-
}
|
|
148
|
-
pruneReceiptCache() {
|
|
149
|
-
const now = Date.now();
|
|
150
|
-
const expiredEntries = Array.from(this.receiptCache.entries()).filter(([_, cached]) => now - cached.timestamp > this.receiptTtl);
|
|
151
|
-
for (const [userOpHash] of expiredEntries) {
|
|
152
|
-
this.receiptCache.delete(userOpHash);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
// Free executors and remove userOps from mempool.
|
|
156
|
-
async freeSubmittedBundle(submittedBundle) {
|
|
157
|
-
const { executor, bundle } = submittedBundle;
|
|
158
|
-
const { userOps, entryPoint } = bundle;
|
|
159
|
-
this.stopTrackingBundle(submittedBundle);
|
|
160
|
-
await this.senderManager.markWalletProcessed(executor);
|
|
161
|
-
await this.mempool.removeSubmittedUserOps({ entryPoint, userOps });
|
|
162
|
-
}
|
|
163
|
-
// Stop tracking bundle in event resubmit fails
|
|
164
|
-
stopTrackingBundle(submittedBundle) {
|
|
165
|
-
this.pendingBundles.delete(submittedBundle.uid);
|
|
166
|
-
}
|
|
167
|
-
async processIncludedUserOp(userOpInfo, userOpReceipt, transactionHash, blockNumber, entryPoint) {
|
|
168
|
-
const { userOpHash, userOp, submissionAttempts, addedToMempool } = userOpInfo;
|
|
169
|
-
this.logger.info({ userOpHash, transactionHash }, "user op included");
|
|
170
|
-
// Update status
|
|
171
|
-
await this.monitor.setUserOpStatus(userOpHash, {
|
|
172
|
-
status: "included",
|
|
173
|
-
transactionHash
|
|
174
|
-
});
|
|
175
|
-
// Emit appropriate event
|
|
176
|
-
if (userOpReceipt.success) {
|
|
177
|
-
this.eventManager.emitIncludedOnChain(userOpHash, transactionHash, blockNumber);
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
this.eventManager.emitExecutionRevertedOnChain(userOpHash, transactionHash, userOpReceipt.reason || "0x", blockNumber);
|
|
181
|
-
}
|
|
182
|
-
// Track metrics
|
|
183
|
-
this.metrics.userOpInclusionDuration.observe((Date.now() - addedToMempool) / 1000);
|
|
184
|
-
this.metrics.userOpsSubmissionAttempts.observe(submissionAttempts);
|
|
185
|
-
// Update reputation
|
|
186
|
-
const accountDeployed = this.checkAccountDeployment(userOpReceipt, userOp.sender);
|
|
187
|
-
this.reputationManager.updateUserOpIncludedStatus(userOp, entryPoint, accountDeployed);
|
|
188
|
-
}
|
|
189
|
-
async checkFrontrun(userOpInfo, blockWaitCount = 0) {
|
|
190
|
-
const { userOpHash } = userOpInfo;
|
|
191
|
-
// Try to find userOp onchain
|
|
192
|
-
try {
|
|
193
|
-
const userOpReceipt = await this.getUserOpReceipt(userOpHash);
|
|
194
|
-
if (userOpReceipt) {
|
|
195
|
-
const transactionHash = userOpReceipt.receipt.transactionHash;
|
|
196
|
-
const blockNumber = userOpReceipt.receipt.blockNumber;
|
|
197
|
-
await this.monitor.setUserOpStatus(userOpHash, {
|
|
198
|
-
status: "included",
|
|
199
|
-
transactionHash
|
|
200
|
-
});
|
|
201
|
-
this.eventManager.emitFrontranOnChain(userOpHash, transactionHash, blockNumber);
|
|
202
|
-
this.logger.info({
|
|
203
|
-
userOpHash
|
|
204
|
-
}, "user op frontrun onchain");
|
|
205
|
-
this.metrics.userOpsOnChain
|
|
206
|
-
.labels({ status: "frontran" })
|
|
207
|
-
.inc(1);
|
|
208
|
-
return true;
|
|
209
|
-
}
|
|
210
|
-
if (blockWaitCount >= this.config.maxBlockWaitCount) {
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
return new Promise((resolve) => {
|
|
214
|
-
setTimeout(() => {
|
|
215
|
-
resolve(this.checkFrontrun(userOpInfo, blockWaitCount + 1));
|
|
216
|
-
}, this.config.publicClient.chain.blockTime ?? 1_000);
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
catch (error) {
|
|
220
|
-
this.logger.error({
|
|
221
|
-
userOpHash,
|
|
222
|
-
error
|
|
223
|
-
}, "Error checking frontrun status");
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
async getUserOpReceipt(userOpHash) {
|
|
228
|
-
// Check cache first
|
|
229
|
-
const cached = this.getCachedReceipt(userOpHash);
|
|
230
|
-
if (cached) {
|
|
231
|
-
return cached;
|
|
232
|
-
}
|
|
233
|
-
let fromBlock;
|
|
234
|
-
let toBlock;
|
|
235
|
-
if (this.config.maxBlockRange !== undefined) {
|
|
236
|
-
const latestBlock = await this.getLatestBlockWithCache();
|
|
237
|
-
fromBlock = latestBlock - BigInt(this.config.maxBlockRange);
|
|
238
|
-
if (fromBlock < 0n) {
|
|
239
|
-
fromBlock = 0n;
|
|
240
|
-
}
|
|
241
|
-
toBlock = "latest";
|
|
242
|
-
}
|
|
243
|
-
const filterResult = await this.config.publicClient.getLogs({
|
|
244
|
-
address: this.config.entrypoints,
|
|
245
|
-
event: getAbiItem({
|
|
246
|
-
abi: entryPoint07Abi,
|
|
247
|
-
name: "UserOperationEvent"
|
|
248
|
-
}),
|
|
249
|
-
fromBlock,
|
|
250
|
-
toBlock,
|
|
251
|
-
args: {
|
|
252
|
-
userOpHash
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
if (filterResult.length === 0) {
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
|
-
const userOperationEvent = filterResult[0];
|
|
259
|
-
// throw if any of the members of userOperationEvent are undefined
|
|
260
|
-
if (userOperationEvent.args.actualGasCost === undefined ||
|
|
261
|
-
userOperationEvent.args.sender === undefined ||
|
|
262
|
-
userOperationEvent.args.nonce === undefined ||
|
|
263
|
-
userOperationEvent.args.userOpHash === undefined ||
|
|
264
|
-
userOperationEvent.args.success === undefined ||
|
|
265
|
-
userOperationEvent.args.paymaster === undefined ||
|
|
266
|
-
userOperationEvent.args.actualGasUsed === undefined) {
|
|
267
|
-
throw new Error("userOperationEvent has undefined members");
|
|
268
|
-
}
|
|
269
|
-
const txHash = userOperationEvent.transactionHash;
|
|
270
|
-
if (txHash === null) {
|
|
271
|
-
// transaction pending
|
|
272
|
-
return null;
|
|
273
|
-
}
|
|
274
|
-
const getTransactionReceipt = async (txHash) => {
|
|
275
|
-
while (true) {
|
|
276
|
-
try {
|
|
277
|
-
const publicClient = this.config.publicClient;
|
|
278
|
-
const transactionReceipt = await publicClient.getTransactionReceipt({
|
|
279
|
-
hash: txHash
|
|
280
|
-
});
|
|
281
|
-
let effectiveGasPrice = transactionReceipt.effectiveGasPrice ??
|
|
282
|
-
transactionReceipt.gasPrice ??
|
|
283
|
-
undefined;
|
|
284
|
-
if (effectiveGasPrice === undefined) {
|
|
285
|
-
const tx = await publicClient.getTransaction({
|
|
286
|
-
hash: txHash
|
|
287
|
-
});
|
|
288
|
-
effectiveGasPrice = tx.gasPrice ?? undefined;
|
|
289
|
-
}
|
|
290
|
-
if (effectiveGasPrice) {
|
|
291
|
-
transactionReceipt.effectiveGasPrice = effectiveGasPrice;
|
|
292
|
-
}
|
|
293
|
-
return transactionReceipt;
|
|
294
|
-
}
|
|
295
|
-
catch (e) {
|
|
296
|
-
if (e instanceof TransactionReceiptNotFoundError) {
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
throw e;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
const receipt = await getTransactionReceipt(txHash);
|
|
304
|
-
const userOpReceipt = parseUserOpReceipt(userOpHash, receipt);
|
|
305
|
-
// Cache the receipt before returning
|
|
306
|
-
this.cacheReceipt(userOpHash, userOpReceipt);
|
|
307
|
-
return userOpReceipt;
|
|
308
|
-
}
|
|
309
|
-
checkAccountDeployment(userOpReceipt, sender) {
|
|
310
|
-
return userOpReceipt.receipt.logs.some((log) => {
|
|
311
|
-
try {
|
|
312
|
-
const { args } = decodeEventLog({
|
|
313
|
-
abi: entryPoint07Abi,
|
|
314
|
-
data: log.data,
|
|
315
|
-
eventName: "AccountDeployed",
|
|
316
|
-
topics: log.topics
|
|
317
|
-
});
|
|
318
|
-
return getAddress(args.sender) === sender;
|
|
319
|
-
}
|
|
320
|
-
catch {
|
|
321
|
-
return false;
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
//# sourceMappingURL=userOpMonitor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"userOpMonitor.js","sourceRoot":"","sources":["../../executor/userOpMonitor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAMH,+BAA+B,EAC/B,cAAc,EACd,UAAU,EACV,UAAU,EACb,MAAM,MAAM,CAAA;AACb,O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AAC,EAAE,CAAC;oBACT,IAAI,CAAC,YAAY,+BAA+B,EAAE,CAAC;wBAC/C,SAAQ;oBACZ,CAAC;oBAED,MAAM,CAAC,CAAA;gBACX,CAAC;YACL,CAAC;QACL,CAAC,CAAA;QAED,MAAM,OAAO,GAAG,MAAM,qBAAqB,CAAC,MAAM,CAAC,CAAA;QACnD,MAAM,aAAa,GAAG,kBAAkB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QAE7D,qCAAqC;QACrC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,aAAa,CAAC,CAAA;QAE5C,OAAO,aAAa,CAAA;IACxB,CAAC;IAEO,sBAAsB,CAC1B,aAAkB,EAClB,MAAe;QAEf,OAAO,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE;YAChD,IAAI,CAAC;gBACD,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC;oBAC5B,GAAG,EAAE,eAAe;oBACpB,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,SAAS,EAAE,iBAAiB;oBAC5B,MAAM,EAAE,GAAG,CAAC,MAAyB;iBACxC,CAAC,CAAA;gBACF,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,MAAM,CAAA;YAC7C,CAAC;YAAC,MAAM,CAAC;gBACL,OAAO,KAAK,CAAA;YAChB,CAAC;QACL,CAAC,CAAC,CAAA;IACN,CAAC;CACJ"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Metrics } from "../utils/index.js";
|
|
2
|
-
import type { Address } from "abitype";
|
|
3
|
-
import type { AltoConfig } from "../createConfig.js";
|
|
4
|
-
export declare class UtilityWalletMonitor {
|
|
5
|
-
private config;
|
|
6
|
-
private utilityWalletAddress;
|
|
7
|
-
private timer;
|
|
8
|
-
private metrics;
|
|
9
|
-
private logger;
|
|
10
|
-
constructor({ config, metrics, utilityWalletAddress }: {
|
|
11
|
-
config: AltoConfig;
|
|
12
|
-
metrics: Metrics;
|
|
13
|
-
utilityWalletAddress: Address;
|
|
14
|
-
});
|
|
15
|
-
private updateMetrics;
|
|
16
|
-
start(): Promise<void>;
|
|
17
|
-
stop(): void;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=utilityWalletMonitor.d.ts.map
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { formatEther } from "viem";
|
|
2
|
-
export class UtilityWalletMonitor {
|
|
3
|
-
config;
|
|
4
|
-
utilityWalletAddress;
|
|
5
|
-
timer;
|
|
6
|
-
metrics;
|
|
7
|
-
logger;
|
|
8
|
-
constructor({ config, metrics, utilityWalletAddress }) {
|
|
9
|
-
this.config = config;
|
|
10
|
-
this.utilityWalletAddress = utilityWalletAddress;
|
|
11
|
-
this.metrics = metrics;
|
|
12
|
-
this.logger = config.getLogger({ module: "utility_wallet_monitor" }, {
|
|
13
|
-
level: config.logLevel
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
async updateMetrics() {
|
|
17
|
-
try {
|
|
18
|
-
const balance = await this.config.publicClient.getBalance({
|
|
19
|
-
address: this.utilityWalletAddress
|
|
20
|
-
});
|
|
21
|
-
this.metrics.utilityWalletBalance.set(Number.parseFloat(formatEther(balance)));
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
this.logger.error(error, "Failed to update utility wallet balance metrics");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async start() {
|
|
28
|
-
if (this.timer) {
|
|
29
|
-
throw new Error("UtilityWalletMonitor already started");
|
|
30
|
-
}
|
|
31
|
-
await this.updateMetrics();
|
|
32
|
-
this.timer = setInterval(this.updateMetrics.bind(this), this.config.utilityWalletMonitorInterval);
|
|
33
|
-
}
|
|
34
|
-
stop() {
|
|
35
|
-
clearInterval(this.timer);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=utilityWalletMonitor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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GAAG,WAAW,CACpB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAC7B,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAC3B,CAAA;IACrB,CAAC;IAEM,IAAI;QACP,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC7B,CAAC;CACJ"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { HexData32, UserOperationStatus } from "../types/index.js";
|
|
2
|
-
import type { AltoConfig } from "../createConfig.js";
|
|
3
|
-
export declare class Monitor {
|
|
4
|
-
private statusStore;
|
|
5
|
-
private userOpTimeouts;
|
|
6
|
-
private timeout;
|
|
7
|
-
private isUsingRedis;
|
|
8
|
-
constructor({ config, timeout }: {
|
|
9
|
-
config: AltoConfig;
|
|
10
|
-
timeout?: number;
|
|
11
|
-
});
|
|
12
|
-
setUserOpStatus(userOpHash: HexData32, status: UserOperationStatus): Promise<void>;
|
|
13
|
-
getUserOpStatus(userOpHash: HexData32): Promise<UserOperationStatus>;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=monitoring.d.ts.map
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { Redis } from "ioredis";
|
|
2
|
-
import { userOperationStatusSchema } from "../types/schemas.js";
|
|
3
|
-
class InMemoryUserOperationStatusStore {
|
|
4
|
-
store = {};
|
|
5
|
-
set(userOpHash, status) {
|
|
6
|
-
this.store[userOpHash] = status;
|
|
7
|
-
return Promise.resolve();
|
|
8
|
-
}
|
|
9
|
-
get(userOpHash) {
|
|
10
|
-
return Promise.resolve(this.store[userOpHash]);
|
|
11
|
-
}
|
|
12
|
-
delete(userOpHash) {
|
|
13
|
-
delete this.store[userOpHash];
|
|
14
|
-
return Promise.resolve();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
class RedisUserOperationStatusStore {
|
|
18
|
-
redis;
|
|
19
|
-
keyPrefix;
|
|
20
|
-
ttlSeconds;
|
|
21
|
-
constructor({ config, ttlSeconds = 3600 // 1 hour ttl by default
|
|
22
|
-
}) {
|
|
23
|
-
if (!config.redisOpStatusUrl) {
|
|
24
|
-
throw new Error("RedisOpStatusUrl is not configured");
|
|
25
|
-
}
|
|
26
|
-
this.redis = new Redis(config.redisOpStatusUrl);
|
|
27
|
-
this.keyPrefix = `${config.chainId}:${config.redisOpStatusQueueName}`;
|
|
28
|
-
this.ttlSeconds = ttlSeconds;
|
|
29
|
-
}
|
|
30
|
-
getKey(userOpHash) {
|
|
31
|
-
return `${this.keyPrefix}:${userOpHash}`;
|
|
32
|
-
}
|
|
33
|
-
serialize(status) {
|
|
34
|
-
try {
|
|
35
|
-
return JSON.stringify(status);
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
throw new Error(`Failed to serialize UserOperationStatus: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
deserialize(data) {
|
|
42
|
-
try {
|
|
43
|
-
const parsed = JSON.parse(data);
|
|
44
|
-
const result = userOperationStatusSchema.safeParse(parsed);
|
|
45
|
-
if (!result.success) {
|
|
46
|
-
throw new Error(`Invalid UserOperationStatus format: ${result.error.message}`);
|
|
47
|
-
}
|
|
48
|
-
return result.data;
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
throw new Error(`Failed to deserialize UserOperationStatus: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async set(userOpHash, status) {
|
|
55
|
-
const key = this.getKey(userOpHash);
|
|
56
|
-
const serialized = this.serialize(status);
|
|
57
|
-
await this.redis.set(key, serialized, "EX", this.ttlSeconds);
|
|
58
|
-
}
|
|
59
|
-
async get(userOpHash) {
|
|
60
|
-
const data = await this.redis.get(this.getKey(userOpHash));
|
|
61
|
-
if (!data) {
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
return this.deserialize(data);
|
|
65
|
-
}
|
|
66
|
-
async delete(userOpHash) {
|
|
67
|
-
await this.redis.del(this.getKey(userOpHash));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
export class Monitor {
|
|
71
|
-
statusStore;
|
|
72
|
-
userOpTimeouts;
|
|
73
|
-
timeout;
|
|
74
|
-
isUsingRedis;
|
|
75
|
-
constructor({ config, timeout = 60 * 60 * 1000 }) {
|
|
76
|
-
this.timeout = timeout;
|
|
77
|
-
this.userOpTimeouts = {};
|
|
78
|
-
this.isUsingRedis = Boolean(config.redisOpStatusUrl);
|
|
79
|
-
if (this.isUsingRedis) {
|
|
80
|
-
this.statusStore = new RedisUserOperationStatusStore({
|
|
81
|
-
config
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
this.statusStore = new InMemoryUserOperationStatusStore();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
async setUserOpStatus(userOpHash, status) {
|
|
89
|
-
// Clear existing timer if it exists
|
|
90
|
-
if (this.userOpTimeouts[userOpHash]) {
|
|
91
|
-
clearTimeout(this.userOpTimeouts[userOpHash]);
|
|
92
|
-
}
|
|
93
|
-
// Set the user operation status
|
|
94
|
-
await this.statusStore.set(userOpHash, status);
|
|
95
|
-
// For in-memory storage, we need to manually prune statuses
|
|
96
|
-
if (!this.isUsingRedis) {
|
|
97
|
-
// Clear existing timer if it exists
|
|
98
|
-
if (this.userOpTimeouts[userOpHash]) {
|
|
99
|
-
clearTimeout(this.userOpTimeouts[userOpHash]);
|
|
100
|
-
}
|
|
101
|
-
this.userOpTimeouts[userOpHash] = setTimeout(async () => {
|
|
102
|
-
await this.statusStore.delete(userOpHash);
|
|
103
|
-
delete this.userOpTimeouts[userOpHash];
|
|
104
|
-
}, this.timeout);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async getUserOpStatus(userOpHash) {
|
|
108
|
-
const status = await this.statusStore.get(userOpHash);
|
|
109
|
-
if (status === undefined) {
|
|
110
|
-
return {
|
|
111
|
-
status: "not_found",
|
|
112
|
-
transactionHash: null
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
return status;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=monitoring.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"monitoring.js","sourceRoot":"","sources":["../../mempool/monitoring.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAQ5D,MAAM,gCAAgC;IAC1B,KAAK,GAA2C,EAAE,CAAA;IAE1D,GAAG,CAAC,UAAqB,EAAE,MAA2B;QAClD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,MAAM,CAAA;QAC/B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC5B,CAAC;IAED,GAAG,CAAC,UAAqB;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAA;IAClD,CAAC;IAED,MAAM,CAAC,UAAqB;QACxB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QAC7B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC5B,CAAC;CACJ;AAED,MAAM,6BAA6B;IACvB,KAAK,CAAO;IACZ,SAAS,CAAQ;IACjB,UAAU,CAAQ;IAE1B,YAAY,EACR,MAAM,EACN,UAAU,GAAG,IAAI,CAAC,wBAAwB;MAI7C;QACG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;QACzD,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;QAC/C,IAAI,CAAC,SAAS,GAAG,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,sBAAsB,EA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