@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.
- 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/338795fc743ca612.json +1 -0
- package/contracts/build-info/44a9648cfe32a468.json +1 -0
- package/contracts/build-info/{880955d5786bfdae.json → 8dbf8a4ad39019b5.json} +1 -1
- 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 +13 -6
- package/esm/cli/alto.js.map +1 -1
- package/esm/cli/config/bundler.d.ts +190 -148
- package/esm/cli/config/bundler.js +72 -83
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.d.ts +2 -1
- package/esm/cli/config/options.js +105 -68
- 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 +48 -52
- package/esm/cli/handler.js.map +1 -1
- package/esm/cli/setupServer.js +46 -47
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/cli/shutDown.d.ts +20 -0
- package/esm/cli/shutDown.js +260 -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} +38 -32
- package/esm/executor/{userOpMonitor.js → bundleManager.js} +127 -99
- package/esm/executor/bundleManager.js.map +1 -0
- package/esm/executor/executor.d.ts +4 -3
- package/esm/executor/executor.js +33 -20
- package/esm/executor/executor.js.map +1 -1
- package/esm/executor/executorManager.d.ts +17 -15
- package/esm/executor/executorManager.js +130 -55
- 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/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 +3 -6
- package/esm/executor/senderManager/createRedisSenderManager.js.map +1 -1
- package/esm/executor/senderManager/flushOnStartUp.js +4 -4
- 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 +2 -2
- package/esm/executor/senderManager/validateAndRefill.js.map +1 -1
- package/esm/executor/utilityWalletMonitor.d.ts +4 -4
- package/esm/executor/utilityWalletMonitor.js +1 -1
- package/esm/executor/utilityWalletMonitor.js.map +1 -1
- package/esm/executor/utils.d.ts +7 -2
- package/esm/executor/utils.js +57 -26
- 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/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 +8 -9
- package/esm/handlers/gasPriceManager.js +68 -80
- 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 +57 -22
- package/esm/mempool/mempool.js +180 -134
- 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} +95 -47
- 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 +54 -48
- package/esm/rpc/estimation/utils.js.map +1 -1
- package/esm/rpc/methods/boost_sendUserOperation.d.ts +304 -0
- 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 +50 -29
- 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 +26 -26
- package/esm/rpc/methods/eth_getUserOperationReceipt.js +1 -1
- package/esm/rpc/methods/eth_sendUserOperation.d.ts +305 -1
- package/esm/rpc/methods/eth_sendUserOperation.js +132 -36
- 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 +330 -26
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js +15 -27
- 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 +21 -22
- package/esm/rpc/rpcHandler.js +15 -17
- 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 +71 -40
- package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
- package/esm/store/createMempoolStore.d.ts +1 -1
- package/esm/store/createMempoolStore.js +63 -139
- 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 +16 -0
- package/esm/store/processing/memory.js +58 -0
- package/esm/store/processing/memory.js.map +1 -0
- package/esm/store/processing/redis.d.ts +23 -0
- package/esm/store/processing/redis.js +85 -0
- package/esm/store/processing/redis.js.map +1 -0
- package/esm/store/processing/types.d.ts +10 -0
- package/esm/store/processing/types.js +2 -0
- package/esm/store/processing/types.js.map +1 -0
- package/esm/store/types.d.ts +50 -0
- package/esm/store/types.js +2 -0
- package/esm/store/types.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/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 +13174 -4732
- package/esm/types/schemas.js +113 -25
- 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 +2 -1
- package/esm/utils/helpers.js +30 -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 +2 -1
- package/esm/utils/metrics.js +15 -8
- 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 +87 -55
- package/esm/utils/userop.js +138 -248
- 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.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/utils/preVerificationGasCalulator.js.map +0 -1
package/esm/utils/userop.d.ts
CHANGED
|
@@ -1,65 +1,92 @@
|
|
|
1
|
-
import { type PackedUserOperation, type UserOperation, type
|
|
2
|
-
import { type Address, type Hex, type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
20
|
-
export declare function unpackGasLimits(gasLimits: Hex): {
|
|
21
|
-
maxPriorityFeePerGas: bigint;
|
|
21
|
+
verificationGasLimit: bigint;
|
|
22
|
+
preVerificationGas: bigint;
|
|
22
23
|
maxFeePerGas: bigint;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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(
|
|
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
|
|
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
|
-
|
|
60
|
-
}) => `0x${string}` | Promise<`0x${string}`>;
|
|
85
|
+
}): Hex;
|
|
61
86
|
export declare const getNonceKeyAndSequence: (nonce: bigint) => bigint[];
|
|
62
|
-
export declare function
|
|
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
|
package/esm/utils/userop.js
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
import { logSchema, receiptSchema } from "../types/index.js";
|
|
2
|
-
import {
|
|
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 {
|
|
6
|
-
// Type predicate check if the UserOperation is
|
|
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
|
|
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
|
|
14
|
+
// Type predicate to check if the UserOperation is v0.8
|
|
15
15
|
export function isVersion08(operation, entryPointAddress) {
|
|
16
|
-
return entryPointAddress.startsWith("
|
|
16
|
+
return entryPointAddress.startsWith("0x433708");
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
310
|
-
|
|
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
|
-
|
|
141
|
+
entryPointVersion: "0.9",
|
|
142
|
+
userOperation: {
|
|
143
|
+
...toViemUserOp(userOp),
|
|
144
|
+
authorization
|
|
145
|
+
}
|
|
326
146
|
});
|
|
327
147
|
}
|
|
328
148
|
if (isVersion08(userOp, entryPointAddress)) {
|
|
329
|
-
|
|
330
|
-
|
|
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
|
-
|
|
173
|
+
entryPointAddress,
|
|
174
|
+
entryPointVersion: "0.7",
|
|
175
|
+
userOperation: toViemUserOp(userOp)
|
|
334
176
|
});
|
|
335
177
|
}
|
|
336
|
-
return
|
|
337
|
-
|
|
178
|
+
return getUserOperationHash({
|
|
179
|
+
chainId,
|
|
338
180
|
entryPointAddress,
|
|
339
|
-
|
|
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
|
|
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
|