@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../executor/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../executor/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAcoB;AAEpB,uCAMoB;AACpB,0FAA0F;AAC1F,qDAAsC;AACtC,+BAiBa;AAEN,MAAM,6BAA6B,GAAG,CAAC,CAAY,EAAE,EAAE;IAC1D,OAAO,CAAC,EAAE,OAAO;QACb,EAAE,WAAW,EAAE;SACd,QAAQ,CAAC,qCAAqC,CAA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EAChB,CAAC;QACC,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,eAAe,CAAC;gBAC9C,OAAO,EAAE,MAAM;gBACf,EAAE,EAAE,MAAM,CAAC,OAAO;gBAClB,KAAK,EAAE,EAAE;gBACT,KAAK,EAAE,YAAY;gBACnB,YAAY,EAAE,QAAQ;gBACtB,oBAAoB,EAAE,QAAQ;aACjC,CAAC,CAAA;YAEF,MAAM,CAAC,KAAK,CACR,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,EACvD,2BAA2B,CAC9B,CAAA;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;YAC1B,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,kCAAkC,CAAC,CAAA;QACjE,CAAC;IACL,CAAC;AACL,CAAC;AA5DD,sDA4DC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class ArbitrumManager {
|
|
2
|
+
private l1BaseFeeQueue;
|
|
3
|
+
private l2BaseFeeQueue;
|
|
4
|
+
constructor(queueValidity: number);
|
|
5
|
+
saveL1BaseFee(baseFee: bigint): void;
|
|
6
|
+
saveL2BaseFee(baseFee: bigint): void;
|
|
7
|
+
getMinL1BaseFee(): bigint;
|
|
8
|
+
getMaxL1BaseFee(): bigint;
|
|
9
|
+
getMaxL2BaseFee(): bigint;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=arbitrumGasPriceManager.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArbitrumManager = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const timedQueue_1 = require("../utils/timedQueue.js");
|
|
6
|
+
class ArbitrumManager {
|
|
7
|
+
l1BaseFeeQueue;
|
|
8
|
+
l2BaseFeeQueue;
|
|
9
|
+
constructor(queueValidity) {
|
|
10
|
+
this.l1BaseFeeQueue = new timedQueue_1.TimedQueue(queueValidity);
|
|
11
|
+
this.l2BaseFeeQueue = new timedQueue_1.TimedQueue(queueValidity);
|
|
12
|
+
}
|
|
13
|
+
saveL1BaseFee(baseFee) {
|
|
14
|
+
this.l1BaseFeeQueue.saveValue(baseFee);
|
|
15
|
+
}
|
|
16
|
+
saveL2BaseFee(baseFee) {
|
|
17
|
+
this.l2BaseFeeQueue.saveValue(baseFee);
|
|
18
|
+
}
|
|
19
|
+
getMinL1BaseFee() {
|
|
20
|
+
let minL1BaseFee = this.l1BaseFeeQueue.getMinValue() || 1n;
|
|
21
|
+
return minL1BaseFee;
|
|
22
|
+
}
|
|
23
|
+
getMaxL1BaseFee() {
|
|
24
|
+
let maxL1BaseFee = this.l1BaseFeeQueue.getMaxValue() || viem_1.maxUint128;
|
|
25
|
+
return maxL1BaseFee;
|
|
26
|
+
}
|
|
27
|
+
getMaxL2BaseFee() {
|
|
28
|
+
let maxL2BaseFee = this.l2BaseFeeQueue.getMaxValue() || viem_1.maxUint128;
|
|
29
|
+
return maxL2BaseFee;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.ArbitrumManager = ArbitrumManager;
|
|
33
|
+
//# sourceMappingURL=arbitrumGasPriceManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arbitrumGasPriceManager.js","sourceRoot":"","sources":["../../handlers/arbitrumGasPriceManager.ts"],"names":[],"mappings":";;;AAAA,+BAAiC;AACjC,oDAAgD;AAEhD,MAAa,eAAe;IAChB,cAAc,CAAY;IAC1B,cAAc,CAAY;IAElC,YAAY,aAAqB;QAC7B,IAAI,CAAC,cAAc,GAAG,IAAI,uBAAU,CAAC,aAAa,CAAC,CAAA;QACnD,IAAI,CAAC,cAAc,GAAG,IAAI,uBAAU,CAAC,aAAa,CAAC,CAAA;IACvD,CAAC;IAEM,aAAa,CAAC,OAAe;QAChC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAC1C,CAAC;IAEM,aAAa,CAAC,OAAe;QAChC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAC1C,CAAC;IAEM,eAAe;QAClB,IAAI,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,EAAE,CAAA;QAC1D,OAAO,YAAY,CAAA;IACvB,CAAC;IAEM,eAAe;QAClB,IAAI,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,iBAAU,CAAA;QAClE,OAAO,YAAY,CAAA;IACvB,CAAC;IAEM,eAAe;QAClB,IAAI,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,iBAAU,CAAA;QAClE,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ;AA/BD,0CA+BC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import type { Metrics } from "../utils/index.js";
|
|
1
2
|
import type { Hex } from "viem";
|
|
2
|
-
import type {
|
|
3
|
+
import type { AltoConfig } from "../createConfig.js";
|
|
3
4
|
export declare class EventManager {
|
|
4
|
-
private redis;
|
|
5
5
|
private chainId;
|
|
6
6
|
private logger;
|
|
7
7
|
private metrics;
|
|
8
|
-
|
|
8
|
+
private redisEventManagerQueue?;
|
|
9
|
+
constructor({ config, metrics }: {
|
|
10
|
+
config: AltoConfig;
|
|
11
|
+
metrics: Metrics;
|
|
12
|
+
});
|
|
9
13
|
emitExecutionRevertedOnChain(userOperationHash: Hex, transactionHash: Hex, reason: Hex, blockNumber: bigint): Promise<void>;
|
|
10
14
|
emitFailedOnChain(userOperationHash: Hex, transactionHash: Hex, blockNumber: bigint): Promise<void>;
|
|
11
15
|
emitFrontranOnChain(userOperationHash: Hex, transactionHash: Hex, blockNumber: bigint): Promise<void>;
|
|
@@ -27,23 +27,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.EventManager = void 0;
|
|
30
|
-
// biome-ignore lint/style/noNamespaceImport: explicitly make it clear when sentry is used
|
|
31
30
|
const sentry = __importStar(require("@sentry/node"));
|
|
32
31
|
const ioredis_1 = __importDefault(require("ioredis"));
|
|
32
|
+
const bull_1 = __importDefault(require("bull"));
|
|
33
33
|
class EventManager {
|
|
34
|
-
redis;
|
|
35
34
|
chainId;
|
|
36
35
|
logger;
|
|
37
36
|
metrics;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.
|
|
37
|
+
redisEventManagerQueue;
|
|
38
|
+
constructor({ config, metrics }) {
|
|
39
|
+
this.chainId = config.publicClient.chain.id;
|
|
40
|
+
this.logger = config.getLogger({ module: "event_manager" }, {
|
|
41
|
+
level: config.logLevel
|
|
42
|
+
});
|
|
41
43
|
this.metrics = metrics;
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
+
if (config.redisQueueEndpoint && config.redisEventManagerQueueName) {
|
|
45
|
+
const redis = new ioredis_1.default(config.redisQueueEndpoint);
|
|
46
|
+
this.redisEventManagerQueue = new bull_1.default(config.redisEventManagerQueueName, {
|
|
47
|
+
createClient: () => {
|
|
48
|
+
return redis;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
44
51
|
return;
|
|
45
52
|
}
|
|
46
|
-
this.redis = undefined;
|
|
47
53
|
}
|
|
48
54
|
// emits when the userOperation was mined onchain but reverted during the callphase
|
|
49
55
|
async emitExecutionRevertedOnChain(userOperationHash, transactionHash, reason, blockNumber) {
|
|
@@ -163,7 +169,7 @@ class EventManager {
|
|
|
163
169
|
});
|
|
164
170
|
}
|
|
165
171
|
async emitEvent({ userOperationHash, event, timestamp }) {
|
|
166
|
-
if (!this.
|
|
172
|
+
if (!this.redisEventManagerQueue) {
|
|
167
173
|
return;
|
|
168
174
|
}
|
|
169
175
|
const entry = {
|
|
@@ -173,21 +179,23 @@ class EventManager {
|
|
|
173
179
|
...event
|
|
174
180
|
};
|
|
175
181
|
// log to redis here
|
|
176
|
-
let
|
|
182
|
+
let jobStatus;
|
|
177
183
|
try {
|
|
178
|
-
await this.
|
|
179
|
-
|
|
184
|
+
await this.redisEventManagerQueue.add(entry, {
|
|
185
|
+
removeOnComplete: true,
|
|
186
|
+
removeOnFail: true
|
|
187
|
+
});
|
|
188
|
+
jobStatus = "success";
|
|
180
189
|
}
|
|
181
190
|
catch (e) {
|
|
182
|
-
this.logger.error("Failed to send userOperation status event due to "
|
|
191
|
+
this.logger.error(e, "Failed to send userOperation status event due to ");
|
|
183
192
|
sentry.captureException(e);
|
|
184
|
-
|
|
193
|
+
jobStatus = "failed";
|
|
185
194
|
}
|
|
186
195
|
this.metrics.emittedOpEvents
|
|
187
196
|
.labels({
|
|
188
|
-
// biome-ignore lint/style/useNamingConvention: event_type
|
|
189
197
|
event_type: event.eventType,
|
|
190
|
-
status:
|
|
198
|
+
status: jobStatus
|
|
191
199
|
})
|
|
192
200
|
.inc();
|
|
193
201
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventManager.js","sourceRoot":"","sources":["../../handlers/eventManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"eventManager.js","sourceRoot":"","sources":["../../handlers/eventManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAsC;AACtC,sDAA2B;AAI3B,gDAAqD;AAQrD,MAAa,YAAY;IACb,OAAO,CAAQ;IACf,MAAM,CAAQ;IACd,OAAO,CAAS;IAChB,sBAAsB,CAA0B;IAExD,YAAY,EACR,MAAM,EACN,OAAO,EAIV;QACG,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAA;QAE3C,IAAI,CAAC,MAA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AG,QAAQ,CAAA;QACxB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,eAAe;aACvB,MAAM,CAAC;YACJ,UAAU,EAAE,KAAK,CAAC,SAAS;YAC3B,MAAM,EAAE,SAAS;SACpB,CAAC;aACD,GAAG,EAAE,CAAA;IACd,CAAC;CACJ;AA1OD,oCA0OC"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { type GasPriceParameters
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { type GasPriceParameters } from "../types/index.js";
|
|
2
|
+
import type { AltoConfig } from "../createConfig.js";
|
|
3
|
+
import { ArbitrumManager } from "./arbitrumGasPriceManager.js";
|
|
4
|
+
import { MantleManager } from "./mantleGasPriceManager.js";
|
|
4
5
|
export declare class GasPriceManager {
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
private
|
|
6
|
+
private readonly config;
|
|
7
|
+
private baseFeePerGasQueue;
|
|
8
|
+
private maxFeePerGasQueue;
|
|
9
|
+
private maxPriorityFeePerGasQueue;
|
|
8
10
|
private logger;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
private maxQueueSize;
|
|
13
|
-
private gasBumpMultiplier;
|
|
14
|
-
private gasPriceRefreshIntervalInSeconds;
|
|
15
|
-
private chainType;
|
|
16
|
-
constructor(chain: Chain, publicClient: PublicClient, legacyTransactions: boolean, logger: Logger, gasBumpMultiplier: bigint, gasPriceTimeValidityInSeconds: number, gasPriceRefreshIntervalInSeconds: number, chainType: ChainType);
|
|
11
|
+
arbitrumManager: ArbitrumManager;
|
|
12
|
+
mantleManager: MantleManager;
|
|
13
|
+
constructor(config: AltoConfig);
|
|
17
14
|
init(): Promise<[{
|
|
18
15
|
maxFeePerGas: bigint;
|
|
19
16
|
maxPriorityFeePerGas: bigint;
|
|
@@ -22,24 +19,14 @@ export declare class GasPriceManager {
|
|
|
22
19
|
private getPolygonGasPriceParameters;
|
|
23
20
|
private bumpTheGasPrice;
|
|
24
21
|
private getFallBackMaxPriorityFeePerGas;
|
|
25
|
-
private getNextBaseFee;
|
|
26
22
|
private getLegacyTransactionGasPrice;
|
|
27
23
|
private estimateGasPrice;
|
|
28
|
-
private saveBaseFeePerGas;
|
|
29
|
-
private saveMaxFeePerGas;
|
|
30
|
-
private saveMaxPriorityFeePerGas;
|
|
31
|
-
private saveGasPrice;
|
|
32
24
|
private innerGetGasPrice;
|
|
33
25
|
private updateBaseFee;
|
|
34
|
-
getBaseFee():
|
|
26
|
+
getBaseFee(): Promise<bigint>;
|
|
35
27
|
private updateGasPrice;
|
|
36
|
-
getGasPrice(): Promise<
|
|
37
|
-
|
|
38
|
-
maxPriorityFeePerGas: bigint;
|
|
39
|
-
}> | {
|
|
40
|
-
maxFeePerGas: bigint;
|
|
41
|
-
maxPriorityFeePerGas: bigint;
|
|
42
|
-
};
|
|
28
|
+
getGasPrice(): Promise<GasPriceParameters>;
|
|
29
|
+
getNetworkGasPrice(): Promise<GasPriceParameters>;
|
|
43
30
|
getMaxBaseFeePerGas(): Promise<bigint>;
|
|
44
31
|
private getMinMaxFeePerGas;
|
|
45
32
|
private getMinMaxPriorityFeePerGas;
|
|
@@ -29,6 +29,9 @@ const utils_1 = require("../utils/index.js");
|
|
|
29
29
|
const sentry = __importStar(require("@sentry/node"));
|
|
30
30
|
const viem_1 = require("viem");
|
|
31
31
|
const chains_1 = require("viem/chains");
|
|
32
|
+
const timedQueue_1 = require("../utils/timedQueue.js");
|
|
33
|
+
const arbitrumGasPriceManager_1 = require("./arbitrumGasPriceManager.js");
|
|
34
|
+
const mantleGasPriceManager_1 = require("./mantleGasPriceManager.js");
|
|
32
35
|
var ChainId;
|
|
33
36
|
(function (ChainId) {
|
|
34
37
|
ChainId[ChainId["Goerli"] = 5] = "Goerli";
|
|
@@ -48,40 +51,38 @@ function getGasStationUrl(chainId) {
|
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
class GasPriceManager {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
config;
|
|
55
|
+
baseFeePerGasQueue;
|
|
56
|
+
maxFeePerGasQueue;
|
|
57
|
+
maxPriorityFeePerGasQueue;
|
|
54
58
|
logger;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
this.legacyTransactions = legacyTransactions;
|
|
67
|
-
this.logger = logger;
|
|
68
|
-
this.gasBumpMultiplier = gasBumpMultiplier;
|
|
69
|
-
this.gasPriceRefreshIntervalInSeconds = gasPriceRefreshIntervalInSeconds;
|
|
70
|
-
this.chainType = chainType;
|
|
59
|
+
arbitrumManager;
|
|
60
|
+
mantleManager;
|
|
61
|
+
constructor(config) {
|
|
62
|
+
this.config = config;
|
|
63
|
+
this.logger = config.getLogger({ module: "gas_price_manager" }, {
|
|
64
|
+
level: config.publicClientLogLevel || config.logLevel
|
|
65
|
+
});
|
|
66
|
+
const queueValidity = this.config.gasPriceExpiry * 1_000;
|
|
67
|
+
this.baseFeePerGasQueue = new timedQueue_1.TimedQueue(queueValidity);
|
|
68
|
+
this.maxFeePerGasQueue = new timedQueue_1.TimedQueue(queueValidity);
|
|
69
|
+
this.maxPriorityFeePerGasQueue = new timedQueue_1.TimedQueue(queueValidity);
|
|
71
70
|
// Periodically update gas prices if specified
|
|
72
|
-
if (this.
|
|
71
|
+
if (this.config.gasPriceRefreshInterval > 0) {
|
|
73
72
|
setInterval(() => {
|
|
74
|
-
if (this.legacyTransactions === false) {
|
|
73
|
+
if (this.config.legacyTransactions === false) {
|
|
75
74
|
this.updateBaseFee();
|
|
76
75
|
}
|
|
77
76
|
this.updateGasPrice();
|
|
78
|
-
}, this.
|
|
77
|
+
}, this.config.gasPriceRefreshInterval * 1000);
|
|
79
78
|
}
|
|
79
|
+
this.arbitrumManager = new arbitrumGasPriceManager_1.ArbitrumManager(queueValidity);
|
|
80
|
+
this.mantleManager = new mantleGasPriceManager_1.MantleManager(queueValidity);
|
|
80
81
|
}
|
|
81
82
|
init() {
|
|
82
83
|
return Promise.all([
|
|
83
84
|
this.updateGasPrice(),
|
|
84
|
-
this.legacyTransactions === false
|
|
85
|
+
this.config.legacyTransactions === false
|
|
85
86
|
? this.updateBaseFee()
|
|
86
87
|
: Promise.resolve()
|
|
87
88
|
]);
|
|
@@ -97,7 +98,7 @@ class GasPriceManager {
|
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
async getPolygonGasPriceParameters() {
|
|
100
|
-
const gasStationUrl = getGasStationUrl(this.chain.id);
|
|
101
|
+
const gasStationUrl = getGasStationUrl(this.config.publicClient.chain.id);
|
|
101
102
|
try {
|
|
102
103
|
const data = await (await fetch(gasStationUrl)).json();
|
|
103
104
|
// take the standard speed here, SDK options will define the extra tip
|
|
@@ -110,21 +111,22 @@ class GasPriceManager {
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
bumpTheGasPrice(gasPriceParameters) {
|
|
113
|
-
const bumpAmount = this.
|
|
114
|
-
const maxPriorityFeePerGas = (0, utils_1.maxBigInt)(gasPriceParameters.maxPriorityFeePerGas, this.getDefaultGasFee(this.chain.id));
|
|
114
|
+
const bumpAmount = this.config.gasPriceBump;
|
|
115
|
+
const maxPriorityFeePerGas = (0, utils_1.maxBigInt)(gasPriceParameters.maxPriorityFeePerGas, this.getDefaultGasFee(this.config.publicClient.chain.id));
|
|
115
116
|
const maxFeePerGas = (0, utils_1.maxBigInt)(gasPriceParameters.maxFeePerGas, maxPriorityFeePerGas);
|
|
116
117
|
const result = {
|
|
117
118
|
maxFeePerGas: (maxFeePerGas * bumpAmount) / 100n,
|
|
118
119
|
maxPriorityFeePerGas: (maxPriorityFeePerGas * bumpAmount) / 100n
|
|
119
120
|
};
|
|
120
|
-
if (this.chain.id === chains_1.celo.id ||
|
|
121
|
+
if (this.config.publicClient.chain.id === chains_1.celo.id ||
|
|
122
|
+
this.config.publicClient.chain.id === chains_1.celoAlfajores.id) {
|
|
121
123
|
const maxFee = (0, utils_1.maxBigInt)(result.maxFeePerGas, result.maxPriorityFeePerGas);
|
|
122
124
|
return {
|
|
123
125
|
maxFeePerGas: maxFee,
|
|
124
126
|
maxPriorityFeePerGas: maxFee
|
|
125
127
|
};
|
|
126
128
|
}
|
|
127
|
-
if (this.chain.id === chains_1.dfk.id) {
|
|
129
|
+
if (this.config.publicClient.chain.id === chains_1.dfk.id) {
|
|
128
130
|
const maxFeePerGas = (0, utils_1.maxBigInt)(5000000000n, result.maxFeePerGas);
|
|
129
131
|
const maxPriorityFeePerGas = (0, utils_1.maxBigInt)(5000000000n, result.maxPriorityFeePerGas);
|
|
130
132
|
return {
|
|
@@ -133,7 +135,7 @@ class GasPriceManager {
|
|
|
133
135
|
};
|
|
134
136
|
}
|
|
135
137
|
// set a minimum maxPriorityFee & maxFee to 1.5gwei on avalanche (because eth_maxPriorityFeePerGas returns 0)
|
|
136
|
-
if (this.chain.id === chains_1.avalanche.id) {
|
|
138
|
+
if (this.config.publicClient.chain.id === chains_1.avalanche.id) {
|
|
137
139
|
const maxFeePerGas = (0, utils_1.maxBigInt)((0, viem_1.parseGwei)("1.5"), result.maxFeePerGas);
|
|
138
140
|
const maxPriorityFeePerGas = (0, utils_1.maxBigInt)((0, viem_1.parseGwei)("1.5"), result.maxPriorityFeePerGas);
|
|
139
141
|
return {
|
|
@@ -155,30 +157,11 @@ class GasPriceManager {
|
|
|
155
157
|
const feeAverage = feeHistory.reward.reduce((acc, cur) => cur[0] + acc, 0n) / 10n;
|
|
156
158
|
return (0, utils_1.minBigInt)(feeAverage, gasPrice);
|
|
157
159
|
}
|
|
158
|
-
async getNextBaseFee(publicClient) {
|
|
159
|
-
const block = await publicClient.getBlock({
|
|
160
|
-
blockTag: "latest"
|
|
161
|
-
});
|
|
162
|
-
const currentBaseFeePerGas = block.baseFeePerGas || (await publicClient.getGasPrice());
|
|
163
|
-
const currentGasUsed = block.gasUsed;
|
|
164
|
-
const gasTarget = block.gasLimit / 2n;
|
|
165
|
-
if (currentGasUsed === gasTarget) {
|
|
166
|
-
return currentBaseFeePerGas;
|
|
167
|
-
}
|
|
168
|
-
if (currentGasUsed > gasTarget) {
|
|
169
|
-
const gasUsedDelta = currentGasUsed - gasTarget;
|
|
170
|
-
const baseFeePerGasDelta = (0, utils_1.maxBigInt)((currentBaseFeePerGas * gasUsedDelta) / gasTarget / 8n, 1n);
|
|
171
|
-
return currentBaseFeePerGas + baseFeePerGasDelta;
|
|
172
|
-
}
|
|
173
|
-
const gasUsedDelta = currentGasUsed - gasTarget;
|
|
174
|
-
const baseFeePerGasDelta = (currentBaseFeePerGas * gasUsedDelta) / gasTarget / 8n;
|
|
175
|
-
return currentBaseFeePerGas - baseFeePerGasDelta;
|
|
176
|
-
}
|
|
177
160
|
async getLegacyTransactionGasPrice() {
|
|
178
161
|
let gasPrice;
|
|
179
162
|
try {
|
|
180
|
-
const gasInfo = await this.publicClient.estimateFeesPerGas({
|
|
181
|
-
chain: this.chain,
|
|
163
|
+
const gasInfo = await this.config.publicClient.estimateFeesPerGas({
|
|
164
|
+
chain: this.config.publicClient.chain,
|
|
182
165
|
type: "legacy"
|
|
183
166
|
});
|
|
184
167
|
gasPrice = gasInfo.gasPrice;
|
|
@@ -191,7 +174,7 @@ class GasPriceManager {
|
|
|
191
174
|
if (gasPrice === undefined) {
|
|
192
175
|
this.logger.warn("gasPrice is undefined, using fallback value");
|
|
193
176
|
try {
|
|
194
|
-
gasPrice = await this.publicClient.getGasPrice();
|
|
177
|
+
gasPrice = await this.config.publicClient.getGasPrice();
|
|
195
178
|
}
|
|
196
179
|
catch (e) {
|
|
197
180
|
this.logger.error("failed to get fallback gasPrice");
|
|
@@ -208,8 +191,8 @@ class GasPriceManager {
|
|
|
208
191
|
let maxFeePerGas;
|
|
209
192
|
let maxPriorityFeePerGas;
|
|
210
193
|
try {
|
|
211
|
-
const fees = await this.publicClient.estimateFeesPerGas({
|
|
212
|
-
chain: this.chain
|
|
194
|
+
const fees = await this.config.publicClient.estimateFeesPerGas({
|
|
195
|
+
chain: this.config.publicClient.chain
|
|
213
196
|
});
|
|
214
197
|
maxFeePerGas = fees.maxFeePerGas;
|
|
215
198
|
maxPriorityFeePerGas = fees.maxPriorityFeePerGas;
|
|
@@ -224,7 +207,7 @@ class GasPriceManager {
|
|
|
224
207
|
this.logger.warn("maxPriorityFeePerGas is undefined, using fallback value");
|
|
225
208
|
try {
|
|
226
209
|
maxPriorityFeePerGas =
|
|
227
|
-
await this.getFallBackMaxPriorityFeePerGas(this.publicClient, maxFeePerGas ?? 0n);
|
|
210
|
+
await this.getFallBackMaxPriorityFeePerGas(this.config.publicClient, maxFeePerGas ?? 0n);
|
|
228
211
|
}
|
|
229
212
|
catch (e) {
|
|
230
213
|
this.logger.error("failed to get fallback maxPriorityFeePerGas");
|
|
@@ -236,7 +219,7 @@ class GasPriceManager {
|
|
|
236
219
|
this.logger.warn("maxFeePerGas is undefined, using fallback value");
|
|
237
220
|
try {
|
|
238
221
|
maxFeePerGas =
|
|
239
|
-
(await this.
|
|
222
|
+
(await this.config.publicClient.getGasPrice()) +
|
|
240
223
|
maxPriorityFeePerGas;
|
|
241
224
|
}
|
|
242
225
|
catch (e) {
|
|
@@ -250,60 +233,11 @@ class GasPriceManager {
|
|
|
250
233
|
}
|
|
251
234
|
return { maxFeePerGas, maxPriorityFeePerGas };
|
|
252
235
|
}
|
|
253
|
-
saveBaseFeePerGas(gasPrice, timestamp) {
|
|
254
|
-
const queue = this.queueBaseFeePerGas;
|
|
255
|
-
const last = queue.length > 0 ? queue[queue.length - 1] : null;
|
|
256
|
-
if (!last || timestamp - last.timestamp >= 1000) {
|
|
257
|
-
if (queue.length >= this.maxQueueSize) {
|
|
258
|
-
queue.shift();
|
|
259
|
-
}
|
|
260
|
-
queue.push({ baseFeePerGas: gasPrice, timestamp });
|
|
261
|
-
}
|
|
262
|
-
else if (gasPrice < last.baseFeePerGas) {
|
|
263
|
-
last.baseFeePerGas = gasPrice;
|
|
264
|
-
last.timestamp = timestamp;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
saveMaxFeePerGas(gasPrice, timestamp) {
|
|
268
|
-
const queue = this.queueMaxFeePerGas;
|
|
269
|
-
const last = queue.length > 0 ? queue[queue.length - 1] : null;
|
|
270
|
-
if (!last || timestamp - last.timestamp >= 1000) {
|
|
271
|
-
if (queue.length >= this.maxQueueSize) {
|
|
272
|
-
queue.shift();
|
|
273
|
-
}
|
|
274
|
-
queue.push({ maxFeePerGas: gasPrice, timestamp });
|
|
275
|
-
}
|
|
276
|
-
else if (gasPrice < last.maxFeePerGas) {
|
|
277
|
-
last.maxFeePerGas = gasPrice;
|
|
278
|
-
last.timestamp = timestamp;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
saveMaxPriorityFeePerGas(gasPrice, timestamp) {
|
|
282
|
-
const queue = this.queueMaxPriorityFeePerGas;
|
|
283
|
-
const last = queue.length > 0 ? queue[queue.length - 1] : null;
|
|
284
|
-
if (!last || timestamp - last.timestamp >= 1000) {
|
|
285
|
-
if (queue.length >= this.maxQueueSize) {
|
|
286
|
-
queue.shift();
|
|
287
|
-
}
|
|
288
|
-
queue.push({ maxPriorityFeePerGas: gasPrice, timestamp });
|
|
289
|
-
}
|
|
290
|
-
else if (gasPrice < last.maxPriorityFeePerGas) {
|
|
291
|
-
last.maxPriorityFeePerGas = gasPrice;
|
|
292
|
-
last.timestamp = timestamp;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
saveGasPrice(gasPrice, timestamp) {
|
|
296
|
-
return new Promise((resolve) => {
|
|
297
|
-
this.saveMaxFeePerGas(gasPrice.maxFeePerGas, timestamp);
|
|
298
|
-
this.saveMaxPriorityFeePerGas(gasPrice.maxPriorityFeePerGas, timestamp);
|
|
299
|
-
resolve();
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
236
|
async innerGetGasPrice() {
|
|
303
237
|
let maxFeePerGas = 0n;
|
|
304
238
|
let maxPriorityFeePerGas = 0n;
|
|
305
|
-
if (this.chain.id === chains_1.polygon.id ||
|
|
306
|
-
this.chain.id === chains_1.polygonMumbai.id) {
|
|
239
|
+
if (this.config.publicClient.chain.id === chains_1.polygon.id ||
|
|
240
|
+
this.config.publicClient.chain.id === chains_1.polygonMumbai.id) {
|
|
307
241
|
const polygonEstimate = await this.getPolygonGasPriceParameters();
|
|
308
242
|
if (polygonEstimate) {
|
|
309
243
|
const gasPrice = this.bumpTheGasPrice({
|
|
@@ -316,7 +250,7 @@ class GasPriceManager {
|
|
|
316
250
|
};
|
|
317
251
|
}
|
|
318
252
|
}
|
|
319
|
-
if (this.legacyTransactions) {
|
|
253
|
+
if (this.config.legacyTransactions) {
|
|
320
254
|
const gasPrice = this.bumpTheGasPrice(await this.getLegacyTransactionGasPrice());
|
|
321
255
|
return {
|
|
322
256
|
maxFeePerGas: (0, utils_1.maxBigInt)(gasPrice.maxFeePerGas, maxFeePerGas),
|
|
@@ -336,65 +270,77 @@ class GasPriceManager {
|
|
|
336
270
|
};
|
|
337
271
|
}
|
|
338
272
|
async updateBaseFee() {
|
|
339
|
-
const latestBlock = await this.publicClient.getBlock();
|
|
273
|
+
const latestBlock = await this.config.publicClient.getBlock();
|
|
340
274
|
if (latestBlock.baseFeePerGas === null) {
|
|
341
275
|
throw new types_1.RpcError("block does not have baseFeePerGas");
|
|
342
276
|
}
|
|
343
277
|
const baseFee = latestBlock.baseFeePerGas;
|
|
344
|
-
this.
|
|
278
|
+
this.baseFeePerGasQueue.saveValue(baseFee);
|
|
345
279
|
return baseFee;
|
|
346
280
|
}
|
|
347
|
-
getBaseFee() {
|
|
348
|
-
if (this.legacyTransactions) {
|
|
281
|
+
async getBaseFee() {
|
|
282
|
+
if (this.config.legacyTransactions) {
|
|
349
283
|
throw new types_1.RpcError("baseFee is not available for legacy transactions");
|
|
350
284
|
}
|
|
351
|
-
if (this.
|
|
352
|
-
return this.updateBaseFee();
|
|
285
|
+
if (this.config.gasPriceRefreshInterval === 0) {
|
|
286
|
+
return await this.updateBaseFee();
|
|
287
|
+
}
|
|
288
|
+
let baseFee = this.baseFeePerGasQueue.getLatestValue();
|
|
289
|
+
if (!baseFee) {
|
|
290
|
+
baseFee = await this.getBaseFee();
|
|
353
291
|
}
|
|
354
|
-
|
|
355
|
-
return baseFeePerGas;
|
|
292
|
+
return baseFee;
|
|
356
293
|
}
|
|
357
294
|
async updateGasPrice() {
|
|
358
295
|
const gasPrice = await this.innerGetGasPrice();
|
|
359
|
-
this.
|
|
360
|
-
|
|
361
|
-
maxPriorityFeePerGas: gasPrice.maxPriorityFeePerGas
|
|
362
|
-
}, Date.now());
|
|
296
|
+
this.maxFeePerGasQueue.saveValue(gasPrice.maxFeePerGas);
|
|
297
|
+
this.maxPriorityFeePerGasQueue.saveValue(gasPrice.maxPriorityFeePerGas);
|
|
363
298
|
return gasPrice;
|
|
364
299
|
}
|
|
365
|
-
getGasPrice() {
|
|
366
|
-
if (this.
|
|
367
|
-
return this.updateGasPrice();
|
|
300
|
+
async getGasPrice() {
|
|
301
|
+
if (this.config.gasPriceRefreshInterval === 0) {
|
|
302
|
+
return await this.updateGasPrice();
|
|
303
|
+
}
|
|
304
|
+
const maxFeePerGas = this.maxFeePerGasQueue.getLatestValue();
|
|
305
|
+
const maxPriorityFeePerGas = this.maxPriorityFeePerGasQueue.getLatestValue();
|
|
306
|
+
if (!maxFeePerGas || !maxPriorityFeePerGas) {
|
|
307
|
+
throw new types_1.RpcError("No gas price available");
|
|
368
308
|
}
|
|
369
|
-
const { maxPriorityFeePerGas } = this.queueMaxPriorityFeePerGas[this.queueMaxPriorityFeePerGas.length - 1];
|
|
370
|
-
const { maxFeePerGas } = this.queueMaxFeePerGas[this.queueMaxFeePerGas.length - 1];
|
|
371
309
|
return {
|
|
372
310
|
maxFeePerGas,
|
|
373
311
|
maxPriorityFeePerGas
|
|
374
312
|
};
|
|
375
313
|
}
|
|
314
|
+
async getNetworkGasPrice() {
|
|
315
|
+
return await this.innerGetGasPrice();
|
|
316
|
+
}
|
|
376
317
|
async getMaxBaseFeePerGas() {
|
|
377
|
-
|
|
378
|
-
|
|
318
|
+
let maxBaseFeePerGas = this.baseFeePerGasQueue.getMaxValue();
|
|
319
|
+
if (!maxBaseFeePerGas) {
|
|
320
|
+
maxBaseFeePerGas = await this.getBaseFee();
|
|
379
321
|
}
|
|
380
|
-
return
|
|
322
|
+
return maxBaseFeePerGas;
|
|
381
323
|
}
|
|
382
324
|
async getMinMaxFeePerGas() {
|
|
383
|
-
|
|
384
|
-
|
|
325
|
+
let minMaxFeePerGas = this.maxFeePerGasQueue.getMinValue();
|
|
326
|
+
if (!minMaxFeePerGas) {
|
|
327
|
+
const gasPrice = await this.getGasPrice();
|
|
328
|
+
minMaxFeePerGas = gasPrice.maxFeePerGas;
|
|
385
329
|
}
|
|
386
|
-
return
|
|
330
|
+
return minMaxFeePerGas;
|
|
387
331
|
}
|
|
388
332
|
async getMinMaxPriorityFeePerGas() {
|
|
389
|
-
|
|
390
|
-
|
|
333
|
+
let minMaxPriorityFeePerGas = this.maxPriorityFeePerGasQueue.getMinValue();
|
|
334
|
+
if (!minMaxPriorityFeePerGas) {
|
|
335
|
+
const gasPrices = await this.getGasPrice();
|
|
336
|
+
minMaxPriorityFeePerGas = gasPrices.maxPriorityFeePerGas;
|
|
391
337
|
}
|
|
392
|
-
return
|
|
338
|
+
return minMaxPriorityFeePerGas;
|
|
393
339
|
}
|
|
394
340
|
async validateGasPrice(gasPrice) {
|
|
395
341
|
let lowestMaxFeePerGas = await this.getMinMaxFeePerGas();
|
|
396
342
|
let lowestMaxPriorityFeePerGas = await this.getMinMaxPriorityFeePerGas();
|
|
397
|
-
if (this.chainType === "hedera") {
|
|
343
|
+
if (this.config.chainType === "hedera") {
|
|
398
344
|
lowestMaxFeePerGas /= 10n ** 9n;
|
|
399
345
|
lowestMaxPriorityFeePerGas /= 10n ** 9n;
|
|
400
346
|
}
|