@pimlico/alto 0.0.5 → 0.0.7
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 +52 -34
- package/esm/cli/config/bundler.js +12 -1
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.d.ts +2 -1
- package/esm/cli/config/options.js +14 -0
- package/esm/cli/config/options.js.map +1 -1
- package/esm/cli/setupServer.js +2 -2
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/executor/executorManager.js +14 -4
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/handlers/gasPriceManager.d.ts +14 -0
- package/esm/handlers/gasPriceManager.js +71 -1
- package/esm/handlers/gasPriceManager.js.map +1 -1
- package/esm/rpc/estimation/gasEstimationHandler.d.ts +24 -0
- package/esm/rpc/estimation/gasEstimationHandler.js +64 -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 +115 -0
- package/esm/rpc/estimation/gasEstimationsV06.js.map +1 -0
- package/esm/rpc/estimation/gasEstimationsV07.d.ts +93 -0
- package/esm/rpc/estimation/gasEstimationsV07.js +417 -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/rpcHandler.js +11 -7
- package/esm/rpc/rpcHandler.js.map +1 -1
- package/esm/rpc/server.js +2 -3
- package/esm/rpc/server.js.map +1 -1
- package/esm/rpc/validation/SafeValidator.d.ts +1 -1
- package/esm/rpc/validation/SafeValidator.js +6 -7
- package/esm/rpc/validation/SafeValidator.js.map +1 -1
- package/esm/rpc/validation/UnsafeValidator.d.ts +4 -6
- package/esm/rpc/validation/UnsafeValidator.js +25 -17
- package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
- package/esm/types/contracts/EntryPointSimulations.d.ts +1369 -143
- package/esm/types/contracts/EntryPointSimulations.js +196 -372
- package/esm/types/contracts/EntryPointSimulations.js.map +1 -1
- 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/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/interfaces.d.ts +1 -1
- package/esm/types/schemas.d.ts +68 -68
- package/esm/utils/validation.d.ts +1 -1
- package/esm/utils/validation.js +19 -7
- package/esm/utils/validation.js.map +1 -1
- package/lib/cli/config/bundler.d.ts +52 -34
- package/lib/cli/config/bundler.js +13 -2
- package/lib/cli/config/bundler.js.map +1 -1
- package/lib/cli/config/options.d.ts +2 -1
- package/lib/cli/config/options.js +15 -1
- package/lib/cli/config/options.js.map +1 -1
- package/lib/cli/setupServer.js +2 -2
- package/lib/cli/setupServer.js.map +1 -1
- package/lib/executor/executorManager.js +14 -4
- package/lib/executor/executorManager.js.map +1 -1
- package/lib/handlers/gasPriceManager.d.ts +14 -0
- package/lib/handlers/gasPriceManager.js +70 -0
- package/lib/handlers/gasPriceManager.js.map +1 -1
- package/lib/rpc/estimation/gasEstimationHandler.d.ts +24 -0
- package/lib/rpc/estimation/gasEstimationHandler.js +68 -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 +119 -0
- package/lib/rpc/estimation/gasEstimationsV06.js.map +1 -0
- package/lib/rpc/estimation/gasEstimationsV07.d.ts +93 -0
- package/lib/rpc/estimation/gasEstimationsV07.js +423 -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/rpcHandler.js +10 -6
- package/lib/rpc/rpcHandler.js.map +1 -1
- package/lib/rpc/server.js +2 -3
- package/lib/rpc/server.js.map +1 -1
- package/lib/rpc/validation/SafeValidator.d.ts +1 -1
- package/lib/rpc/validation/SafeValidator.js +7 -8
- package/lib/rpc/validation/SafeValidator.js.map +1 -1
- package/lib/rpc/validation/UnsafeValidator.d.ts +4 -6
- package/lib/rpc/validation/UnsafeValidator.js +25 -17
- package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
- package/lib/types/contracts/EntryPointSimulations.d.ts +1369 -143
- package/lib/types/contracts/EntryPointSimulations.js +196 -372
- package/lib/types/contracts/EntryPointSimulations.js.map +1 -1
- 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/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/interfaces.d.ts +1 -1
- package/lib/types/schemas.d.ts +68 -68
- package/lib/utils/validation.d.ts +1 -1
- package/lib/utils/validation.js +18 -6
- 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/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/esm/rpc/gasEstimation.js
DELETED
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
import { EntryPointV06Abi, ExecutionErrors, RpcError, ValidationErrors, executionResultSchema, hexDataSchema, EntryPointV06SimulationsAbi, EntryPointV07SimulationsAbi, EntryPointV07Abi, targetCallResultSchema } from "../types/index.js";
|
|
2
|
-
import { deepHexlify, getUserOperationHash, isVersion06, toPackedUserOperation } from "../utils/index.js";
|
|
3
|
-
import { decodeErrorResult, encodeFunctionData, toHex, decodeAbiParameters, decodeFunctionResult, toFunctionSelector, toBytes, slice } from "viem";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { ExecuteSimulatorDeployedBytecode } from "./ExecuteSimulator.js";
|
|
6
|
-
import { PimlicoEntryPointSimulationsAbi } from "../types/index.js";
|
|
7
|
-
function getStateOverrides({ userOperation, entryPoint, replacedEntryPoint, stateOverride = {} }) {
|
|
8
|
-
return replacedEntryPoint
|
|
9
|
-
? {
|
|
10
|
-
...stateOverride,
|
|
11
|
-
[userOperation.sender]: {
|
|
12
|
-
balance: toHex(100000000000000000000000n),
|
|
13
|
-
...(stateOverride
|
|
14
|
-
? deepHexlify(stateOverride?.[userOperation.sender])
|
|
15
|
-
: [])
|
|
16
|
-
},
|
|
17
|
-
[entryPoint]: {
|
|
18
|
-
code: ExecuteSimulatorDeployedBytecode
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
: {
|
|
22
|
-
...stateOverride,
|
|
23
|
-
[userOperation.sender]: {
|
|
24
|
-
balance: toHex(100000000000000000000000n),
|
|
25
|
-
...(stateOverride
|
|
26
|
-
? deepHexlify(stateOverride?.[userOperation.sender])
|
|
27
|
-
: [])
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export async function simulateHandleOpV06(userOperation, entryPoint, publicClient, targetAddress, targetCallData, blockTagSupport, utilityWalletAddress, finalParam = undefined, fixedGasLimitForEstimation) {
|
|
32
|
-
try {
|
|
33
|
-
await publicClient.request({
|
|
34
|
-
method: "eth_call",
|
|
35
|
-
params: [
|
|
36
|
-
{
|
|
37
|
-
to: entryPoint,
|
|
38
|
-
from: utilityWalletAddress,
|
|
39
|
-
data: encodeFunctionData({
|
|
40
|
-
abi: EntryPointV06Abi,
|
|
41
|
-
functionName: "simulateHandleOp",
|
|
42
|
-
args: [userOperation, targetAddress, targetCallData]
|
|
43
|
-
}),
|
|
44
|
-
...(fixedGasLimitForEstimation !== undefined && {
|
|
45
|
-
gas: `0x${fixedGasLimitForEstimation.toString(16)}`
|
|
46
|
-
})
|
|
47
|
-
},
|
|
48
|
-
blockTagSupport
|
|
49
|
-
? "latest"
|
|
50
|
-
: toHex(await publicClient.getBlockNumber()),
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
...(finalParam ? [finalParam] : [])
|
|
53
|
-
]
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
const err = e;
|
|
58
|
-
if (/return data out of bounds.*|EVM error OutOfOffset.*/.test(err.details)) {
|
|
59
|
-
// out of bound (low level evm error) occurs when paymaster reverts with less than 32bytes
|
|
60
|
-
return {
|
|
61
|
-
result: "failed",
|
|
62
|
-
data: "AA50 postOp revert (paymaster revert data out of bounds)"
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const causeParseResult = z
|
|
66
|
-
.union([
|
|
67
|
-
z.object({
|
|
68
|
-
code: z.literal(3),
|
|
69
|
-
message: z.string().regex(/execution reverted.*/),
|
|
70
|
-
data: hexDataSchema
|
|
71
|
-
}),
|
|
72
|
-
/* fuse rpcs return weird values, this accounts for that. */
|
|
73
|
-
z.object({
|
|
74
|
-
code: z.number(),
|
|
75
|
-
message: z.string().regex(/VM execution error.*/),
|
|
76
|
-
data: z
|
|
77
|
-
.string()
|
|
78
|
-
.transform((data) => data.replace("Reverted ", ""))
|
|
79
|
-
.pipe(hexDataSchema)
|
|
80
|
-
}),
|
|
81
|
-
z.object({
|
|
82
|
-
code: z.number(),
|
|
83
|
-
message: z
|
|
84
|
-
.string()
|
|
85
|
-
.regex(/VM Exception while processing transaction:.*/),
|
|
86
|
-
data: hexDataSchema
|
|
87
|
-
})
|
|
88
|
-
])
|
|
89
|
-
.safeParse(err.cause);
|
|
90
|
-
if (!causeParseResult.success) {
|
|
91
|
-
throw new Error(JSON.stringify(err.cause));
|
|
92
|
-
}
|
|
93
|
-
const cause = causeParseResult.data;
|
|
94
|
-
if (cause.data === "0x") {
|
|
95
|
-
throw new RpcError("AA23 reverted: UserOperation called non-existant contract, or reverted with 0x", ValidationErrors.SimulateValidation);
|
|
96
|
-
}
|
|
97
|
-
const decodedError = decodeErrorResult({
|
|
98
|
-
abi: [...EntryPointV06Abi, ...EntryPointV06SimulationsAbi],
|
|
99
|
-
data: cause.data
|
|
100
|
-
});
|
|
101
|
-
if (decodedError &&
|
|
102
|
-
decodedError.errorName === "FailedOp" &&
|
|
103
|
-
decodedError.args) {
|
|
104
|
-
return {
|
|
105
|
-
result: "failed",
|
|
106
|
-
data: decodedError.args[1]
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
if (decodedError &&
|
|
110
|
-
decodedError.errorName === "Error" &&
|
|
111
|
-
decodedError.args) {
|
|
112
|
-
return {
|
|
113
|
-
result: "failed",
|
|
114
|
-
data: decodedError.args[0]
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
if (decodedError.errorName === "ExecutionResult") {
|
|
118
|
-
const parsedExecutionResult = executionResultSchema.parse(decodedError.args);
|
|
119
|
-
return {
|
|
120
|
-
result: "execution",
|
|
121
|
-
data: {
|
|
122
|
-
executionResult: parsedExecutionResult
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
throw new Error("Unexpected error");
|
|
128
|
-
}
|
|
129
|
-
async function callPimlicoEntryPointSimulations(publicClient, entryPoint, entryPointSimulationsCallData, entryPointSimulationsAddress, blockTagSupport, utilityWalletAddress, stateOverride, fixedGasLimitForEstimation) {
|
|
130
|
-
const callData = encodeFunctionData({
|
|
131
|
-
abi: PimlicoEntryPointSimulationsAbi,
|
|
132
|
-
functionName: "simulateEntryPoint",
|
|
133
|
-
args: [entryPoint, entryPointSimulationsCallData]
|
|
134
|
-
});
|
|
135
|
-
const result = (await publicClient.request({
|
|
136
|
-
method: "eth_call",
|
|
137
|
-
params: [
|
|
138
|
-
{
|
|
139
|
-
to: entryPointSimulationsAddress,
|
|
140
|
-
from: utilityWalletAddress,
|
|
141
|
-
data: callData,
|
|
142
|
-
...(fixedGasLimitForEstimation !== undefined && {
|
|
143
|
-
gas: `0x${fixedGasLimitForEstimation.toString(16)}`
|
|
144
|
-
})
|
|
145
|
-
},
|
|
146
|
-
blockTagSupport
|
|
147
|
-
? "latest"
|
|
148
|
-
: toHex(await publicClient.getBlockNumber()),
|
|
149
|
-
// @ts-ignore
|
|
150
|
-
...(stateOverride ? [stateOverride] : [])
|
|
151
|
-
]
|
|
152
|
-
}));
|
|
153
|
-
const returnBytes = decodeAbiParameters([{ name: "ret", type: "bytes[]" }], result);
|
|
154
|
-
return returnBytes[0].map((data) => {
|
|
155
|
-
const decodedDelegateAndError = decodeErrorResult({
|
|
156
|
-
abi: EntryPointV07Abi,
|
|
157
|
-
data: data
|
|
158
|
-
});
|
|
159
|
-
if (!decodedDelegateAndError?.args?.[1]) {
|
|
160
|
-
throw new Error("Unexpected error");
|
|
161
|
-
}
|
|
162
|
-
return decodedDelegateAndError.args[1];
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
const panicCodes = {
|
|
166
|
-
// from https://docs.soliditylang.org/en/v0.8.0/control-structures.html
|
|
167
|
-
1: "assert(false)",
|
|
168
|
-
17: "arithmetic overflow/underflow",
|
|
169
|
-
18: "divide by zero",
|
|
170
|
-
33: "invalid enum value",
|
|
171
|
-
34: "storage byte array that is incorrectly encoded",
|
|
172
|
-
49: ".pop() on an empty array.",
|
|
173
|
-
50: "array sout-of-bounds or negative index",
|
|
174
|
-
65: "memory overflow",
|
|
175
|
-
81: "zero-initialized variable of internal function type"
|
|
176
|
-
};
|
|
177
|
-
export function parseFailedOpWithRevert(data) {
|
|
178
|
-
const methodSig = data.slice(0, 10);
|
|
179
|
-
const dataParams = `0x${data.slice(10)}`;
|
|
180
|
-
if (methodSig === "0x08c379a0") {
|
|
181
|
-
const [err] = decodeAbiParameters([
|
|
182
|
-
{
|
|
183
|
-
name: "err",
|
|
184
|
-
type: "string"
|
|
185
|
-
}
|
|
186
|
-
], dataParams);
|
|
187
|
-
return err;
|
|
188
|
-
}
|
|
189
|
-
if (methodSig === "0x4e487b71") {
|
|
190
|
-
const [code] = decodeAbiParameters([
|
|
191
|
-
{
|
|
192
|
-
name: "err",
|
|
193
|
-
type: "uint256"
|
|
194
|
-
}
|
|
195
|
-
], dataParams);
|
|
196
|
-
return panicCodes[Number(code)] ?? `${code}`;
|
|
197
|
-
}
|
|
198
|
-
return data;
|
|
199
|
-
}
|
|
200
|
-
function validateTargetCallDataResult(data) {
|
|
201
|
-
try {
|
|
202
|
-
const targetCallResult = decodeFunctionResult({
|
|
203
|
-
abi: EntryPointV07SimulationsAbi,
|
|
204
|
-
functionName: "simulateCallData",
|
|
205
|
-
data: data
|
|
206
|
-
});
|
|
207
|
-
const parsedTargetCallResult = targetCallResultSchema.parse(targetCallResult);
|
|
208
|
-
if (parsedTargetCallResult.success) {
|
|
209
|
-
return {
|
|
210
|
-
result: "success",
|
|
211
|
-
data: parsedTargetCallResult
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
return {
|
|
215
|
-
result: "failed",
|
|
216
|
-
data: parsedTargetCallResult.returnData,
|
|
217
|
-
code: ExecutionErrors.UserOperationReverted
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
catch (_e) {
|
|
221
|
-
// no error we go the result
|
|
222
|
-
return {
|
|
223
|
-
result: "failed",
|
|
224
|
-
data: "Unknown error, could not parse target call data result.",
|
|
225
|
-
code: ExecutionErrors.UserOperationReverted
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
function getSimulateHandleOpResult(data) {
|
|
230
|
-
try {
|
|
231
|
-
const decodedError = decodeErrorResult({
|
|
232
|
-
abi: EntryPointV07SimulationsAbi,
|
|
233
|
-
data: data
|
|
234
|
-
});
|
|
235
|
-
if (decodedError &&
|
|
236
|
-
decodedError.errorName === "FailedOp" &&
|
|
237
|
-
decodedError.args) {
|
|
238
|
-
return {
|
|
239
|
-
result: "failed",
|
|
240
|
-
data: decodedError.args[1],
|
|
241
|
-
code: ValidationErrors.SimulateValidation
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
if (decodedError &&
|
|
245
|
-
decodedError.errorName === "FailedOpWithRevert" &&
|
|
246
|
-
decodedError.args) {
|
|
247
|
-
return {
|
|
248
|
-
result: "failed",
|
|
249
|
-
data: parseFailedOpWithRevert(decodedError.args?.[2]),
|
|
250
|
-
code: ValidationErrors.SimulateValidation
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
catch {
|
|
255
|
-
// no error we go the result
|
|
256
|
-
const decodedResult = decodeFunctionResult({
|
|
257
|
-
abi: EntryPointV07SimulationsAbi,
|
|
258
|
-
functionName: "simulateHandleOp",
|
|
259
|
-
data
|
|
260
|
-
});
|
|
261
|
-
return {
|
|
262
|
-
result: "execution",
|
|
263
|
-
data: {
|
|
264
|
-
executionResult: decodedResult
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
throw new Error("Unexpected error");
|
|
269
|
-
}
|
|
270
|
-
export async function simulateHandleOpV07(userOperation, queuedUserOperations, entryPoint, publicClient, entryPointSimulationsAddress, chainId, blockTagSupport, utilityWalletAddress, finalParam = undefined, fixedGasLimitForEstimation) {
|
|
271
|
-
const userOperations = [...queuedUserOperations, userOperation];
|
|
272
|
-
const packedUserOperations = userOperations.map((uop) => ({
|
|
273
|
-
packedUserOperation: toPackedUserOperation(uop),
|
|
274
|
-
userOperation: uop,
|
|
275
|
-
userOperationHash: getUserOperationHash(uop, entryPoint, chainId)
|
|
276
|
-
}));
|
|
277
|
-
const entryPointSimulationsSimulateHandleOpCallData = encodeFunctionData({
|
|
278
|
-
abi: EntryPointV07SimulationsAbi,
|
|
279
|
-
functionName: "simulateHandleOpLast",
|
|
280
|
-
args: [packedUserOperations.map((uop) => uop.packedUserOperation)]
|
|
281
|
-
});
|
|
282
|
-
const entryPointSimulationsSimulateTargetCallData = encodeFunctionData({
|
|
283
|
-
abi: EntryPointV07SimulationsAbi,
|
|
284
|
-
functionName: "simulateCallDataLast",
|
|
285
|
-
args: [
|
|
286
|
-
packedUserOperations.map((uop) => uop.packedUserOperation),
|
|
287
|
-
packedUserOperations.map((packedUserOperation) => packedUserOperation.userOperation.sender),
|
|
288
|
-
packedUserOperations.map((packedUserOperation) => {
|
|
289
|
-
const executeUserOpAbi = [
|
|
290
|
-
{
|
|
291
|
-
inputs: [
|
|
292
|
-
{
|
|
293
|
-
components: [
|
|
294
|
-
{
|
|
295
|
-
internalType: "address",
|
|
296
|
-
name: "sender",
|
|
297
|
-
type: "address"
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
internalType: "uint256",
|
|
301
|
-
name: "nonce",
|
|
302
|
-
type: "uint256"
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
internalType: "bytes",
|
|
306
|
-
name: "initCode",
|
|
307
|
-
type: "bytes"
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
internalType: "bytes",
|
|
311
|
-
name: "callData",
|
|
312
|
-
type: "bytes"
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
internalType: "bytes32",
|
|
316
|
-
name: "accountGasLimits",
|
|
317
|
-
type: "bytes32"
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
internalType: "uint256",
|
|
321
|
-
name: "preVerificationGas",
|
|
322
|
-
type: "uint256"
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
internalType: "bytes32",
|
|
326
|
-
name: "gasFees",
|
|
327
|
-
type: "bytes32"
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
internalType: "bytes",
|
|
331
|
-
name: "paymasterAndData",
|
|
332
|
-
type: "bytes"
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
internalType: "bytes",
|
|
336
|
-
name: "signature",
|
|
337
|
-
type: "bytes"
|
|
338
|
-
}
|
|
339
|
-
],
|
|
340
|
-
internalType: "struct PackedUserOperation",
|
|
341
|
-
name: "userOp",
|
|
342
|
-
type: "tuple"
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
internalType: "bytes32",
|
|
346
|
-
name: "userOpHash",
|
|
347
|
-
type: "bytes32"
|
|
348
|
-
}
|
|
349
|
-
],
|
|
350
|
-
name: "executeUserOp",
|
|
351
|
-
outputs: [],
|
|
352
|
-
stateMutability: "nonpayable",
|
|
353
|
-
type: "function"
|
|
354
|
-
}
|
|
355
|
-
];
|
|
356
|
-
const executeUserOpMethodSig = toFunctionSelector(executeUserOpAbi[0]);
|
|
357
|
-
const callDataMethodSig = toHex(slice(toBytes(packedUserOperation.userOperation.callData), 0, 4));
|
|
358
|
-
if (executeUserOpMethodSig === callDataMethodSig) {
|
|
359
|
-
return encodeFunctionData({
|
|
360
|
-
abi: executeUserOpAbi,
|
|
361
|
-
functionName: "executeUserOp",
|
|
362
|
-
args: [
|
|
363
|
-
packedUserOperation.packedUserOperation,
|
|
364
|
-
getUserOperationHash(packedUserOperation.userOperation, entryPoint, chainId)
|
|
365
|
-
]
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
return packedUserOperation.userOperation.callData;
|
|
369
|
-
})
|
|
370
|
-
]
|
|
371
|
-
});
|
|
372
|
-
const cause = await callPimlicoEntryPointSimulations(publicClient, entryPoint, [
|
|
373
|
-
entryPointSimulationsSimulateHandleOpCallData,
|
|
374
|
-
entryPointSimulationsSimulateTargetCallData
|
|
375
|
-
], entryPointSimulationsAddress, blockTagSupport, utilityWalletAddress, finalParam, fixedGasLimitForEstimation);
|
|
376
|
-
try {
|
|
377
|
-
const executionResult = getSimulateHandleOpResult(cause[0]);
|
|
378
|
-
if (executionResult.result === "failed") {
|
|
379
|
-
return executionResult;
|
|
380
|
-
}
|
|
381
|
-
const targetCallValidationResult = validateTargetCallDataResult(cause[1]);
|
|
382
|
-
if (targetCallValidationResult.result === "failed") {
|
|
383
|
-
return targetCallValidationResult;
|
|
384
|
-
}
|
|
385
|
-
return {
|
|
386
|
-
result: "execution",
|
|
387
|
-
data: {
|
|
388
|
-
callDataResult: targetCallValidationResult.data,
|
|
389
|
-
executionResult: executionResult.data.executionResult
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
catch (e) {
|
|
394
|
-
return {
|
|
395
|
-
result: "failed",
|
|
396
|
-
data: "Unknown error, could not parse simulate handle op result.",
|
|
397
|
-
code: ValidationErrors.SimulateValidation
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
export function simulateHandleOp(userOperation, queuedUserOperations, entryPoint, publicClient, replacedEntryPoint, targetAddress, targetCallData, balanceOverrideEnabled, chainId, blockTagSupport, utilityWalletAddress, stateOverride = {}, entryPointSimulationsAddress, fixedGasLimitForEstimation) {
|
|
402
|
-
let finalStateOverride = undefined;
|
|
403
|
-
if (balanceOverrideEnabled) {
|
|
404
|
-
finalStateOverride = getStateOverrides({
|
|
405
|
-
userOperation,
|
|
406
|
-
entryPoint,
|
|
407
|
-
replacedEntryPoint,
|
|
408
|
-
stateOverride
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
if (isVersion06(userOperation)) {
|
|
412
|
-
return simulateHandleOpV06(userOperation, entryPoint, publicClient, targetAddress, targetCallData, blockTagSupport, utilityWalletAddress, finalStateOverride, fixedGasLimitForEstimation);
|
|
413
|
-
}
|
|
414
|
-
if (!entryPointSimulationsAddress) {
|
|
415
|
-
throw new RpcError("entryPointSimulationsAddress must be provided for V07 UserOperation", ValidationErrors.InvalidFields);
|
|
416
|
-
}
|
|
417
|
-
return simulateHandleOpV07(userOperation, queuedUserOperations, entryPoint, publicClient, entryPointSimulationsAddress, chainId, blockTagSupport, utilityWalletAddress, finalStateOverride, fixedGasLimitForEstimation);
|
|
418
|
-
}
|
|
419
|
-
//# sourceMappingURL=gasEstimation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gasEstimation.js","sourceRoot":"","sources":["../../rpc/gasEstimation.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,eAAe,EAEf,QAAQ,EAER,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,2BAA2B,EAC3B,2BAA2B,EAC3B,gBAAgB,EAChB,sBAAsB,EACzB,MAAM,aAAa,CAAA;AAOpB,OAAO,EACH,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACxB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAGH,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,OAAO,EACP,KAAK,EACR,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAA;AACrE,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAE7D,SAAS,iBAAiB,CAAC,EACvB,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,aAAa,GAAG,EAAE,E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A;IACL,CAAC;IAED,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAChC,MAAM,IAAI,QAAQ,CACd,qEAAqE,EACrE,gBAAgB,CAAC,aAAa,CACjC,CAAA;IACL,CAAC;IAED,OAAO,mBAAmB,CACtB,aAAa,EACb,oBAA0C,EAC1C,UAAU,EACV,YAAY,EACZ,4BAA4B,EAC5B,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,0BAA0B,CAC7B,CAAA;AACL,CAAC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { Hex } from "viem";
|
|
2
|
-
import { type Address, type PublicClient } from "viem";
|
|
3
|
-
import { ExecutionErrors, ValidationErrors, type StateOverrides, type UserOperationV07, type ValidationResultV07 } from "../types/index.js";
|
|
4
|
-
export declare function parseFailedOpWithRevert(data: Hex): string;
|
|
5
|
-
export declare function simulateHandleOp(userOperation: UserOperationV07, entryPoint: Address, publicClient: PublicClient, replacedEntryPoint: boolean, targetAddress: Address, targetCallData: Hex, entryPointSimulationsAddress: Address, blockTagSupport: boolean, utilityWalletAddress: Address, stateOverride?: StateOverrides): Promise<{
|
|
6
|
-
readonly result: "failed";
|
|
7
|
-
readonly data: string;
|
|
8
|
-
readonly code: ExecutionErrors;
|
|
9
|
-
} | {
|
|
10
|
-
readonly result: "failed";
|
|
11
|
-
readonly data: unknown;
|
|
12
|
-
readonly code: ValidationErrors.SimulateValidation;
|
|
13
|
-
} | {
|
|
14
|
-
readonly result: "execution";
|
|
15
|
-
readonly data: {
|
|
16
|
-
preOpGas: bigint;
|
|
17
|
-
paid: bigint;
|
|
18
|
-
validationData: bigint;
|
|
19
|
-
paymasterValidationData: bigint;
|
|
20
|
-
targetSuccess: boolean;
|
|
21
|
-
targetResult: `0x${string}`;
|
|
22
|
-
};
|
|
23
|
-
readonly code?: undefined;
|
|
24
|
-
}>;
|
|
25
|
-
export declare function getSimulateValidationResult(errorData: Hex): {
|
|
26
|
-
status: "failed" | "validation";
|
|
27
|
-
data: ValidationResultV07 | Hex | string;
|
|
28
|
-
};
|
|
29
|
-
export declare function simulateValidation(userOperation: UserOperationV07, queuedUserOperations: UserOperationV07[], entryPoint: Address, publicClient: PublicClient, entryPointSimulationsAddress: Address, blockTagSupport: boolean, utilityWalletAddress: Address): Promise<{
|
|
30
|
-
simulateValidationResult: {
|
|
31
|
-
status: "validation" | "failed";
|
|
32
|
-
data: string | {
|
|
33
|
-
returnInfo: {
|
|
34
|
-
preOpGas: bigint;
|
|
35
|
-
prefund: bigint;
|
|
36
|
-
paymasterContext: `0x${string}`;
|
|
37
|
-
accountValidationData: bigint;
|
|
38
|
-
paymasterValidationData: bigint;
|
|
39
|
-
accountSigFailed?: boolean | undefined;
|
|
40
|
-
paymasterSigFailed?: boolean | undefined;
|
|
41
|
-
validAfter?: number | undefined;
|
|
42
|
-
validUntil?: number | undefined;
|
|
43
|
-
};
|
|
44
|
-
senderInfo: {
|
|
45
|
-
stake: bigint;
|
|
46
|
-
unstakeDelaySec: bigint;
|
|
47
|
-
addr?: string | undefined;
|
|
48
|
-
};
|
|
49
|
-
factoryInfo: {
|
|
50
|
-
stake: bigint;
|
|
51
|
-
unstakeDelaySec: bigint;
|
|
52
|
-
addr?: string | undefined;
|
|
53
|
-
} | undefined;
|
|
54
|
-
paymasterInfo: {
|
|
55
|
-
stake: bigint;
|
|
56
|
-
unstakeDelaySec: bigint;
|
|
57
|
-
addr?: string | undefined;
|
|
58
|
-
} | undefined;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
}>;
|
|
62
|
-
//# sourceMappingURL=EntryPointSimulationsV07.d.ts.map
|