@pimlico/alto 0.0.0-main.20250307T203608 → 0.0.0-main.20250324T173449
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 +5 -3
- package/esm/cli/alto.js.map +1 -1
- package/esm/cli/config/bundler.d.ts +87 -36
- package/esm/cli/config/bundler.js +15 -3
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.d.ts +2 -1
- package/esm/cli/config/options.js +59 -5
- package/esm/cli/config/options.js.map +1 -1
- package/esm/cli/handler.js +3 -4
- package/esm/cli/handler.js.map +1 -1
- package/esm/cli/setupServer.d.ts +1 -1
- package/esm/cli/setupServer.js +109 -49
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/createConfig.d.ts +1 -0
- package/esm/createConfig.js +1 -0
- package/esm/createConfig.js.map +1 -1
- package/esm/executor/executor.d.ts +3 -3
- package/esm/executor/executor.js +7 -4
- package/esm/executor/executor.js.map +1 -1
- package/esm/executor/executorManager.d.ts +14 -12
- package/esm/executor/executorManager.js +131 -97
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/executor/index.d.ts +1 -1
- package/esm/executor/index.js +1 -1
- package/esm/executor/senderManager/createMemorySenderManager.d.ts +8 -0
- package/esm/executor/senderManager/createMemorySenderManager.js +41 -0
- package/esm/executor/senderManager/createMemorySenderManager.js.map +1 -0
- package/esm/executor/senderManager/createRedisSenderManager.d.ts +8 -0
- package/esm/executor/senderManager/createRedisSenderManager.js +78 -0
- package/esm/executor/senderManager/createRedisSenderManager.js.map +1 -0
- package/esm/executor/senderManager/flushOnStartUp.d.ts +9 -0
- package/esm/executor/senderManager/flushOnStartUp.js +33 -0
- package/esm/executor/senderManager/flushOnStartUp.js.map +1 -0
- package/esm/executor/senderManager/index.d.ts +15 -0
- package/esm/executor/senderManager/index.js +20 -0
- package/esm/executor/senderManager/index.js.map +1 -0
- package/esm/executor/senderManager/validateAndRefill.d.ts +11 -0
- package/esm/executor/senderManager/validateAndRefill.js +111 -0
- package/esm/executor/senderManager/validateAndRefill.js.map +1 -0
- package/esm/executor/utils.d.ts +8 -2
- package/esm/executor/utils.js +12 -3
- package/esm/executor/utils.js.map +1 -1
- package/esm/handlers/arbitrumGasPriceManager.d.ts +7 -4
- package/esm/handlers/arbitrumGasPriceManager.js +19 -13
- package/esm/handlers/arbitrumGasPriceManager.js.map +1 -1
- package/esm/handlers/eventManager.js +5 -4
- package/esm/handlers/eventManager.js.map +1 -1
- package/esm/handlers/gasPriceManager.d.ts +1 -4
- package/esm/handlers/gasPriceManager.js +81 -48
- package/esm/handlers/gasPriceManager.js.map +1 -1
- package/esm/handlers/mantleGasPriceManager.d.ts +6 -3
- package/esm/handlers/mantleGasPriceManager.js +23 -11
- package/esm/handlers/mantleGasPriceManager.js.map +1 -1
- package/esm/handlers/optimismManager.d.ts +5 -2
- package/esm/handlers/optimismManager.js +8 -5
- package/esm/handlers/optimismManager.js.map +1 -1
- 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 +95 -27
- package/esm/mempool/mempool.js +132 -252
- package/esm/mempool/mempool.js.map +1 -1
- package/esm/mempool/monitoring.d.ts +8 -4
- package/esm/mempool/monitoring.js +72 -9
- package/esm/mempool/monitoring.js.map +1 -1
- package/esm/rpc/estimation/gasEstimationHandler.d.ts +10 -4
- package/esm/rpc/estimation/gasEstimationHandler.js +16 -19
- package/esm/rpc/estimation/gasEstimationHandler.js.map +1 -1
- package/esm/rpc/estimation/gasEstimationsV07.d.ts +7 -0
- package/esm/rpc/estimation/gasEstimationsV07.js +69 -4
- package/esm/rpc/estimation/gasEstimationsV07.js.map +1 -1
- package/esm/rpc/methods/debug_bundler_clearReputation.js.map +1 -1
- package/esm/rpc/methods/debug_bundler_dumpMempool.js +2 -2
- package/esm/rpc/methods/debug_bundler_dumpMempool.js.map +1 -1
- package/esm/rpc/methods/debug_bundler_setBundlingMode.js.map +1 -1
- package/esm/rpc/methods/eth_chainId.js +1 -1
- package/esm/rpc/methods/eth_chainId.js.map +1 -1
- package/esm/rpc/methods/eth_sendUserOperation.js +2 -2
- package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
- package/esm/rpc/methods/index.js +0 -5
- package/esm/rpc/methods/index.js.map +1 -1
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js +2 -3
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
- package/esm/rpc/rpcHandler.d.ts +4 -7
- package/esm/rpc/rpcHandler.js +37 -37
- package/esm/rpc/rpcHandler.js.map +1 -1
- package/esm/rpc/validation/SafeValidator.js +2 -2
- package/esm/rpc/validation/SafeValidator.js.map +1 -1
- package/esm/rpc/validation/UnsafeValidator.d.ts +7 -2
- package/esm/rpc/validation/UnsafeValidator.js +20 -4
- package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
- package/esm/store/createMemoryOutstandingStore.d.ts +28 -0
- package/esm/store/createMemoryOutstandingStore.js +221 -0
- package/esm/store/createMemoryOutstandingStore.js.map +1 -0
- package/esm/store/createMempoolStore.d.ts +8 -0
- package/esm/store/createMempoolStore.js +193 -0
- package/esm/store/createMempoolStore.js.map +1 -0
- package/esm/store/createRedisOutstandingStore.d.ts +27 -0
- package/esm/store/createRedisOutstandingStore.js +344 -0
- package/esm/store/createRedisOutstandingStore.js.map +1 -0
- package/esm/store/createRedisStore.d.ts +9 -0
- package/esm/store/createRedisStore.js +131 -0
- package/esm/store/createRedisStore.js.map +1 -0
- package/esm/store/createStore.d.ts +6 -0
- package/esm/store/createStore.js +66 -0
- package/esm/store/createStore.js.map +1 -0
- package/esm/store/index.d.ts +81 -0
- package/esm/store/index.js +2 -0
- package/esm/store/index.js.map +1 -0
- package/esm/types/interfaces.d.ts +7 -3
- package/esm/types/mempool.d.ts +2 -15
- package/esm/types/mempool.js.map +1 -1
- package/esm/types/schemas.d.ts +4617 -7632
- package/esm/types/schemas.js +19 -42
- package/esm/types/schemas.js.map +1 -1
- package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.d.ts +6 -0
- package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.js +53 -0
- package/esm/utils/minMaxQueue/createMemoryMinMaxQueue.js.map +1 -0
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +7 -0
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js +98 -0
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js.map +1 -0
- package/esm/utils/minMaxQueue/index.d.ts +12 -0
- package/esm/utils/minMaxQueue/index.js +12 -0
- package/esm/utils/minMaxQueue/index.js.map +1 -0
- package/esm/utils/validation.js +8 -10
- package/esm/utils/validation.js.map +1 -1
- package/lib/cli/alto.js +3 -1
- package/lib/cli/alto.js.map +1 -1
- package/lib/cli/config/bundler.d.ts +87 -36
- package/lib/cli/config/bundler.js +16 -4
- package/lib/cli/config/bundler.js.map +1 -1
- package/lib/cli/config/options.d.ts +2 -1
- package/lib/cli/config/options.js +60 -6
- package/lib/cli/config/options.js.map +1 -1
- package/lib/cli/handler.js +3 -4
- package/lib/cli/handler.js.map +1 -1
- package/lib/cli/setupServer.d.ts +1 -1
- package/lib/cli/setupServer.js +108 -48
- package/lib/cli/setupServer.js.map +1 -1
- package/lib/createConfig.d.ts +1 -0
- package/lib/createConfig.js +1 -0
- package/lib/createConfig.js.map +1 -1
- package/lib/executor/executor.d.ts +3 -3
- package/lib/executor/executor.js +7 -4
- package/lib/executor/executor.js.map +1 -1
- package/lib/executor/executorManager.d.ts +14 -12
- package/lib/executor/executorManager.js +131 -97
- package/lib/executor/executorManager.js.map +1 -1
- package/lib/executor/index.d.ts +1 -1
- package/lib/executor/index.js +1 -1
- package/lib/executor/senderManager/createMemorySenderManager.d.ts +8 -0
- package/lib/executor/senderManager/createMemorySenderManager.js +45 -0
- package/lib/executor/senderManager/createMemorySenderManager.js.map +1 -0
- package/lib/executor/senderManager/createRedisSenderManager.d.ts +8 -0
- package/lib/executor/senderManager/createRedisSenderManager.js +85 -0
- package/lib/executor/senderManager/createRedisSenderManager.js.map +1 -0
- package/lib/executor/senderManager/flushOnStartUp.d.ts +9 -0
- package/lib/executor/senderManager/flushOnStartUp.js +37 -0
- package/lib/executor/senderManager/flushOnStartUp.js.map +1 -0
- package/lib/executor/senderManager/index.d.ts +15 -0
- package/lib/executor/senderManager/index.js +25 -0
- package/lib/executor/senderManager/index.js.map +1 -0
- package/lib/executor/senderManager/validateAndRefill.d.ts +11 -0
- package/lib/executor/senderManager/validateAndRefill.js +115 -0
- package/lib/executor/senderManager/validateAndRefill.js.map +1 -0
- package/lib/executor/utils.d.ts +8 -2
- package/lib/executor/utils.js +12 -3
- package/lib/executor/utils.js.map +1 -1
- package/lib/handlers/arbitrumGasPriceManager.d.ts +7 -4
- package/lib/handlers/arbitrumGasPriceManager.js +19 -13
- package/lib/handlers/arbitrumGasPriceManager.js.map +1 -1
- package/lib/handlers/eventManager.js +5 -4
- package/lib/handlers/eventManager.js.map +1 -1
- package/lib/handlers/gasPriceManager.d.ts +1 -4
- package/lib/handlers/gasPriceManager.js +81 -48
- package/lib/handlers/gasPriceManager.js.map +1 -1
- package/lib/handlers/mantleGasPriceManager.d.ts +6 -3
- package/lib/handlers/mantleGasPriceManager.js +23 -11
- package/lib/handlers/mantleGasPriceManager.js.map +1 -1
- package/lib/handlers/optimismManager.d.ts +5 -2
- package/lib/handlers/optimismManager.js +8 -5
- package/lib/handlers/optimismManager.js.map +1 -1
- 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 +95 -27
- package/lib/mempool/mempool.js +133 -253
- package/lib/mempool/mempool.js.map +1 -1
- package/lib/mempool/monitoring.d.ts +8 -4
- package/lib/mempool/monitoring.js +72 -9
- package/lib/mempool/monitoring.js.map +1 -1
- package/lib/rpc/estimation/gasEstimationHandler.d.ts +10 -4
- package/lib/rpc/estimation/gasEstimationHandler.js +15 -18
- package/lib/rpc/estimation/gasEstimationHandler.js.map +1 -1
- package/lib/rpc/estimation/gasEstimationsV07.d.ts +7 -0
- package/lib/rpc/estimation/gasEstimationsV07.js +69 -4
- package/lib/rpc/estimation/gasEstimationsV07.js.map +1 -1
- package/lib/rpc/methods/debug_bundler_clearReputation.js.map +1 -1
- package/lib/rpc/methods/debug_bundler_dumpMempool.js +2 -2
- package/lib/rpc/methods/debug_bundler_dumpMempool.js.map +1 -1
- package/lib/rpc/methods/debug_bundler_setBundlingMode.js.map +1 -1
- package/lib/rpc/methods/eth_chainId.js +1 -1
- package/lib/rpc/methods/eth_chainId.js.map +1 -1
- package/lib/rpc/methods/eth_sendUserOperation.js +2 -2
- package/lib/rpc/methods/eth_sendUserOperation.js.map +1 -1
- package/lib/rpc/methods/index.js +0 -5
- package/lib/rpc/methods/index.js.map +1 -1
- package/lib/rpc/methods/pimlico_sendUserOperationNow.js +2 -3
- package/lib/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
- package/lib/rpc/rpcHandler.d.ts +4 -7
- package/lib/rpc/rpcHandler.js +37 -37
- package/lib/rpc/rpcHandler.js.map +1 -1
- package/lib/rpc/validation/SafeValidator.js +2 -2
- package/lib/rpc/validation/SafeValidator.js.map +1 -1
- package/lib/rpc/validation/UnsafeValidator.d.ts +7 -2
- package/lib/rpc/validation/UnsafeValidator.js +20 -4
- package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
- package/lib/store/createMemoryOutstandingStore.d.ts +28 -0
- package/lib/store/createMemoryOutstandingStore.js +226 -0
- package/lib/store/createMemoryOutstandingStore.js.map +1 -0
- package/lib/store/createMempoolStore.d.ts +8 -0
- package/lib/store/createMempoolStore.js +197 -0
- package/lib/store/createMempoolStore.js.map +1 -0
- package/lib/store/createRedisOutstandingStore.d.ts +27 -0
- package/lib/store/createRedisOutstandingStore.js +349 -0
- package/lib/store/createRedisOutstandingStore.js.map +1 -0
- package/lib/store/createRedisStore.d.ts +9 -0
- package/lib/store/createRedisStore.js +138 -0
- package/lib/store/createRedisStore.js.map +1 -0
- package/lib/store/createStore.d.ts +6 -0
- package/lib/store/createStore.js +70 -0
- package/lib/store/createStore.js.map +1 -0
- package/lib/store/index.d.ts +81 -0
- package/lib/store/index.js +6 -0
- package/lib/store/index.js.map +1 -0
- package/lib/types/interfaces.d.ts +7 -3
- package/lib/types/mempool.d.ts +2 -15
- package/lib/types/mempool.js.map +1 -1
- package/lib/types/schemas.d.ts +4617 -7632
- package/lib/types/schemas.js +24 -47
- package/lib/types/schemas.js.map +1 -1
- package/lib/utils/minMaxQueue/createMemoryMinMaxQueue.d.ts +6 -0
- package/lib/utils/minMaxQueue/createMemoryMinMaxQueue.js +57 -0
- package/lib/utils/minMaxQueue/createMemoryMinMaxQueue.js.map +1 -0
- package/lib/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +7 -0
- package/lib/utils/minMaxQueue/createRedisMinMaxQueue.js +105 -0
- package/lib/utils/minMaxQueue/createRedisMinMaxQueue.js.map +1 -0
- package/lib/utils/minMaxQueue/index.d.ts +12 -0
- package/lib/utils/minMaxQueue/index.js +16 -0
- package/lib/utils/minMaxQueue/index.js.map +1 -0
- package/lib/utils/validation.js +8 -10
- package/lib/utils/validation.js.map +1 -1
- package/package.json +2 -2
- package/esm/executor/senderManager.d.ts +0 -26
- package/esm/executor/senderManager.js +0 -216
- package/esm/executor/senderManager.js.map +0 -1
- package/esm/mempool/nonceQueuer.d.ts +0 -32
- package/esm/mempool/nonceQueuer.js +0 -143
- package/esm/mempool/nonceQueuer.js.map +0 -1
- package/esm/mempool/store.d.ts +0 -22
- package/esm/mempool/store.js +0 -124
- package/esm/mempool/store.js.map +0 -1
- package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.d.ts +0 -979
- package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js +0 -22
- package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js.map +0 -1
- package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.d.ts +0 -422
- package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.js +0 -19
- package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.js.map +0 -1
- package/esm/utils/slidingWindowTimedQueue.d.ts +0 -12
- package/esm/utils/slidingWindowTimedQueue.js +0 -48
- package/esm/utils/slidingWindowTimedQueue.js.map +0 -1
- package/lib/executor/senderManager.d.ts +0 -26
- package/lib/executor/senderManager.js +0 -220
- package/lib/executor/senderManager.js.map +0 -1
- package/lib/mempool/nonceQueuer.d.ts +0 -32
- package/lib/mempool/nonceQueuer.js +0 -147
- package/lib/mempool/nonceQueuer.js.map +0 -1
- package/lib/mempool/store.d.ts +0 -22
- package/lib/mempool/store.js +0 -128
- package/lib/mempool/store.js.map +0 -1
- package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.d.ts +0 -979
- package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js +0 -25
- package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js.map +0 -1
- package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.d.ts +0 -422
- package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.js +0 -22
- package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.js.map +0 -1
- package/lib/utils/slidingWindowTimedQueue.d.ts +0 -12
- package/lib/utils/slidingWindowTimedQueue.js +0 -52
- package/lib/utils/slidingWindowTimedQueue.js.map +0 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { getNonceKeyAndSequence, isVersion06, isVersion07 } from "../utils/userop.js";
|
|
2
|
+
const senderNonceSlot = (userOp) => {
|
|
3
|
+
const sender = userOp.sender;
|
|
4
|
+
const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
|
|
5
|
+
return `${sender}-${nonceKey}`;
|
|
6
|
+
};
|
|
7
|
+
export class MemoryOutstanding {
|
|
8
|
+
config;
|
|
9
|
+
pendingOps = new Map();
|
|
10
|
+
priorityQueue = [];
|
|
11
|
+
logger;
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.config = config;
|
|
14
|
+
this.logger = config.getLogger({ module: "memory-outstanding-queue" }, {
|
|
15
|
+
level: config.logLevel
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
dump() {
|
|
19
|
+
return [...Array.from(this.pendingOps.values()).flat()];
|
|
20
|
+
}
|
|
21
|
+
// Adds userOp to queue and maintains sorting by gas price.
|
|
22
|
+
addToPriorityQueue(userOpInfo) {
|
|
23
|
+
this.priorityQueue.push(userOpInfo);
|
|
24
|
+
this.priorityQueue.sort((a, b) => {
|
|
25
|
+
const userOpA = a.userOp;
|
|
26
|
+
const userOpB = b.userOp;
|
|
27
|
+
return Number(userOpA.maxFeePerGas - userOpB.maxFeePerGas);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
validateQueuedLimit(userOp) {
|
|
31
|
+
const outstandingOps = this.dump();
|
|
32
|
+
const parallelUserOperationsCount = outstandingOps.filter((userOpInfo) => {
|
|
33
|
+
const { userOp: mempoolUserOp } = userOpInfo;
|
|
34
|
+
return mempoolUserOp.sender === userOp.sender;
|
|
35
|
+
}).length;
|
|
36
|
+
if (parallelUserOperationsCount > this.config.mempoolMaxParallelOps) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
validateParallelLimit(userOp) {
|
|
42
|
+
const outstandingOps = this.dump();
|
|
43
|
+
const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
|
|
44
|
+
const queuedUserOperationsCount = outstandingOps.filter((userOpInfo) => {
|
|
45
|
+
const { userOp: mempoolUserOp } = userOpInfo;
|
|
46
|
+
const [opNonceKey] = getNonceKeyAndSequence(mempoolUserOp.nonce);
|
|
47
|
+
return (mempoolUserOp.sender === userOp.sender &&
|
|
48
|
+
opNonceKey === nonceKey);
|
|
49
|
+
}).length;
|
|
50
|
+
if (queuedUserOperationsCount > this.config.mempoolMaxQueuedOps) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
async popConflicting(userOp) {
|
|
56
|
+
const outstandingOps = this.dump();
|
|
57
|
+
let conflictingReason = undefined;
|
|
58
|
+
for (const userOpInfo of outstandingOps) {
|
|
59
|
+
const { userOp: mempoolUserOp } = userOpInfo;
|
|
60
|
+
const isSameSender = mempoolUserOp.sender === userOp.sender;
|
|
61
|
+
if (isSameSender && mempoolUserOp.nonce === userOp.nonce) {
|
|
62
|
+
this.remove(userOpInfo.userOpHash);
|
|
63
|
+
conflictingReason = {
|
|
64
|
+
reason: "conflicting_nonce",
|
|
65
|
+
userOpInfo
|
|
66
|
+
};
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
const isConflictingV6Deployment = isVersion06(userOp) &&
|
|
70
|
+
isVersion06(mempoolUserOp) &&
|
|
71
|
+
userOp.initCode &&
|
|
72
|
+
userOp.initCode !== "0x" &&
|
|
73
|
+
mempoolUserOp.initCode &&
|
|
74
|
+
mempoolUserOp.initCode !== "0x" &&
|
|
75
|
+
isSameSender;
|
|
76
|
+
const isConflictingV7Deployment = isVersion07(userOp) &&
|
|
77
|
+
isVersion07(mempoolUserOp) &&
|
|
78
|
+
userOp.factory &&
|
|
79
|
+
userOp.factory !== "0x" &&
|
|
80
|
+
mempoolUserOp.factory &&
|
|
81
|
+
mempoolUserOp.factory !== "0x" &&
|
|
82
|
+
isSameSender;
|
|
83
|
+
const isConflictingDeployment = isConflictingV6Deployment || isConflictingV7Deployment;
|
|
84
|
+
if (isConflictingDeployment) {
|
|
85
|
+
this.remove(userOpInfo.userOpHash);
|
|
86
|
+
conflictingReason = {
|
|
87
|
+
reason: "conflicting_deployment",
|
|
88
|
+
userOpInfo
|
|
89
|
+
};
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return conflictingReason;
|
|
94
|
+
}
|
|
95
|
+
async contains(userOpHash) {
|
|
96
|
+
for (const userOpInfos of this.pendingOps.values()) {
|
|
97
|
+
if (userOpInfos.some((info) => info.userOpHash === userOpHash)) {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
async peek() {
|
|
104
|
+
if (this.priorityQueue.length === 0) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
return this.priorityQueue[0];
|
|
108
|
+
}
|
|
109
|
+
async pop() {
|
|
110
|
+
const userOpInfo = this.priorityQueue.shift();
|
|
111
|
+
if (!userOpInfo) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
const pendingOpsSlot = senderNonceSlot(userOpInfo.userOp);
|
|
115
|
+
const backlogOps = this.pendingOps.get(pendingOpsSlot);
|
|
116
|
+
// This should never throw.
|
|
117
|
+
if (!backlogOps?.shift()) {
|
|
118
|
+
throw new Error("FATAL: No pending userOps for sender");
|
|
119
|
+
}
|
|
120
|
+
// Move next pending userOp into priorityQueue if exist.
|
|
121
|
+
if (backlogOps.length > 0) {
|
|
122
|
+
this.addToPriorityQueue(backlogOps[0]);
|
|
123
|
+
}
|
|
124
|
+
// Cleanup.
|
|
125
|
+
if (backlogOps.length === 0) {
|
|
126
|
+
this.pendingOps.delete(pendingOpsSlot);
|
|
127
|
+
}
|
|
128
|
+
return userOpInfo;
|
|
129
|
+
}
|
|
130
|
+
async add(userOpInfo) {
|
|
131
|
+
const { userOp, userOpHash } = userOpInfo;
|
|
132
|
+
const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
|
|
133
|
+
const pendingOpsSlot = senderNonceSlot(userOp);
|
|
134
|
+
const backlogOps = this.pendingOps.get(pendingOpsSlot) ||
|
|
135
|
+
this.pendingOps.set(pendingOpsSlot, []).get(pendingOpsSlot);
|
|
136
|
+
// Note: the userOpInfo is always added to backlogOps, because we are pushing to a reference
|
|
137
|
+
backlogOps.push(userOpInfo);
|
|
138
|
+
backlogOps
|
|
139
|
+
.map((sop) => sop.userOp)
|
|
140
|
+
.sort((a, b) => {
|
|
141
|
+
const [, aNonceSeq] = getNonceKeyAndSequence(a.nonce);
|
|
142
|
+
const [, bNonceSeq] = getNonceKeyAndSequence(b.nonce);
|
|
143
|
+
return Number(aNonceSeq) - Number(bNonceSeq);
|
|
144
|
+
});
|
|
145
|
+
const lowestUserOpHash = backlogOps[0].userOpHash;
|
|
146
|
+
// If lowest, remove any existing userOp with same sender and nonceKey and add current userOp to priorityQueue.
|
|
147
|
+
if (lowestUserOpHash === userOpHash) {
|
|
148
|
+
this.priorityQueue = this.priorityQueue.filter((userOpInfo) => {
|
|
149
|
+
const pendingUserOp = userOpInfo.userOp;
|
|
150
|
+
const isSameSender = pendingUserOp.sender === userOp.sender;
|
|
151
|
+
const isSameNonceKey = getNonceKeyAndSequence(pendingUserOp.nonce)[0] === nonceKey;
|
|
152
|
+
return !(isSameSender && isSameNonceKey);
|
|
153
|
+
});
|
|
154
|
+
this.addToPriorityQueue(userOpInfo);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async getQueuedUserOps(userOp) {
|
|
158
|
+
const [nonceKey, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
|
|
159
|
+
const outstandingOps = this.dump();
|
|
160
|
+
const outstanding = outstandingOps.filter((userOpInfo) => {
|
|
161
|
+
const { userOp: mempoolUserOp } = userOpInfo;
|
|
162
|
+
const [mempoolNonceKey, mempoolNonceSequence] = getNonceKeyAndSequence(mempoolUserOp.nonce);
|
|
163
|
+
// Filter operations with the same sender and nonce key
|
|
164
|
+
// but with a lower nonce sequence
|
|
165
|
+
return (mempoolUserOp.sender === userOp.sender &&
|
|
166
|
+
mempoolNonceKey === nonceKey &&
|
|
167
|
+
mempoolNonceSequence < nonceSequence);
|
|
168
|
+
});
|
|
169
|
+
return outstanding
|
|
170
|
+
.sort((a, b) => {
|
|
171
|
+
const aUserOp = a.userOp;
|
|
172
|
+
const bUserOp = b.userOp;
|
|
173
|
+
const [, aNonceValue] = getNonceKeyAndSequence(aUserOp.nonce);
|
|
174
|
+
const [, bNonceValue] = getNonceKeyAndSequence(bUserOp.nonce);
|
|
175
|
+
return Number(aNonceValue - bNonceValue);
|
|
176
|
+
})
|
|
177
|
+
.map((userOpInfo) => userOpInfo.userOp);
|
|
178
|
+
}
|
|
179
|
+
async remove(userOpHash) {
|
|
180
|
+
const priorityQueueIndex = this.priorityQueue.findIndex((info) => info.userOpHash === userOpHash);
|
|
181
|
+
if (priorityQueueIndex === -1) {
|
|
182
|
+
this.logger.info("tried to remove non-existent user op from mempool");
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
const userOpInfo = this.priorityQueue[priorityQueueIndex];
|
|
186
|
+
const pendingOpsSlot = senderNonceSlot(userOpInfo.userOp);
|
|
187
|
+
// Remove from priority queue
|
|
188
|
+
this.priorityQueue.splice(priorityQueueIndex, 1);
|
|
189
|
+
// Find and remove from pending ops
|
|
190
|
+
const backlogOps = this.pendingOps.get(pendingOpsSlot);
|
|
191
|
+
if (!backlogOps) {
|
|
192
|
+
throw new Error(`FATAL: No pending operations found for userOpHash ${userOpHash}`);
|
|
193
|
+
}
|
|
194
|
+
const backlogIndex = backlogOps.findIndex((info) => info.userOpHash === userOpHash);
|
|
195
|
+
if (backlogIndex === -1) {
|
|
196
|
+
throw new Error(`FATAL: UserOp with hash ${userOpHash} not found in backlog`);
|
|
197
|
+
}
|
|
198
|
+
backlogOps.splice(backlogIndex, 1);
|
|
199
|
+
// If this was the first operation and there are more in the backlog,
|
|
200
|
+
// add the new first operation to the priority queue
|
|
201
|
+
if (backlogIndex === 0 && backlogOps.length > 0) {
|
|
202
|
+
this.addToPriorityQueue(backlogOps[0]);
|
|
203
|
+
}
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
async dumpLocal() {
|
|
207
|
+
return this.dump();
|
|
208
|
+
}
|
|
209
|
+
async clear() {
|
|
210
|
+
this.priorityQueue = [];
|
|
211
|
+
this.pendingOps.clear();
|
|
212
|
+
}
|
|
213
|
+
// Adding findConflicting method to maintain compatibility with Store interface
|
|
214
|
+
async findConflicting(userOp) {
|
|
215
|
+
return this.popConflicting(userOp);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
export const createMemoryOutstandingQueue = ({ config }) => {
|
|
219
|
+
return new MemoryOutstanding(config);
|
|
220
|
+
};
|
|
221
|
+
//# sourceMappingURL=createMemoryOutstandingStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMemoryOutstandingStore.js","sourceRoot":"","sources":["../../store/createMemoryOutstandingStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,WAAW,EACX,WAAW,EACd,MAAM,iBAAiB,CAAA;AAMxB,MAAM,eAAe,GAAG,CAAC,MAAqB,EAAE,EAAE;IAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;IAC5B,MAAM,CAAC,QAAQ,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACvD,OAAO,GAAG,MAAM,IAAI,QAAQ,EAAE,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,OAAO,iBAAiB;IAKN;IAJZ,UAAU,GAA8B,IAAI,GAAG,EAAE,CAAA;IACjD,aAAa,GAAiB,EAAE,CAAA;IAChC,MAAM,CAAQ;IAEtB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAC1B,EAAE,MAAM,EAAE,0BAA0B,EAAE,EACtC;YACI,KAAK,EAAE,MAAM,CAAC,QAAQ;SACzB,CACJ,CAAA;IACL,CAAC;IAEO,IAAI;QACR,OAAO,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IAC3D,CAAC;IAED,2DAA2D;IACnD,kBAAkB,C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AAG,UAAU,CAAC,SAAS,CACrC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,KAAK,UAAU,CAC3C,CAAA;QAED,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACX,2BAA2B,UAAU,uBAAuB,CAC/D,CAAA;QACL,CAAC;QAED,UAAU,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;QAElC,qEAAqE;QACrE,oDAAoD;QACpD,IAAI,YAAY,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9C,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1C,CAAC;QAED,OAAO,IAAI,CAAA;IACf,CAAC;IAED,KAAK,CAAC,SAAS;QACX,OAAO,IAAI,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,KAAK;QACP,IAAI,CAAC,aAAa,GAAG,EAAE,CAAA;QACvB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;IAC3B,CAAC;IAED,+EAA+E;IAC/E,KAAK,CAAC,eAAe,CACjB,MAAqB;QAErB,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;IACtC,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EACzC,MAAM,EACe,EAAoB,EAAE;IAC3C,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAA;AACxC,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Metrics } from "../utils/index.js";
|
|
2
|
+
import { MempoolStore } from "./index.js";
|
|
3
|
+
import { AltoConfig } from "../createConfig.js";
|
|
4
|
+
export declare const createMempoolStore: ({ config, metrics }: {
|
|
5
|
+
config: AltoConfig;
|
|
6
|
+
metrics: Metrics;
|
|
7
|
+
}) => MempoolStore;
|
|
8
|
+
//# sourceMappingURL=createMempoolStore.d.ts.map
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { createMemoryOutstandingQueue } from "./createMemoryOutstandingStore.js";
|
|
2
|
+
import { createMemoryStore } from "./createStore.js";
|
|
3
|
+
import { createRedisOutstandingQueue } from "./createRedisOutstandingStore.js";
|
|
4
|
+
import { createRedisStore } from "./createRedisStore.js";
|
|
5
|
+
export const createMempoolStore = ({ config, metrics }) => {
|
|
6
|
+
let logger = config.getLogger({ module: "mempool-store" }, {
|
|
7
|
+
level: config.logLevel
|
|
8
|
+
});
|
|
9
|
+
const storeHandlers = new Map();
|
|
10
|
+
// Helper function to get store handlers for an entry point
|
|
11
|
+
const getStoreHandlers = (entryPoint) => {
|
|
12
|
+
const handlers = storeHandlers.get(entryPoint);
|
|
13
|
+
if (!handlers) {
|
|
14
|
+
throw new Error(`No store handlers found for entry point ${entryPoint}`);
|
|
15
|
+
}
|
|
16
|
+
return handlers;
|
|
17
|
+
};
|
|
18
|
+
for (const entryPoint of config.entrypoints) {
|
|
19
|
+
let outstanding;
|
|
20
|
+
let processing;
|
|
21
|
+
let submitted;
|
|
22
|
+
if (config.redisMempoolUrl) {
|
|
23
|
+
outstanding = createRedisOutstandingQueue({
|
|
24
|
+
config,
|
|
25
|
+
entryPoint
|
|
26
|
+
});
|
|
27
|
+
processing = createRedisStore({
|
|
28
|
+
config,
|
|
29
|
+
entryPoint,
|
|
30
|
+
storeType: "processing"
|
|
31
|
+
});
|
|
32
|
+
submitted = createRedisStore({
|
|
33
|
+
config,
|
|
34
|
+
entryPoint,
|
|
35
|
+
storeType: "submitted"
|
|
36
|
+
});
|
|
37
|
+
logger.info("Using redis for outstanding, processing, submitted mempools");
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
outstanding = createMemoryOutstandingQueue({
|
|
41
|
+
config
|
|
42
|
+
});
|
|
43
|
+
processing = createMemoryStore({
|
|
44
|
+
config
|
|
45
|
+
});
|
|
46
|
+
submitted = createMemoryStore({
|
|
47
|
+
config
|
|
48
|
+
});
|
|
49
|
+
logger.info("Using memory for outstanding, processing, submitted mempools");
|
|
50
|
+
}
|
|
51
|
+
storeHandlers.set(entryPoint, {
|
|
52
|
+
processing,
|
|
53
|
+
submitted,
|
|
54
|
+
outstanding
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const logAddOperation = (userOpHash, storeType) => {
|
|
58
|
+
logger.debug({ userOpHash, store: storeType }, `added user op to ${storeType} mempool`);
|
|
59
|
+
metrics.userOperationsInMempool.labels({ status: storeType }).inc();
|
|
60
|
+
};
|
|
61
|
+
const logRemoveOperation = (userOpHash, storeType, removed) => {
|
|
62
|
+
if (!removed) {
|
|
63
|
+
logger.warn({ userOpHash, store: storeType }, "tried to remove non-existent user op from mempool");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
logger.debug({ userOpHash, store: storeType }, "removed user op from mempool");
|
|
67
|
+
metrics.userOperationsInMempool.labels({ status: storeType }).dec();
|
|
68
|
+
};
|
|
69
|
+
const logDumpOperation = (storeType) => {
|
|
70
|
+
logger.trace({
|
|
71
|
+
store: storeType
|
|
72
|
+
}, "dumping mempool");
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
// Methods used for bundling
|
|
76
|
+
popOutstanding: async (entryPoint) => {
|
|
77
|
+
const { outstanding } = getStoreHandlers(entryPoint);
|
|
78
|
+
return await outstanding.pop();
|
|
79
|
+
},
|
|
80
|
+
peekOutstanding: async (entryPoint) => {
|
|
81
|
+
const { outstanding } = getStoreHandlers(entryPoint);
|
|
82
|
+
return await outstanding.peek();
|
|
83
|
+
},
|
|
84
|
+
// State handling
|
|
85
|
+
addOutstanding: async ({ entryPoint, userOpInfo }) => {
|
|
86
|
+
const { outstanding } = getStoreHandlers(entryPoint);
|
|
87
|
+
logAddOperation(userOpInfo.userOpHash, "outstanding");
|
|
88
|
+
await outstanding.add(userOpInfo);
|
|
89
|
+
},
|
|
90
|
+
addProcessing: async ({ entryPoint, userOpInfo }) => {
|
|
91
|
+
const { processing } = getStoreHandlers(entryPoint);
|
|
92
|
+
logAddOperation(userOpInfo.userOpHash, "processing");
|
|
93
|
+
processing.add(userOpInfo);
|
|
94
|
+
},
|
|
95
|
+
addSubmitted: async ({ entryPoint, submittedUserOp }) => {
|
|
96
|
+
const { submitted } = getStoreHandlers(entryPoint);
|
|
97
|
+
logAddOperation(submittedUserOp.userOpHash, "submitted");
|
|
98
|
+
submitted.add(submittedUserOp);
|
|
99
|
+
},
|
|
100
|
+
removeOutstanding: async ({ entryPoint, userOpHash }) => {
|
|
101
|
+
const { outstanding } = getStoreHandlers(entryPoint);
|
|
102
|
+
const removed = await outstanding.remove(userOpHash);
|
|
103
|
+
logRemoveOperation(userOpHash, "outstanding", removed);
|
|
104
|
+
},
|
|
105
|
+
removeProcessing: async ({ entryPoint, userOpHash }) => {
|
|
106
|
+
const { processing } = getStoreHandlers(entryPoint);
|
|
107
|
+
const removed = await processing.remove(userOpHash);
|
|
108
|
+
logRemoveOperation(userOpHash, "processing", removed);
|
|
109
|
+
},
|
|
110
|
+
removeSubmitted: async ({ entryPoint, userOpHash }) => {
|
|
111
|
+
const { submitted } = getStoreHandlers(entryPoint);
|
|
112
|
+
const removed = await submitted.remove(userOpHash);
|
|
113
|
+
logRemoveOperation(userOpHash, "submitted", removed);
|
|
114
|
+
},
|
|
115
|
+
dumpOutstanding: async (entryPoint) => {
|
|
116
|
+
const { outstanding } = getStoreHandlers(entryPoint);
|
|
117
|
+
logDumpOperation("outstanding");
|
|
118
|
+
return await outstanding.dumpLocal();
|
|
119
|
+
},
|
|
120
|
+
dumpProcessing: async (entryPoint) => {
|
|
121
|
+
const { processing } = getStoreHandlers(entryPoint);
|
|
122
|
+
logDumpOperation("processing");
|
|
123
|
+
return await processing.dumpLocal();
|
|
124
|
+
},
|
|
125
|
+
dumpSubmitted: async (entryPoint) => {
|
|
126
|
+
const { submitted } = getStoreHandlers(entryPoint);
|
|
127
|
+
logDumpOperation("submitted");
|
|
128
|
+
return await submitted.dumpLocal();
|
|
129
|
+
},
|
|
130
|
+
// Check if the userOp is already in the mempool
|
|
131
|
+
isInMempool: async ({ userOpHash, entryPoint }) => {
|
|
132
|
+
const { outstanding, processing, submitted } = getStoreHandlers(entryPoint);
|
|
133
|
+
const [inOutstanding, inProcessing, inSubmitted] = await Promise.all([
|
|
134
|
+
outstanding.contains(userOpHash),
|
|
135
|
+
processing.contains(userOpHash),
|
|
136
|
+
submitted.contains(userOpHash)
|
|
137
|
+
]);
|
|
138
|
+
return inOutstanding || inProcessing || inSubmitted;
|
|
139
|
+
},
|
|
140
|
+
validateSubmittedOrProcessing: async ({ entryPoint, userOp }) => {
|
|
141
|
+
const { submitted, processing } = getStoreHandlers(entryPoint);
|
|
142
|
+
const [submittedConflict, processingConflict] = await Promise.all([
|
|
143
|
+
submitted.findConflicting(userOp),
|
|
144
|
+
processing.findConflicting(userOp)
|
|
145
|
+
]);
|
|
146
|
+
const conflicting = submittedConflict || processingConflict;
|
|
147
|
+
if (conflicting?.reason === "conflicting_nonce") {
|
|
148
|
+
return {
|
|
149
|
+
valid: false,
|
|
150
|
+
reason: "AA25 invalid account nonce: Another UserOperation with same sender and nonce is already being processed"
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (conflicting?.reason === "conflicting_deployment") {
|
|
154
|
+
return {
|
|
155
|
+
valid: false,
|
|
156
|
+
reason: "AA25 invalid account deployment: Another deployment operation for this sender is already being processed"
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return { valid: true };
|
|
160
|
+
},
|
|
161
|
+
popConflictingOustanding: async ({ entryPoint, userOp }) => {
|
|
162
|
+
const { outstanding } = getStoreHandlers(entryPoint);
|
|
163
|
+
return await outstanding.popConflicting(userOp);
|
|
164
|
+
},
|
|
165
|
+
validateSenderLimits: async ({ entryPoint, userOp }) => {
|
|
166
|
+
const { outstanding } = getStoreHandlers(entryPoint);
|
|
167
|
+
if (!outstanding.validateParallelLimit(userOp)) {
|
|
168
|
+
return {
|
|
169
|
+
valid: false,
|
|
170
|
+
reason: "AA25 invalid account nonce: Maximum number of parallel user operations for that is allowed for this sender reached"
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
if (!outstanding.validateQueuedLimit(userOp)) {
|
|
174
|
+
return {
|
|
175
|
+
valid: false,
|
|
176
|
+
reason: "AA25 invalid account nonce: Maximum number of queued user operations reached for this sender and nonce key"
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
return { valid: true };
|
|
180
|
+
},
|
|
181
|
+
// misc
|
|
182
|
+
getQueuedOutstandingUserOps: async ({ userOp, entryPoint }) => {
|
|
183
|
+
const { outstanding } = getStoreHandlers(entryPoint);
|
|
184
|
+
return await outstanding.getQueuedUserOps(userOp);
|
|
185
|
+
},
|
|
186
|
+
clearOutstanding: async (entryPoint) => {
|
|
187
|
+
const { outstanding } = getStoreHandlers(entryPoint);
|
|
188
|
+
await outstanding.clear();
|
|
189
|
+
logger.debug({ store: "outstanding" }, "cleared mempool");
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
//# sourceMappingURL=createMempoolStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMempoolStore.js","sourceRoot":"","sources":["../../store/createMempoolStore.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAC/B,MAAM,EACN,OAAO,EACgC,EAAgB,EAAE;IACzD,IAAI,MAAM,GAAW,MAAM,CAAC,SAAS,CACjC,EAAE,MAAM,EAAE,eAAe,EAAE,EAC3B;QACI,KAAK,EA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+
import { Address } from "../types/index.js";
|
|
3
|
+
import { OutstandingStore } from "./index.js";
|
|
4
|
+
import { ChainableCommander, Redis } from "ioredis";
|
|
5
|
+
export declare class RedisHash {
|
|
6
|
+
private redis;
|
|
7
|
+
private keyName;
|
|
8
|
+
constructor(redis: Redis, keyName: string);
|
|
9
|
+
get keyPath(): string;
|
|
10
|
+
set({ key, value, multi }: {
|
|
11
|
+
key: string;
|
|
12
|
+
value: string;
|
|
13
|
+
multi?: ChainableCommander | Redis;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
get(field: string): Promise<string | null>;
|
|
16
|
+
delete({ key, multi }: {
|
|
17
|
+
key: string;
|
|
18
|
+
multi?: ChainableCommander | Redis;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
exists(field: string): Promise<boolean>;
|
|
21
|
+
getAll(): Promise<Record<string, string>>;
|
|
22
|
+
}
|
|
23
|
+
export declare const createRedisOutstandingQueue: ({ config, entryPoint }: {
|
|
24
|
+
config: AltoConfig;
|
|
25
|
+
entryPoint: Address;
|
|
26
|
+
}) => OutstandingStore;
|
|
27
|
+
//# sourceMappingURL=createRedisOutstandingStore.d.ts.map
|