@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.
Files changed (85) hide show
  1. package/esm/executor/utils.js +1 -1
  2. package/esm/rpc/estimation/gasEstimationHandler.d.ts +3 -3
  3. package/esm/rpc/estimation/gasEstimationHandler.js +10 -17
  4. package/esm/rpc/estimation/gasEstimationHandler.js.map +1 -1
  5. package/esm/rpc/estimation/gasEstimationsV06.js +6 -8
  6. package/esm/rpc/estimation/gasEstimationsV06.js.map +1 -1
  7. package/esm/rpc/estimation/gasEstimationsV07.d.ts +1 -3
  8. package/esm/rpc/estimation/gasEstimationsV07.js +27 -40
  9. package/esm/rpc/estimation/gasEstimationsV07.js.map +1 -1
  10. package/esm/rpc/methods/debug_bundler_dumpMempool.d.ts +18 -18
  11. package/esm/rpc/methods/eth_estimateUserOperationGas.d.ts +32 -32
  12. package/esm/rpc/methods/eth_estimateUserOperationGas.js +6 -1
  13. package/esm/rpc/methods/eth_estimateUserOperationGas.js.map +1 -1
  14. package/esm/rpc/methods/eth_getUserOperationByHash.d.ts +34 -34
  15. package/esm/rpc/methods/eth_sendUserOperation.d.ts +16 -16
  16. package/esm/rpc/methods/eth_sendUserOperation.js +6 -0
  17. package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
  18. package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.d.ts +32 -32
  19. package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js +3 -1
  20. package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js.map +1 -1
  21. package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.d.ts +16 -16
  22. package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.js +4 -1
  23. package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.js.map +1 -1
  24. package/esm/rpc/methods/pimlico_sendUserOperationNow.d.ts +16 -16
  25. package/esm/rpc/rpcHandler.d.ts +4 -1
  26. package/esm/rpc/rpcHandler.js +7 -7
  27. package/esm/rpc/rpcHandler.js.map +1 -1
  28. package/esm/rpc/validation/SafeValidator.js +13 -3
  29. package/esm/rpc/validation/SafeValidator.js.map +1 -1
  30. package/esm/rpc/validation/UnsafeValidator.d.ts +2 -2
  31. package/esm/rpc/validation/UnsafeValidator.js +3 -3
  32. package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
  33. package/esm/rpc/validation/tracer.d.ts +4 -1
  34. package/esm/rpc/validation/tracer.js +0 -1
  35. package/esm/rpc/validation/tracer.js.map +1 -1
  36. package/esm/types/interfaces.d.ts +1 -1
  37. package/esm/types/schemas.d.ts +422 -422
  38. package/esm/types/schemas.js +4 -4
  39. package/esm/utils/helpers.d.ts +3 -4
  40. package/esm/utils/helpers.js +24 -15
  41. package/esm/utils/helpers.js.map +1 -1
  42. package/esm/utils/validation.js +1 -1
  43. package/lib/executor/utils.js +1 -1
  44. package/lib/rpc/estimation/gasEstimationHandler.d.ts +3 -3
  45. package/lib/rpc/estimation/gasEstimationHandler.js +9 -16
  46. package/lib/rpc/estimation/gasEstimationHandler.js.map +1 -1
  47. package/lib/rpc/estimation/gasEstimationsV06.js +5 -7
  48. package/lib/rpc/estimation/gasEstimationsV06.js.map +1 -1
  49. package/lib/rpc/estimation/gasEstimationsV07.d.ts +1 -3
  50. package/lib/rpc/estimation/gasEstimationsV07.js +26 -39
  51. package/lib/rpc/estimation/gasEstimationsV07.js.map +1 -1
  52. package/lib/rpc/methods/debug_bundler_dumpMempool.d.ts +18 -18
  53. package/lib/rpc/methods/eth_estimateUserOperationGas.d.ts +32 -32
  54. package/lib/rpc/methods/eth_estimateUserOperationGas.js +6 -1
  55. package/lib/rpc/methods/eth_estimateUserOperationGas.js.map +1 -1
  56. package/lib/rpc/methods/eth_getUserOperationByHash.d.ts +34 -34
  57. package/lib/rpc/methods/eth_sendUserOperation.d.ts +16 -16
  58. package/lib/rpc/methods/eth_sendUserOperation.js +6 -0
  59. package/lib/rpc/methods/eth_sendUserOperation.js.map +1 -1
  60. package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.d.ts +32 -32
  61. package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js +3 -1
  62. package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js.map +1 -1
  63. package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.d.ts +16 -16
  64. package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.js +4 -1
  65. package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.js.map +1 -1
  66. package/lib/rpc/methods/pimlico_sendUserOperationNow.d.ts +16 -16
  67. package/lib/rpc/rpcHandler.d.ts +4 -1
  68. package/lib/rpc/rpcHandler.js +7 -7
  69. package/lib/rpc/rpcHandler.js.map +1 -1
  70. package/lib/rpc/validation/SafeValidator.js +12 -2
  71. package/lib/rpc/validation/SafeValidator.js.map +1 -1
  72. package/lib/rpc/validation/UnsafeValidator.d.ts +2 -2
  73. package/lib/rpc/validation/UnsafeValidator.js +3 -3
  74. package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
  75. package/lib/rpc/validation/tracer.d.ts +4 -1
  76. package/lib/rpc/validation/tracer.js +0 -1
  77. package/lib/rpc/validation/tracer.js.map +1 -1
  78. package/lib/types/interfaces.d.ts +1 -1
  79. package/lib/types/schemas.d.ts +422 -422
  80. package/lib/types/schemas.js +4 -4
  81. package/lib/utils/helpers.d.ts +3 -4
  82. package/lib/utils/helpers.js +26 -17
  83. package/lib/utils/helpers.js.map +1 -1
  84. package/lib/utils/validation.js +1 -1
  85. package/package.json +1 -1
@@ -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
- eip7702auth: signedAuthorizationSchema.optional().nullable()
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
- eip7702auth: signedAuthorizationSchema.optional().nullable()
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
- eip7702auth: signedAuthorizationSchema.optional()
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
- eip7702auth: signedAuthorizationSchema.optional().nullable()
159
+ eip7702Auth: signedAuthorizationSchema.optional().nullable()
160
160
  })
161
161
  .strict()
162
162
  .transform((val) => val);
@@ -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 addAuthorizationStateOverrides({ publicClient, authorizationList, stateOverrides }: {
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;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addAuthorizationStateOverrides = exports.getAAError = exports.getRevertErrorData = exports.areAddressesEqual = void 0;
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
- // biome-ignore lint/style/useBlockStatements:
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 addAuthorizationStateOverrides({ publicClient, authorizationList, stateOverrides }) {
33
- if (!stateOverrides)
34
- stateOverrides = {};
35
- for (const authorization of authorizationList) {
36
- const sender = await (0, experimental_1.recoverAuthorizationAddress)({ authorization });
37
- const code = await publicClient.getCode({
38
- address: authorization.contractAddress
39
- });
40
- stateOverrides[sender] = { ...stateOverrides?.[sender], code };
41
- }
42
- return stateOverrides;
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.addAuthorizationStateOverrides = addAuthorizationStateOverrides;
53
+ exports.getAuthorizationStateOverrides = getAuthorizationStateOverrides;
45
54
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../utils/helpers.ts"],"names":[],"mappings":";;;AACA,+BAKa;AACb,oDAG0B;AAE1B,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,8CAA8C;IAC9C,IAAI,CAAC,CAAC,GAAG,YAAY,gBAAS,CAAC;QAAE,OAAO,SAAS,CAAA;IACjD,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAsB,CAAA;IAC5C,OAAO,OAAO,KAAK,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAA;AAC1E,CAAC;AALD,gDAKC;AAED,+CAA+C;AAC/C,SAAgB,UAAU,CAAC,QAAgB;IACvC,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAA;IACx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AY;qBACf,CAAC,CAAC;iBACN,CAAA;YACL,CAAC;QACL,CAAC,CAAC;KACL,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;AACpB,CAAC;AA1BD,wEA0BC"}
@@ -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.eip7702auth
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.20250225T164854",
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",