@pimlico/alto 0.0.0-main.20250225T164854 → 0.0.0-main.20250227T131500
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/executor/utils.js +1 -1
- package/esm/rpc/estimation/gasEstimationHandler.d.ts +3 -3
- package/esm/rpc/estimation/gasEstimationHandler.js +10 -17
- package/esm/rpc/estimation/gasEstimationHandler.js.map +1 -1
- package/esm/rpc/estimation/gasEstimationsV06.js +6 -8
- package/esm/rpc/estimation/gasEstimationsV06.js.map +1 -1
- package/esm/rpc/estimation/gasEstimationsV07.d.ts +1 -3
- package/esm/rpc/estimation/gasEstimationsV07.js +27 -40
- package/esm/rpc/estimation/gasEstimationsV07.js.map +1 -1
- package/esm/rpc/methods/debug_bundler_dumpMempool.d.ts +18 -18
- package/esm/rpc/methods/eth_estimateUserOperationGas.d.ts +32 -32
- package/esm/rpc/methods/eth_estimateUserOperationGas.js +6 -1
- package/esm/rpc/methods/eth_estimateUserOperationGas.js.map +1 -1
- package/esm/rpc/methods/eth_getUserOperationByHash.d.ts +34 -34
- package/esm/rpc/methods/eth_sendUserOperation.d.ts +16 -16
- package/esm/rpc/methods/eth_sendUserOperation.js +6 -0
- package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
- package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.d.ts +32 -32
- package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js +3 -1
- package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js.map +1 -1
- package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.d.ts +16 -16
- package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.js +4 -1
- package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.js.map +1 -1
- package/esm/rpc/methods/pimlico_sendUserOperationNow.d.ts +16 -16
- package/esm/rpc/rpcHandler.d.ts +4 -1
- package/esm/rpc/rpcHandler.js +7 -7
- package/esm/rpc/rpcHandler.js.map +1 -1
- package/esm/rpc/validation/SafeValidator.js +13 -3
- package/esm/rpc/validation/SafeValidator.js.map +1 -1
- package/esm/rpc/validation/UnsafeValidator.d.ts +2 -2
- package/esm/rpc/validation/UnsafeValidator.js +3 -3
- package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
- package/esm/rpc/validation/tracer.d.ts +4 -1
- package/esm/rpc/validation/tracer.js +0 -1
- package/esm/rpc/validation/tracer.js.map +1 -1
- package/esm/types/interfaces.d.ts +1 -1
- package/esm/types/schemas.d.ts +422 -422
- package/esm/types/schemas.js +4 -4
- package/esm/utils/helpers.d.ts +3 -4
- package/esm/utils/helpers.js +24 -15
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/validation.js +1 -1
- package/lib/executor/utils.js +1 -1
- package/lib/rpc/estimation/gasEstimationHandler.d.ts +3 -3
- package/lib/rpc/estimation/gasEstimationHandler.js +9 -16
- package/lib/rpc/estimation/gasEstimationHandler.js.map +1 -1
- package/lib/rpc/estimation/gasEstimationsV06.js +5 -7
- package/lib/rpc/estimation/gasEstimationsV06.js.map +1 -1
- package/lib/rpc/estimation/gasEstimationsV07.d.ts +1 -3
- package/lib/rpc/estimation/gasEstimationsV07.js +26 -39
- package/lib/rpc/estimation/gasEstimationsV07.js.map +1 -1
- package/lib/rpc/methods/debug_bundler_dumpMempool.d.ts +18 -18
- package/lib/rpc/methods/eth_estimateUserOperationGas.d.ts +32 -32
- package/lib/rpc/methods/eth_estimateUserOperationGas.js +6 -1
- package/lib/rpc/methods/eth_estimateUserOperationGas.js.map +1 -1
- package/lib/rpc/methods/eth_getUserOperationByHash.d.ts +34 -34
- package/lib/rpc/methods/eth_sendUserOperation.d.ts +16 -16
- package/lib/rpc/methods/eth_sendUserOperation.js +6 -0
- package/lib/rpc/methods/eth_sendUserOperation.js.map +1 -1
- package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.d.ts +32 -32
- package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js +3 -1
- package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js.map +1 -1
- package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.d.ts +16 -16
- package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.js +4 -1
- package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.js.map +1 -1
- package/lib/rpc/methods/pimlico_sendUserOperationNow.d.ts +16 -16
- package/lib/rpc/rpcHandler.d.ts +4 -1
- package/lib/rpc/rpcHandler.js +7 -7
- package/lib/rpc/rpcHandler.js.map +1 -1
- package/lib/rpc/validation/SafeValidator.js +12 -2
- package/lib/rpc/validation/SafeValidator.js.map +1 -1
- package/lib/rpc/validation/UnsafeValidator.d.ts +2 -2
- package/lib/rpc/validation/UnsafeValidator.js +3 -3
- package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
- package/lib/rpc/validation/tracer.d.ts +4 -1
- package/lib/rpc/validation/tracer.js +0 -1
- package/lib/rpc/validation/tracer.js.map +1 -1
- package/lib/types/interfaces.d.ts +1 -1
- package/lib/types/schemas.d.ts +422 -422
- package/lib/types/schemas.js +4 -4
- package/lib/utils/helpers.d.ts +3 -4
- package/lib/utils/helpers.js +26 -17
- package/lib/utils/helpers.js.map +1 -1
- package/lib/utils/validation.js +1 -1
- package/package.json +1 -1
package/lib/types/schemas.js
CHANGED
|
@@ -57,7 +57,7 @@ const userOperationV06Schema = zod_1.z
|
|
|
57
57
|
maxFeePerGas: exports.hexNumberSchema,
|
|
58
58
|
paymasterAndData: exports.hexDataSchema,
|
|
59
59
|
signature: exports.hexDataSchema,
|
|
60
|
-
|
|
60
|
+
eip7702Auth: signedAuthorizationSchema.optional().nullable()
|
|
61
61
|
})
|
|
62
62
|
.strict()
|
|
63
63
|
.transform((val) => {
|
|
@@ -98,7 +98,7 @@ const userOperationV07Schema = zod_1.z
|
|
|
98
98
|
.optional()
|
|
99
99
|
.transform((val) => val ?? null),
|
|
100
100
|
signature: exports.hexDataSchema,
|
|
101
|
-
|
|
101
|
+
eip7702Auth: signedAuthorizationSchema.optional().nullable()
|
|
102
102
|
})
|
|
103
103
|
.strict()
|
|
104
104
|
.transform((val) => val);
|
|
@@ -115,7 +115,7 @@ const partialUserOperationV06Schema = zod_1.z
|
|
|
115
115
|
maxFeePerGas: exports.hexNumberSchema.default(1n),
|
|
116
116
|
paymasterAndData: exports.hexDataSchema,
|
|
117
117
|
signature: exports.hexDataSchema,
|
|
118
|
-
|
|
118
|
+
eip7702Auth: signedAuthorizationSchema.optional()
|
|
119
119
|
})
|
|
120
120
|
.strict()
|
|
121
121
|
.transform((val) => {
|
|
@@ -156,7 +156,7 @@ const partialUserOperationV07Schema = zod_1.z
|
|
|
156
156
|
.optional()
|
|
157
157
|
.transform((val) => val ?? null),
|
|
158
158
|
signature: exports.hexDataSchema,
|
|
159
|
-
|
|
159
|
+
eip7702Auth: signedAuthorizationSchema.optional().nullable()
|
|
160
160
|
})
|
|
161
161
|
.strict()
|
|
162
162
|
.transform((val) => val);
|
package/lib/utils/helpers.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { StateOverrides } from "../types/index.js";
|
|
1
|
+
import type { StateOverrides, UserOperation } from "../types/index.js";
|
|
2
2
|
import { type PublicClient } from "viem";
|
|
3
|
-
import { type SignedAuthorizationList } from "viem/experimental";
|
|
4
3
|
export declare const areAddressesEqual: (a: string, b: string) => boolean;
|
|
5
4
|
export declare function getRevertErrorData(err: unknown): `0x${string}` | undefined;
|
|
6
5
|
export declare function getAAError(errorMsg: string): string | undefined;
|
|
7
|
-
export declare function
|
|
6
|
+
export declare function getAuthorizationStateOverrides({ userOperations, publicClient, stateOverrides }: {
|
|
7
|
+
userOperations: UserOperation[];
|
|
8
8
|
publicClient: PublicClient;
|
|
9
|
-
authorizationList: SignedAuthorizationList;
|
|
10
9
|
stateOverrides?: StateOverrides;
|
|
11
10
|
}): Promise<Partial<Record<`0x${string}`, {
|
|
12
11
|
balance?: bigint | undefined;
|
package/lib/utils/helpers.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAuthorizationStateOverrides = exports.getAAError = exports.getRevertErrorData = exports.areAddressesEqual = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
|
-
const experimental_1 = require("viem/experimental");
|
|
6
5
|
/// Ensure proper equality by converting both addresses into their checksum type
|
|
7
6
|
const areAddressesEqual = (a, b) => {
|
|
8
7
|
try {
|
|
@@ -14,14 +13,13 @@ const areAddressesEqual = (a, b) => {
|
|
|
14
13
|
};
|
|
15
14
|
exports.areAddressesEqual = areAddressesEqual;
|
|
16
15
|
function getRevertErrorData(err) {
|
|
17
|
-
|
|
18
|
-
if (!(err instanceof viem_1.BaseError))
|
|
16
|
+
if (!(err instanceof viem_1.BaseError)) {
|
|
19
17
|
return undefined;
|
|
18
|
+
}
|
|
20
19
|
const error = err.walk();
|
|
21
20
|
return typeof error?.data === "object" ? error.data?.data : error.data;
|
|
22
21
|
}
|
|
23
22
|
exports.getRevertErrorData = getRevertErrorData;
|
|
24
|
-
// biome-ignore lint/style/useNamingConvention:
|
|
25
23
|
function getAAError(errorMsg) {
|
|
26
24
|
const uppercase = errorMsg.toUpperCase();
|
|
27
25
|
const match = uppercase.match(/AA\d{2}/);
|
|
@@ -29,17 +27,28 @@ function getAAError(errorMsg) {
|
|
|
29
27
|
}
|
|
30
28
|
exports.getAAError = getAAError;
|
|
31
29
|
// authorizationList is not currently supported in viem's sendTransaction, this is a temporary solution
|
|
32
|
-
async function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
async function getAuthorizationStateOverride({ publicClient, authorization }) {
|
|
31
|
+
const code = await publicClient.getCode({
|
|
32
|
+
address: authorization.contractAddress
|
|
33
|
+
});
|
|
34
|
+
return { code };
|
|
35
|
+
}
|
|
36
|
+
async function getAuthorizationStateOverrides({ userOperations, publicClient, stateOverrides }) {
|
|
37
|
+
const overrides = { ...(stateOverrides ?? {}) };
|
|
38
|
+
await Promise.all([
|
|
39
|
+
...userOperations.map(async (op) => {
|
|
40
|
+
if (op.eip7702Auth) {
|
|
41
|
+
overrides[op.sender] = {
|
|
42
|
+
...(overrides[op.sender] || {}),
|
|
43
|
+
...(await getAuthorizationStateOverride({
|
|
44
|
+
authorization: op.eip7702Auth,
|
|
45
|
+
publicClient
|
|
46
|
+
}))
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
]);
|
|
51
|
+
return overrides;
|
|
43
52
|
}
|
|
44
|
-
exports.
|
|
53
|
+
exports.getAuthorizationStateOverrides = getAuthorizationStateOverrides;
|
|
45
54
|
//# sourceMappingURL=helpers.js.map
|
package/lib/utils/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../utils/helpers.ts"],"names":[],"mappings":";;;AACA,+BAKa;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../utils/helpers.ts"],"names":[],"mappings":";;;AACA,+BAKa;AAGb,gFAAgF;AACzE,MAAM,iBAAiB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;IACtD,IAAI,CAAC;QACD,OAAO,IAAA,iBAAU,EAAC,CAAC,CAAC,KAAK,IAAA,iBAAU,EAAC,CAAC,CAAC,CAAA;IAC1C,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAA;IAChB,CAAC;AACL,CAAC,CAAA;AANY,QAAA,iBAAiB,qBAM7B;AAED,SAAgB,kBAAkB,CAAC,GAAY;IAC3C,IAAI,CAAC,CAAC,GAAG,YAAY,gBAAS,CAAC,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAA;IACpB,CAAC;IACD,MAAM,K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,CAAC;iBACN,CAAA;YACL,CAAC;QACL,CAAC,CAAC;KACL,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;AACpB,CAAC;AA1BD,wEA0BC"}
|
package/lib/utils/validation.js
CHANGED
|
@@ -247,7 +247,7 @@ function calcDefaultPreVerificationGas(userOperation, overheads) {
|
|
|
247
247
|
const callDataCost = packed
|
|
248
248
|
.map((x) => (x === 0 ? ov.zeroByte : ov.nonZeroByte))
|
|
249
249
|
.reduce((sum, x) => sum + x);
|
|
250
|
-
const authorizationCost = userOperation.
|
|
250
|
+
const authorizationCost = userOperation.eip7702Auth
|
|
251
251
|
? 37500 // overhead for PER_EMPTY_ACCOUNT_COST + PER_AUTH_BASE_COST
|
|
252
252
|
: 0;
|
|
253
253
|
const ret = Math.round(authorizationCost +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pimlico/alto",
|
|
3
|
-
"version": "0.0.0-main.
|
|
3
|
+
"version": "0.0.0-main.20250227T131500",
|
|
4
4
|
"description": "A performant and modular ERC-4337 Bundler written in Typescript",
|
|
5
5
|
"repository": "https://github.com/pimlicolabs/alto.git",
|
|
6
6
|
"author": "Pimlico",
|