@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,OAAO,EAGH,gBAAgB,EAChB,gBAAgB,EAOhB,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAChC,MAAM,aAAa,CAAA;AAEpB,OAAO,EACH,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACxB,MAAM,aAAa,CAAA;AACpB,0FAA0F;AAC1F,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;A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OAAO,EAAE,EACrD,mCAAmC,CACtC,CAAA;IAED,KACI,IAAI,YAAY,GAAG,WAAW,EAC9B,YAAY,GAAG,YAAY,EAC3B,YAAY,EAAE,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"}
|
|
@@ -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,29 @@
|
|
|
1
|
+
import { maxUint128 } from "viem";
|
|
2
|
+
import { TimedQueue } from "../utils/timedQueue.js";
|
|
3
|
+
export class ArbitrumManager {
|
|
4
|
+
l1BaseFeeQueue;
|
|
5
|
+
l2BaseFeeQueue;
|
|
6
|
+
constructor(queueValidity) {
|
|
7
|
+
this.l1BaseFeeQueue = new TimedQueue(queueValidity);
|
|
8
|
+
this.l2BaseFeeQueue = new TimedQueue(queueValidity);
|
|
9
|
+
}
|
|
10
|
+
saveL1BaseFee(baseFee) {
|
|
11
|
+
this.l1BaseFeeQueue.saveValue(baseFee);
|
|
12
|
+
}
|
|
13
|
+
saveL2BaseFee(baseFee) {
|
|
14
|
+
this.l2BaseFeeQueue.saveValue(baseFee);
|
|
15
|
+
}
|
|
16
|
+
getMinL1BaseFee() {
|
|
17
|
+
let minL1BaseFee = this.l1BaseFeeQueue.getMinValue() || 1n;
|
|
18
|
+
return minL1BaseFee;
|
|
19
|
+
}
|
|
20
|
+
getMaxL1BaseFee() {
|
|
21
|
+
let maxL1BaseFee = this.l1BaseFeeQueue.getMaxValue() || maxUint128;
|
|
22
|
+
return maxL1BaseFee;
|
|
23
|
+
}
|
|
24
|
+
getMaxL2BaseFee() {
|
|
25
|
+
let maxL2BaseFee = this.l2BaseFeeQueue.getMaxValue() || maxUint128;
|
|
26
|
+
return maxL2BaseFee;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=arbitrumGasPriceManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arbitrumGasPriceManager.js","sourceRoot":"","sources":["../../handlers/arbitrumGasPriceManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,MAAM,OAAO,eAAe;IAChB,cAAc,CAAY;IAC1B,cAAc,CAAY;IAElC,YAAY,aAAqB;QAC7B,IAAI,CAAC,cAAc,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,CAAA;QACnD,IAAI,CAAC,cAAc,GAAG,IAAI,UAAU,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,UAAU,CAAA;QAClE,OAAO,YAAY,CAAA;IACvB,CAAC;IAEM,eAAe;QAClB,IAAI,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,UAAU,CAAA;QAClE,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ"}
|
|
@@ -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>;
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
// biome-ignore lint/style/noNamespaceImport: explicitly make it clear when sentry is used
|
|
2
1
|
import * as sentry from "@sentry/node";
|
|
3
2
|
import Redis from "ioredis";
|
|
3
|
+
import Queue from "bull";
|
|
4
4
|
export class EventManager {
|
|
5
|
-
redis;
|
|
6
5
|
chainId;
|
|
7
6
|
logger;
|
|
8
7
|
metrics;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.
|
|
8
|
+
redisEventManagerQueue;
|
|
9
|
+
constructor({ config, metrics }) {
|
|
10
|
+
this.chainId = config.publicClient.chain.id;
|
|
11
|
+
this.logger = config.getLogger({ module: "event_manager" }, {
|
|
12
|
+
level: config.logLevel
|
|
13
|
+
});
|
|
12
14
|
this.metrics = metrics;
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
+
if (config.redisQueueEndpoint && config.redisEventManagerQueueName) {
|
|
16
|
+
const redis = new Redis(config.redisQueueEndpoint);
|
|
17
|
+
this.redisEventManagerQueue = new Queue(config.redisEventManagerQueueName, {
|
|
18
|
+
createClient: () => {
|
|
19
|
+
return redis;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
15
22
|
return;
|
|
16
23
|
}
|
|
17
|
-
this.redis = undefined;
|
|
18
24
|
}
|
|
19
25
|
// emits when the userOperation was mined onchain but reverted during the callphase
|
|
20
26
|
async emitExecutionRevertedOnChain(userOperationHash, transactionHash, reason, blockNumber) {
|
|
@@ -134,7 +140,7 @@ export class EventManager {
|
|
|
134
140
|
});
|
|
135
141
|
}
|
|
136
142
|
async emitEvent({ userOperationHash, event, timestamp }) {
|
|
137
|
-
if (!this.
|
|
143
|
+
if (!this.redisEventManagerQueue) {
|
|
138
144
|
return;
|
|
139
145
|
}
|
|
140
146
|
const entry = {
|
|
@@ -144,21 +150,23 @@ export class EventManager {
|
|
|
144
150
|
...event
|
|
145
151
|
};
|
|
146
152
|
// log to redis here
|
|
147
|
-
let
|
|
153
|
+
let jobStatus;
|
|
148
154
|
try {
|
|
149
|
-
await this.
|
|
150
|
-
|
|
155
|
+
await this.redisEventManagerQueue.add(entry, {
|
|
156
|
+
removeOnComplete: true,
|
|
157
|
+
removeOnFail: true
|
|
158
|
+
});
|
|
159
|
+
jobStatus = "success";
|
|
151
160
|
}
|
|
152
161
|
catch (e) {
|
|
153
|
-
this.logger.error("Failed to send userOperation status event due to "
|
|
162
|
+
this.logger.error(e, "Failed to send userOperation status event due to ");
|
|
154
163
|
sentry.captureException(e);
|
|
155
|
-
|
|
164
|
+
jobStatus = "failed";
|
|
156
165
|
}
|
|
157
166
|
this.metrics.emittedOpEvents
|
|
158
167
|
.labels({
|
|
159
|
-
// biome-ignore lint/style/useNamingConvention: event_type
|
|
160
168
|
event_type: event.eventType,
|
|
161
|
-
status:
|
|
169
|
+
status: jobStatus
|
|
162
170
|
})
|
|
163
171
|
.inc();
|
|
164
172
|
}
|
|
@@ -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,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,MAAM,SAAS,CAAA;AAI3B,OAAO,KAAkC,MAAM,MAAM,CAAA;AAQrD,MAAM,OAAO,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,MAAM,GAAG,MAAM,CAAC,SAAS,CAC1B,EAAE,MAAM,EAAE,eAAe,EAAE,EAC3B;YACI,KAAK,EAAE,MAAM,CAAC,QAAQ;SACzB,CACJ,CAAA;QACD,IAAI,CAAC,OAAO,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CAAC;aACD,GAAG,EAAE,CAAA;IACd,CAAC;CACJ"}
|
|
@@ -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;
|
|
@@ -2,7 +2,10 @@ import { RpcError, gasStationResult } from "../types/index.js";
|
|
|
2
2
|
import { maxBigInt, minBigInt } from "../utils/index.js";
|
|
3
3
|
import * as sentry from "@sentry/node";
|
|
4
4
|
import { parseGwei } from "viem";
|
|
5
|
-
import { celo, celoAlfajores, dfk,
|
|
5
|
+
import { avalanche, celo, celoAlfajores, dfk, polygon, polygonMumbai } from "viem/chains";
|
|
6
|
+
import { TimedQueue } from "../utils/timedQueue.js";
|
|
7
|
+
import { ArbitrumManager } from "./arbitrumGasPriceManager.js";
|
|
8
|
+
import { MantleManager } from "./mantleGasPriceManager.js";
|
|
6
9
|
var ChainId;
|
|
7
10
|
(function (ChainId) {
|
|
8
11
|
ChainId[ChainId["Goerli"] = 5] = "Goerli";
|
|
@@ -22,40 +25,38 @@ function getGasStationUrl(chainId) {
|
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
export class GasPriceManager {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
config;
|
|
29
|
+
baseFeePerGasQueue;
|
|
30
|
+
maxFeePerGasQueue;
|
|
31
|
+
maxPriorityFeePerGasQueue;
|
|
28
32
|
logger;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.legacyTransactions = legacyTransactions;
|
|
41
|
-
this.logger = logger;
|
|
42
|
-
this.gasBumpMultiplier = gasBumpMultiplier;
|
|
43
|
-
this.gasPriceRefreshIntervalInSeconds = gasPriceRefreshIntervalInSeconds;
|
|
44
|
-
this.chainType = chainType;
|
|
33
|
+
arbitrumManager;
|
|
34
|
+
mantleManager;
|
|
35
|
+
constructor(config) {
|
|
36
|
+
this.config = config;
|
|
37
|
+
this.logger = config.getLogger({ module: "gas_price_manager" }, {
|
|
38
|
+
level: config.publicClientLogLevel || config.logLevel
|
|
39
|
+
});
|
|
40
|
+
const queueValidity = this.config.gasPriceExpiry * 1_000;
|
|
41
|
+
this.baseFeePerGasQueue = new TimedQueue(queueValidity);
|
|
42
|
+
this.maxFeePerGasQueue = new TimedQueue(queueValidity);
|
|
43
|
+
this.maxPriorityFeePerGasQueue = new TimedQueue(queueValidity);
|
|
45
44
|
// Periodically update gas prices if specified
|
|
46
|
-
if (this.
|
|
45
|
+
if (this.config.gasPriceRefreshInterval > 0) {
|
|
47
46
|
setInterval(() => {
|
|
48
|
-
if (this.legacyTransactions === false) {
|
|
47
|
+
if (this.config.legacyTransactions === false) {
|
|
49
48
|
this.updateBaseFee();
|
|
50
49
|
}
|
|
51
50
|
this.updateGasPrice();
|
|
52
|
-
}, this.
|
|
51
|
+
}, this.config.gasPriceRefreshInterval * 1000);
|
|
53
52
|
}
|
|
53
|
+
this.arbitrumManager = new ArbitrumManager(queueValidity);
|
|
54
|
+
this.mantleManager = new MantleManager(queueValidity);
|
|
54
55
|
}
|
|
55
56
|
init() {
|
|
56
57
|
return Promise.all([
|
|
57
58
|
this.updateGasPrice(),
|
|
58
|
-
this.legacyTransactions === false
|
|
59
|
+
this.config.legacyTransactions === false
|
|
59
60
|
? this.updateBaseFee()
|
|
60
61
|
: Promise.resolve()
|
|
61
62
|
]);
|
|
@@ -71,7 +72,7 @@ export class GasPriceManager {
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
async getPolygonGasPriceParameters() {
|
|
74
|
-
const gasStationUrl = getGasStationUrl(this.chain.id);
|
|
75
|
+
const gasStationUrl = getGasStationUrl(this.config.publicClient.chain.id);
|
|
75
76
|
try {
|
|
76
77
|
const data = await (await fetch(gasStationUrl)).json();
|
|
77
78
|
// take the standard speed here, SDK options will define the extra tip
|
|
@@ -84,21 +85,22 @@ export class GasPriceManager {
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
bumpTheGasPrice(gasPriceParameters) {
|
|
87
|
-
const bumpAmount = this.
|
|
88
|
-
const maxPriorityFeePerGas = maxBigInt(gasPriceParameters.maxPriorityFeePerGas, this.getDefaultGasFee(this.chain.id));
|
|
88
|
+
const bumpAmount = this.config.gasPriceBump;
|
|
89
|
+
const maxPriorityFeePerGas = maxBigInt(gasPriceParameters.maxPriorityFeePerGas, this.getDefaultGasFee(this.config.publicClient.chain.id));
|
|
89
90
|
const maxFeePerGas = maxBigInt(gasPriceParameters.maxFeePerGas, maxPriorityFeePerGas);
|
|
90
91
|
const result = {
|
|
91
92
|
maxFeePerGas: (maxFeePerGas * bumpAmount) / 100n,
|
|
92
93
|
maxPriorityFeePerGas: (maxPriorityFeePerGas * bumpAmount) / 100n
|
|
93
94
|
};
|
|
94
|
-
if (this.chain.id === celo.id ||
|
|
95
|
+
if (this.config.publicClient.chain.id === celo.id ||
|
|
96
|
+
this.config.publicClient.chain.id === celoAlfajores.id) {
|
|
95
97
|
const maxFee = maxBigInt(result.maxFeePerGas, result.maxPriorityFeePerGas);
|
|
96
98
|
return {
|
|
97
99
|
maxFeePerGas: maxFee,
|
|
98
100
|
maxPriorityFeePerGas: maxFee
|
|
99
101
|
};
|
|
100
102
|
}
|
|
101
|
-
if (this.chain.id === dfk.id) {
|
|
103
|
+
if (this.config.publicClient.chain.id === dfk.id) {
|
|
102
104
|
const maxFeePerGas = maxBigInt(5000000000n, result.maxFeePerGas);
|
|
103
105
|
const maxPriorityFeePerGas = maxBigInt(5000000000n, result.maxPriorityFeePerGas);
|
|
104
106
|
return {
|
|
@@ -107,7 +109,7 @@ export class GasPriceManager {
|
|
|
107
109
|
};
|
|
108
110
|
}
|
|
109
111
|
// set a minimum maxPriorityFee & maxFee to 1.5gwei on avalanche (because eth_maxPriorityFeePerGas returns 0)
|
|
110
|
-
if (this.chain.id === avalanche.id) {
|
|
112
|
+
if (this.config.publicClient.chain.id === avalanche.id) {
|
|
111
113
|
const maxFeePerGas = maxBigInt(parseGwei("1.5"), result.maxFeePerGas);
|
|
112
114
|
const maxPriorityFeePerGas = maxBigInt(parseGwei("1.5"), result.maxPriorityFeePerGas);
|
|
113
115
|
return {
|
|
@@ -129,30 +131,11 @@ export class GasPriceManager {
|
|
|
129
131
|
const feeAverage = feeHistory.reward.reduce((acc, cur) => cur[0] + acc, 0n) / 10n;
|
|
130
132
|
return minBigInt(feeAverage, gasPrice);
|
|
131
133
|
}
|
|
132
|
-
async getNextBaseFee(publicClient) {
|
|
133
|
-
const block = await publicClient.getBlock({
|
|
134
|
-
blockTag: "latest"
|
|
135
|
-
});
|
|
136
|
-
const currentBaseFeePerGas = block.baseFeePerGas || (await publicClient.getGasPrice());
|
|
137
|
-
const currentGasUsed = block.gasUsed;
|
|
138
|
-
const gasTarget = block.gasLimit / 2n;
|
|
139
|
-
if (currentGasUsed === gasTarget) {
|
|
140
|
-
return currentBaseFeePerGas;
|
|
141
|
-
}
|
|
142
|
-
if (currentGasUsed > gasTarget) {
|
|
143
|
-
const gasUsedDelta = currentGasUsed - gasTarget;
|
|
144
|
-
const baseFeePerGasDelta = maxBigInt((currentBaseFeePerGas * gasUsedDelta) / gasTarget / 8n, 1n);
|
|
145
|
-
return currentBaseFeePerGas + baseFeePerGasDelta;
|
|
146
|
-
}
|
|
147
|
-
const gasUsedDelta = currentGasUsed - gasTarget;
|
|
148
|
-
const baseFeePerGasDelta = (currentBaseFeePerGas * gasUsedDelta) / gasTarget / 8n;
|
|
149
|
-
return currentBaseFeePerGas - baseFeePerGasDelta;
|
|
150
|
-
}
|
|
151
134
|
async getLegacyTransactionGasPrice() {
|
|
152
135
|
let gasPrice;
|
|
153
136
|
try {
|
|
154
|
-
const gasInfo = await this.publicClient.estimateFeesPerGas({
|
|
155
|
-
chain: this.chain,
|
|
137
|
+
const gasInfo = await this.config.publicClient.estimateFeesPerGas({
|
|
138
|
+
chain: this.config.publicClient.chain,
|
|
156
139
|
type: "legacy"
|
|
157
140
|
});
|
|
158
141
|
gasPrice = gasInfo.gasPrice;
|
|
@@ -165,7 +148,7 @@ export class GasPriceManager {
|
|
|
165
148
|
if (gasPrice === undefined) {
|
|
166
149
|
this.logger.warn("gasPrice is undefined, using fallback value");
|
|
167
150
|
try {
|
|
168
|
-
gasPrice = await this.publicClient.getGasPrice();
|
|
151
|
+
gasPrice = await this.config.publicClient.getGasPrice();
|
|
169
152
|
}
|
|
170
153
|
catch (e) {
|
|
171
154
|
this.logger.error("failed to get fallback gasPrice");
|
|
@@ -182,8 +165,8 @@ export class GasPriceManager {
|
|
|
182
165
|
let maxFeePerGas;
|
|
183
166
|
let maxPriorityFeePerGas;
|
|
184
167
|
try {
|
|
185
|
-
const fees = await this.publicClient.estimateFeesPerGas({
|
|
186
|
-
chain: this.chain
|
|
168
|
+
const fees = await this.config.publicClient.estimateFeesPerGas({
|
|
169
|
+
chain: this.config.publicClient.chain
|
|
187
170
|
});
|
|
188
171
|
maxFeePerGas = fees.maxFeePerGas;
|
|
189
172
|
maxPriorityFeePerGas = fees.maxPriorityFeePerGas;
|
|
@@ -198,7 +181,7 @@ export class GasPriceManager {
|
|
|
198
181
|
this.logger.warn("maxPriorityFeePerGas is undefined, using fallback value");
|
|
199
182
|
try {
|
|
200
183
|
maxPriorityFeePerGas =
|
|
201
|
-
await this.getFallBackMaxPriorityFeePerGas(this.publicClient, maxFeePerGas ?? 0n);
|
|
184
|
+
await this.getFallBackMaxPriorityFeePerGas(this.config.publicClient, maxFeePerGas ?? 0n);
|
|
202
185
|
}
|
|
203
186
|
catch (e) {
|
|
204
187
|
this.logger.error("failed to get fallback maxPriorityFeePerGas");
|
|
@@ -210,7 +193,7 @@ export class GasPriceManager {
|
|
|
210
193
|
this.logger.warn("maxFeePerGas is undefined, using fallback value");
|
|
211
194
|
try {
|
|
212
195
|
maxFeePerGas =
|
|
213
|
-
(await this.
|
|
196
|
+
(await this.config.publicClient.getGasPrice()) +
|
|
214
197
|
maxPriorityFeePerGas;
|
|
215
198
|
}
|
|
216
199
|
catch (e) {
|
|
@@ -224,60 +207,11 @@ export class GasPriceManager {
|
|
|
224
207
|
}
|
|
225
208
|
return { maxFeePerGas, maxPriorityFeePerGas };
|
|
226
209
|
}
|
|
227
|
-
saveBaseFeePerGas(gasPrice, timestamp) {
|
|
228
|
-
const queue = this.queueBaseFeePerGas;
|
|
229
|
-
const last = queue.length > 0 ? queue[queue.length - 1] : null;
|
|
230
|
-
if (!last || timestamp - last.timestamp >= 1000) {
|
|
231
|
-
if (queue.length >= this.maxQueueSize) {
|
|
232
|
-
queue.shift();
|
|
233
|
-
}
|
|
234
|
-
queue.push({ baseFeePerGas: gasPrice, timestamp });
|
|
235
|
-
}
|
|
236
|
-
else if (gasPrice < last.baseFeePerGas) {
|
|
237
|
-
last.baseFeePerGas = gasPrice;
|
|
238
|
-
last.timestamp = timestamp;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
saveMaxFeePerGas(gasPrice, timestamp) {
|
|
242
|
-
const queue = this.queueMaxFeePerGas;
|
|
243
|
-
const last = queue.length > 0 ? queue[queue.length - 1] : null;
|
|
244
|
-
if (!last || timestamp - last.timestamp >= 1000) {
|
|
245
|
-
if (queue.length >= this.maxQueueSize) {
|
|
246
|
-
queue.shift();
|
|
247
|
-
}
|
|
248
|
-
queue.push({ maxFeePerGas: gasPrice, timestamp });
|
|
249
|
-
}
|
|
250
|
-
else if (gasPrice < last.maxFeePerGas) {
|
|
251
|
-
last.maxFeePerGas = gasPrice;
|
|
252
|
-
last.timestamp = timestamp;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
saveMaxPriorityFeePerGas(gasPrice, timestamp) {
|
|
256
|
-
const queue = this.queueMaxPriorityFeePerGas;
|
|
257
|
-
const last = queue.length > 0 ? queue[queue.length - 1] : null;
|
|
258
|
-
if (!last || timestamp - last.timestamp >= 1000) {
|
|
259
|
-
if (queue.length >= this.maxQueueSize) {
|
|
260
|
-
queue.shift();
|
|
261
|
-
}
|
|
262
|
-
queue.push({ maxPriorityFeePerGas: gasPrice, timestamp });
|
|
263
|
-
}
|
|
264
|
-
else if (gasPrice < last.maxPriorityFeePerGas) {
|
|
265
|
-
last.maxPriorityFeePerGas = gasPrice;
|
|
266
|
-
last.timestamp = timestamp;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
saveGasPrice(gasPrice, timestamp) {
|
|
270
|
-
return new Promise((resolve) => {
|
|
271
|
-
this.saveMaxFeePerGas(gasPrice.maxFeePerGas, timestamp);
|
|
272
|
-
this.saveMaxPriorityFeePerGas(gasPrice.maxPriorityFeePerGas, timestamp);
|
|
273
|
-
resolve();
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
210
|
async innerGetGasPrice() {
|
|
277
211
|
let maxFeePerGas = 0n;
|
|
278
212
|
let maxPriorityFeePerGas = 0n;
|
|
279
|
-
if (this.chain.id === polygon.id ||
|
|
280
|
-
this.chain.id === polygonMumbai.id) {
|
|
213
|
+
if (this.config.publicClient.chain.id === polygon.id ||
|
|
214
|
+
this.config.publicClient.chain.id === polygonMumbai.id) {
|
|
281
215
|
const polygonEstimate = await this.getPolygonGasPriceParameters();
|
|
282
216
|
if (polygonEstimate) {
|
|
283
217
|
const gasPrice = this.bumpTheGasPrice({
|
|
@@ -290,7 +224,7 @@ export class GasPriceManager {
|
|
|
290
224
|
};
|
|
291
225
|
}
|
|
292
226
|
}
|
|
293
|
-
if (this.legacyTransactions) {
|
|
227
|
+
if (this.config.legacyTransactions) {
|
|
294
228
|
const gasPrice = this.bumpTheGasPrice(await this.getLegacyTransactionGasPrice());
|
|
295
229
|
return {
|
|
296
230
|
maxFeePerGas: maxBigInt(gasPrice.maxFeePerGas, maxFeePerGas),
|
|
@@ -310,65 +244,77 @@ export class GasPriceManager {
|
|
|
310
244
|
};
|
|
311
245
|
}
|
|
312
246
|
async updateBaseFee() {
|
|
313
|
-
const latestBlock = await this.publicClient.getBlock();
|
|
247
|
+
const latestBlock = await this.config.publicClient.getBlock();
|
|
314
248
|
if (latestBlock.baseFeePerGas === null) {
|
|
315
249
|
throw new RpcError("block does not have baseFeePerGas");
|
|
316
250
|
}
|
|
317
251
|
const baseFee = latestBlock.baseFeePerGas;
|
|
318
|
-
this.
|
|
252
|
+
this.baseFeePerGasQueue.saveValue(baseFee);
|
|
319
253
|
return baseFee;
|
|
320
254
|
}
|
|
321
|
-
getBaseFee() {
|
|
322
|
-
if (this.legacyTransactions) {
|
|
255
|
+
async getBaseFee() {
|
|
256
|
+
if (this.config.legacyTransactions) {
|
|
323
257
|
throw new RpcError("baseFee is not available for legacy transactions");
|
|
324
258
|
}
|
|
325
|
-
if (this.
|
|
326
|
-
return this.updateBaseFee();
|
|
259
|
+
if (this.config.gasPriceRefreshInterval === 0) {
|
|
260
|
+
return await this.updateBaseFee();
|
|
261
|
+
}
|
|
262
|
+
let baseFee = this.baseFeePerGasQueue.getLatestValue();
|
|
263
|
+
if (!baseFee) {
|
|
264
|
+
baseFee = await this.getBaseFee();
|
|
327
265
|
}
|
|
328
|
-
|
|
329
|
-
return baseFeePerGas;
|
|
266
|
+
return baseFee;
|
|
330
267
|
}
|
|
331
268
|
async updateGasPrice() {
|
|
332
269
|
const gasPrice = await this.innerGetGasPrice();
|
|
333
|
-
this.
|
|
334
|
-
|
|
335
|
-
maxPriorityFeePerGas: gasPrice.maxPriorityFeePerGas
|
|
336
|
-
}, Date.now());
|
|
270
|
+
this.maxFeePerGasQueue.saveValue(gasPrice.maxFeePerGas);
|
|
271
|
+
this.maxPriorityFeePerGasQueue.saveValue(gasPrice.maxPriorityFeePerGas);
|
|
337
272
|
return gasPrice;
|
|
338
273
|
}
|
|
339
|
-
getGasPrice() {
|
|
340
|
-
if (this.
|
|
341
|
-
return this.updateGasPrice();
|
|
274
|
+
async getGasPrice() {
|
|
275
|
+
if (this.config.gasPriceRefreshInterval === 0) {
|
|
276
|
+
return await this.updateGasPrice();
|
|
277
|
+
}
|
|
278
|
+
const maxFeePerGas = this.maxFeePerGasQueue.getLatestValue();
|
|
279
|
+
const maxPriorityFeePerGas = this.maxPriorityFeePerGasQueue.getLatestValue();
|
|
280
|
+
if (!maxFeePerGas || !maxPriorityFeePerGas) {
|
|
281
|
+
throw new RpcError("No gas price available");
|
|
342
282
|
}
|
|
343
|
-
const { maxPriorityFeePerGas } = this.queueMaxPriorityFeePerGas[this.queueMaxPriorityFeePerGas.length - 1];
|
|
344
|
-
const { maxFeePerGas } = this.queueMaxFeePerGas[this.queueMaxFeePerGas.length - 1];
|
|
345
283
|
return {
|
|
346
284
|
maxFeePerGas,
|
|
347
285
|
maxPriorityFeePerGas
|
|
348
286
|
};
|
|
349
287
|
}
|
|
288
|
+
async getNetworkGasPrice() {
|
|
289
|
+
return await this.innerGetGasPrice();
|
|
290
|
+
}
|
|
350
291
|
async getMaxBaseFeePerGas() {
|
|
351
|
-
|
|
352
|
-
|
|
292
|
+
let maxBaseFeePerGas = this.baseFeePerGasQueue.getMaxValue();
|
|
293
|
+
if (!maxBaseFeePerGas) {
|
|
294
|
+
maxBaseFeePerGas = await this.getBaseFee();
|
|
353
295
|
}
|
|
354
|
-
return
|
|
296
|
+
return maxBaseFeePerGas;
|
|
355
297
|
}
|
|
356
298
|
async getMinMaxFeePerGas() {
|
|
357
|
-
|
|
358
|
-
|
|
299
|
+
let minMaxFeePerGas = this.maxFeePerGasQueue.getMinValue();
|
|
300
|
+
if (!minMaxFeePerGas) {
|
|
301
|
+
const gasPrice = await this.getGasPrice();
|
|
302
|
+
minMaxFeePerGas = gasPrice.maxFeePerGas;
|
|
359
303
|
}
|
|
360
|
-
return
|
|
304
|
+
return minMaxFeePerGas;
|
|
361
305
|
}
|
|
362
306
|
async getMinMaxPriorityFeePerGas() {
|
|
363
|
-
|
|
364
|
-
|
|
307
|
+
let minMaxPriorityFeePerGas = this.maxPriorityFeePerGasQueue.getMinValue();
|
|
308
|
+
if (!minMaxPriorityFeePerGas) {
|
|
309
|
+
const gasPrices = await this.getGasPrice();
|
|
310
|
+
minMaxPriorityFeePerGas = gasPrices.maxPriorityFeePerGas;
|
|
365
311
|
}
|
|
366
|
-
return
|
|
312
|
+
return minMaxPriorityFeePerGas;
|
|
367
313
|
}
|
|
368
314
|
async validateGasPrice(gasPrice) {
|
|
369
315
|
let lowestMaxFeePerGas = await this.getMinMaxFeePerGas();
|
|
370
316
|
let lowestMaxPriorityFeePerGas = await this.getMinMaxPriorityFeePerGas();
|
|
371
|
-
if (this.chainType === "hedera") {
|
|
317
|
+
if (this.config.chainType === "hedera") {
|
|
372
318
|
lowestMaxFeePerGas /= 10n ** 9n;
|
|
373
319
|
lowestMaxPriorityFeePerGas /= 10n ** 9n;
|
|
374
320
|
}
|