@pimlico/alto 0.0.4 → 0.0.6
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 +0 -4
- package/esm/cli/alto.js.map +1 -1
- package/esm/cli/config/bundler.d.ts +2296 -22
- package/esm/cli/config/bundler.js +31 -4
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.js +53 -4
- package/esm/cli/config/options.js.map +1 -1
- package/esm/cli/customTransport.js +5 -1
- package/esm/cli/customTransport.js.map +1 -1
- package/esm/cli/handler.js +14 -3
- package/esm/cli/handler.js.map +1 -1
- package/esm/cli/instrumentation.js +2 -2
- package/esm/cli/instrumentation.js.map +1 -1
- package/esm/cli/setupServer.d.ts +2 -1
- package/esm/cli/setupServer.js +51 -27
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/executor/executor.d.ts +7 -14
- package/esm/executor/executor.js +139 -128
- package/esm/executor/executor.js.map +1 -1
- package/esm/executor/executorManager.d.ts +58 -4
- package/esm/executor/executorManager.js +207 -53
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/executor/senderManager.d.ts +2 -1
- package/esm/executor/senderManager.js +3 -0
- package/esm/executor/senderManager.js.map +1 -1
- package/esm/executor/utilityWalletMonitor.d.ts +15 -0
- package/esm/executor/utilityWalletMonitor.js +38 -0
- package/esm/executor/utilityWalletMonitor.js.map +1 -0
- package/esm/executor/utils.d.ts +1 -2
- package/esm/executor/utils.js +49 -38
- package/esm/executor/utils.js.map +1 -1
- package/esm/handlers/compressionHandler.js.map +1 -0
- package/esm/handlers/eventManager.d.ts +21 -0
- package/esm/handlers/eventManager.js +166 -0
- package/esm/handlers/eventManager.js.map +1 -0
- package/{lib/utils → esm/handlers}/gasPriceManager.d.ts +19 -5
- package/esm/{utils → handlers}/gasPriceManager.js +58 -13
- package/esm/handlers/gasPriceManager.js.map +1 -0
- package/esm/handlers/index.d.ts +4 -0
- package/esm/handlers/index.js +4 -0
- package/esm/handlers/index.js.map +1 -0
- package/esm/mempool/index.d.ts +0 -1
- package/esm/mempool/index.js +0 -1
- package/esm/mempool/index.js.map +1 -1
- package/esm/mempool/mempool.d.ts +4 -2
- package/esm/mempool/mempool.js +65 -19
- package/esm/mempool/mempool.js.map +1 -1
- package/esm/rpc/EntryPointSimulationsV07.d.ts +2 -2
- package/esm/rpc/EntryPointSimulationsV07.js +10 -7
- package/esm/rpc/EntryPointSimulationsV07.js.map +1 -1
- package/esm/rpc/gasEstimation.d.ts +3 -3
- package/esm/rpc/gasEstimation.js +22 -17
- package/esm/rpc/gasEstimation.js.map +1 -1
- package/esm/rpc/nonceQueuer.d.ts +4 -1
- package/esm/rpc/nonceQueuer.js +9 -3
- package/esm/rpc/nonceQueuer.js.map +1 -1
- package/esm/rpc/rpcHandler.d.ts +53 -3
- package/esm/rpc/rpcHandler.js +132 -231
- package/esm/rpc/rpcHandler.js.map +1 -1
- package/esm/rpc/server.d.ts +2 -1
- package/esm/rpc/server.js +6 -1
- package/esm/rpc/server.js.map +1 -1
- package/esm/rpc/validation/SafeValidator.d.ts +3 -2
- package/esm/rpc/validation/SafeValidator.js +2 -2
- package/esm/rpc/validation/SafeValidator.js.map +1 -1
- package/esm/rpc/validation/UnsafeValidator.d.ts +5 -2
- package/esm/rpc/validation/UnsafeValidator.js +10 -6
- package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
- package/esm/rpc/validation/tracer.js +1 -0
- package/esm/rpc/validation/tracer.js.map +1 -1
- package/esm/types/schemas.d.ts +1029 -333
- package/esm/types/schemas.js +94 -20
- package/esm/types/schemas.js.map +1 -1
- package/esm/types/utils.d.ts +1 -1
- package/esm/types/validation.js +7 -2
- package/esm/types/validation.js.map +1 -1
- package/esm/utils/bigInt.d.ts +1 -0
- package/esm/utils/bigInt.js +4 -0
- package/esm/utils/bigInt.js.map +1 -1
- package/esm/utils/helpers.d.ts +1 -0
- package/esm/utils/helpers.js +6 -0
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/index.d.ts +0 -3
- package/esm/utils/index.js +0 -3
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/metrics.d.ts +4 -0
- package/esm/utils/metrics.js +29 -1
- package/esm/utils/metrics.js.map +1 -1
- package/esm/utils/rpc-reply.d.ts +1 -1
- package/esm/utils/rpc-reply.js +2 -1
- package/esm/utils/rpc-reply.js.map +1 -1
- package/esm/utils/userop.d.ts +66 -6
- package/esm/utils/userop.js +183 -96
- package/esm/utils/userop.js.map +1 -1
- package/esm/utils/validation.d.ts +1 -1
- package/esm/utils/validation.js +9 -13
- package/esm/utils/validation.js.map +1 -1
- package/lib/cli/alto.js +0 -4
- package/lib/cli/alto.js.map +1 -1
- package/lib/cli/config/bundler.d.ts +2296 -22
- package/lib/cli/config/bundler.js +30 -3
- package/lib/cli/config/bundler.js.map +1 -1
- package/lib/cli/config/options.js +53 -4
- package/lib/cli/config/options.js.map +1 -1
- package/lib/cli/customTransport.js +5 -1
- package/lib/cli/customTransport.js.map +1 -1
- package/lib/cli/handler.js +13 -2
- package/lib/cli/handler.js.map +1 -1
- package/lib/cli/instrumentation.js +2 -2
- package/lib/cli/instrumentation.js.map +1 -1
- package/lib/cli/setupServer.d.ts +2 -1
- package/lib/cli/setupServer.js +52 -28
- package/lib/cli/setupServer.js.map +1 -1
- package/lib/executor/executor.d.ts +7 -14
- package/lib/executor/executor.js +138 -128
- package/lib/executor/executor.js.map +1 -1
- package/lib/executor/executorManager.d.ts +58 -4
- package/lib/executor/executorManager.js +205 -51
- package/lib/executor/executorManager.js.map +1 -1
- package/lib/executor/senderManager.d.ts +2 -1
- package/lib/executor/senderManager.js +3 -0
- package/lib/executor/senderManager.js.map +1 -1
- package/lib/executor/utilityWalletMonitor.d.ts +15 -0
- package/lib/executor/utilityWalletMonitor.js +42 -0
- package/lib/executor/utilityWalletMonitor.js.map +1 -0
- package/lib/executor/utils.d.ts +1 -2
- package/lib/executor/utils.js +48 -37
- package/lib/executor/utils.js.map +1 -1
- package/lib/handlers/compressionHandler.js.map +1 -0
- package/lib/handlers/eventManager.d.ts +21 -0
- package/lib/handlers/eventManager.js +196 -0
- package/lib/handlers/eventManager.js.map +1 -0
- package/{esm/utils → lib/handlers}/gasPriceManager.d.ts +19 -5
- package/lib/{utils → handlers}/gasPriceManager.js +58 -13
- package/lib/handlers/gasPriceManager.js.map +1 -0
- package/lib/handlers/index.d.ts +4 -0
- package/lib/handlers/index.js +20 -0
- package/lib/handlers/index.js.map +1 -0
- package/lib/mempool/index.d.ts +0 -1
- package/lib/mempool/index.js +0 -1
- package/lib/mempool/index.js.map +1 -1
- package/lib/mempool/mempool.d.ts +4 -2
- package/lib/mempool/mempool.js +65 -19
- package/lib/mempool/mempool.js.map +1 -1
- package/lib/rpc/EntryPointSimulationsV07.d.ts +2 -2
- package/lib/rpc/EntryPointSimulationsV07.js +10 -7
- package/lib/rpc/EntryPointSimulationsV07.js.map +1 -1
- package/lib/rpc/gasEstimation.d.ts +3 -3
- package/lib/rpc/gasEstimation.js +22 -17
- package/lib/rpc/gasEstimation.js.map +1 -1
- package/lib/rpc/nonceQueuer.d.ts +4 -1
- package/lib/rpc/nonceQueuer.js +9 -3
- package/lib/rpc/nonceQueuer.js.map +1 -1
- package/lib/rpc/rpcHandler.d.ts +53 -3
- package/lib/rpc/rpcHandler.js +129 -251
- package/lib/rpc/rpcHandler.js.map +1 -1
- package/lib/rpc/server.d.ts +2 -1
- package/lib/rpc/server.js +6 -1
- package/lib/rpc/server.js.map +1 -1
- package/lib/rpc/validation/SafeValidator.d.ts +3 -2
- package/lib/rpc/validation/SafeValidator.js +2 -2
- package/lib/rpc/validation/SafeValidator.js.map +1 -1
- package/lib/rpc/validation/UnsafeValidator.d.ts +5 -2
- package/lib/rpc/validation/UnsafeValidator.js +33 -6
- package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
- package/lib/rpc/validation/tracer.js +1 -0
- package/lib/rpc/validation/tracer.js.map +1 -1
- package/lib/types/schemas.d.ts +1029 -333
- package/lib/types/schemas.js +93 -19
- package/lib/types/schemas.js.map +1 -1
- package/lib/types/utils.d.ts +1 -1
- package/lib/types/validation.js +7 -2
- package/lib/types/validation.js.map +1 -1
- package/lib/utils/bigInt.d.ts +1 -0
- package/lib/utils/bigInt.js +6 -1
- package/lib/utils/bigInt.js.map +1 -1
- package/lib/utils/helpers.d.ts +1 -0
- package/lib/utils/helpers.js +8 -1
- package/lib/utils/helpers.js.map +1 -1
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/index.js +0 -3
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/metrics.d.ts +4 -0
- package/lib/utils/metrics.js +29 -1
- package/lib/utils/metrics.js.map +1 -1
- package/lib/utils/rpc-reply.d.ts +1 -1
- package/lib/utils/rpc-reply.js +2 -1
- package/lib/utils/rpc-reply.js.map +1 -1
- package/lib/utils/userop.d.ts +66 -6
- package/lib/utils/userop.js +208 -96
- package/lib/utils/userop.js.map +1 -1
- package/lib/utils/validation.d.ts +1 -1
- package/lib/utils/validation.js +9 -36
- package/lib/utils/validation.js.map +1 -1
- package/package.json +15 -14
- package/esm/executor/test/utils.d.ts +0 -13
- package/esm/executor/test/utils.js +0 -75
- package/esm/executor/test/utils.js.map +0 -1
- package/esm/mempool/nullMempool.d.ts +0 -15
- package/esm/mempool/nullMempool.js +0 -36
- package/esm/mempool/nullMempool.js.map +0 -1
- package/esm/types/test/validationTestErrors.d.ts +0 -3
- package/esm/types/test/validationTestErrors.js +0 -229
- package/esm/types/test/validationTestErrors.js.map +0 -1
- package/esm/utils/compressionHandler.js.map +0 -1
- package/esm/utils/gasPriceManager.js.map +0 -1
- package/esm/utils/test.d.ts +0 -17
- package/esm/utils/test.js +0 -130
- package/esm/utils/test.js.map +0 -1
- package/lib/executor/test/utils.d.ts +0 -13
- package/lib/executor/test/utils.js +0 -81
- package/lib/executor/test/utils.js.map +0 -1
- package/lib/mempool/nullMempool.d.ts +0 -15
- package/lib/mempool/nullMempool.js +0 -40
- package/lib/mempool/nullMempool.js.map +0 -1
- package/lib/types/test/validationTestErrors.d.ts +0 -3
- package/lib/types/test/validationTestErrors.js +0 -232
- package/lib/types/test/validationTestErrors.js.map +0 -1
- package/lib/utils/compressionHandler.js.map +0 -1
- package/lib/utils/gasPriceManager.js.map +0 -1
- package/lib/utils/test.d.ts +0 -17
- package/lib/utils/test.js +0 -161
- package/lib/utils/test.js.map +0 -1
- /package/esm/{utils → handlers}/compressionHandler.d.ts +0 -0
- /package/esm/{utils → handlers}/compressionHandler.js +0 -0
- /package/lib/{utils → handlers}/compressionHandler.d.ts +0 -0
- /package/lib/{utils → handlers}/compressionHandler.js +0 -0
package/lib/executor/utils.js
CHANGED
|
@@ -24,20 +24,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.flushStuckTransaction = exports.filterOpsAndEstimateGas = exports.createCompressedCalldata = exports.simulatedOpsToResults = void 0;
|
|
27
|
+
// biome-ignore lint/style/noNamespaceImport: explicitly make it clear when sentry is used
|
|
28
|
+
const sentry = __importStar(require("@sentry/node"));
|
|
27
29
|
const types_1 = require("../types/index.js");
|
|
28
30
|
const utils_1 = require("../utils/index.js");
|
|
29
|
-
const sentry = __importStar(require("@sentry/node"));
|
|
30
31
|
const viem_1 = require("viem");
|
|
31
32
|
function simulatedOpsToResults(simulatedOps, transactionInfo) {
|
|
32
|
-
return simulatedOps.map((
|
|
33
|
-
if (
|
|
33
|
+
return simulatedOps.map(({ reason, owh }) => {
|
|
34
|
+
if (reason === undefined) {
|
|
34
35
|
return {
|
|
35
36
|
status: "success",
|
|
36
37
|
value: {
|
|
37
38
|
userOperation: {
|
|
38
39
|
entryPoint: transactionInfo.entryPoint,
|
|
39
|
-
mempoolUserOperation:
|
|
40
|
-
userOperationHash:
|
|
40
|
+
mempoolUserOperation: owh.mempoolUserOperation,
|
|
41
|
+
userOperationHash: owh.userOperationHash,
|
|
41
42
|
lastReplaced: Date.now(),
|
|
42
43
|
firstSubmitted: Date.now()
|
|
43
44
|
},
|
|
@@ -49,9 +50,9 @@ function simulatedOpsToResults(simulatedOps, transactionInfo) {
|
|
|
49
50
|
status: "failure",
|
|
50
51
|
error: {
|
|
51
52
|
entryPoint: transactionInfo.entryPoint,
|
|
52
|
-
userOperation:
|
|
53
|
-
userOpHash:
|
|
54
|
-
reason:
|
|
53
|
+
userOperation: owh.mempoolUserOperation,
|
|
54
|
+
userOpHash: owh.userOperationHash,
|
|
55
|
+
reason: reason
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
});
|
|
@@ -78,16 +79,17 @@ async function filterOpsAndEstimateGas(entryPoint, callContext, wallet, ops, non
|
|
|
78
79
|
});
|
|
79
80
|
let gasLimit;
|
|
80
81
|
// TODO compressed ops are not supported in V07
|
|
81
|
-
const isUserOpV06 = callContext.type
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
const isUserOpV06 = callContext.type !== "default" || // All compressed ops are v6 by default
|
|
83
|
+
(0, utils_1.isVersion06)(simulatedOps[0].owh.mempoolUserOperation);
|
|
84
|
+
const gasOptions = onlyPre1559
|
|
85
|
+
? { gasPrice: maxFeePerGas }
|
|
86
|
+
: { maxFeePerGas, maxPriorityFeePerGas };
|
|
87
|
+
let fixedEstimationGasLimit = fixedGasLimitForEstimation;
|
|
88
|
+
let retriesLeft = 5;
|
|
84
89
|
while (simulatedOps.filter((op) => op.reason === undefined).length > 0) {
|
|
85
90
|
try {
|
|
86
|
-
const gasOptions = onlyPre1559
|
|
87
|
-
? { gasPrice: maxFeePerGas }
|
|
88
|
-
: { maxFeePerGas, maxPriorityFeePerGas };
|
|
89
91
|
if (callContext.type === "default") {
|
|
90
|
-
const ep = callContext
|
|
92
|
+
const { ep } = callContext;
|
|
91
93
|
const opsToSend = simulatedOps
|
|
92
94
|
.filter((op) => op.reason === undefined)
|
|
93
95
|
.map((op) => {
|
|
@@ -102,8 +104,8 @@ async function filterOpsAndEstimateGas(entryPoint, callContext, wallet, ops, non
|
|
|
102
104
|
account: wallet,
|
|
103
105
|
nonce: nonce,
|
|
104
106
|
blockTag: blockTag,
|
|
105
|
-
...(
|
|
106
|
-
gas:
|
|
107
|
+
...(fixedEstimationGasLimit !== undefined && {
|
|
108
|
+
gas: fixedEstimationGasLimit
|
|
107
109
|
}),
|
|
108
110
|
...gasOptions
|
|
109
111
|
});
|
|
@@ -118,13 +120,15 @@ async function filterOpsAndEstimateGas(entryPoint, callContext, wallet, ops, non
|
|
|
118
120
|
to: bundleBulker,
|
|
119
121
|
account: wallet,
|
|
120
122
|
data: createCompressedCalldata(opsToSend, perOpInflatorId),
|
|
121
|
-
|
|
123
|
+
...(fixedEstimationGasLimit !== undefined && {
|
|
124
|
+
gas: fixedEstimationGasLimit
|
|
125
|
+
}),
|
|
122
126
|
nonce: nonce,
|
|
123
127
|
blockTag: blockTag,
|
|
124
128
|
...gasOptions
|
|
125
129
|
});
|
|
126
130
|
}
|
|
127
|
-
return { simulatedOps, gasLimit
|
|
131
|
+
return { simulatedOps, gasLimit };
|
|
128
132
|
}
|
|
129
133
|
catch (err) {
|
|
130
134
|
logger.error({ err, blockTag }, "error estimating gas");
|
|
@@ -140,6 +144,12 @@ async function filterOpsAndEstimateGas(entryPoint, callContext, wallet, ops, non
|
|
|
140
144
|
errorData = failedOpWithRevertError.data.args;
|
|
141
145
|
}
|
|
142
146
|
if (errorData) {
|
|
147
|
+
if (errorData.reason.indexOf("AA95 out of gas") !== -1 &&
|
|
148
|
+
retriesLeft > 0) {
|
|
149
|
+
retriesLeft--;
|
|
150
|
+
fixedEstimationGasLimit = (0, utils_1.scaleBigIntByPercent)(fixedEstimationGasLimit || BigInt(30_000_000), 110);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
143
153
|
logger.debug({
|
|
144
154
|
errorData,
|
|
145
155
|
userOpHashes: simulatedOps
|
|
@@ -159,20 +169,26 @@ async function filterOpsAndEstimateGas(entryPoint, callContext, wallet, ops, non
|
|
|
159
169
|
}, "failed to parse failedOpError");
|
|
160
170
|
return {
|
|
161
171
|
simulatedOps: [],
|
|
162
|
-
gasLimit: 0n
|
|
163
|
-
resubmitAllOps: false
|
|
172
|
+
gasLimit: 0n
|
|
164
173
|
};
|
|
165
174
|
}
|
|
166
175
|
}
|
|
167
176
|
else if (e instanceof viem_1.EstimateGasExecutionError ||
|
|
168
177
|
err instanceof viem_1.EstimateGasExecutionError) {
|
|
169
|
-
if (e?.cause instanceof viem_1.FeeCapTooLowError) {
|
|
178
|
+
if (e?.cause instanceof viem_1.FeeCapTooLowError && retriesLeft > 0) {
|
|
179
|
+
retriesLeft--;
|
|
170
180
|
logger.info({ error: e.shortMessage }, "error estimating gas due to max fee < basefee");
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
181
|
+
if ("gasPrice" in gasOptions) {
|
|
182
|
+
gasOptions.gasPrice = (0, utils_1.scaleBigIntByPercent)(gasOptions.gasPrice || maxFeePerGas, 125);
|
|
183
|
+
}
|
|
184
|
+
if ("maxFeePerGas" in gasOptions) {
|
|
185
|
+
gasOptions.maxFeePerGas = (0, utils_1.scaleBigIntByPercent)(gasOptions.maxFeePerGas || maxFeePerGas, 125);
|
|
186
|
+
}
|
|
187
|
+
if ("maxPriorityFeePerGas" in gasOptions) {
|
|
188
|
+
gasOptions.maxPriorityFeePerGas = (0, utils_1.scaleBigIntByPercent)(gasOptions.maxPriorityFeePerGas ||
|
|
189
|
+
maxPriorityFeePerGas, 125);
|
|
190
|
+
}
|
|
191
|
+
continue;
|
|
176
192
|
}
|
|
177
193
|
try {
|
|
178
194
|
let errorHexData = "0x";
|
|
@@ -201,8 +217,7 @@ async function filterOpsAndEstimateGas(entryPoint, callContext, wallet, ops, non
|
|
|
201
217
|
}, "unexpected error result");
|
|
202
218
|
return {
|
|
203
219
|
simulatedOps: [],
|
|
204
|
-
gasLimit: 0n
|
|
205
|
-
resubmitAllOps: false
|
|
220
|
+
gasLimit: 0n
|
|
206
221
|
};
|
|
207
222
|
}
|
|
208
223
|
const failingOp = simulatedOps.filter((op) => op.reason === undefined)[Number(errorResult.args[0])];
|
|
@@ -212,22 +227,21 @@ async function filterOpsAndEstimateGas(entryPoint, callContext, wallet, ops, non
|
|
|
212
227
|
logger.error({ error: JSON.stringify(err) }, "failed to parse error result");
|
|
213
228
|
return {
|
|
214
229
|
simulatedOps: [],
|
|
215
|
-
gasLimit: 0n
|
|
216
|
-
resubmitAllOps: false
|
|
230
|
+
gasLimit: 0n
|
|
217
231
|
};
|
|
218
232
|
}
|
|
219
233
|
}
|
|
220
234
|
else {
|
|
221
235
|
sentry.captureException(err);
|
|
222
236
|
logger.error({ error: JSON.stringify(err), blockTag }, "error estimating gas");
|
|
223
|
-
return { simulatedOps: [], gasLimit: 0n
|
|
237
|
+
return { simulatedOps: [], gasLimit: 0n };
|
|
224
238
|
}
|
|
225
239
|
}
|
|
226
240
|
}
|
|
227
|
-
return { simulatedOps, gasLimit: 0n
|
|
241
|
+
return { simulatedOps, gasLimit: 0n };
|
|
228
242
|
}
|
|
229
243
|
exports.filterOpsAndEstimateGas = filterOpsAndEstimateGas;
|
|
230
|
-
async function flushStuckTransaction(publicClient, walletClient, wallet, gasPrice, logger
|
|
244
|
+
async function flushStuckTransaction(publicClient, walletClient, wallet, gasPrice, logger) {
|
|
231
245
|
const latestNonce = await publicClient.getTransactionCount({
|
|
232
246
|
address: wallet.address,
|
|
233
247
|
blockTag: "latest"
|
|
@@ -257,9 +271,6 @@ async function flushStuckTransaction(publicClient, walletClient, wallet, gasPric
|
|
|
257
271
|
maxPriorityFeePerGas: gasPrice
|
|
258
272
|
});
|
|
259
273
|
logger.debug({ txHash, nonce: nonceToFlush, wallet: wallet.address }, "flushed stuck transaction");
|
|
260
|
-
// TODO: We don't know if the entrypoint is the V06 or V07. So we try and catch both.
|
|
261
|
-
await (0, utils_1.transactionIncluded)(true, txHash, publicClient, entryPoint);
|
|
262
|
-
await (0, utils_1.transactionIncluded)(false, txHash, publicClient, entryPoint);
|
|
263
274
|
}
|
|
264
275
|
catch (e) {
|
|
265
276
|
sentry.captureException(e);
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0FAA0F;AAC1F,qDAAsC;AAEtC,uCAcoB;AAEpB,uCAMoB;AACpB,+BAgBa;AAEb,SAAgB,qBAAqB,CACjC,YAGG,EACH,eAAgC;IAEhC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE;QACxC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO;gBACH,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE;oBACH,aAAa,EAAE;wBACX,UAAU,EAAE,eAAe,CAAC,UAAU;wBACtC,oBAAoB,EAAE,GAAG,CAAC,oBAAoB;wBAC9C,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;wBACxC,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;wBACxB,cAAc,EAAE,IAAI,CAAC,GAAG,EAAE;qBAC7B;oBACD,eAAe;iBAClB;aACJ,CAAA;QACL,CAAC;QACD,OAAO;YACH,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE;gBACH,UAAU,EAAE,eAAe,CAAC,UAAU;gBACtC,aAAa,EAAE,GAAG,CAAC,oBAAoB;gBACvC,UAAU,EAAE,GAAG,CAAC,iBAAiB;gBACjC,MAAM,EAAE,MAAgB;aAC3B;SACJ,CAAA;IACL,CAAC,CAAC,CAAA;AACN,CAAC;AAjCD,sDAiCC;AAoBD,SAAgB,wBAAwB,CACpC,aAAwC,EACxC,eAAuB;IAEvB,MAAM,mBAAmB,GAA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
import type { Logger, Metrics } from "../utils/index.js";
|
|
3
|
+
export declare class EventManager {
|
|
4
|
+
private redis;
|
|
5
|
+
private chainId;
|
|
6
|
+
private logger;
|
|
7
|
+
private metrics;
|
|
8
|
+
constructor(endpoint: string | undefined, chainId: number, logger: Logger, metrics: Metrics);
|
|
9
|
+
emitExecutionRevertedOnChain(userOperationHash: Hex, transactionHash: Hex, reason: Hex, blockNumber: bigint): Promise<void>;
|
|
10
|
+
emitFailedOnChain(userOperationHash: Hex, transactionHash: Hex, blockNumber: bigint): Promise<void>;
|
|
11
|
+
emitFrontranOnChain(userOperationHash: Hex, transactionHash: Hex, blockNumber: bigint): Promise<void>;
|
|
12
|
+
emitIncludedOnChain(userOperationHash: Hex, transactionHash: Hex, blockNumber: bigint): Promise<void>;
|
|
13
|
+
emitQueued(userOperationHash: Hex): Promise<void>;
|
|
14
|
+
emitReceived(userOperationHash: Hex, timestamp?: number): Promise<void>;
|
|
15
|
+
emitFailedValidation(userOperationHash: Hex, reason?: string, aaError?: string): Promise<void>;
|
|
16
|
+
emitSubmitted(userOperationHash: Hex, transactionHash: Hex): Promise<void>;
|
|
17
|
+
emitDropped(userOperationHash: Hex, reason?: string, aaError?: string): Promise<void>;
|
|
18
|
+
emitAddedToMempool(userOperationHash: Hex): Promise<void>;
|
|
19
|
+
private emitEvent;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=eventManager.d.ts.map
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.EventManager = void 0;
|
|
30
|
+
// biome-ignore lint/style/noNamespaceImport: explicitly make it clear when sentry is used
|
|
31
|
+
const sentry = __importStar(require("@sentry/node"));
|
|
32
|
+
const ioredis_1 = __importDefault(require("ioredis"));
|
|
33
|
+
class EventManager {
|
|
34
|
+
redis;
|
|
35
|
+
chainId;
|
|
36
|
+
logger;
|
|
37
|
+
metrics;
|
|
38
|
+
constructor(endpoint, chainId, logger, metrics) {
|
|
39
|
+
this.chainId = chainId;
|
|
40
|
+
this.logger = logger;
|
|
41
|
+
this.metrics = metrics;
|
|
42
|
+
if (endpoint) {
|
|
43
|
+
this.redis = new ioredis_1.default(endpoint);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.redis = undefined;
|
|
47
|
+
}
|
|
48
|
+
// emits when the userOperation was mined onchain but reverted during the callphase
|
|
49
|
+
async emitExecutionRevertedOnChain(userOperationHash, transactionHash, reason, blockNumber) {
|
|
50
|
+
await this.emitEvent({
|
|
51
|
+
userOperationHash,
|
|
52
|
+
event: {
|
|
53
|
+
eventType: "execution_reverted_onchain",
|
|
54
|
+
transactionHash,
|
|
55
|
+
data: {
|
|
56
|
+
blockNumber: Number(blockNumber),
|
|
57
|
+
reason
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// emits when the userOperation was mined onchain but failed EntryPoint validation
|
|
63
|
+
async emitFailedOnChain(userOperationHash, transactionHash, blockNumber) {
|
|
64
|
+
await this.emitEvent({
|
|
65
|
+
userOperationHash,
|
|
66
|
+
event: {
|
|
67
|
+
eventType: "failed_onchain",
|
|
68
|
+
transactionHash,
|
|
69
|
+
data: {
|
|
70
|
+
blockNumber: Number(blockNumber)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// emits when the userOperation has been included onchain but bundled by a frontrunner
|
|
76
|
+
async emitFrontranOnChain(userOperationHash, transactionHash, blockNumber) {
|
|
77
|
+
await this.emitEvent({
|
|
78
|
+
userOperationHash,
|
|
79
|
+
event: {
|
|
80
|
+
eventType: "frontran_onchain",
|
|
81
|
+
transactionHash,
|
|
82
|
+
data: {
|
|
83
|
+
blockNumber: Number(blockNumber)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// emits when the userOperation is included onchain
|
|
89
|
+
async emitIncludedOnChain(userOperationHash, transactionHash, blockNumber) {
|
|
90
|
+
await this.emitEvent({
|
|
91
|
+
userOperationHash,
|
|
92
|
+
event: {
|
|
93
|
+
eventType: "included_onchain",
|
|
94
|
+
transactionHash,
|
|
95
|
+
data: {
|
|
96
|
+
blockNumber: Number(blockNumber)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
// emits when the userOperation is placed in the nonce queue
|
|
102
|
+
async emitQueued(userOperationHash) {
|
|
103
|
+
await this.emitEvent({
|
|
104
|
+
userOperationHash,
|
|
105
|
+
event: {
|
|
106
|
+
eventType: "queued"
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// emits when the userOperation is first seen
|
|
111
|
+
async emitReceived(userOperationHash, timestamp) {
|
|
112
|
+
await this.emitEvent({
|
|
113
|
+
userOperationHash,
|
|
114
|
+
event: {
|
|
115
|
+
eventType: "received"
|
|
116
|
+
},
|
|
117
|
+
timestamp
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// emits when the userOperation failed to get added to the mempool
|
|
121
|
+
async emitFailedValidation(userOperationHash, reason, aaError) {
|
|
122
|
+
await this.emitEvent({
|
|
123
|
+
userOperationHash,
|
|
124
|
+
event: {
|
|
125
|
+
eventType: "failed_validation",
|
|
126
|
+
data: {
|
|
127
|
+
reason,
|
|
128
|
+
aaError
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
// emits when the userOperation has been submitted to the network
|
|
134
|
+
async emitSubmitted(userOperationHash, transactionHash) {
|
|
135
|
+
await this.emitEvent({
|
|
136
|
+
userOperationHash,
|
|
137
|
+
event: {
|
|
138
|
+
eventType: "submitted",
|
|
139
|
+
transactionHash
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
// emits when the userOperation was dropped from the internal mempool
|
|
144
|
+
async emitDropped(userOperationHash, reason, aaError) {
|
|
145
|
+
await this.emitEvent({
|
|
146
|
+
userOperationHash,
|
|
147
|
+
event: {
|
|
148
|
+
eventType: "dropped",
|
|
149
|
+
data: {
|
|
150
|
+
reason,
|
|
151
|
+
aaError
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// emits when the userOperation was added to the internal mempool
|
|
157
|
+
async emitAddedToMempool(userOperationHash) {
|
|
158
|
+
await this.emitEvent({
|
|
159
|
+
userOperationHash,
|
|
160
|
+
event: {
|
|
161
|
+
eventType: "added_to_mempool"
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
async emitEvent({ userOperationHash, event, timestamp }) {
|
|
166
|
+
if (!this.redis) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const entry = {
|
|
170
|
+
userOperationHash,
|
|
171
|
+
eventTimestamp: timestamp ?? Date.now(),
|
|
172
|
+
chainId: this.chainId,
|
|
173
|
+
...event
|
|
174
|
+
};
|
|
175
|
+
// log to redis here
|
|
176
|
+
let lpushStatus;
|
|
177
|
+
try {
|
|
178
|
+
await this.redis.lpush("UserOperationStatusEventsQueue", JSON.stringify(entry));
|
|
179
|
+
lpushStatus = "success";
|
|
180
|
+
}
|
|
181
|
+
catch (e) {
|
|
182
|
+
this.logger.error("Failed to send userOperation status event due to ", JSON.stringify(e));
|
|
183
|
+
sentry.captureException(e);
|
|
184
|
+
lpushStatus = "failed";
|
|
185
|
+
}
|
|
186
|
+
this.metrics.emittedOpEvents
|
|
187
|
+
.labels({
|
|
188
|
+
// biome-ignore lint/style/useNamingConvention: event_type
|
|
189
|
+
event_type: event.eventType,
|
|
190
|
+
status: lpushStatus
|
|
191
|
+
})
|
|
192
|
+
.inc();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
exports.EventManager = EventManager;
|
|
196
|
+
//# sourceMappingURL=eventManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventManager.js","sourceRoot":"","sources":["../../handlers/eventManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0FAA0F;AAC1F,qDAAsC;AACtC,sDAA2B;AAK3B,MAAa,YAAY;IACb,KAAK,CAAmB;IACxB,OAAO,CAAQ;IACf,MAAM,CAAQ;IACd,OAAO,CAAS;IAExB,YACI,QAA4B,EAC5B,OAAe,EACf,MAAc,EACd,OAAgB;QAEhB,IAAI,CAAC,OAAO,GAAG,OAAO,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 -1,5 +1,5 @@
|
|
|
1
|
-
import { type GasPriceParameters } from "../types/index.js";
|
|
2
|
-
import { type Logger } from "
|
|
1
|
+
import { type GasPriceParameters, type ChainType } from "../types/index.js";
|
|
2
|
+
import { type Logger } from "../utils/index.js";
|
|
3
3
|
import { type Chain, type PublicClient } from "viem";
|
|
4
4
|
export declare class GasPriceManager {
|
|
5
5
|
private chain;
|
|
@@ -11,7 +11,13 @@ export declare class GasPriceManager {
|
|
|
11
11
|
private queueMaxPriorityFeePerGas;
|
|
12
12
|
private maxQueueSize;
|
|
13
13
|
private gasBumpMultiplier;
|
|
14
|
-
|
|
14
|
+
private gasPriceRefreshIntervalInSeconds;
|
|
15
|
+
private chainType;
|
|
16
|
+
constructor(chain: Chain, publicClient: PublicClient, legacyTransactions: boolean, logger: Logger, gasBumpMultiplier: bigint, gasPriceTimeValidityInSeconds: number, gasPriceRefreshIntervalInSeconds: number, chainType: ChainType);
|
|
17
|
+
init(): Promise<[{
|
|
18
|
+
maxFeePerGas: bigint;
|
|
19
|
+
maxPriorityFeePerGas: bigint;
|
|
20
|
+
}, bigint | void]>;
|
|
15
21
|
private getDefaultGasFee;
|
|
16
22
|
private getPolygonGasPriceParameters;
|
|
17
23
|
private bumpTheGasPrice;
|
|
@@ -24,8 +30,16 @@ export declare class GasPriceManager {
|
|
|
24
30
|
private saveMaxPriorityFeePerGas;
|
|
25
31
|
private saveGasPrice;
|
|
26
32
|
private innerGetGasPrice;
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
private updateBaseFee;
|
|
34
|
+
getBaseFee(): bigint | Promise<bigint>;
|
|
35
|
+
private updateGasPrice;
|
|
36
|
+
getGasPrice(): Promise<{
|
|
37
|
+
maxFeePerGas: bigint;
|
|
38
|
+
maxPriorityFeePerGas: bigint;
|
|
39
|
+
}> | {
|
|
40
|
+
maxFeePerGas: bigint;
|
|
41
|
+
maxPriorityFeePerGas: bigint;
|
|
42
|
+
};
|
|
29
43
|
getMaxBaseFeePerGas(): Promise<bigint>;
|
|
30
44
|
private getMinMaxFeePerGas;
|
|
31
45
|
private getMinMaxPriorityFeePerGas;
|
|
@@ -25,10 +25,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.GasPriceManager = void 0;
|
|
27
27
|
const types_1 = require("../types/index.js");
|
|
28
|
-
const utils_1 = require("
|
|
28
|
+
const utils_1 = require("../utils/index.js");
|
|
29
29
|
const sentry = __importStar(require("@sentry/node"));
|
|
30
30
|
const viem_1 = require("viem");
|
|
31
|
-
const
|
|
31
|
+
const chains_1 = require("viem/chains");
|
|
32
32
|
var ChainId;
|
|
33
33
|
(function (ChainId) {
|
|
34
34
|
ChainId[ChainId["Goerli"] = 5] = "Goerli";
|
|
@@ -57,13 +57,34 @@ class GasPriceManager {
|
|
|
57
57
|
queueMaxPriorityFeePerGas = []; // Store pairs of [price, timestamp]
|
|
58
58
|
maxQueueSize;
|
|
59
59
|
gasBumpMultiplier;
|
|
60
|
-
|
|
60
|
+
gasPriceRefreshIntervalInSeconds;
|
|
61
|
+
chainType;
|
|
62
|
+
constructor(chain, publicClient, legacyTransactions, logger, gasBumpMultiplier, gasPriceTimeValidityInSeconds, gasPriceRefreshIntervalInSeconds, chainType) {
|
|
61
63
|
this.maxQueueSize = gasPriceTimeValidityInSeconds;
|
|
62
64
|
this.chain = chain;
|
|
63
65
|
this.publicClient = publicClient;
|
|
64
66
|
this.legacyTransactions = legacyTransactions;
|
|
65
67
|
this.logger = logger;
|
|
66
68
|
this.gasBumpMultiplier = gasBumpMultiplier;
|
|
69
|
+
this.gasPriceRefreshIntervalInSeconds = gasPriceRefreshIntervalInSeconds;
|
|
70
|
+
this.chainType = chainType;
|
|
71
|
+
// Periodically update gas prices if specified
|
|
72
|
+
if (this.gasPriceRefreshIntervalInSeconds > 0) {
|
|
73
|
+
setInterval(() => {
|
|
74
|
+
if (this.legacyTransactions === false) {
|
|
75
|
+
this.updateBaseFee();
|
|
76
|
+
}
|
|
77
|
+
this.updateGasPrice();
|
|
78
|
+
}, this.gasPriceRefreshIntervalInSeconds * 1000);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
init() {
|
|
82
|
+
return Promise.all([
|
|
83
|
+
this.updateGasPrice(),
|
|
84
|
+
this.legacyTransactions === false
|
|
85
|
+
? this.updateBaseFee()
|
|
86
|
+
: Promise.resolve()
|
|
87
|
+
]);
|
|
67
88
|
}
|
|
68
89
|
getDefaultGasFee(chainId) {
|
|
69
90
|
switch (chainId) {
|
|
@@ -96,15 +117,14 @@ class GasPriceManager {
|
|
|
96
117
|
maxFeePerGas: (maxFeePerGas * bumpAmount) / 100n,
|
|
97
118
|
maxPriorityFeePerGas: (maxPriorityFeePerGas * bumpAmount) / 100n
|
|
98
119
|
};
|
|
99
|
-
if (this.chain.id ===
|
|
100
|
-
this.chain.id === chains.celoAlfajores.id) {
|
|
120
|
+
if (this.chain.id === chains_1.celo.id || this.chain.id === chains_1.celoAlfajores.id) {
|
|
101
121
|
const maxFee = (0, utils_1.maxBigInt)(result.maxFeePerGas, result.maxPriorityFeePerGas);
|
|
102
122
|
return {
|
|
103
123
|
maxFeePerGas: maxFee,
|
|
104
124
|
maxPriorityFeePerGas: maxFee
|
|
105
125
|
};
|
|
106
126
|
}
|
|
107
|
-
if (this.chain.id ===
|
|
127
|
+
if (this.chain.id === chains_1.dfk.id) {
|
|
108
128
|
const maxFeePerGas = (0, utils_1.maxBigInt)(5000000000n, result.maxFeePerGas);
|
|
109
129
|
const maxPriorityFeePerGas = (0, utils_1.maxBigInt)(5000000000n, result.maxPriorityFeePerGas);
|
|
110
130
|
return {
|
|
@@ -113,7 +133,7 @@ class GasPriceManager {
|
|
|
113
133
|
};
|
|
114
134
|
}
|
|
115
135
|
// set a minimum maxPriorityFee & maxFee to 1.5gwei on avalanche (because eth_maxPriorityFeePerGas returns 0)
|
|
116
|
-
if (this.chain.id ===
|
|
136
|
+
if (this.chain.id === chains_1.avalanche.id) {
|
|
117
137
|
const maxFeePerGas = (0, utils_1.maxBigInt)((0, viem_1.parseGwei)("1.5"), result.maxFeePerGas);
|
|
118
138
|
const maxPriorityFeePerGas = (0, utils_1.maxBigInt)((0, viem_1.parseGwei)("1.5"), result.maxPriorityFeePerGas);
|
|
119
139
|
return {
|
|
@@ -282,8 +302,8 @@ class GasPriceManager {
|
|
|
282
302
|
async innerGetGasPrice() {
|
|
283
303
|
let maxFeePerGas = 0n;
|
|
284
304
|
let maxPriorityFeePerGas = 0n;
|
|
285
|
-
if (this.chain.id ===
|
|
286
|
-
this.chain.id ===
|
|
305
|
+
if (this.chain.id === chains_1.polygon.id ||
|
|
306
|
+
this.chain.id === chains_1.polygonMumbai.id) {
|
|
287
307
|
const polygonEstimate = await this.getPolygonGasPriceParameters();
|
|
288
308
|
if (polygonEstimate) {
|
|
289
309
|
const gasPrice = this.bumpTheGasPrice({
|
|
@@ -315,7 +335,7 @@ class GasPriceManager {
|
|
|
315
335
|
maxPriorityFeePerGas: (0, utils_1.maxBigInt)(gasPrice.maxPriorityFeePerGas, maxPriorityFeePerGas)
|
|
316
336
|
};
|
|
317
337
|
}
|
|
318
|
-
async
|
|
338
|
+
async updateBaseFee() {
|
|
319
339
|
const latestBlock = await this.publicClient.getBlock();
|
|
320
340
|
if (latestBlock.baseFeePerGas === null) {
|
|
321
341
|
throw new types_1.RpcError("block does not have baseFeePerGas");
|
|
@@ -324,7 +344,17 @@ class GasPriceManager {
|
|
|
324
344
|
this.saveBaseFeePerGas(baseFee, Date.now());
|
|
325
345
|
return baseFee;
|
|
326
346
|
}
|
|
327
|
-
|
|
347
|
+
getBaseFee() {
|
|
348
|
+
if (this.legacyTransactions) {
|
|
349
|
+
throw new types_1.RpcError("baseFee is not available for legacy transactions");
|
|
350
|
+
}
|
|
351
|
+
if (this.gasPriceRefreshIntervalInSeconds === 0) {
|
|
352
|
+
return this.updateBaseFee();
|
|
353
|
+
}
|
|
354
|
+
const { baseFeePerGas } = this.queueBaseFeePerGas[this.queueBaseFeePerGas.length - 1];
|
|
355
|
+
return baseFeePerGas;
|
|
356
|
+
}
|
|
357
|
+
async updateGasPrice() {
|
|
328
358
|
const gasPrice = await this.innerGetGasPrice();
|
|
329
359
|
this.saveGasPrice({
|
|
330
360
|
maxFeePerGas: gasPrice.maxFeePerGas,
|
|
@@ -332,6 +362,17 @@ class GasPriceManager {
|
|
|
332
362
|
}, Date.now());
|
|
333
363
|
return gasPrice;
|
|
334
364
|
}
|
|
365
|
+
getGasPrice() {
|
|
366
|
+
if (this.gasPriceRefreshIntervalInSeconds === 0) {
|
|
367
|
+
return this.updateGasPrice();
|
|
368
|
+
}
|
|
369
|
+
const { maxPriorityFeePerGas } = this.queueMaxPriorityFeePerGas[this.queueMaxPriorityFeePerGas.length - 1];
|
|
370
|
+
const { maxFeePerGas } = this.queueMaxFeePerGas[this.queueMaxFeePerGas.length - 1];
|
|
371
|
+
return {
|
|
372
|
+
maxFeePerGas,
|
|
373
|
+
maxPriorityFeePerGas
|
|
374
|
+
};
|
|
375
|
+
}
|
|
335
376
|
async getMaxBaseFeePerGas() {
|
|
336
377
|
if (this.queueBaseFeePerGas.length === 0) {
|
|
337
378
|
await this.getBaseFee();
|
|
@@ -351,8 +392,12 @@ class GasPriceManager {
|
|
|
351
392
|
return this.queueMaxPriorityFeePerGas.reduce((acc, cur) => (0, utils_1.minBigInt)(cur.maxPriorityFeePerGas, acc), this.queueMaxPriorityFeePerGas[0].maxPriorityFeePerGas);
|
|
352
393
|
}
|
|
353
394
|
async validateGasPrice(gasPrice) {
|
|
354
|
-
|
|
355
|
-
|
|
395
|
+
let lowestMaxFeePerGas = await this.getMinMaxFeePerGas();
|
|
396
|
+
let lowestMaxPriorityFeePerGas = await this.getMinMaxPriorityFeePerGas();
|
|
397
|
+
if (this.chainType === "hedera") {
|
|
398
|
+
lowestMaxFeePerGas /= 10n ** 9n;
|
|
399
|
+
lowestMaxPriorityFeePerGas /= 10n ** 9n;
|
|
400
|
+
}
|
|
356
401
|
if (gasPrice.maxFeePerGas < lowestMaxFeePerGas) {
|
|
357
402
|
throw new types_1.RpcError(`maxFeePerGas must be at least ${lowestMaxFeePerGas} (current maxFeePerGas: ${gasPrice.maxFeePerGas}) - use pimlico_getUserOperationGasPrice to get the current gas price`);
|
|
358
403
|
}
|