@pimlico/alto 0.0.7 → 0.0.9
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 +320 -272
- package/esm/cli/config/bundler.js +26 -7
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.js +65 -10
- 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 +35 -0
- package/esm/cli/deploySimulationsContract.js.map +1 -0
- package/esm/cli/handler.d.ts +2 -2
- package/esm/cli/handler.js +78 -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 +100 -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 +48 -14
- package/esm/executor/executor.js +262 -139
- package/esm/executor/executor.js.map +1 -1
- package/esm/executor/executorManager.d.ts +14 -10
- package/esm/executor/executorManager.js +36 -39
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/executor/senderManager.d.ts +11 -6
- package/esm/executor/senderManager.js +39 -36
- 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 -41
- package/esm/handlers/gasPriceManager.js +87 -208
- 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 +7 -7
- package/esm/rpc/estimation/gasEstimationHandler.js +18 -33
- package/esm/rpc/estimation/gasEstimationHandler.js.map +1 -1
- package/esm/rpc/estimation/gasEstimationsV06.d.ts +7 -7
- package/esm/rpc/estimation/gasEstimationsV06.js +90 -48
- package/esm/rpc/estimation/gasEstimationsV06.js.map +1 -1
- package/esm/rpc/estimation/gasEstimationsV07.d.ts +7 -12
- package/esm/rpc/estimation/gasEstimationsV07.js +53 -37
- package/esm/rpc/estimation/gasEstimationsV07.js.map +1 -1
- 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 +98 -90
- package/esm/rpc/rpcHandler.js.map +1 -1
- package/esm/rpc/server.d.ts +9 -7
- package/esm/rpc/server.js +27 -25
- package/esm/rpc/server.js.map +1 -1
- package/esm/rpc/validation/SafeValidator.d.ts +11 -6
- package/esm/rpc/validation/SafeValidator.js +14 -11
- 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 +11 -12
- package/esm/rpc/validation/UnsafeValidator.js +28 -29
- 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/{EntryPointSimulations.d.ts → EntryPointSimulationsV7.d.ts} +1 -9
- package/esm/types/contracts/{EntryPointSimulations.js → EntryPointSimulationsV7.js} +1 -13
- package/esm/types/contracts/EntryPointSimulationsV7.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 +114 -0
- package/esm/types/contracts/OpL1FeeAbi.js +74 -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/mempool.d.ts +1 -2
- package/esm/types/mempool.js.map +1 -1
- package/esm/types/schemas.d.ts +26 -26
- 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/metrics.d.ts +1 -0
- package/esm/utils/metrics.js +7 -0
- package/esm/utils/metrics.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 +3 -3
- package/esm/utils/userop.js +4 -3
- package/esm/utils/userop.js.map +1 -1
- package/esm/utils/validation.d.ts +14 -6
- package/esm/utils/validation.js +160 -168
- 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 +320 -272
- package/lib/cli/config/bundler.js +25 -6
- package/lib/cli/config/bundler.js.map +1 -1
- package/lib/cli/config/options.js +65 -10
- 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 +39 -0
- package/lib/cli/deploySimulationsContract.js.map +1 -0
- package/lib/cli/handler.d.ts +2 -2
- package/lib/cli/handler.js +77 -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 +100 -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 +48 -14
- package/lib/executor/executor.js +258 -135
- package/lib/executor/executor.js.map +1 -1
- package/lib/executor/executorManager.d.ts +14 -10
- package/lib/executor/executorManager.js +34 -37
- package/lib/executor/executorManager.js.map +1 -1
- package/lib/executor/senderManager.d.ts +11 -6
- package/lib/executor/senderManager.js +39 -36
- 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 -41
- package/lib/handlers/gasPriceManager.js +85 -206
- 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 +7 -7
- package/lib/rpc/estimation/gasEstimationHandler.js +18 -33
- package/lib/rpc/estimation/gasEstimationHandler.js.map +1 -1
- package/lib/rpc/estimation/gasEstimationsV06.d.ts +7 -7
- package/lib/rpc/estimation/gasEstimationsV06.js +88 -46
- package/lib/rpc/estimation/gasEstimationsV06.js.map +1 -1
- package/lib/rpc/estimation/gasEstimationsV07.d.ts +7 -12
- package/lib/rpc/estimation/gasEstimationsV07.js +52 -36
- package/lib/rpc/estimation/gasEstimationsV07.js.map +1 -1
- 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 +97 -89
- package/lib/rpc/rpcHandler.js.map +1 -1
- package/lib/rpc/server.d.ts +9 -7
- package/lib/rpc/server.js +26 -24
- package/lib/rpc/server.js.map +1 -1
- package/lib/rpc/validation/SafeValidator.d.ts +11 -6
- package/lib/rpc/validation/SafeValidator.js +13 -10
- 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 +11 -12
- package/lib/rpc/validation/UnsafeValidator.js +28 -29
- 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/{EntryPointSimulations.d.ts → EntryPointSimulationsV7.d.ts} +1 -9
- package/lib/types/contracts/{EntryPointSimulations.js → EntryPointSimulationsV7.js} +2 -14
- package/lib/types/contracts/EntryPointSimulationsV7.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 +114 -0
- package/lib/types/contracts/OpL1FeeAbi.js +77 -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/mempool.d.ts +1 -2
- package/lib/types/mempool.js.map +1 -1
- package/lib/types/schemas.d.ts +26 -26
- 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/metrics.d.ts +1 -0
- package/lib/utils/metrics.js +7 -0
- package/lib/utils/metrics.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 +3 -3
- package/lib/utils/userop.js +3 -2
- package/lib/utils/userop.js.map +1 -1
- package/lib/utils/validation.d.ts +14 -6
- package/lib/utils/validation.js +164 -168
- package/lib/utils/validation.js.map +1 -1
- package/package.json +1 -1
- package/esm/types/contracts/EntryPointSimulations.js.map +0 -1
- package/lib/types/contracts/EntryPointSimulations.js.map +0 -1
package/lib/cli/handler.js
CHANGED
|
@@ -2,60 +2,54 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bundlerHandler = void 0;
|
|
4
4
|
const executor_1 = require("../executor/index.js");
|
|
5
|
+
const handlers_1 = require("../handlers/index.js");
|
|
5
6
|
const utils_1 = require("../utils/index.js");
|
|
6
7
|
const prom_client_1 = require("prom-client");
|
|
7
8
|
const viem_1 = require("viem");
|
|
8
|
-
const
|
|
9
|
-
const config_1 = require("./config/index.js");
|
|
9
|
+
const utilityWalletMonitor_1 = require("../executor/utilityWalletMonitor.js");
|
|
10
10
|
const customTransport_1 = require("./customTransport.js");
|
|
11
11
|
const setupServer_1 = require("./setupServer.js");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (!parsing.success) {
|
|
19
|
-
const error = (0, zod_validation_error_1.fromZodError)(parsing.error);
|
|
20
|
-
throw new Error(error.message);
|
|
21
|
-
}
|
|
22
|
-
return parsing.data;
|
|
23
|
-
};
|
|
24
|
-
const preFlightChecks = async (publicClient, parsedArgs) => {
|
|
25
|
-
for (const entrypoint of parsedArgs.entrypoints) {
|
|
26
|
-
const entryPointCode = await publicClient.getBytecode({
|
|
12
|
+
const createConfig_1 = require("../createConfig.js");
|
|
13
|
+
const parseArgs_1 = require("./parseArgs.js");
|
|
14
|
+
const deploySimulationsContract_1 = require("./deploySimulationsContract.js");
|
|
15
|
+
const preFlightChecks = async (config) => {
|
|
16
|
+
for (const entrypoint of config.entrypoints) {
|
|
17
|
+
const entryPointCode = await config.publicClient.getCode({
|
|
27
18
|
address: entrypoint
|
|
28
19
|
});
|
|
29
|
-
if (entryPointCode === "0x") {
|
|
20
|
+
if (entryPointCode === undefined || entryPointCode === "0x") {
|
|
30
21
|
throw new Error(`entry point ${entrypoint} does not exist`);
|
|
31
22
|
}
|
|
32
23
|
}
|
|
33
|
-
if (
|
|
34
|
-
const simulations =
|
|
35
|
-
const simulationsCode = await publicClient.
|
|
24
|
+
if (config.entrypointSimulationContract) {
|
|
25
|
+
const simulations = config.entrypointSimulationContract;
|
|
26
|
+
const simulationsCode = await config.publicClient.getCode({
|
|
36
27
|
address: simulations
|
|
37
28
|
});
|
|
38
29
|
if (simulationsCode === undefined || simulationsCode === "0x") {
|
|
39
30
|
throw new Error(`EntryPointSimulations contract ${simulations} does not exist`);
|
|
40
31
|
}
|
|
41
32
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
logger = (0, utils_1.initDebugLogger)(parsedArgs["log-level"]);
|
|
33
|
+
if (config.refillHelperContract) {
|
|
34
|
+
const refillHelper = config.refillHelperContract;
|
|
35
|
+
const refillHelperCode = await config.publicClient.getCode({
|
|
36
|
+
address: refillHelper
|
|
37
|
+
});
|
|
38
|
+
if (refillHelperCode === undefined || refillHelperCode === "0x") {
|
|
39
|
+
throw new Error(`RefillHelper contract ${refillHelper} does not exist`);
|
|
40
|
+
}
|
|
51
41
|
}
|
|
52
|
-
|
|
42
|
+
};
|
|
43
|
+
async function bundlerHandler(args_) {
|
|
44
|
+
const args = (0, parseArgs_1.parseArgs)(args_);
|
|
45
|
+
const logger = args.json
|
|
46
|
+
? (0, utils_1.initProductionLogger)(args.logLevel)
|
|
47
|
+
: (0, utils_1.initDebugLogger)(args.logLevel);
|
|
53
48
|
const getChainId = async () => {
|
|
54
49
|
const client = (0, viem_1.createPublicClient)({
|
|
55
|
-
transport: (0, customTransport_1.customTransport)(
|
|
50
|
+
transport: (0, customTransport_1.customTransport)(args.rpcUrl, {
|
|
56
51
|
logger: logger.child({ module: "public_client" }, {
|
|
57
|
-
level:
|
|
58
|
-
parsedArgs["log-level"]
|
|
52
|
+
level: args.publicClientLogLevel || args.logLevel
|
|
59
53
|
})
|
|
60
54
|
})
|
|
61
55
|
});
|
|
@@ -64,53 +58,57 @@ async function bundlerHandler(args) {
|
|
|
64
58
|
const chainId = await getChainId();
|
|
65
59
|
const chain = {
|
|
66
60
|
id: chainId,
|
|
67
|
-
name: args
|
|
61
|
+
name: args.networkName,
|
|
68
62
|
nativeCurrency: {
|
|
69
63
|
name: "ETH",
|
|
70
64
|
symbol: "ETH",
|
|
71
65
|
decimals: 18
|
|
72
66
|
},
|
|
73
67
|
rpcUrls: {
|
|
74
|
-
default: { http: [args
|
|
75
|
-
public: { http: [args
|
|
68
|
+
default: { http: [args.rpcUrl] },
|
|
69
|
+
public: { http: [args.rpcUrl] }
|
|
76
70
|
}
|
|
77
71
|
};
|
|
78
|
-
|
|
79
|
-
transport: (0, customTransport_1.customTransport)(args
|
|
72
|
+
let publicClient = (0, viem_1.createPublicClient)({
|
|
73
|
+
transport: (0, customTransport_1.customTransport)(args.rpcUrl, {
|
|
80
74
|
logger: logger.child({ module: "public_client" }, {
|
|
81
|
-
level:
|
|
82
|
-
parsedArgs["log-level"]
|
|
75
|
+
level: args.publicClientLogLevel || args.logLevel
|
|
83
76
|
})
|
|
84
77
|
}),
|
|
85
78
|
chain
|
|
86
79
|
});
|
|
80
|
+
if (args.chainType === "skale") {
|
|
81
|
+
// SKALE only allows white listed addresses to deploy contracts.
|
|
82
|
+
publicClient = publicClient
|
|
83
|
+
.extend((client) => ({
|
|
84
|
+
async call(args) {
|
|
85
|
+
args.account = "0x4337000c2828F5260d8921fD25829F606b9E8680";
|
|
86
|
+
return await client.call(args);
|
|
87
|
+
}
|
|
88
|
+
}))
|
|
89
|
+
.extend(viem_1.publicActions);
|
|
90
|
+
}
|
|
91
|
+
const createWalletTransport = (url) => (0, customTransport_1.customTransport)(url, {
|
|
92
|
+
logger: logger.child({ module: "wallet_client" }, { level: args.walletClientLogLevel || args.logLevel })
|
|
93
|
+
});
|
|
94
|
+
const walletClient = (0, viem_1.createWalletClient)({
|
|
95
|
+
transport: args.sendTransactionRpcUrl
|
|
96
|
+
? (0, viem_1.fallback)([
|
|
97
|
+
createWalletTransport(args.sendTransactionRpcUrl),
|
|
98
|
+
createWalletTransport(args.rpcUrl)
|
|
99
|
+
], { rank: false })
|
|
100
|
+
: createWalletTransport(args.rpcUrl),
|
|
101
|
+
chain
|
|
102
|
+
});
|
|
87
103
|
// if flag is set, use utility wallet to deploy the simulations contract
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const walletClient = (0, viem_1.createWalletClient)({
|
|
93
|
-
transport: (0, viem_1.http)(args["rpc-url"]),
|
|
94
|
-
account: parsedArgs["utility-private-key"]
|
|
95
|
-
});
|
|
96
|
-
const deployHash = await walletClient.deployContract({
|
|
97
|
-
chain,
|
|
98
|
-
abi: [],
|
|
99
|
-
bytecode: contracts_1.PimlicoEntryPointSimulationsDeployBytecode
|
|
104
|
+
if (args.deploySimulationsContract) {
|
|
105
|
+
args.entrypointSimulationContract = await (0, deploySimulationsContract_1.deploySimulationsContract)({
|
|
106
|
+
args,
|
|
107
|
+
publicClient
|
|
100
108
|
});
|
|
101
|
-
const receipt = await client.getTransactionReceipt({
|
|
102
|
-
hash: deployHash
|
|
103
|
-
});
|
|
104
|
-
const simulationsContract = receipt.contractAddress;
|
|
105
|
-
if (simulationsContract === null) {
|
|
106
|
-
throw new Error("Failed to deploy simulationsContract");
|
|
107
|
-
}
|
|
108
|
-
parsedArgs["entrypoint-simulation-contract"] = simulationsContract;
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
parsedArgs["log-level"]
|
|
113
|
-
}), parsedArgs["gas-price-bump"], parsedArgs["gas-price-expiry"], parsedArgs["gas-price-refresh-interval"], parsedArgs["chain-type"]);
|
|
110
|
+
const config = (0, createConfig_1.createConfig)({ ...args, logger, publicClient, walletClient });
|
|
111
|
+
const gasPriceManager = new handlers_1.GasPriceManager(config);
|
|
114
112
|
await gasPriceManager.init();
|
|
115
113
|
const registry = new prom_client_1.Registry();
|
|
116
114
|
registry.setDefaultLabels({
|
|
@@ -118,33 +116,24 @@ async function bundlerHandler(args) {
|
|
|
118
116
|
chainId
|
|
119
117
|
});
|
|
120
118
|
const metrics = (0, utils_1.createMetrics)(registry);
|
|
121
|
-
await preFlightChecks(
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
parsedArgs["log-level"]
|
|
127
|
-
})
|
|
128
|
-
}),
|
|
129
|
-
chain
|
|
119
|
+
await preFlightChecks(config);
|
|
120
|
+
const senderManager = new executor_1.SenderManager({
|
|
121
|
+
config,
|
|
122
|
+
metrics,
|
|
123
|
+
gasPriceManager
|
|
130
124
|
});
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}));
|
|
125
|
+
const utilityWalletAddress = config.utilityPrivateKey?.address;
|
|
126
|
+
if (utilityWalletAddress && config.utilityWalletMonitor) {
|
|
127
|
+
const utilityWalletMonitor = new utilityWalletMonitor_1.UtilityWalletMonitor({
|
|
128
|
+
config,
|
|
129
|
+
metrics,
|
|
130
|
+
utilityWalletAddress
|
|
131
|
+
});
|
|
139
132
|
await utilityWalletMonitor.start();
|
|
140
133
|
}
|
|
141
|
-
metrics.executorWalletsMinBalance.set(Number.parseFloat((0, viem_1.formatEther)(
|
|
134
|
+
metrics.executorWalletsMinBalance.set(Number.parseFloat((0, viem_1.formatEther)(config.minExecutorBalance || 0n)));
|
|
142
135
|
await (0, setupServer_1.setupServer)({
|
|
143
|
-
|
|
144
|
-
walletClient,
|
|
145
|
-
parsedArgs,
|
|
146
|
-
logger,
|
|
147
|
-
rootLogger,
|
|
136
|
+
config,
|
|
148
137
|
registry,
|
|
149
138
|
metrics,
|
|
150
139
|
senderManager,
|
package/lib/cli/handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../cli/handler.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAC9C,
|
|
1
|
+
{"version":3,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AAa;QACb,eAAe;KAClB,CAAC,CAAA;AACN,CAAC;AArID,wCAqIC"}
|
|
@@ -5,10 +5,10 @@ const exporter_trace_otlp_proto_1 = require("@opentelemetry/exporter-trace-otlp-
|
|
|
5
5
|
const instrumentation_fastify_1 = require("@opentelemetry/instrumentation-fastify");
|
|
6
6
|
const instrumentation_http_1 = require("@opentelemetry/instrumentation-http");
|
|
7
7
|
const instrumentation_pino_1 = require("@opentelemetry/instrumentation-pino");
|
|
8
|
+
const instrumentation_undici_1 = require("@opentelemetry/instrumentation-undici");
|
|
8
9
|
const sdk_node_1 = require("@opentelemetry/sdk-node");
|
|
9
10
|
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
10
11
|
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
11
|
-
const instrumentation_undici_1 = require("@opentelemetry/instrumentation-undici");
|
|
12
12
|
class CustomSampler {
|
|
13
13
|
shouldSample(_context, _traceId, _spanName, spanKind, attributes) {
|
|
14
14
|
const ignoredRoutes = ["/metrics", "/health"];
|
|
@@ -31,7 +31,9 @@ const sdk = new sdk_node_1.NodeSDK({
|
|
|
31
31
|
new instrumentation_http_1.HttpInstrumentation({
|
|
32
32
|
requireParentforOutgoingSpans: true
|
|
33
33
|
}),
|
|
34
|
-
new instrumentation_undici_1.UndiciInstrumentation(
|
|
34
|
+
new instrumentation_undici_1.UndiciInstrumentation({
|
|
35
|
+
requireParentforSpans: true
|
|
36
|
+
}),
|
|
35
37
|
new instrumentation_fastify_1.FastifyInstrumentation(),
|
|
36
38
|
new instrumentation_pino_1.PinoInstrumentation()
|
|
37
39
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../cli/instrumentation.ts"],"names":[],"mappings":";;AAAA,4CAA4E;AAC5E,wFAA4E;AAC5E,oFAA+E;AAC/E,8EAAyE;AACzE,8EAAyE;AACzE,sDAAiD;AACjD,kEAIsC;AACtC,8EAAwE;
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 -0,0 +1,8 @@
|
|
|
1
|
+
import { type IOptions, type IOptionsInput } from "./index.js";
|
|
2
|
+
type CamelCase<S extends string> = S extends `${infer P1}-${infer P2}${infer P3}` ? `${P1}${Uppercase<P2>}${CamelCase<P3>}` : S extends `${infer P1}_${infer P2}${infer P3}` ? `${P1}${Uppercase<P2>}${CamelCase<P3>}` : S;
|
|
3
|
+
export type CamelCasedProperties<T> = {
|
|
4
|
+
[K in keyof T as CamelCase<Extract<K, string>>]: T[K];
|
|
5
|
+
};
|
|
6
|
+
export declare const parseArgs: (args: IOptionsInput) => CamelCasedProperties<IOptions>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=parseArgs.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseArgs = void 0;
|
|
4
|
+
const cli_1 = require("./index.js");
|
|
5
|
+
const zod_validation_error_1 = require("zod-validation-error");
|
|
6
|
+
function toCamelCase(str) {
|
|
7
|
+
return str.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace("-", "").replace("_", ""));
|
|
8
|
+
}
|
|
9
|
+
function convertKeysToCamelCase(obj) {
|
|
10
|
+
return Object.keys(obj).reduce((acc, key) => {
|
|
11
|
+
const camelCaseKey = toCamelCase(key);
|
|
12
|
+
acc[camelCaseKey] = obj[key];
|
|
13
|
+
return acc;
|
|
14
|
+
}, {});
|
|
15
|
+
}
|
|
16
|
+
const parseArgs = (args) => {
|
|
17
|
+
const parsing = cli_1.optionArgsSchema.safeParse(args);
|
|
18
|
+
if (!parsing.success) {
|
|
19
|
+
const error = (0, zod_validation_error_1.fromZodError)(parsing.error);
|
|
20
|
+
throw new Error(error.message);
|
|
21
|
+
}
|
|
22
|
+
return convertKeysToCamelCase(parsing.data);
|
|
23
|
+
};
|
|
24
|
+
exports.parseArgs = parseArgs;
|
|
25
|
+
//# sourceMappingURL=parseArgs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseArgs.js","sourceRoot":"","sources":["../../cli/parseArgs.ts"],"names":[],"mappings":";;;AAAA,mCAA+E;AAC/E,+DAAmD;AAanD,SAAS,WAAW,CAAC,GAAW;IAC5B,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE,CACzC,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CACxD,CAAA;AACL,CAAC;AAED,SAAS,sBAAsB,CAC3B,GAAM;IAEN,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAC1B,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACT,MAAM,YAAY,GAAG,WAAW,CAC5B,GAAG,CAC2B,CACjC;QAAC,GAAW,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,GAAc,CAAC,CAAA;QAEjD,OAAO,GAAG,CAAA;IACd,CAAC,EACD,EAA6B,CAChC,CAAA;AACL,CAAC;AAEM,MAAM,SAAS,GAAG,CACrB,IAAmB,EACW,EAAE;IAChC,MAAM,OAAO,GAAG,sBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAChD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,IAAA,mCAAY,EAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACzC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC/C,CAAC,CAAA;AAVY,QAAA,SAAS,aAUrB"}
|
package/lib/cli/setupServer.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import type { SenderManager } from "../executor/index.js";
|
|
2
2
|
import { type GasPriceManager } from "../handlers/index.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Metrics } from "../utils/index.js";
|
|
4
4
|
import type { Registry } from "prom-client";
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
client: PublicClient<Transport, Chain>;
|
|
9
|
-
walletClient: WalletClient<Transport, Chain>;
|
|
10
|
-
parsedArgs: IOptions;
|
|
11
|
-
logger: Logger;
|
|
12
|
-
rootLogger: Logger;
|
|
5
|
+
import type { AltoConfig } from "../createConfig.js";
|
|
6
|
+
export declare const setupServer: ({ config, registry, metrics, senderManager, gasPriceManager }: {
|
|
7
|
+
config: AltoConfig;
|
|
13
8
|
registry: Registry;
|
|
14
9
|
metrics: Metrics;
|
|
15
10
|
senderManager: SenderManager;
|
package/lib/cli/setupServer.js
CHANGED
|
@@ -5,141 +5,161 @@ const executor_1 = require("../executor/index.js");
|
|
|
5
5
|
const handlers_1 = require("../handlers/index.js");
|
|
6
6
|
const mempool_1 = require("../mempool/index.js");
|
|
7
7
|
const rpc_1 = require("../rpc/index.js");
|
|
8
|
-
const getReputationManager = (
|
|
9
|
-
if (
|
|
10
|
-
return new mempool_1.ReputationManager(
|
|
11
|
-
level: parsedArgs["reputation-manager-log-level"] ||
|
|
12
|
-
parsedArgs["log-level"]
|
|
13
|
-
}));
|
|
8
|
+
const getReputationManager = (config) => {
|
|
9
|
+
if (config.safeMode) {
|
|
10
|
+
return new mempool_1.ReputationManager(config);
|
|
14
11
|
}
|
|
15
12
|
return new mempool_1.NullReputationManager();
|
|
16
13
|
};
|
|
17
|
-
const getValidator = ({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
const getValidator = ({ config, senderManager, metrics, gasPriceManager }) => {
|
|
15
|
+
if (config.safeMode) {
|
|
16
|
+
return new rpc_1.SafeValidator({
|
|
17
|
+
config,
|
|
18
|
+
senderManager,
|
|
19
|
+
metrics,
|
|
20
|
+
gasPriceManager
|
|
21
|
+
});
|
|
24
22
|
}
|
|
25
|
-
return new rpc_1.UnsafeValidator(
|
|
23
|
+
return new rpc_1.UnsafeValidator({
|
|
24
|
+
config,
|
|
25
|
+
metrics,
|
|
26
|
+
gasPriceManager
|
|
27
|
+
});
|
|
26
28
|
};
|
|
27
29
|
const getMonitor = () => {
|
|
28
30
|
return new mempool_1.Monitor();
|
|
29
31
|
};
|
|
30
|
-
const getMempool = ({ monitor, reputationManager, validator,
|
|
31
|
-
return new mempool_1.MemoryMempool(
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const getMempool = ({ config, monitor, reputationManager, validator, metrics, eventManager }) => {
|
|
33
|
+
return new mempool_1.MemoryMempool({
|
|
34
|
+
config,
|
|
35
|
+
monitor,
|
|
36
|
+
reputationManager,
|
|
37
|
+
validator,
|
|
38
|
+
metrics,
|
|
39
|
+
eventManager
|
|
40
|
+
});
|
|
34
41
|
};
|
|
35
|
-
const getEventManager = ({
|
|
36
|
-
return new handlers_1.EventManager(
|
|
42
|
+
const getEventManager = ({ config, metrics }) => {
|
|
43
|
+
return new handlers_1.EventManager({ config, metrics });
|
|
37
44
|
};
|
|
38
|
-
const getCompressionHandler = async (
|
|
45
|
+
const getCompressionHandler = async (config) => {
|
|
39
46
|
let compressionHandler = null;
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
compressionHandler = await handlers_1.CompressionHandler.createAsync(
|
|
47
|
+
if (config.bundleBulkerAddress !== undefined &&
|
|
48
|
+
config.perOpInflatorAddress !== undefined) {
|
|
49
|
+
compressionHandler = await handlers_1.CompressionHandler.createAsync(config.bundleBulkerAddress, config.perOpInflatorAddress, config.publicClient);
|
|
43
50
|
}
|
|
44
51
|
return compressionHandler;
|
|
45
52
|
};
|
|
46
|
-
const getExecutor = ({
|
|
47
|
-
return new executor_1.Executor(
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
const getExecutor = ({ mempool, config, senderManager, reputationManager, metrics, compressionHandler, gasPriceManager, eventManager }) => {
|
|
54
|
+
return new executor_1.Executor({
|
|
55
|
+
mempool,
|
|
56
|
+
config,
|
|
57
|
+
senderManager,
|
|
58
|
+
reputationManager,
|
|
59
|
+
metrics,
|
|
60
|
+
compressionHandler,
|
|
61
|
+
gasPriceManager,
|
|
62
|
+
eventManager
|
|
63
|
+
});
|
|
50
64
|
};
|
|
51
|
-
const getExecutorManager = ({ executor, mempool, monitor, reputationManager,
|
|
52
|
-
return new executor_1.ExecutorManager(
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
const getExecutorManager = ({ config, executor, mempool, monitor, reputationManager, metrics, gasPriceManager, eventManager }) => {
|
|
66
|
+
return new executor_1.ExecutorManager({
|
|
67
|
+
config,
|
|
68
|
+
executor,
|
|
69
|
+
mempool,
|
|
70
|
+
monitor,
|
|
71
|
+
reputationManager,
|
|
72
|
+
metrics,
|
|
73
|
+
gasPriceManager,
|
|
74
|
+
eventManager
|
|
75
|
+
});
|
|
55
76
|
};
|
|
56
|
-
const getNonceQueuer = ({
|
|
57
|
-
return new rpc_1.NonceQueuer(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
77
|
+
const getNonceQueuer = ({ config, mempool, eventManager }) => {
|
|
78
|
+
return new rpc_1.NonceQueuer({
|
|
79
|
+
config,
|
|
80
|
+
mempool,
|
|
81
|
+
eventManager
|
|
82
|
+
});
|
|
61
83
|
};
|
|
62
|
-
const getRpcHandler = ({
|
|
63
|
-
return new rpc_1.RpcHandler(
|
|
84
|
+
const getRpcHandler = ({ config, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, metrics, compressionHandler, gasPriceManager, eventManager }) => {
|
|
85
|
+
return new rpc_1.RpcHandler({
|
|
86
|
+
config,
|
|
87
|
+
validator,
|
|
88
|
+
mempool,
|
|
89
|
+
executor,
|
|
90
|
+
monitor,
|
|
91
|
+
nonceQueuer,
|
|
92
|
+
executorManager,
|
|
93
|
+
reputationManager,
|
|
94
|
+
metrics,
|
|
95
|
+
compressionHandler,
|
|
96
|
+
gasPriceManager,
|
|
97
|
+
eventManager
|
|
98
|
+
});
|
|
64
99
|
};
|
|
65
|
-
const getServer = ({
|
|
66
|
-
return new rpc_1.Server(
|
|
100
|
+
const getServer = ({ config, rpcEndpoint, registry, metrics }) => {
|
|
101
|
+
return new rpc_1.Server({
|
|
102
|
+
config,
|
|
103
|
+
rpcEndpoint,
|
|
104
|
+
registry,
|
|
105
|
+
metrics
|
|
106
|
+
});
|
|
67
107
|
};
|
|
68
|
-
const setupServer = async ({
|
|
108
|
+
const setupServer = async ({ config, registry, metrics, senderManager, gasPriceManager }) => {
|
|
69
109
|
const validator = getValidator({
|
|
70
|
-
|
|
71
|
-
logger,
|
|
72
|
-
parsedArgs,
|
|
110
|
+
config,
|
|
73
111
|
senderManager,
|
|
74
112
|
metrics,
|
|
75
|
-
gasPriceManager
|
|
76
|
-
walletClient
|
|
77
|
-
});
|
|
78
|
-
const reputationManager = getReputationManager({
|
|
79
|
-
client,
|
|
80
|
-
parsedArgs,
|
|
81
|
-
logger
|
|
82
|
-
});
|
|
83
|
-
const compressionHandler = await getCompressionHandler({
|
|
84
|
-
client,
|
|
85
|
-
parsedArgs
|
|
113
|
+
gasPriceManager
|
|
86
114
|
});
|
|
115
|
+
const reputationManager = getReputationManager(config);
|
|
116
|
+
const compressionHandler = await getCompressionHandler(config);
|
|
87
117
|
const eventManager = getEventManager({
|
|
88
|
-
|
|
89
|
-
chainId: client.chain.id,
|
|
90
|
-
logger,
|
|
118
|
+
config,
|
|
91
119
|
metrics
|
|
92
120
|
});
|
|
93
|
-
if (
|
|
94
|
-
await senderManager.validateAndRefillWallets(
|
|
121
|
+
if (config.refillingWallets) {
|
|
122
|
+
await senderManager.validateAndRefillWallets();
|
|
95
123
|
setInterval(async () => {
|
|
96
|
-
await senderManager.validateAndRefillWallets(
|
|
97
|
-
},
|
|
124
|
+
await senderManager.validateAndRefillWallets();
|
|
125
|
+
}, config.executorRefillInterval * 1000);
|
|
98
126
|
}
|
|
99
127
|
const monitor = getMonitor();
|
|
100
128
|
const mempool = getMempool({
|
|
129
|
+
config,
|
|
101
130
|
monitor,
|
|
102
131
|
reputationManager,
|
|
103
132
|
validator,
|
|
104
|
-
client,
|
|
105
|
-
parsedArgs,
|
|
106
|
-
logger,
|
|
107
133
|
metrics,
|
|
108
134
|
eventManager
|
|
109
135
|
});
|
|
110
136
|
const executor = getExecutor({
|
|
111
|
-
|
|
112
|
-
|
|
137
|
+
mempool,
|
|
138
|
+
config,
|
|
113
139
|
senderManager,
|
|
114
140
|
reputationManager,
|
|
115
|
-
parsedArgs,
|
|
116
|
-
logger,
|
|
117
141
|
metrics,
|
|
118
142
|
compressionHandler,
|
|
119
143
|
gasPriceManager,
|
|
120
144
|
eventManager
|
|
121
145
|
});
|
|
122
146
|
const executorManager = getExecutorManager({
|
|
147
|
+
config,
|
|
123
148
|
executor,
|
|
124
149
|
mempool,
|
|
125
150
|
monitor,
|
|
126
151
|
reputationManager,
|
|
127
|
-
client,
|
|
128
|
-
parsedArgs,
|
|
129
|
-
logger,
|
|
130
152
|
metrics,
|
|
131
153
|
gasPriceManager,
|
|
132
154
|
eventManager
|
|
133
155
|
});
|
|
134
156
|
const nonceQueuer = getNonceQueuer({
|
|
157
|
+
config,
|
|
135
158
|
mempool,
|
|
136
|
-
client,
|
|
137
|
-
parsedArgs,
|
|
138
|
-
logger,
|
|
139
159
|
eventManager
|
|
140
160
|
});
|
|
141
161
|
const rpcEndpoint = getRpcHandler({
|
|
142
|
-
|
|
162
|
+
config,
|
|
143
163
|
validator,
|
|
144
164
|
mempool,
|
|
145
165
|
executor,
|
|
@@ -147,21 +167,19 @@ const setupServer = async ({ client, walletClient, parsedArgs, logger, rootLogge
|
|
|
147
167
|
nonceQueuer,
|
|
148
168
|
executorManager,
|
|
149
169
|
reputationManager,
|
|
150
|
-
parsedArgs,
|
|
151
|
-
logger,
|
|
152
170
|
metrics,
|
|
153
171
|
compressionHandler,
|
|
154
172
|
gasPriceManager,
|
|
155
173
|
eventManager
|
|
156
174
|
});
|
|
157
|
-
if (
|
|
175
|
+
if (config.flushStuckTransactionsDuringStartup) {
|
|
158
176
|
executor.flushStuckTransactions();
|
|
159
177
|
}
|
|
178
|
+
const rootLogger = config.getLogger({ module: "root" }, { level: config.logLevel });
|
|
160
179
|
rootLogger.info(`Initialized ${senderManager.wallets.length} executor wallets`);
|
|
161
180
|
const server = getServer({
|
|
181
|
+
config,
|
|
162
182
|
rpcEndpoint,
|
|
163
|
-
parsedArgs,
|
|
164
|
-
logger,
|
|
165
183
|
registry,
|
|
166
184
|
metrics
|
|
167
185
|
});
|