@pimlico/alto 0.0.0-main.20250916T162729 → 0.0.0-main.20251001T162733
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/config/bundler.d.ts +12 -0
- package/esm/cli/config/bundler.js +2 -0
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.js +11 -0
- package/esm/cli/config/options.js.map +1 -1
- package/esm/cli/setupServer.js +1 -1
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/cli/shutDown.js +15 -55
- package/esm/cli/shutDown.js.map +1 -1
- package/esm/executor/bundleManager.d.ts +1 -1
- package/esm/executor/bundleManager.js +47 -34
- package/esm/executor/bundleManager.js.map +1 -1
- package/esm/executor/executorManager.js +3 -4
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/executor/senderManager/createRedisSenderManager.js +1 -2
- package/esm/executor/senderManager/createRedisSenderManager.js.map +1 -1
- package/esm/handlers/arbitrumGasPriceManager.js +2 -2
- package/esm/handlers/gasPriceManager.js +3 -3
- package/esm/handlers/mantleGasPriceManager.js +4 -4
- package/esm/handlers/optimismManager.js +1 -1
- package/esm/mempool/mempool.d.ts +3 -11
- package/esm/mempool/mempool.js +93 -96
- package/esm/mempool/mempool.js.map +1 -1
- package/esm/mempool/monitoring.d.ts +1 -1
- package/esm/mempool/monitoring.js +30 -21
- package/esm/mempool/monitoring.js.map +1 -1
- package/esm/receiptCache/createMemoryReceiptCache.js +8 -5
- package/esm/receiptCache/createMemoryReceiptCache.js.map +1 -1
- package/esm/receiptCache/createRedisReceiptCache.js +13 -11
- package/esm/receiptCache/createRedisReceiptCache.js.map +1 -1
- package/esm/receiptCache/index.d.ts +4 -1
- package/esm/receiptCache/index.js.map +1 -1
- package/esm/rpc/methods/eth_sendUserOperation.js +6 -7
- package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js +8 -11
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
- package/esm/store/createMempoolStore.d.ts +1 -1
- package/esm/store/createMempoolStore.js +51 -143
- package/esm/store/createMempoolStore.js.map +1 -1
- package/esm/store/index.d.ts +4 -75
- package/esm/store/index.js +4 -1
- package/esm/store/index.js.map +1 -1
- package/esm/store/outstanding/index.d.ts +13 -0
- package/esm/store/outstanding/index.js +16 -0
- package/esm/store/outstanding/index.js.map +1 -0
- package/esm/store/{createMemoryOutstandingStore.d.ts → outstanding/memory.d.ts} +11 -10
- package/esm/store/outstanding/memory.js +249 -0
- package/esm/store/outstanding/memory.js.map +1 -0
- package/esm/store/outstanding/redis.d.ts +11 -0
- package/esm/store/outstanding/redis.js +201 -0
- package/esm/store/outstanding/redis.js.map +1 -0
- package/esm/store/outstanding/types.d.ts +18 -0
- package/esm/store/outstanding/types.js +2 -0
- package/esm/store/outstanding/types.js.map +1 -0
- package/esm/store/processing/index.d.ts +11 -0
- package/esm/store/processing/index.js +17 -0
- package/esm/store/processing/index.js.map +1 -0
- package/esm/store/processing/memory.d.ts +14 -0
- package/esm/store/processing/memory.js +46 -0
- package/esm/store/processing/memory.js.map +1 -0
- package/esm/store/processing/redis.d.ts +21 -0
- package/esm/store/processing/redis.js +69 -0
- package/esm/store/processing/redis.js.map +1 -0
- package/esm/store/processing/types.d.ts +9 -0
- package/esm/store/processing/types.js +2 -0
- package/esm/store/processing/types.js.map +1 -0
- package/esm/store/types.d.ts +49 -0
- package/esm/store/types.js +2 -0
- package/esm/store/types.js.map +1 -0
- package/esm/utils/helpers.d.ts +0 -1
- package/esm/utils/helpers.js +1 -8
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +23 -2
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js +83 -60
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js.map +1 -1
- package/esm/utils/minMaxQueue/index.d.ts +2 -2
- package/esm/utils/minMaxQueue/index.js +2 -2
- package/esm/utils/minMaxQueue/index.js.map +1 -1
- package/esm/utils/preVerificationGasCalulator.d.ts +0 -2
- package/esm/utils/preVerificationGasCalulator.js +2 -2
- package/esm/utils/preVerificationGasCalulator.js.map +1 -1
- package/esm/utils/userop.d.ts +4 -50
- package/esm/utils/userop.js +61 -196
- package/esm/utils/userop.js.map +1 -1
- package/package.json +1 -1
- package/esm/cli/config/redisKeys.d.ts +0 -9
- package/esm/cli/config/redisKeys.js +0 -16
- package/esm/cli/config/redisKeys.js.map +0 -1
- package/esm/store/createMemoryOutstandingStore.js +0 -240
- package/esm/store/createMemoryOutstandingStore.js.map +0 -1
- package/esm/store/createRedisOutstandingStore.d.ts +0 -28
- package/esm/store/createRedisOutstandingStore.js +0 -341
- package/esm/store/createRedisOutstandingStore.js.map +0 -1
- package/esm/store/createRedisStore.d.ts +0 -10
- package/esm/store/createRedisStore.js +0 -128
- package/esm/store/createRedisStore.js.map +0 -1
- package/esm/store/createStore.d.ts +0 -6
- package/esm/store/createStore.js +0 -66
- package/esm/store/createStore.js.map +0 -1
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import Redis from "ioredis";
|
|
2
|
-
import { toHex } from "viem";
|
|
3
|
-
import { userOperationSchema } from "../types/schemas.js";
|
|
4
|
-
import { isVersion06, isVersion07 } from "../utils/userop.js";
|
|
5
|
-
import { RedisHash } from "./createRedisOutstandingStore.js";
|
|
6
|
-
import { createMemoryStore } from "./createStore.js";
|
|
7
|
-
const isDeploymentOperation = (userOp) => {
|
|
8
|
-
const isV6Deployment = isVersion06(userOp) && !!userOp.initCode && userOp.initCode !== "0x";
|
|
9
|
-
const isV7Deployment = isVersion07(userOp) && !!userOp.factory && userOp.factory !== "0x";
|
|
10
|
-
return isV6Deployment || isV7Deployment;
|
|
11
|
-
};
|
|
12
|
-
const serializeUserOp = (userOpInfo) => {
|
|
13
|
-
return JSON.stringify(userOpInfo, (_, value) => typeof value === "bigint" ? toHex(value) : value);
|
|
14
|
-
};
|
|
15
|
-
const deserializeUserOp = (data) => {
|
|
16
|
-
try {
|
|
17
|
-
const parsed = JSON.parse(data);
|
|
18
|
-
const result = userOperationSchema.safeParse(parsed);
|
|
19
|
-
if (!result.success) {
|
|
20
|
-
throw new Error(`Failed to parse UserOpInfo: ${result.error.message}`);
|
|
21
|
-
}
|
|
22
|
-
return result.data;
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
if (error instanceof Error) {
|
|
26
|
-
throw new Error(`UserOpInfo deserialization failed: ${error.message}`);
|
|
27
|
-
}
|
|
28
|
-
throw new Error("UserOpInfo deserialization failed with unknown error");
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
export const createRedisStore = ({ config, storeType, entryPoint, redisEndpoint }) => {
|
|
32
|
-
const redis = new Redis(redisEndpoint, {});
|
|
33
|
-
const factoryLookupKey = `${config.chainId}:${storeType}:factory-lookup:${entryPoint}`;
|
|
34
|
-
const conflictingNonceKey = `${config.chainId}:${storeType}:conflicting-nonce:${entryPoint}`;
|
|
35
|
-
const userOpHashLookupKey = `${config.chainId}:${storeType}:user-op-hash-index:${entryPoint}`;
|
|
36
|
-
const senderNonceLookupKey = `${config.chainId}:${storeType}:sender-nonce-lookup:${entryPoint}`;
|
|
37
|
-
const conflictingNonce = new RedisHash(redis, conflictingNonceKey); // userOpHash -> userOp
|
|
38
|
-
const factoryLookup = new RedisHash(redis, factoryLookupKey); // sender -> userOpHash (if deployment is present)
|
|
39
|
-
const senderNonceLookup = new RedisHash(redis, senderNonceLookupKey); // sender + nonce -> userOp
|
|
40
|
-
const userOpHashLookup = new RedisHash(redis, userOpHashLookupKey); // userOpHash -> userOp
|
|
41
|
-
const memoryStore = createMemoryStore({ config });
|
|
42
|
-
const encodeSenderNonce = (userOp) => {
|
|
43
|
-
return `${userOp.sender}-${userOp.nonce}`;
|
|
44
|
-
};
|
|
45
|
-
return {
|
|
46
|
-
add: async (op) => {
|
|
47
|
-
// Local memory logic
|
|
48
|
-
memoryStore.add(op);
|
|
49
|
-
// Global redis logic
|
|
50
|
-
const { userOpHash, userOp } = op;
|
|
51
|
-
const multi = redis.multi();
|
|
52
|
-
await userOpHashLookup.set({
|
|
53
|
-
key: userOpHash,
|
|
54
|
-
value: serializeUserOp(userOp),
|
|
55
|
-
multi
|
|
56
|
-
});
|
|
57
|
-
await conflictingNonce.set({
|
|
58
|
-
key: userOpHash,
|
|
59
|
-
value: serializeUserOp(userOp),
|
|
60
|
-
multi
|
|
61
|
-
});
|
|
62
|
-
await senderNonceLookup.set({
|
|
63
|
-
key: encodeSenderNonce(userOp),
|
|
64
|
-
value: serializeUserOp(userOp),
|
|
65
|
-
multi
|
|
66
|
-
});
|
|
67
|
-
if (isDeploymentOperation(userOp)) {
|
|
68
|
-
await factoryLookup.set({
|
|
69
|
-
key: op.userOp.sender,
|
|
70
|
-
value: op.userOpHash,
|
|
71
|
-
multi
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
await multi.exec();
|
|
75
|
-
},
|
|
76
|
-
remove: async (userOpHash) => {
|
|
77
|
-
// Local memory logic
|
|
78
|
-
memoryStore.remove(userOpHash);
|
|
79
|
-
// Redis Logic
|
|
80
|
-
const exist = await userOpHashLookup.get(userOpHash);
|
|
81
|
-
if (!exist) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
const userOp = deserializeUserOp(exist);
|
|
85
|
-
const multi = redis.multi();
|
|
86
|
-
await userOpHashLookup.delete({ key: userOpHash, multi });
|
|
87
|
-
await senderNonceLookup.delete({
|
|
88
|
-
key: encodeSenderNonce(userOp),
|
|
89
|
-
multi
|
|
90
|
-
});
|
|
91
|
-
if (isDeploymentOperation(userOp)) {
|
|
92
|
-
await factoryLookup.delete({ key: userOp.sender, multi });
|
|
93
|
-
}
|
|
94
|
-
await multi.exec();
|
|
95
|
-
return true;
|
|
96
|
-
},
|
|
97
|
-
contains: async (userOpHash) => {
|
|
98
|
-
return await userOpHashLookup.exists(userOpHash);
|
|
99
|
-
},
|
|
100
|
-
dumpLocal: () => {
|
|
101
|
-
return memoryStore.dumpLocal();
|
|
102
|
-
},
|
|
103
|
-
findConflicting: async (userOp) => {
|
|
104
|
-
const conflictingNonce = await senderNonceLookup.get(encodeSenderNonce(userOp));
|
|
105
|
-
if (conflictingNonce) {
|
|
106
|
-
return {
|
|
107
|
-
reason: "conflicting_nonce",
|
|
108
|
-
userOp: deserializeUserOp(conflictingNonce)
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
if (isDeploymentOperation(userOp)) {
|
|
112
|
-
const userOpHash = await factoryLookup.get(userOp.sender);
|
|
113
|
-
if (userOpHash) {
|
|
114
|
-
const userOp = await userOpHashLookup.get(userOpHash);
|
|
115
|
-
if (!userOp) {
|
|
116
|
-
return undefined;
|
|
117
|
-
}
|
|
118
|
-
return {
|
|
119
|
-
reason: "conflicting_deployment",
|
|
120
|
-
userOp: deserializeUserOp(userOp)
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return undefined;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
//# sourceMappingURL=createRedisStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createRedisStore.js","sourceRoot":"","sources":["../../store/createRedisStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,EAAgB,KAAK,EAAE,MAAM,MAAM,CAAA;AAG1C,OAAO,EAIH,mBAAmB,EACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,MAAM,qBAAqB,GAAG,CAAC,MAAqB,EAAW,EAAE;IAC7D,MAAM,cAAc,GAChB,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,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AAC,MAAM,CAAC;qBACpC,CAAA;gBACL,CAAC;YACL,CAAC;YAED,OAAO,SAAS,CAAA;QACpB,CAAC;KACJ,CAAA;AACL,CAAC,CAAA"}
|
package/esm/store/createStore.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { isVersion06, isVersion07 } from "../utils/userop.js";
|
|
2
|
-
export const createMemoryStore = ({ config }) => {
|
|
3
|
-
let store = [];
|
|
4
|
-
return {
|
|
5
|
-
findConflicting: async (userOp) => {
|
|
6
|
-
const dump = [...store];
|
|
7
|
-
const { sender, nonce } = userOp;
|
|
8
|
-
// Check for same sender and nonce
|
|
9
|
-
const conflictingNonce = dump.find((userOpInfo) => {
|
|
10
|
-
const { userOp: mempoolUserOp } = userOpInfo;
|
|
11
|
-
return (mempoolUserOp.sender === sender &&
|
|
12
|
-
mempoolUserOp.nonce === nonce);
|
|
13
|
-
});
|
|
14
|
-
if (conflictingNonce) {
|
|
15
|
-
return {
|
|
16
|
-
reason: "conflicting_nonce",
|
|
17
|
-
userOp: conflictingNonce.userOp
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
// Check for deployment conflict
|
|
21
|
-
const isCurrentOpDeployment = (isVersion06(userOp) &&
|
|
22
|
-
userOp.initCode &&
|
|
23
|
-
userOp.initCode !== "0x") ||
|
|
24
|
-
(isVersion07(userOp) &&
|
|
25
|
-
userOp.factory &&
|
|
26
|
-
userOp.factory !== "0x");
|
|
27
|
-
if (isCurrentOpDeployment) {
|
|
28
|
-
const conflictingDeployment = dump.find((userOpInfo) => {
|
|
29
|
-
const { userOp: mempoolUserOp } = userOpInfo;
|
|
30
|
-
const isV6Deployment = isVersion06(mempoolUserOp) &&
|
|
31
|
-
mempoolUserOp.initCode &&
|
|
32
|
-
mempoolUserOp.initCode !== "0x";
|
|
33
|
-
const isV7Deployment = isVersion07(mempoolUserOp) &&
|
|
34
|
-
mempoolUserOp.factory &&
|
|
35
|
-
mempoolUserOp.factory !== "0x";
|
|
36
|
-
const isDeployment = isV6Deployment || isV7Deployment;
|
|
37
|
-
return mempoolUserOp.sender === sender && isDeployment;
|
|
38
|
-
});
|
|
39
|
-
if (conflictingDeployment) {
|
|
40
|
-
return {
|
|
41
|
-
reason: "conflicting_deployment",
|
|
42
|
-
userOp: conflictingDeployment.userOp
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
},
|
|
48
|
-
add: (op) => {
|
|
49
|
-
store = [...store, op];
|
|
50
|
-
return Promise.resolve();
|
|
51
|
-
},
|
|
52
|
-
remove: (userOpHash) => {
|
|
53
|
-
const exists = store.some((op) => op.userOpHash === userOpHash);
|
|
54
|
-
store = store.filter((op) => op.userOpHash !== userOpHash);
|
|
55
|
-
return Promise.resolve(exists);
|
|
56
|
-
},
|
|
57
|
-
contains: (userOpHash) => {
|
|
58
|
-
const contains = store.some((op) => op.userOpHash === userOpHash);
|
|
59
|
-
return Promise.resolve(contains);
|
|
60
|
-
},
|
|
61
|
-
dumpLocal: () => {
|
|
62
|
-
return Promise.resolve([...store]);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=createStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createStore.js","sourceRoot":"","sources":["../../store/createStore.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAC9B,MAAM,EACe,EAAS,EAAE;IAChC,IAAI,KAAK,GAAiB,EAAE,CAAA;IAE5B,OAAO;QACH,eAAe,EAAE,KAAK,EAAE,MAAqB,EAAE,EAAE;YAC7C,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;YACvB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;YAEhC,kCAAkC;YAClC,MAAM,g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