@pimlico/alto 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/cli/alto.js +3 -1
- package/esm/cli/alto.js.map +1 -1
- package/esm/cli/config/bundler.d.ts +348 -306
- package/esm/cli/config/bundler.js +26 -7
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.d.ts +2 -1
- package/esm/cli/config/options.js +46 -8
- package/esm/cli/config/options.js.map +1 -1
- package/esm/cli/customTransport.js +40 -7
- package/esm/cli/customTransport.js.map +1 -1
- package/esm/cli/deploySimulationsContract.d.ts +8 -0
- package/esm/cli/deploySimulationsContract.js +26 -0
- package/esm/cli/deploySimulationsContract.js.map +1 -0
- package/esm/cli/handler.d.ts +2 -2
- package/esm/cli/handler.js +67 -89
- package/esm/cli/handler.js.map +1 -1
- package/esm/cli/instrumentation.js +4 -2
- package/esm/cli/instrumentation.js.map +1 -1
- package/esm/cli/parseArgs.d.ts +8 -0
- package/esm/cli/parseArgs.js +21 -0
- package/esm/cli/parseArgs.js.map +1 -0
- package/esm/cli/setupServer.d.ts +4 -9
- package/esm/cli/setupServer.js +98 -82
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/createConfig.d.ts +15 -0
- package/esm/createConfig.js +8 -0
- package/esm/createConfig.js.map +1 -0
- package/esm/executor/executor.d.ts +29 -13
- package/esm/executor/executor.js +110 -72
- package/esm/executor/executor.js.map +1 -1
- package/esm/executor/executorManager.d.ts +14 -10
- package/esm/executor/executorManager.js +42 -42
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/executor/senderManager.d.ts +11 -6
- package/esm/executor/senderManager.js +25 -32
- package/esm/executor/senderManager.js.map +1 -1
- package/esm/executor/utilityWalletMonitor.d.ts +9 -5
- package/esm/executor/utilityWalletMonitor.js +8 -8
- package/esm/executor/utilityWalletMonitor.js.map +1 -1
- package/esm/executor/utils.d.ts +2 -1
- package/esm/executor/utils.js +7 -2
- package/esm/executor/utils.js.map +1 -1
- package/esm/handlers/arbitrumGasPriceManager.d.ts +11 -0
- package/esm/handlers/arbitrumGasPriceManager.js +29 -0
- package/esm/handlers/arbitrumGasPriceManager.js.map +1 -0
- package/esm/handlers/eventManager.d.ts +7 -3
- package/esm/handlers/eventManager.js +24 -16
- package/esm/handlers/eventManager.js.map +1 -1
- package/esm/handlers/gasPriceManager.d.ts +14 -27
- package/esm/handlers/gasPriceManager.js +81 -135
- package/esm/handlers/gasPriceManager.js.map +1 -1
- package/esm/handlers/mantleGasPriceManager.d.ts +20 -0
- package/esm/handlers/mantleGasPriceManager.js +28 -0
- package/esm/handlers/mantleGasPriceManager.js.map +1 -0
- package/esm/mempool/mempool.d.ts +13 -10
- package/esm/mempool/mempool.js +29 -26
- package/esm/mempool/mempool.js.map +1 -1
- package/esm/mempool/reputationManager.d.ts +4 -6
- package/esm/mempool/reputationManager.js +25 -29
- package/esm/mempool/reputationManager.js.map +1 -1
- package/esm/mempool/store.d.ts +1 -1
- package/esm/rpc/estimation/gasEstimationHandler.d.ts +24 -0
- package/esm/rpc/estimation/gasEstimationHandler.js +48 -0
- package/esm/rpc/estimation/gasEstimationHandler.js.map +1 -0
- package/esm/rpc/estimation/gasEstimationsV06.d.ts +19 -0
- package/esm/rpc/estimation/gasEstimationsV06.js +146 -0
- package/esm/rpc/estimation/gasEstimationsV06.js.map +1 -0
- package/esm/rpc/estimation/gasEstimationsV07.d.ts +88 -0
- package/esm/rpc/estimation/gasEstimationsV07.js +429 -0
- package/esm/rpc/estimation/gasEstimationsV07.js.map +1 -0
- package/esm/rpc/estimation/types.d.ts +113 -0
- package/esm/rpc/estimation/types.js +122 -0
- package/esm/rpc/estimation/types.js.map +1 -0
- package/esm/rpc/nonceQueuer.d.ts +10 -6
- package/esm/rpc/nonceQueuer.js +10 -10
- package/esm/rpc/nonceQueuer.js.map +1 -1
- package/esm/rpc/rpcHandler.d.ts +19 -16
- package/esm/rpc/rpcHandler.js +83 -72
- package/esm/rpc/rpcHandler.js.map +1 -1
- package/esm/rpc/server.d.ts +9 -7
- package/esm/rpc/server.js +27 -26
- package/esm/rpc/server.js.map +1 -1
- package/esm/rpc/validation/SafeValidator.d.ts +11 -6
- package/esm/rpc/validation/SafeValidator.js +16 -14
- package/esm/rpc/validation/SafeValidator.js.map +1 -1
- package/esm/rpc/validation/TracerResultParserV06.d.ts +1 -1
- package/esm/rpc/validation/TracerResultParserV06.js.map +1 -1
- package/esm/rpc/validation/TracerResultParserV07.d.ts +1 -1
- package/esm/rpc/validation/TracerResultParserV07.js +1 -1
- package/esm/rpc/validation/TracerResultParserV07.js.map +1 -1
- package/esm/rpc/validation/UnsafeValidator.d.ts +14 -17
- package/esm/rpc/validation/UnsafeValidator.js +49 -42
- package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
- package/esm/types/contracts/ArbitrumL1FeeAbi.d.ts +32 -0
- package/esm/types/contracts/ArbitrumL1FeeAbi.js +42 -0
- package/esm/types/contracts/ArbitrumL1FeeAbi.js.map +1 -0
- package/esm/types/contracts/EntryPointSimulationsV6.d.ts +34 -0
- package/esm/types/contracts/EntryPointSimulationsV6.js +48 -0
- package/esm/types/contracts/EntryPointSimulationsV6.js.map +1 -0
- package/esm/types/contracts/EntryPointSimulationsV7.d.ts +1370 -0
- package/esm/types/contracts/{EntryPointSimulations.js → EntryPointSimulationsV7.js} +197 -385
- package/esm/types/contracts/EntryPointSimulationsV7.js.map +1 -0
- package/esm/types/contracts/IAccountExecute.d.ts +53 -0
- package/esm/types/contracts/IAccountExecute.js +68 -0
- package/esm/types/contracts/IAccountExecute.js.map +1 -0
- package/esm/types/contracts/MantleBvmGasPriceOracle.d.ts +219 -0
- package/esm/types/contracts/MantleBvmGasPriceOracle.js +177 -0
- package/esm/types/contracts/MantleBvmGasPriceOracle.js.map +1 -0
- package/esm/types/contracts/OpL1FeeAbi.d.ts +26 -0
- package/esm/types/contracts/OpL1FeeAbi.js +29 -0
- package/esm/types/contracts/OpL1FeeAbi.js.map +1 -0
- package/esm/types/contracts/PimlicoEntryPointSimulations.d.ts +1 -1
- package/esm/types/contracts/PimlicoEntryPointSimulations.js +1 -1
- package/esm/types/contracts/PimlicoEntryPointSimulations.js.map +1 -1
- package/esm/types/contracts/index.d.ts +5 -1
- package/esm/types/contracts/index.js +5 -1
- package/esm/types/contracts/index.js.map +1 -1
- package/esm/types/interfaces.d.ts +2 -2
- package/esm/types/schemas.d.ts +94 -94
- package/esm/types/schemas.js +3 -3
- package/esm/types/schemas.js.map +1 -1
- package/esm/types/utils.d.ts +1 -1
- package/esm/utils/bigInt.js +2 -2
- package/esm/utils/bigInt.js.map +1 -1
- package/esm/utils/helpers.js +1 -1
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/rpc-reply.d.ts +1 -1
- package/esm/utils/timedQueue.d.ts +12 -0
- package/esm/utils/timedQueue.js +51 -0
- package/esm/utils/timedQueue.js.map +1 -0
- package/esm/utils/userop.d.ts +2 -2
- package/esm/utils/userop.js +2 -2
- package/esm/utils/userop.js.map +1 -1
- package/esm/utils/validation.d.ts +14 -6
- package/esm/utils/validation.js +115 -132
- package/esm/utils/validation.js.map +1 -1
- package/lib/cli/alto.js +2 -0
- package/lib/cli/alto.js.map +1 -1
- package/lib/cli/config/bundler.d.ts +348 -306
- package/lib/cli/config/bundler.js +26 -7
- package/lib/cli/config/bundler.js.map +1 -1
- package/lib/cli/config/options.d.ts +2 -1
- package/lib/cli/config/options.js +47 -9
- package/lib/cli/config/options.js.map +1 -1
- package/lib/cli/customTransport.js +38 -5
- package/lib/cli/customTransport.js.map +1 -1
- package/lib/cli/deploySimulationsContract.d.ts +8 -0
- package/lib/cli/deploySimulationsContract.js +30 -0
- package/lib/cli/deploySimulationsContract.js.map +1 -0
- package/lib/cli/handler.d.ts +2 -2
- package/lib/cli/handler.js +66 -88
- package/lib/cli/handler.js.map +1 -1
- package/lib/cli/instrumentation.js +4 -2
- package/lib/cli/instrumentation.js.map +1 -1
- package/lib/cli/parseArgs.d.ts +8 -0
- package/lib/cli/parseArgs.js +25 -0
- package/lib/cli/parseArgs.js.map +1 -0
- package/lib/cli/setupServer.d.ts +4 -9
- package/lib/cli/setupServer.js +98 -82
- package/lib/cli/setupServer.js.map +1 -1
- package/lib/createConfig.d.ts +15 -0
- package/lib/createConfig.js +12 -0
- package/lib/createConfig.js.map +1 -0
- package/lib/executor/executor.d.ts +29 -13
- package/lib/executor/executor.js +106 -68
- package/lib/executor/executor.js.map +1 -1
- package/lib/executor/executorManager.d.ts +14 -10
- package/lib/executor/executorManager.js +40 -40
- package/lib/executor/executorManager.js.map +1 -1
- package/lib/executor/senderManager.d.ts +11 -6
- package/lib/executor/senderManager.js +25 -32
- package/lib/executor/senderManager.js.map +1 -1
- package/lib/executor/utilityWalletMonitor.d.ts +9 -5
- package/lib/executor/utilityWalletMonitor.js +8 -8
- package/lib/executor/utilityWalletMonitor.js.map +1 -1
- package/lib/executor/utils.d.ts +2 -1
- package/lib/executor/utils.js +9 -3
- package/lib/executor/utils.js.map +1 -1
- package/lib/handlers/arbitrumGasPriceManager.d.ts +11 -0
- package/lib/handlers/arbitrumGasPriceManager.js +33 -0
- package/lib/handlers/arbitrumGasPriceManager.js.map +1 -0
- package/lib/handlers/eventManager.d.ts +7 -3
- package/lib/handlers/eventManager.js +24 -16
- package/lib/handlers/eventManager.js.map +1 -1
- package/lib/handlers/gasPriceManager.d.ts +14 -27
- package/lib/handlers/gasPriceManager.js +80 -134
- package/lib/handlers/gasPriceManager.js.map +1 -1
- package/lib/handlers/mantleGasPriceManager.d.ts +20 -0
- package/lib/handlers/mantleGasPriceManager.js +32 -0
- package/lib/handlers/mantleGasPriceManager.js.map +1 -0
- package/lib/mempool/mempool.d.ts +13 -10
- package/lib/mempool/mempool.js +28 -25
- package/lib/mempool/mempool.js.map +1 -1
- package/lib/mempool/reputationManager.d.ts +4 -6
- package/lib/mempool/reputationManager.js +25 -29
- package/lib/mempool/reputationManager.js.map +1 -1
- package/lib/mempool/store.d.ts +1 -1
- package/lib/rpc/estimation/gasEstimationHandler.d.ts +24 -0
- package/lib/rpc/estimation/gasEstimationHandler.js +52 -0
- package/lib/rpc/estimation/gasEstimationHandler.js.map +1 -0
- package/lib/rpc/estimation/gasEstimationsV06.d.ts +19 -0
- package/lib/rpc/estimation/gasEstimationsV06.js +150 -0
- package/lib/rpc/estimation/gasEstimationsV06.js.map +1 -0
- package/lib/rpc/estimation/gasEstimationsV07.d.ts +88 -0
- package/lib/rpc/estimation/gasEstimationsV07.js +435 -0
- package/lib/rpc/estimation/gasEstimationsV07.js.map +1 -0
- package/lib/rpc/estimation/types.d.ts +113 -0
- package/lib/rpc/estimation/types.js +125 -0
- package/lib/rpc/estimation/types.js.map +1 -0
- package/lib/rpc/nonceQueuer.d.ts +10 -6
- package/lib/rpc/nonceQueuer.js +9 -9
- package/lib/rpc/nonceQueuer.js.map +1 -1
- package/lib/rpc/rpcHandler.d.ts +19 -16
- package/lib/rpc/rpcHandler.js +82 -71
- package/lib/rpc/rpcHandler.js.map +1 -1
- package/lib/rpc/server.d.ts +9 -7
- package/lib/rpc/server.js +26 -25
- package/lib/rpc/server.js.map +1 -1
- package/lib/rpc/validation/SafeValidator.d.ts +11 -6
- package/lib/rpc/validation/SafeValidator.js +16 -14
- package/lib/rpc/validation/SafeValidator.js.map +1 -1
- package/lib/rpc/validation/TracerResultParserV06.d.ts +1 -1
- package/lib/rpc/validation/TracerResultParserV07.d.ts +1 -1
- package/lib/rpc/validation/TracerResultParserV07.js +1 -1
- package/lib/rpc/validation/TracerResultParserV07.js.map +1 -1
- package/lib/rpc/validation/UnsafeValidator.d.ts +14 -17
- package/lib/rpc/validation/UnsafeValidator.js +49 -42
- package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
- package/lib/types/contracts/ArbitrumL1FeeAbi.d.ts +32 -0
- package/lib/types/contracts/ArbitrumL1FeeAbi.js +45 -0
- package/lib/types/contracts/ArbitrumL1FeeAbi.js.map +1 -0
- package/lib/types/contracts/EntryPointSimulationsV6.d.ts +34 -0
- package/lib/types/contracts/EntryPointSimulationsV6.js +51 -0
- package/lib/types/contracts/EntryPointSimulationsV6.js.map +1 -0
- package/lib/types/contracts/EntryPointSimulationsV7.d.ts +1370 -0
- package/lib/types/contracts/{EntryPointSimulations.js → EntryPointSimulationsV7.js} +198 -386
- package/lib/types/contracts/EntryPointSimulationsV7.js.map +1 -0
- package/lib/types/contracts/IAccountExecute.d.ts +53 -0
- package/lib/types/contracts/IAccountExecute.js +71 -0
- package/lib/types/contracts/IAccountExecute.js.map +1 -0
- package/lib/types/contracts/MantleBvmGasPriceOracle.d.ts +219 -0
- package/lib/types/contracts/MantleBvmGasPriceOracle.js +180 -0
- package/lib/types/contracts/MantleBvmGasPriceOracle.js.map +1 -0
- package/lib/types/contracts/OpL1FeeAbi.d.ts +26 -0
- package/lib/types/contracts/OpL1FeeAbi.js +32 -0
- package/lib/types/contracts/OpL1FeeAbi.js.map +1 -0
- package/lib/types/contracts/PimlicoEntryPointSimulations.d.ts +1 -1
- package/lib/types/contracts/PimlicoEntryPointSimulations.js +1 -1
- package/lib/types/contracts/PimlicoEntryPointSimulations.js.map +1 -1
- package/lib/types/contracts/index.d.ts +5 -1
- package/lib/types/contracts/index.js +5 -1
- package/lib/types/contracts/index.js.map +1 -1
- package/lib/types/interfaces.d.ts +2 -2
- package/lib/types/schemas.d.ts +94 -94
- package/lib/types/schemas.js +3 -3
- package/lib/types/schemas.js.map +1 -1
- package/lib/types/utils.d.ts +1 -1
- package/lib/utils/bigInt.js +2 -2
- package/lib/utils/bigInt.js.map +1 -1
- package/lib/utils/rpc-reply.d.ts +1 -1
- package/lib/utils/timedQueue.d.ts +12 -0
- package/lib/utils/timedQueue.js +55 -0
- package/lib/utils/timedQueue.js.map +1 -0
- package/lib/utils/userop.d.ts +2 -2
- package/lib/utils/userop.js +1 -1
- package/lib/utils/userop.js.map +1 -1
- package/lib/utils/validation.d.ts +14 -6
- package/lib/utils/validation.js +118 -134
- package/lib/utils/validation.js.map +1 -1
- package/package.json +1 -1
- package/esm/rpc/EntryPointSimulationsV07.d.ts +0 -62
- package/esm/rpc/EntryPointSimulationsV07.js +0 -410
- package/esm/rpc/EntryPointSimulationsV07.js.map +0 -1
- package/esm/rpc/ExecuteSimulator.d.ts +0 -37
- package/esm/rpc/ExecuteSimulator.js +0 -48
- package/esm/rpc/ExecuteSimulator.js.map +0 -1
- package/esm/rpc/gasEstimation.d.ts +0 -17
- package/esm/rpc/gasEstimation.js +0 -419
- package/esm/rpc/gasEstimation.js.map +0 -1
- package/esm/types/contracts/EntryPointSimulations.d.ts +0 -152
- package/esm/types/contracts/EntryPointSimulations.js.map +0 -1
- package/lib/rpc/EntryPointSimulationsV07.d.ts +0 -62
- package/lib/rpc/EntryPointSimulationsV07.js +0 -417
- package/lib/rpc/EntryPointSimulationsV07.js.map +0 -1
- package/lib/rpc/ExecuteSimulator.d.ts +0 -37
- package/lib/rpc/ExecuteSimulator.js +0 -51
- package/lib/rpc/ExecuteSimulator.js.map +0 -1
- package/lib/rpc/gasEstimation.d.ts +0 -17
- package/lib/rpc/gasEstimation.js +0 -426
- package/lib/rpc/gasEstimation.js.map +0 -1
- package/lib/types/contracts/EntryPointSimulations.d.ts +0 -152
- package/lib/types/contracts/EntryPointSimulations.js.map +0 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.simulationValidationResultStruct = void 0;
|
|
4
|
+
exports.simulationValidationResultStruct = [
|
|
5
|
+
{
|
|
6
|
+
components: [
|
|
7
|
+
{
|
|
8
|
+
components: [
|
|
9
|
+
{
|
|
10
|
+
internalType: "uint256",
|
|
11
|
+
name: "preOpGas",
|
|
12
|
+
type: "uint256"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
internalType: "uint256",
|
|
16
|
+
name: "prefund",
|
|
17
|
+
type: "uint256"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
internalType: "uint256",
|
|
21
|
+
name: "accountValidationData",
|
|
22
|
+
type: "uint256"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
internalType: "uint256",
|
|
26
|
+
name: "paymasterValidationData",
|
|
27
|
+
type: "uint256"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
internalType: "bytes",
|
|
31
|
+
name: "paymasterContext",
|
|
32
|
+
type: "bytes"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
internalType: "struct IEntryPoint.ReturnInfo",
|
|
36
|
+
name: "returnInfo",
|
|
37
|
+
type: "tuple"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
components: [
|
|
41
|
+
{
|
|
42
|
+
internalType: "uint256",
|
|
43
|
+
name: "stake",
|
|
44
|
+
type: "uint256"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
internalType: "uint256",
|
|
48
|
+
name: "unstakeDelaySec",
|
|
49
|
+
type: "uint256"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
internalType: "struct IStakeManager.StakeInfo",
|
|
53
|
+
name: "senderInfo",
|
|
54
|
+
type: "tuple"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
components: [
|
|
58
|
+
{
|
|
59
|
+
internalType: "uint256",
|
|
60
|
+
name: "stake",
|
|
61
|
+
type: "uint256"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
internalType: "uint256",
|
|
65
|
+
name: "unstakeDelaySec",
|
|
66
|
+
type: "uint256"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
internalType: "struct IStakeManager.StakeInfo",
|
|
70
|
+
name: "factoryInfo",
|
|
71
|
+
type: "tuple"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
components: [
|
|
75
|
+
{
|
|
76
|
+
internalType: "uint256",
|
|
77
|
+
name: "stake",
|
|
78
|
+
type: "uint256"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
internalType: "uint256",
|
|
82
|
+
name: "unstakeDelaySec",
|
|
83
|
+
type: "uint256"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
internalType: "struct IStakeManager.StakeInfo",
|
|
87
|
+
name: "paymasterInfo",
|
|
88
|
+
type: "tuple"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
components: [
|
|
92
|
+
{
|
|
93
|
+
internalType: "address",
|
|
94
|
+
name: "aggregator",
|
|
95
|
+
type: "address"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
components: [
|
|
99
|
+
{
|
|
100
|
+
internalType: "uint256",
|
|
101
|
+
name: "stake",
|
|
102
|
+
type: "uint256"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
internalType: "uint256",
|
|
106
|
+
name: "unstakeDelaySec",
|
|
107
|
+
type: "uint256"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
internalType: "struct IStakeManager.StakeInfo",
|
|
111
|
+
name: "stakeInfo",
|
|
112
|
+
type: "tuple"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
internalType: "struct IEntryPoint.AggregatorStakeInfo",
|
|
116
|
+
name: "aggregatorInfo",
|
|
117
|
+
type: "tuple"
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
internalType: "struct IEntryPointSimulations.ValidationResult",
|
|
121
|
+
name: "",
|
|
122
|
+
type: "tuple"
|
|
123
|
+
}
|
|
124
|
+
];
|
|
125
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../rpc/estimation/types.ts"],"names":[],"mappings":";;;AAsCa,QAAA,gCAAgC,GAAG;IAC5C;QACI,UAAU,EAAE;YACR;gBACI,UAAU,EAAE;oBACR;wBACI,YAAY,EAAE,SAAS;wBACvB,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,SAAS;qBAClB;oBACD;wBACI,YAAY,EAA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AAE,gCAAgC;gBAC9C,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,OAAO;aAChB;YACD;gBACI,UAAU,EAAE;oBACR;wBACI,YAAY,EAAE,SAAS;wBACvB,IAAI,EAAE,YAAY;wBAClB,IAAI,EAAE,SAAS;qBAClB;oBACD;wBACI,UAAU,EAAE;4BACR;gCACI,YAAY,EAAE,SAAS;gCACvB,IAAI,EAAE,OAAO;gCACb,IAAI,EAAE,SAAS;6BAClB;4BACD;gCACI,YAAY,EAAE,SAAS;gCACvB,IAAI,EAAE,iBAAiB;gCACvB,IAAI,EAAE,SAAS;6BAClB;yBACJ;wBACD,YAAY,EAAE,gCAAgC;wBAC9C,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,OAAO;qBAChB;iBACJ;gBACD,YAAY,EAAE,wCAAwC;gBACtD,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,OAAO;aAChB;SACJ;QACD,YAAY,EAAE,gDAAgD;QAC9D,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,OAAO;KAChB;CACK,CAAA"}
|
package/lib/rpc/nonceQueuer.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { EventManager } from "../handlers/index.js";
|
|
2
|
+
import type { MemoryMempool } from "../mempool/index.js";
|
|
1
3
|
import { type MempoolUserOperation } from "../types/index.js";
|
|
2
4
|
import type { Logger } from "../utils/index.js";
|
|
3
|
-
import { type Address, type
|
|
4
|
-
import type {
|
|
5
|
-
import type { EventManager } from "../handlers/index.js";
|
|
5
|
+
import { type Address, type Hash, type PublicClient } from "viem";
|
|
6
|
+
import type { AltoConfig } from "../createConfig.js";
|
|
6
7
|
type QueuedUserOperation = {
|
|
7
8
|
entryPoint: Address;
|
|
8
9
|
userOperationHash: Hash;
|
|
@@ -13,12 +14,15 @@ type QueuedUserOperation = {
|
|
|
13
14
|
};
|
|
14
15
|
export declare class NonceQueuer {
|
|
15
16
|
queuedUserOperations: QueuedUserOperation[];
|
|
17
|
+
config: AltoConfig;
|
|
16
18
|
mempool: MemoryMempool;
|
|
17
|
-
publicClient: PublicClient<Transport, Chain>;
|
|
18
19
|
logger: Logger;
|
|
19
|
-
blockTagSupport: boolean;
|
|
20
20
|
eventManager: EventManager;
|
|
21
|
-
constructor(
|
|
21
|
+
constructor({ config, mempool, eventManager }: {
|
|
22
|
+
config: AltoConfig;
|
|
23
|
+
mempool: MemoryMempool;
|
|
24
|
+
eventManager: EventManager;
|
|
25
|
+
});
|
|
22
26
|
process(): Promise<void>;
|
|
23
27
|
add(mempoolUserOperation: MempoolUserOperation, entryPoint: Address): void;
|
|
24
28
|
resubmitUserOperation(mempoolUserOperation: MempoolUserOperation, entryPoint: Address): void;
|
package/lib/rpc/nonceQueuer.js
CHANGED
|
@@ -6,16 +6,16 @@ const utils_1 = require("../utils/index.js");
|
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
class NonceQueuer {
|
|
8
8
|
queuedUserOperations = [];
|
|
9
|
+
config;
|
|
9
10
|
mempool;
|
|
10
|
-
publicClient;
|
|
11
11
|
logger;
|
|
12
|
-
blockTagSupport;
|
|
13
12
|
eventManager;
|
|
14
|
-
constructor(
|
|
13
|
+
constructor({ config, mempool, eventManager }) {
|
|
14
|
+
this.config = config;
|
|
15
15
|
this.mempool = mempool;
|
|
16
|
-
this.
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
this.logger = config.getLogger({ module: "nonce_queuer" }, {
|
|
17
|
+
level: config.nonceQueuerLogLevel || config.logLevel
|
|
18
|
+
});
|
|
19
19
|
this.eventManager = eventManager;
|
|
20
20
|
setInterval(() => {
|
|
21
21
|
this.process();
|
|
@@ -29,7 +29,7 @@ class NonceQueuer {
|
|
|
29
29
|
if (this.queuedUserOperations.length === 0) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const availableOps = await this.getAvailableUserOperations(this.publicClient);
|
|
32
|
+
const availableOps = await this.getAvailableUserOperations(this.config.publicClient);
|
|
33
33
|
if (availableOps.length === 0) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
@@ -46,7 +46,7 @@ class NonceQueuer {
|
|
|
46
46
|
add(mempoolUserOperation, entryPoint) {
|
|
47
47
|
const userOperation = (0, types_1.deriveUserOperation)(mempoolUserOperation);
|
|
48
48
|
const [nonceKey, nonceValue] = (0, utils_1.getNonceKeyAndValue)(userOperation.nonce);
|
|
49
|
-
const hash = (0, utils_1.getUserOperationHash)((0, types_1.deriveUserOperation)(mempoolUserOperation), entryPoint, this.publicClient.chain.id);
|
|
49
|
+
const hash = (0, utils_1.getUserOperationHash)((0, types_1.deriveUserOperation)(mempoolUserOperation), entryPoint, this.config.publicClient.chain.id);
|
|
50
50
|
this.queuedUserOperations.push({
|
|
51
51
|
entryPoint,
|
|
52
52
|
userOperationHash: hash,
|
|
@@ -83,7 +83,7 @@ class NonceQueuer {
|
|
|
83
83
|
args: [userOperation.sender, qop.nonceKey]
|
|
84
84
|
};
|
|
85
85
|
}),
|
|
86
|
-
blockTag: this.blockTagSupport ? "latest" : undefined
|
|
86
|
+
blockTag: this.config.blockTagSupport ? "latest" : undefined
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nonceQueuer.js","sourceRoot":"","sources":["../../rpc/nonceQueuer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"nonceQueuer.js","sourceRoot":"","sources":["../../rpc/nonceQueuer.ts"],"names":[],"mappings":";;;AAEA,uCAKoB;AAEpB,uCAIoB;AACpB,+BAMa;AAYb,MAAa,WAAW;IACpB,oBAAoB,GAA0B,EAAE,CAAA;IAEhD,MAAM,CAAY;IAClB,OAAO,CAAe;IACtB,MAAM,CAAQ;IACd,YAAY,CAAc;IAE1B,YAAY,EACR,MAAM,EACN,OAAO,EACP,YAAY,EAKf;QACG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,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,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,oBAAoB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACnD,MAAM,GAAG,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAA;YACnC,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;YAEzB,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9B,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EACvB,sBAAsB,CACzB,CAAA;gBACD,SAAQ;YACZ,CAAC;YAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAA;YAEvC,IAAI,iBAAiB,KAAK,GAAG,CAAC,UAAU,EAAE,CAAC;gBACvC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACnC,CAAC;QACL,CAAC;QAED,OAAO,qBAAqB,CAAA;IAChC,CAAC;CACJ;AA9MD,kCA8MC"}
|
package/lib/rpc/rpcHandler.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Executor, ExecutorManager } from "../executor/index.js";
|
|
2
|
+
import type { CompressionHandler, EventManager, GasPriceManager } from "../handlers/index.js";
|
|
2
3
|
import type { InterfaceReputationManager, MemoryMempool, Monitor } from "../mempool/index.js";
|
|
3
|
-
import type { ApiVersion, StateOverrides
|
|
4
|
+
import type { ApiVersion, StateOverrides } from "../types/index.js";
|
|
4
5
|
import { type Address, type BundlerClearMempoolResponseResult, type BundlerClearStateResponseResult, type BundlerDumpMempoolResponseResult, type BundlerDumpReputationsResponseResult, type BundlerGetStakeStatusResponseResult, type BundlerRequest, type BundlerResponse, type BundlerSendBundleNowResponseResult, type BundlerSetBundlingModeResponseResult, type BundlerSetReputationsRequestParams, type BundlingMode, type ChainIdResponseResult, type EstimateUserOperationGasResponseResult, type GetUserOperationByHashResponseResult, type GetUserOperationReceiptResponseResult, type HexData32, type InterfaceValidator, type MempoolUserOperation, type PimlicoGetUserOperationGasPriceResponseResult, type PimlicoGetUserOperationStatusResponseResult, type SendUserOperationResponseResult, type SupportedEntryPointsResponseResult, type UserOperation } from "../types/index.js";
|
|
5
6
|
import type { Logger, Metrics } from "../utils/index.js";
|
|
6
|
-
import
|
|
7
|
-
import { type Chain, type Hex, type PublicClient, type Transport } from "viem";
|
|
7
|
+
import { type Hex } from "viem";
|
|
8
8
|
import type { NonceQueuer } from "./nonceQueuer.js";
|
|
9
|
+
import type { AltoConfig } from "../createConfig.js";
|
|
9
10
|
export interface IRpcEndpoint {
|
|
10
11
|
handleMethod(request: BundlerRequest, apiVersion: ApiVersion): Promise<BundlerResponse>;
|
|
11
12
|
eth_chainId(): ChainIdResponseResult;
|
|
@@ -16,31 +17,33 @@ export interface IRpcEndpoint {
|
|
|
16
17
|
eth_getUserOperationReceipt(userOperationHash: HexData32): Promise<GetUserOperationReceiptResponseResult>;
|
|
17
18
|
}
|
|
18
19
|
export declare class RpcHandler implements IRpcEndpoint {
|
|
19
|
-
|
|
20
|
-
publicClient: PublicClient<Transport, Chain>;
|
|
20
|
+
config: AltoConfig;
|
|
21
21
|
validator: InterfaceValidator;
|
|
22
22
|
mempool: MemoryMempool;
|
|
23
23
|
executor: Executor;
|
|
24
24
|
monitor: Monitor;
|
|
25
25
|
nonceQueuer: NonceQueuer;
|
|
26
|
-
usingTenderly: boolean;
|
|
27
|
-
rpcMaxBlockRange: number | undefined;
|
|
28
26
|
logger: Logger;
|
|
29
27
|
metrics: Metrics;
|
|
30
|
-
chainId: number;
|
|
31
|
-
chainType: ChainType;
|
|
32
|
-
enableDebugEndpoints: boolean;
|
|
33
28
|
executorManager: ExecutorManager;
|
|
34
29
|
reputationManager: InterfaceReputationManager;
|
|
35
30
|
compressionHandler: CompressionHandler | null;
|
|
36
|
-
legacyTransactions: boolean;
|
|
37
|
-
dangerousSkipUserOperationValidation: boolean;
|
|
38
31
|
gasPriceManager: GasPriceManager;
|
|
39
|
-
gasPriceMultipliers: GasPriceMultipliers;
|
|
40
|
-
paymasterGasLimitMultiplier: bigint;
|
|
41
32
|
eventManager: EventManager;
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
constructor({ config, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, metrics, compressionHandler, gasPriceManager, eventManager }: {
|
|
34
|
+
config: AltoConfig;
|
|
35
|
+
validator: InterfaceValidator;
|
|
36
|
+
mempool: MemoryMempool;
|
|
37
|
+
executor: Executor;
|
|
38
|
+
monitor: Monitor;
|
|
39
|
+
nonceQueuer: NonceQueuer;
|
|
40
|
+
executorManager: ExecutorManager;
|
|
41
|
+
reputationManager: InterfaceReputationManager;
|
|
42
|
+
metrics: Metrics;
|
|
43
|
+
compressionHandler: CompressionHandler | null;
|
|
44
|
+
eventManager: EventManager;
|
|
45
|
+
gasPriceManager: GasPriceManager;
|
|
46
|
+
});
|
|
44
47
|
handleMethod(request: BundlerRequest, apiVersion: ApiVersion): Promise<BundlerResponse>;
|
|
45
48
|
ensureEntryPointIsSupported(entryPoint: Address): void;
|
|
46
49
|
ensureDebugEndpointsAreEnabled(methodName: string): void;
|
package/lib/rpc/rpcHandler.js
CHANGED
|
@@ -6,55 +6,34 @@ const utils_1 = require("../utils/index.js");
|
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const chains_1 = require("viem/chains");
|
|
8
8
|
class RpcHandler {
|
|
9
|
-
|
|
10
|
-
publicClient;
|
|
9
|
+
config;
|
|
11
10
|
validator;
|
|
12
11
|
mempool;
|
|
13
12
|
executor;
|
|
14
13
|
monitor;
|
|
15
14
|
nonceQueuer;
|
|
16
|
-
usingTenderly;
|
|
17
|
-
rpcMaxBlockRange;
|
|
18
15
|
logger;
|
|
19
16
|
metrics;
|
|
20
|
-
chainId;
|
|
21
|
-
chainType;
|
|
22
|
-
enableDebugEndpoints;
|
|
23
17
|
executorManager;
|
|
24
18
|
reputationManager;
|
|
25
19
|
compressionHandler;
|
|
26
|
-
legacyTransactions;
|
|
27
|
-
dangerousSkipUserOperationValidation;
|
|
28
20
|
gasPriceManager;
|
|
29
|
-
gasPriceMultipliers;
|
|
30
|
-
paymasterGasLimitMultiplier;
|
|
31
21
|
eventManager;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.entryPoints = entryPoints;
|
|
35
|
-
this.publicClient = publicClient;
|
|
22
|
+
constructor({ config, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, metrics, compressionHandler, gasPriceManager, eventManager }) {
|
|
23
|
+
this.config = config;
|
|
36
24
|
this.validator = validator;
|
|
37
25
|
this.mempool = mempool;
|
|
38
26
|
this.executor = executor;
|
|
39
27
|
this.monitor = monitor;
|
|
40
28
|
this.nonceQueuer = nonceQueuer;
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
this.logger = config.getLogger({ module: "rpc" }, {
|
|
30
|
+
level: config.rpcLogLevel || config.logLevel
|
|
31
|
+
});
|
|
44
32
|
this.metrics = metrics;
|
|
45
|
-
this.enableDebugEndpoints = enableDebugEndpoints;
|
|
46
|
-
this.chainId = publicClient.chain.id;
|
|
47
33
|
this.executorManager = executorManager;
|
|
48
34
|
this.reputationManager = reputationManager;
|
|
49
35
|
this.compressionHandler = compressionHandler;
|
|
50
|
-
this.legacyTransactions = legacyTransactions;
|
|
51
|
-
this.dangerousSkipUserOperationValidation =
|
|
52
|
-
dangerousSkipUserOperationValidation;
|
|
53
|
-
this.gasPriceMultipliers = gasPriceMultipliers;
|
|
54
|
-
this.chainType = chainType;
|
|
55
36
|
this.gasPriceManager = gasPriceManager;
|
|
56
|
-
this.paymasterGasLimitMultiplier = paymasterGasLimitMultiplier;
|
|
57
|
-
this.enableInstantBundlingEndpoint = enableInstantBundlingEndpoint;
|
|
58
37
|
this.eventManager = eventManager;
|
|
59
38
|
}
|
|
60
39
|
async handleMethod(request, apiVersion) {
|
|
@@ -154,17 +133,17 @@ class RpcHandler {
|
|
|
154
133
|
}
|
|
155
134
|
}
|
|
156
135
|
ensureEntryPointIsSupported(entryPoint) {
|
|
157
|
-
if (!this.
|
|
158
|
-
throw new Error(`EntryPoint ${entryPoint} not supported, supported EntryPoints: ${this.
|
|
136
|
+
if (!this.config.entrypoints.includes(entryPoint)) {
|
|
137
|
+
throw new Error(`EntryPoint ${entryPoint} not supported, supported EntryPoints: ${this.config.entrypoints.join(", ")}`);
|
|
159
138
|
}
|
|
160
139
|
}
|
|
161
140
|
ensureDebugEndpointsAreEnabled(methodName) {
|
|
162
|
-
if (!this.enableDebugEndpoints) {
|
|
141
|
+
if (!this.config.enableDebugEndpoints) {
|
|
163
142
|
throw new types_1.RpcError(`${methodName} is only available in development environment`);
|
|
164
143
|
}
|
|
165
144
|
}
|
|
166
145
|
async preMempoolChecks(opHash, userOperation, apiVersion, entryPoint) {
|
|
167
|
-
if (this.legacyTransactions &&
|
|
146
|
+
if (this.config.legacyTransactions &&
|
|
168
147
|
userOperation.maxFeePerGas !== userOperation.maxPriorityFeePerGas) {
|
|
169
148
|
const reason = "maxPriorityFeePerGas must equal maxFeePerGas on chains that don't support EIP-1559";
|
|
170
149
|
this.eventManager.emitFailedValidation(opHash, reason);
|
|
@@ -190,24 +169,38 @@ class RpcHandler {
|
|
|
190
169
|
}
|
|
191
170
|
}
|
|
192
171
|
eth_chainId() {
|
|
193
|
-
return BigInt(this.
|
|
172
|
+
return BigInt(this.config.publicClient.chain.id);
|
|
194
173
|
}
|
|
195
174
|
eth_supportedEntryPoints() {
|
|
196
|
-
return this.
|
|
175
|
+
return this.config.entrypoints;
|
|
197
176
|
}
|
|
198
177
|
async eth_estimateUserOperationGas(apiVersion, userOperation, entryPoint, stateOverrides) {
|
|
199
178
|
this.ensureEntryPointIsSupported(entryPoint);
|
|
200
179
|
if (userOperation.maxFeePerGas === 0n) {
|
|
201
180
|
throw new types_1.RpcError("user operation max fee per gas must be larger than 0 during gas estimation");
|
|
202
181
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
182
|
+
let preVerificationGas = await (0, utils_1.calcPreVerificationGas)({
|
|
183
|
+
config: this.config,
|
|
184
|
+
userOperation,
|
|
185
|
+
entryPoint,
|
|
186
|
+
gasPriceManager: this.gasPriceManager,
|
|
187
|
+
validate: false
|
|
188
|
+
});
|
|
189
|
+
preVerificationGas = (0, utils_1.scaleBigIntByPercent)(preVerificationGas, 110);
|
|
190
|
+
// biome-ignore lint/style/noParameterAssign: prepare userOperaiton for simulation
|
|
191
|
+
userOperation = {
|
|
192
|
+
...userOperation,
|
|
193
|
+
preVerificationGas,
|
|
194
|
+
verificationGasLimit: 10000000n,
|
|
195
|
+
callGasLimit: 10000000n
|
|
196
|
+
};
|
|
197
|
+
if (this.config.publicClient.chain.id === chains_1.base.id) {
|
|
198
|
+
userOperation.verificationGasLimit = 5000000n;
|
|
199
|
+
}
|
|
200
|
+
if (this.config.chainType === "hedera") {
|
|
201
|
+
// The eth_call gasLimit is set to 12_500_000 on Hedera.
|
|
210
202
|
userOperation.verificationGasLimit = 5000000n;
|
|
203
|
+
userOperation.callGasLimit = 4500000n;
|
|
211
204
|
}
|
|
212
205
|
if ((0, utils_1.isVersion07)(userOperation)) {
|
|
213
206
|
userOperation.paymasterPostOpGasLimit = 2000000n;
|
|
@@ -238,8 +231,8 @@ class RpcHandler {
|
|
|
238
231
|
throw new types_1.RpcError("UserOperation reverted during simulation with reason: AA25 invalid account nonce", types_1.ValidationErrors.InvalidFields);
|
|
239
232
|
}
|
|
240
233
|
}
|
|
241
|
-
const executionResult = await this.validator.getExecutionResult(userOperation, entryPoint, queuedUserOperations, stateOverrides);
|
|
242
|
-
let { verificationGasLimit, callGasLimit } = (0, utils_1.calcVerificationGasAndCallGasLimit)(userOperation, executionResult.data.executionResult, this.
|
|
234
|
+
const executionResult = await this.validator.getExecutionResult(userOperation, entryPoint, queuedUserOperations, true, stateOverrides);
|
|
235
|
+
let { verificationGasLimit, callGasLimit } = (0, utils_1.calcVerificationGasAndCallGasLimit)(userOperation, executionResult.data.executionResult, this.config.publicClient.chain.id, executionResult.data.callDataResult);
|
|
243
236
|
let paymasterVerificationGasLimit = 0n;
|
|
244
237
|
let paymasterPostOpGasLimit = 0n;
|
|
245
238
|
if ((0, utils_1.isVersion07)(userOperation) &&
|
|
@@ -253,21 +246,36 @@ class RpcHandler {
|
|
|
253
246
|
paymasterPostOpGasLimit =
|
|
254
247
|
executionResult.data.executionResult.paymasterPostOpGasLimit ||
|
|
255
248
|
1n;
|
|
256
|
-
const multiplier = this.paymasterGasLimitMultiplier;
|
|
257
|
-
paymasterVerificationGasLimit =
|
|
258
|
-
|
|
259
|
-
paymasterPostOpGasLimit =
|
|
260
|
-
(paymasterPostOpGasLimit * multiplier) / 100n;
|
|
249
|
+
const multiplier = Number(this.config.paymasterGasLimitMultiplier);
|
|
250
|
+
paymasterVerificationGasLimit = (0, utils_1.scaleBigIntByPercent)(paymasterVerificationGasLimit, multiplier);
|
|
251
|
+
paymasterPostOpGasLimit = (0, utils_1.scaleBigIntByPercent)(paymasterPostOpGasLimit, multiplier);
|
|
261
252
|
}
|
|
262
|
-
if (this.
|
|
253
|
+
if (this.config.publicClient.chain.id === chains_1.base.id ||
|
|
254
|
+
this.config.publicClient.chain.id === chains_1.baseSepolia.id) {
|
|
263
255
|
callGasLimit += 10000n;
|
|
264
256
|
}
|
|
265
|
-
if (this.
|
|
257
|
+
if (this.config.publicClient.chain.id === chains_1.base.id ||
|
|
258
|
+
this.config.publicClient.chain.id === chains_1.optimism.id) {
|
|
266
259
|
callGasLimit = (0, utils_1.maxBigInt)(callGasLimit, 120000n);
|
|
267
260
|
}
|
|
268
261
|
if (userOperation.callData === "0x") {
|
|
269
262
|
callGasLimit = 0n;
|
|
270
263
|
}
|
|
264
|
+
if ((0, utils_1.isVersion06)(userOperation)) {
|
|
265
|
+
callGasLimit = (0, utils_1.scaleBigIntByPercent)(callGasLimit, Number(this.config.callGasLimitMultiplier));
|
|
266
|
+
}
|
|
267
|
+
// If a balance override is provided for the sender, perform an additional simulation
|
|
268
|
+
// to verify the userOperation succeeds with the specified balance.
|
|
269
|
+
if (stateOverrides?.[userOperation.sender]?.balance) {
|
|
270
|
+
await this.validator.getExecutionResult({
|
|
271
|
+
...userOperation,
|
|
272
|
+
preVerificationGas,
|
|
273
|
+
verificationGasLimit,
|
|
274
|
+
callGasLimit,
|
|
275
|
+
paymasterVerificationGasLimit,
|
|
276
|
+
paymasterPostOpGasLimit
|
|
277
|
+
}, entryPoint, queuedUserOperations, false, (0, utils_1.deepHexlify)(stateOverrides));
|
|
278
|
+
}
|
|
271
279
|
if ((0, utils_1.isVersion07)(userOperation)) {
|
|
272
280
|
return {
|
|
273
281
|
preVerificationGas,
|
|
@@ -292,7 +300,7 @@ class RpcHandler {
|
|
|
292
300
|
};
|
|
293
301
|
}
|
|
294
302
|
async eth_sendUserOperation(apiVersion, userOperation, entryPoint) {
|
|
295
|
-
const hash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.
|
|
303
|
+
const hash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.config.publicClient.chain.id);
|
|
296
304
|
this.eventManager.emitReceived(hash);
|
|
297
305
|
let status = "rejected";
|
|
298
306
|
try {
|
|
@@ -317,18 +325,18 @@ class RpcHandler {
|
|
|
317
325
|
abi: types_1.EntryPointV06Abi,
|
|
318
326
|
name: "UserOperationEvent"
|
|
319
327
|
});
|
|
320
|
-
let fromBlock
|
|
321
|
-
let toBlock
|
|
322
|
-
if (this.
|
|
323
|
-
const latestBlock = await this.publicClient.getBlockNumber();
|
|
324
|
-
fromBlock = latestBlock - BigInt(this.
|
|
328
|
+
let fromBlock;
|
|
329
|
+
let toBlock;
|
|
330
|
+
if (this.config.maxBlockRange !== undefined) {
|
|
331
|
+
const latestBlock = await this.config.publicClient.getBlockNumber();
|
|
332
|
+
fromBlock = latestBlock - BigInt(this.config.maxBlockRange);
|
|
325
333
|
if (fromBlock < 0n) {
|
|
326
334
|
fromBlock = 0n;
|
|
327
335
|
}
|
|
328
336
|
toBlock = "latest";
|
|
329
337
|
}
|
|
330
|
-
const filterResult = await this.publicClient.getLogs({
|
|
331
|
-
address: this.
|
|
338
|
+
const filterResult = await this.config.publicClient.getLogs({
|
|
339
|
+
address: this.config.entrypoints,
|
|
332
340
|
event: userOperationEventAbiItem,
|
|
333
341
|
fromBlock,
|
|
334
342
|
toBlock,
|
|
@@ -347,7 +355,9 @@ class RpcHandler {
|
|
|
347
355
|
}
|
|
348
356
|
const getTransaction = async (txHash) => {
|
|
349
357
|
try {
|
|
350
|
-
return await this.publicClient.getTransaction({
|
|
358
|
+
return await this.config.publicClient.getTransaction({
|
|
359
|
+
hash: txHash
|
|
360
|
+
});
|
|
351
361
|
}
|
|
352
362
|
catch (e) {
|
|
353
363
|
if (e instanceof viem_1.TransactionNotFoundError) {
|
|
@@ -454,11 +464,11 @@ class RpcHandler {
|
|
|
454
464
|
}
|
|
455
465
|
async pimlico_getUserOperationGasPrice() {
|
|
456
466
|
let { maxFeePerGas, maxPriorityFeePerGas } = await this.gasPriceManager.getGasPrice();
|
|
457
|
-
if (this.chainType === "hedera") {
|
|
467
|
+
if (this.config.chainType === "hedera") {
|
|
458
468
|
maxFeePerGas /= 10n ** 9n;
|
|
459
469
|
maxPriorityFeePerGas /= 10n ** 9n;
|
|
460
470
|
}
|
|
461
|
-
const { slow, standard, fast } = this.gasPriceMultipliers;
|
|
471
|
+
const { slow, standard, fast } = this.config.gasPriceMultipliers;
|
|
462
472
|
return {
|
|
463
473
|
slow: {
|
|
464
474
|
maxFeePerGas: (maxFeePerGas * slow) / 100n,
|
|
@@ -478,7 +488,7 @@ class RpcHandler {
|
|
|
478
488
|
async addToMempoolIfValid(op, entryPoint, apiVersion) {
|
|
479
489
|
this.ensureEntryPointIsSupported(entryPoint);
|
|
480
490
|
const userOperation = (0, types_1.deriveUserOperation)(op);
|
|
481
|
-
const opHash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.
|
|
491
|
+
const opHash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.config.publicClient.chain.id);
|
|
482
492
|
await this.preMempoolChecks(opHash, userOperation, apiVersion, entryPoint);
|
|
483
493
|
const currentNonceValue = await this.getNonceValue(userOperation, entryPoint);
|
|
484
494
|
const [, userOperationNonceValue] = (0, utils_1.getNonceKeyAndValue)(userOperation.nonce);
|
|
@@ -499,11 +509,11 @@ class RpcHandler {
|
|
|
499
509
|
}
|
|
500
510
|
if (userOperationNonceValue ===
|
|
501
511
|
currentNonceValue + BigInt(queuedUserOperations.length)) {
|
|
502
|
-
if (this.dangerousSkipUserOperationValidation) {
|
|
512
|
+
if (this.config.dangerousSkipUserOperationValidation) {
|
|
503
513
|
const [success, errorReason] = this.mempool.add(op, entryPoint);
|
|
504
514
|
if (!success) {
|
|
505
515
|
this.eventManager.emitFailedValidation(opHash, errorReason, (0, utils_1.getAAError)(errorReason));
|
|
506
|
-
throw new types_1.RpcError(
|
|
516
|
+
throw new types_1.RpcError(errorReason, types_1.ValidationErrors.InvalidFields);
|
|
507
517
|
}
|
|
508
518
|
}
|
|
509
519
|
else {
|
|
@@ -516,7 +526,7 @@ class RpcHandler {
|
|
|
516
526
|
const [success, errorReason] = this.mempool.add(op, entryPoint, validationResult.referencedContracts);
|
|
517
527
|
if (!success) {
|
|
518
528
|
this.eventManager.emitFailedValidation(opHash, errorReason, (0, utils_1.getAAError)(errorReason));
|
|
519
|
-
throw new types_1.RpcError(
|
|
529
|
+
throw new types_1.RpcError(errorReason, types_1.ValidationErrors.InvalidFields);
|
|
520
530
|
}
|
|
521
531
|
return "added";
|
|
522
532
|
}
|
|
@@ -525,11 +535,11 @@ class RpcHandler {
|
|
|
525
535
|
return "queued";
|
|
526
536
|
}
|
|
527
537
|
async pimlico_sendUserOperationNow(apiVersion, userOperation, entryPoint) {
|
|
528
|
-
if (!this.enableInstantBundlingEndpoint) {
|
|
538
|
+
if (!this.config.enableInstantBundlingEndpoint) {
|
|
529
539
|
throw new types_1.RpcError("pimlico_sendUserOperationNow endpoint is not enabled", types_1.ValidationErrors.InvalidFields);
|
|
530
540
|
}
|
|
531
541
|
this.ensureEntryPointIsSupported(entryPoint);
|
|
532
|
-
const opHash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.
|
|
542
|
+
const opHash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.config.publicClient.chain.id);
|
|
533
543
|
await this.preMempoolChecks(opHash, userOperation, apiVersion, entryPoint);
|
|
534
544
|
const result = (await this.executor.bundle(entryPoint, [userOperation]))[0];
|
|
535
545
|
if (result.status === "failure") {
|
|
@@ -550,8 +560,9 @@ class RpcHandler {
|
|
|
550
560
|
throw new types_1.RpcError(`userOperation reverted during simulation with reason: ${error.reason}`);
|
|
551
561
|
}
|
|
552
562
|
const res = result;
|
|
563
|
+
this.executor.markWalletProcessed(res.value.transactionInfo.executor);
|
|
553
564
|
// wait for receipt
|
|
554
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({
|
|
565
|
+
const receipt = await this.config.publicClient.waitForTransactionReceipt({
|
|
555
566
|
hash: res.value.transactionInfo.transactionHash,
|
|
556
567
|
pollingInterval: 100
|
|
557
568
|
});
|
|
@@ -563,7 +574,7 @@ class RpcHandler {
|
|
|
563
574
|
let status = "rejected";
|
|
564
575
|
try {
|
|
565
576
|
const { inflatedOp, inflatorId } = await this.validateAndInflateCompressedUserOperation(inflatorAddress, compressedCalldata);
|
|
566
|
-
const hash = (0, utils_1.getUserOperationHash)(inflatedOp, entryPoint, this.
|
|
577
|
+
const hash = (0, utils_1.getUserOperationHash)(inflatedOp, entryPoint, this.config.publicClient.chain.id);
|
|
567
578
|
this.eventManager.emitReceived(hash, receivedTimestamp);
|
|
568
579
|
const compressedUserOp = {
|
|
569
580
|
compressedCalldata,
|
|
@@ -593,7 +604,7 @@ class RpcHandler {
|
|
|
593
604
|
if (this.compressionHandler === null) {
|
|
594
605
|
throw new types_1.RpcError("Endpoint not supported");
|
|
595
606
|
}
|
|
596
|
-
const inflatorId = await this.compressionHandler.getInflatorRegisteredId(inflatorAddress, this.publicClient);
|
|
607
|
+
const inflatorId = await this.compressionHandler.getInflatorRegisteredId(inflatorAddress, this.config.publicClient);
|
|
597
608
|
if (inflatorId === 0) {
|
|
598
609
|
throw new types_1.RpcError(`Inflator ${inflatorAddress} is not registered`, types_1.ValidationErrors.InvalidFields);
|
|
599
610
|
}
|
|
@@ -602,7 +613,7 @@ class RpcHandler {
|
|
|
602
613
|
address: inflatorAddress,
|
|
603
614
|
abi: types_1.IOpInflatorAbi,
|
|
604
615
|
client: {
|
|
605
|
-
public: this.publicClient
|
|
616
|
+
public: this.config.publicClient
|
|
606
617
|
}
|
|
607
618
|
});
|
|
608
619
|
let inflatedOp;
|
|
@@ -628,7 +639,7 @@ class RpcHandler {
|
|
|
628
639
|
? types_1.EntryPointV06Abi
|
|
629
640
|
: types_1.EntryPointV07Abi,
|
|
630
641
|
client: {
|
|
631
|
-
public: this.publicClient
|
|
642
|
+
public: this.config.publicClient
|
|
632
643
|
}
|
|
633
644
|
});
|
|
634
645
|
const [nonceKey] = (0, utils_1.getNonceKeyAndValue)(userOperation.nonce);
|