@pimlico/alto 0.0.0-main.20250214T151652 → 0.0.0-main.20250225T152738

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 (197) hide show
  1. package/esm/cli/config/bundler.d.ts +6 -0
  2. package/esm/cli/config/bundler.js +1 -0
  3. package/esm/cli/config/bundler.js.map +1 -1
  4. package/esm/cli/config/options.js +5 -0
  5. package/esm/cli/config/options.js.map +1 -1
  6. package/esm/cli/setupServer.js +4 -4
  7. package/esm/cli/setupServer.js.map +1 -1
  8. package/esm/executor/executorManager.d.ts +9 -9
  9. package/esm/handlers/gasPriceManager.js +6 -0
  10. package/esm/handlers/gasPriceManager.js.map +1 -1
  11. package/esm/mempool/index.d.ts +1 -0
  12. package/esm/mempool/index.js +1 -0
  13. package/esm/mempool/index.js.map +1 -1
  14. package/esm/{rpc → mempool}/nonceQueuer.d.ts +1 -1
  15. package/esm/mempool/nonceQueuer.js.map +1 -0
  16. package/esm/mempool/reputationManager.d.ts +3 -2
  17. package/esm/mempool/reputationManager.js.map +1 -1
  18. package/esm/rpc/createMethodHandler.d.ts +31 -0
  19. package/esm/rpc/createMethodHandler.js +30 -0
  20. package/esm/rpc/createMethodHandler.js.map +1 -0
  21. package/esm/rpc/index.d.ts +0 -1
  22. package/esm/rpc/index.js +0 -1
  23. package/esm/rpc/index.js.map +1 -1
  24. package/esm/rpc/methods/debug_bundler_clearReputation.d.ts +22 -0
  25. package/esm/rpc/methods/debug_bundler_clearReputation.js +12 -0
  26. package/esm/rpc/methods/debug_bundler_clearReputation.js.map +1 -0
  27. package/esm/rpc/methods/debug_bundler_clearState.d.ts +22 -0
  28. package/esm/rpc/methods/debug_bundler_clearState.js +13 -0
  29. package/esm/rpc/methods/debug_bundler_clearState.js.map +1 -0
  30. package/esm/rpc/methods/debug_bundler_dumpMempool.d.ts +468 -0
  31. package/esm/rpc/methods/debug_bundler_dumpMempool.js +13 -0
  32. package/esm/rpc/methods/debug_bundler_dumpMempool.js.map +1 -0
  33. package/esm/rpc/methods/debug_bundler_dumpReputation.d.ts +57 -0
  34. package/esm/rpc/methods/debug_bundler_dumpReputation.js +13 -0
  35. package/esm/rpc/methods/debug_bundler_dumpReputation.js.map +1 -0
  36. package/esm/rpc/methods/debug_bundler_getStakeStatus.d.ts +79 -0
  37. package/esm/rpc/methods/debug_bundler_getStakeStatus.js +14 -0
  38. package/esm/rpc/methods/debug_bundler_getStakeStatus.js.map +1 -0
  39. package/esm/rpc/methods/debug_bundler_sendBundleNow.d.ts +22 -0
  40. package/esm/rpc/methods/debug_bundler_sendBundleNow.js +12 -0
  41. package/esm/rpc/methods/debug_bundler_sendBundleNow.js.map +1 -0
  42. package/esm/rpc/methods/debug_bundler_setBundlingMode.d.ts +22 -0
  43. package/esm/rpc/methods/debug_bundler_setBundlingMode.js +13 -0
  44. package/esm/rpc/methods/debug_bundler_setBundlingMode.js.map +1 -0
  45. package/esm/rpc/methods/debug_bundler_setReputation.d.ts +46 -0
  46. package/esm/rpc/methods/debug_bundler_setReputation.js +13 -0
  47. package/esm/rpc/methods/debug_bundler_setReputation.js.map +1 -0
  48. package/esm/rpc/methods/eth_chainId.d.ts +22 -0
  49. package/esm/rpc/methods/eth_chainId.js +10 -0
  50. package/esm/rpc/methods/eth_chainId.js.map +1 -0
  51. package/esm/rpc/methods/eth_estimateUserOperationGas.d.ts +979 -0
  52. package/esm/rpc/methods/eth_estimateUserOperationGas.js +18 -0
  53. package/esm/rpc/methods/eth_estimateUserOperationGas.js.map +1 -0
  54. package/esm/rpc/methods/eth_getUserOperationByHash.d.ts +878 -0
  55. package/esm/rpc/methods/eth_getUserOperationByHash.js +98 -0
  56. package/esm/rpc/methods/eth_getUserOperationByHash.js.map +1 -0
  57. package/esm/rpc/methods/eth_getUserOperationReceipt.d.ts +412 -0
  58. package/esm/rpc/methods/eth_getUserOperationReceipt.js +11 -0
  59. package/esm/rpc/methods/eth_getUserOperationReceipt.js.map +1 -0
  60. package/esm/rpc/methods/eth_sendUserOperation.d.ts +422 -0
  61. package/esm/rpc/methods/eth_sendUserOperation.js +30 -0
  62. package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -0
  63. package/esm/rpc/methods/eth_supportedEntryPoints.d.ts +22 -0
  64. package/esm/rpc/methods/eth_supportedEntryPoints.js +10 -0
  65. package/esm/rpc/methods/eth_supportedEntryPoints.js.map +1 -0
  66. package/esm/rpc/methods/index.d.ts +3 -0
  67. package/esm/rpc/methods/index.js +45 -0
  68. package/esm/rpc/methods/index.js.map +1 -0
  69. package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.d.ts +979 -0
  70. package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js +20 -0
  71. package/esm/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js.map +1 -0
  72. package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.d.ts +422 -0
  73. package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.js +16 -0
  74. package/esm/rpc/methods/pimlico_experimental_sendUserOperation7702.js.map +1 -0
  75. package/esm/rpc/methods/pimlico_getUserOperationGasPrice.d.ts +131 -0
  76. package/esm/rpc/methods/pimlico_getUserOperationGasPrice.js +30 -0
  77. package/esm/rpc/methods/pimlico_getUserOperationGasPrice.js.map +1 -0
  78. package/esm/rpc/methods/pimlico_getUserOperationStatus.d.ts +43 -0
  79. package/esm/rpc/methods/pimlico_getUserOperationStatus.js +11 -0
  80. package/esm/rpc/methods/pimlico_getUserOperationStatus.js.map +1 -0
  81. package/esm/rpc/methods/pimlico_sendUserOperationNow.d.ts +812 -0
  82. package/esm/rpc/methods/pimlico_sendUserOperationNow.js +41 -0
  83. package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -0
  84. package/esm/rpc/rpcHandler.d.ts +13 -104
  85. package/esm/rpc/rpcHandler.js +34 -373
  86. package/esm/rpc/rpcHandler.js.map +1 -1
  87. package/esm/rpc/server.d.ts +2 -2
  88. package/esm/rpc/server.js +1 -1
  89. package/esm/rpc/server.js.map +1 -1
  90. package/esm/rpc/validation/TracerResultParserV07.js +5 -5
  91. package/esm/rpc/validation/TracerResultParserV07.js.map +1 -1
  92. package/esm/types/schemas.d.ts +9368 -3502
  93. package/esm/types/schemas.js +213 -273
  94. package/esm/types/schemas.js.map +1 -1
  95. package/esm/utils/userop.d.ts +9 -9
  96. package/esm/utils/userop.js.map +1 -1
  97. package/lib/cli/config/bundler.d.ts +6 -0
  98. package/lib/cli/config/bundler.js +1 -0
  99. package/lib/cli/config/bundler.js.map +1 -1
  100. package/lib/cli/config/options.js +5 -0
  101. package/lib/cli/config/options.js.map +1 -1
  102. package/lib/cli/setupServer.js +3 -3
  103. package/lib/cli/setupServer.js.map +1 -1
  104. package/lib/executor/executorManager.d.ts +9 -9
  105. package/lib/handlers/gasPriceManager.js +6 -0
  106. package/lib/handlers/gasPriceManager.js.map +1 -1
  107. package/lib/mempool/index.d.ts +1 -0
  108. package/lib/mempool/index.js +1 -0
  109. package/lib/mempool/index.js.map +1 -1
  110. package/lib/{rpc → mempool}/nonceQueuer.d.ts +1 -1
  111. package/lib/mempool/nonceQueuer.js.map +1 -0
  112. package/lib/mempool/reputationManager.d.ts +3 -2
  113. package/lib/mempool/reputationManager.js.map +1 -1
  114. package/lib/rpc/createMethodHandler.d.ts +31 -0
  115. package/lib/rpc/createMethodHandler.js +34 -0
  116. package/lib/rpc/createMethodHandler.js.map +1 -0
  117. package/lib/rpc/index.d.ts +0 -1
  118. package/lib/rpc/index.js +0 -1
  119. package/lib/rpc/index.js.map +1 -1
  120. package/lib/rpc/methods/debug_bundler_clearReputation.d.ts +22 -0
  121. package/lib/rpc/methods/debug_bundler_clearReputation.js +15 -0
  122. package/lib/rpc/methods/debug_bundler_clearReputation.js.map +1 -0
  123. package/lib/rpc/methods/debug_bundler_clearState.d.ts +22 -0
  124. package/lib/rpc/methods/debug_bundler_clearState.js +16 -0
  125. package/lib/rpc/methods/debug_bundler_clearState.js.map +1 -0
  126. package/lib/rpc/methods/debug_bundler_dumpMempool.d.ts +468 -0
  127. package/lib/rpc/methods/debug_bundler_dumpMempool.js +16 -0
  128. package/lib/rpc/methods/debug_bundler_dumpMempool.js.map +1 -0
  129. package/lib/rpc/methods/debug_bundler_dumpReputation.d.ts +57 -0
  130. package/lib/rpc/methods/debug_bundler_dumpReputation.js +16 -0
  131. package/lib/rpc/methods/debug_bundler_dumpReputation.js.map +1 -0
  132. package/lib/rpc/methods/debug_bundler_getStakeStatus.d.ts +79 -0
  133. package/lib/rpc/methods/debug_bundler_getStakeStatus.js +17 -0
  134. package/lib/rpc/methods/debug_bundler_getStakeStatus.js.map +1 -0
  135. package/lib/rpc/methods/debug_bundler_sendBundleNow.d.ts +22 -0
  136. package/lib/rpc/methods/debug_bundler_sendBundleNow.js +15 -0
  137. package/lib/rpc/methods/debug_bundler_sendBundleNow.js.map +1 -0
  138. package/lib/rpc/methods/debug_bundler_setBundlingMode.d.ts +22 -0
  139. package/lib/rpc/methods/debug_bundler_setBundlingMode.js +16 -0
  140. package/lib/rpc/methods/debug_bundler_setBundlingMode.js.map +1 -0
  141. package/lib/rpc/methods/debug_bundler_setReputation.d.ts +46 -0
  142. package/lib/rpc/methods/debug_bundler_setReputation.js +16 -0
  143. package/lib/rpc/methods/debug_bundler_setReputation.js.map +1 -0
  144. package/lib/rpc/methods/eth_chainId.d.ts +22 -0
  145. package/lib/rpc/methods/eth_chainId.js +13 -0
  146. package/lib/rpc/methods/eth_chainId.js.map +1 -0
  147. package/lib/rpc/methods/eth_estimateUserOperationGas.d.ts +979 -0
  148. package/lib/rpc/methods/eth_estimateUserOperationGas.js +21 -0
  149. package/lib/rpc/methods/eth_estimateUserOperationGas.js.map +1 -0
  150. package/lib/rpc/methods/eth_getUserOperationByHash.d.ts +878 -0
  151. package/lib/rpc/methods/eth_getUserOperationByHash.js +101 -0
  152. package/lib/rpc/methods/eth_getUserOperationByHash.js.map +1 -0
  153. package/lib/rpc/methods/eth_getUserOperationReceipt.d.ts +412 -0
  154. package/lib/rpc/methods/eth_getUserOperationReceipt.js +14 -0
  155. package/lib/rpc/methods/eth_getUserOperationReceipt.js.map +1 -0
  156. package/lib/rpc/methods/eth_sendUserOperation.d.ts +422 -0
  157. package/lib/rpc/methods/eth_sendUserOperation.js +33 -0
  158. package/lib/rpc/methods/eth_sendUserOperation.js.map +1 -0
  159. package/lib/rpc/methods/eth_supportedEntryPoints.d.ts +22 -0
  160. package/lib/rpc/methods/eth_supportedEntryPoints.js +13 -0
  161. package/lib/rpc/methods/eth_supportedEntryPoints.js.map +1 -0
  162. package/lib/rpc/methods/index.d.ts +3 -0
  163. package/lib/rpc/methods/index.js +49 -0
  164. package/lib/rpc/methods/index.js.map +1 -0
  165. package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.d.ts +979 -0
  166. package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js +23 -0
  167. package/lib/rpc/methods/pimlico_experimental_estimateUserOperationGas7702.js.map +1 -0
  168. package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.d.ts +422 -0
  169. package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.js +19 -0
  170. package/lib/rpc/methods/pimlico_experimental_sendUserOperation7702.js.map +1 -0
  171. package/lib/rpc/methods/pimlico_getUserOperationGasPrice.d.ts +131 -0
  172. package/lib/rpc/methods/pimlico_getUserOperationGasPrice.js +33 -0
  173. package/lib/rpc/methods/pimlico_getUserOperationGasPrice.js.map +1 -0
  174. package/lib/rpc/methods/pimlico_getUserOperationStatus.d.ts +43 -0
  175. package/lib/rpc/methods/pimlico_getUserOperationStatus.js +14 -0
  176. package/lib/rpc/methods/pimlico_getUserOperationStatus.js.map +1 -0
  177. package/lib/rpc/methods/pimlico_sendUserOperationNow.d.ts +812 -0
  178. package/lib/rpc/methods/pimlico_sendUserOperationNow.js +44 -0
  179. package/lib/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -0
  180. package/lib/rpc/rpcHandler.d.ts +13 -104
  181. package/lib/rpc/rpcHandler.js +31 -370
  182. package/lib/rpc/rpcHandler.js.map +1 -1
  183. package/lib/rpc/server.d.ts +2 -2
  184. package/lib/rpc/server.js +1 -1
  185. package/lib/rpc/server.js.map +1 -1
  186. package/lib/rpc/validation/TracerResultParserV07.js +4 -4
  187. package/lib/rpc/validation/TracerResultParserV07.js.map +1 -1
  188. package/lib/types/schemas.d.ts +9368 -3502
  189. package/lib/types/schemas.js +261 -348
  190. package/lib/types/schemas.js.map +1 -1
  191. package/lib/utils/userop.d.ts +9 -9
  192. package/lib/utils/userop.js.map +1 -1
  193. package/package.json +2 -1
  194. package/esm/rpc/nonceQueuer.js.map +0 -1
  195. package/lib/rpc/nonceQueuer.js.map +0 -1
  196. /package/esm/{rpc → mempool}/nonceQueuer.js +0 -0
  197. /package/lib/{rpc → mempool}/nonceQueuer.js +0 -0
@@ -4,7 +4,7 @@ const hexDataPattern = /^0x[0-9A-Fa-f]*$/;
4
4
  const addressPattern = /^0x[0-9,a-f,A-F]{40}$/;
5
5
  export const hexData32Pattern = /^0x([0-9a-fA-F][0-9a-fA-F]){32}$/;
6
6
  export const commaSeperatedAddressPattern = /^(0x[0-9a-fA-F]{40})(,\s*(0x[0-9a-fA-F]{40}))*$/;
7
- const addressSchema = z
7
+ export const addressSchema = z
8
8
  .string()
9
9
  .regex(addressPattern, { message: "not a valid hex address" })
10
10
  .transform((val) => getAddress(val));
@@ -17,14 +17,21 @@ export const hexNumberSchema = z
17
17
  .refine((val) => val <= maxUint256, {
18
18
  message: "not a valid uint256"
19
19
  });
20
- const hexDataSchema = z
20
+ export const hexDataSchema = z
21
21
  .string()
22
22
  .regex(hexDataPattern, { message: "not valid hex data" })
23
23
  .transform((val) => val);
24
- const hexData32Schema = z
24
+ export const hexData32Schema = z
25
25
  .string()
26
26
  .regex(hexData32Pattern, { message: "not valid 32-byte hex data" })
27
27
  .transform((val) => val);
28
+ export const stateOverridesSchema = z.record(addressSchema, z.object({
29
+ balance: hexNumberSchema.optional(),
30
+ nonce: hexNumberSchema.optional(),
31
+ code: hexDataSchema.optional(),
32
+ state: z.record(hexData32Schema, hexData32Schema).optional(),
33
+ stateDiff: z.record(hexData32Schema, hexData32Schema).optional()
34
+ }));
28
35
  const signedAuthorizationSchema = z.object({
29
36
  contractAddress: addressSchema,
30
37
  chainId: hexNumberSchema.transform((val) => Number(val)),
@@ -172,7 +179,7 @@ const userOperationSchema = z.union([
172
179
  userOperationV06Schema,
173
180
  userOperationV07Schema
174
181
  ]);
175
- const jsonRpcSchema = z
182
+ export const jsonRpcSchema = z
176
183
  .object({
177
184
  jsonrpc: z.literal("2.0"),
178
185
  id: z.number(),
@@ -190,111 +197,88 @@ const jsonRpcResultSchema = z
190
197
  result: z.unknown()
191
198
  })
192
199
  .strict();
193
- const chainIdRequestSchema = z.object({
194
- method: z.literal("eth_chainId"),
195
- params: z.tuple([])
196
- });
197
- const supportedEntryPointsRequestSchema = z.object({
198
- method: z.literal("eth_supportedEntryPoints"),
199
- params: z.tuple([])
200
- });
201
- const stateOverridesSchema = z.record(addressSchema, z.object({
202
- balance: hexNumberSchema.optional(),
203
- nonce: hexNumberSchema.optional(),
204
- code: hexDataSchema.optional(),
205
- state: z.record(hexData32Schema, hexData32Schema).optional(),
206
- stateDiff: z.record(hexData32Schema, hexData32Schema).optional()
207
- }));
208
- const estimateUserOperationGasRequestSchema = z.object({
209
- method: z.literal("eth_estimateUserOperationGas"),
210
- params: z.union([
211
- z.tuple([partialUserOperationSchema, addressSchema]),
212
- z.tuple([
213
- partialUserOperationSchema,
214
- addressSchema,
215
- stateOverridesSchema
216
- ])
217
- ])
218
- });
219
- const sendUserOperationRequestSchema = z.object({
220
- method: z.literal("eth_sendUserOperation"),
221
- params: z.tuple([userOperationSchema, addressSchema])
222
- });
223
- const getUserOperationByHashRequestSchema = z.object({
224
- method: z.literal("eth_getUserOperationByHash"),
225
- params: z.tuple([
226
- z
227
- .string()
228
- .regex(hexData32Pattern, { message: "Missing/invalid userOpHash" })
229
- .transform((val) => val)
230
- ])
231
- });
232
- const getUserOperationReceiptRequestSchema = z.object({
233
- method: z.literal("eth_getUserOperationReceipt"),
234
- params: z.tuple([
235
- z
236
- .string()
237
- .regex(hexData32Pattern, { message: "Missing/invalid userOpHash" })
238
- .transform((val) => val)
239
- ])
240
- });
241
- const bundlerClearStateRequestSchema = z.object({
242
- method: z.literal("debug_bundler_clearState"),
243
- params: z.tuple([])
244
- });
245
- const bundlerClearMempoolRequestSchema = z.object({
246
- method: z.literal("debug_bundler_clearMempool"),
247
- params: z.tuple([])
248
- });
249
- const bundlerDumpMempoolRequestSchema = z.object({
250
- method: z.literal("debug_bundler_dumpMempool"),
251
- params: z.tuple([addressSchema])
252
- });
253
- const bundlerSendBundleNowRequestSchema = z.object({
254
- method: z.literal("debug_bundler_sendBundleNow"),
255
- params: z.tuple([])
256
- });
257
- const bundlerSetBundlingModeRequestSchema = z.object({
258
- method: z.literal("debug_bundler_setBundlingMode"),
259
- params: z.tuple([z.enum(["manual", "auto"])])
260
- });
261
- const bundlerSetReputationsRequestSchema = z.object({
262
- method: z.literal("debug_bundler_setReputation"),
263
- params: z.tuple([
264
- z.array(z.object({
265
- address: addressSchema,
266
- opsSeen: hexNumberSchema,
267
- opsIncluded: hexNumberSchema
268
- })),
269
- addressSchema
270
- ])
271
- });
272
- const bundlerDumpReputationsRequestSchema = z.object({
273
- method: z.literal("debug_bundler_dumpReputation"),
274
- params: z.tuple([addressSchema])
200
+ export const logSchema = z.object({
201
+ //removed: z.boolean().optional(),
202
+ logIndex: hexNumberSchema,
203
+ transactionIndex: hexNumberSchema,
204
+ transactionHash: hexData32Schema,
205
+ blockHash: hexData32Schema,
206
+ blockNumber: hexNumberSchema,
207
+ address: addressSchema,
208
+ data: hexDataSchema,
209
+ topics: z.array(hexData32Schema)
275
210
  });
276
- const bundlerClearReputationRequestSchema = z.object({
277
- method: z.literal("debug_bundler_clearReputation"),
278
- params: z.tuple([])
211
+ export const receiptSchema = z.object({
212
+ transactionHash: hexData32Schema,
213
+ transactionIndex: hexNumberSchema,
214
+ blockHash: hexData32Schema,
215
+ blockNumber: hexNumberSchema,
216
+ from: addressSchema,
217
+ to: addressSchema.or(z.null()),
218
+ cumulativeGasUsed: hexNumberSchema,
219
+ gasUsed: hexNumberSchema,
220
+ contractAddress: addressSchema.or(z.null()),
221
+ logs: z.array(logSchema),
222
+ logsBloom: z.string().regex(/^0x[0-9a-f]{512}$/),
223
+ //root: hexData32Schema,
224
+ status: hexNumberSchema.or(z.null()),
225
+ effectiveGasPrice: hexNumberSchema.nullish()
226
+ //type: hexNumberSchema
279
227
  });
280
- const pimlicoGetStakeStatusRequestSchema = z.object({
281
- method: z.literal("debug_bundler_getStakeStatus"),
282
- params: z.tuple([addressSchema, addressSchema])
228
+ const userOperationReceiptSchema = z
229
+ .object({
230
+ userOpHash: hexData32Schema,
231
+ entryPoint: addressSchema,
232
+ sender: addressSchema,
233
+ nonce: hexNumberSchema,
234
+ paymaster: addressSchema.optional(),
235
+ actualGasCost: hexNumberSchema,
236
+ actualGasUsed: hexNumberSchema,
237
+ success: z.boolean(),
238
+ reason: hexDataSchema.optional(), // revert reason
239
+ logs: z.array(logSchema),
240
+ receipt: receiptSchema
241
+ })
242
+ .or(z.null());
243
+ const userOperationStatus = z.object({
244
+ status: z.enum([
245
+ "not_found",
246
+ "not_submitted",
247
+ "submitted",
248
+ "rejected",
249
+ "reverted",
250
+ "included",
251
+ "failed"
252
+ ]),
253
+ transactionHash: hexData32Schema.or(z.null())
283
254
  });
284
- const pimlicoGetUserOperationStatusRequestSchema = z.object({
285
- method: z.literal("pimlico_getUserOperationStatus"),
286
- params: z.tuple([hexData32Schema])
255
+ const gasPriceSchema = z.object({
256
+ slow: z.object({
257
+ maxFeePerGas: z.bigint(),
258
+ maxPriorityFeePerGas: z.bigint()
259
+ }),
260
+ standard: z.object({
261
+ maxFeePerGas: z.bigint(),
262
+ maxPriorityFeePerGas: z.bigint()
263
+ }),
264
+ fast: z.object({
265
+ maxFeePerGas: z.bigint(),
266
+ maxPriorityFeePerGas: z.bigint()
267
+ })
287
268
  });
288
- const pimlicoGetUserOperationGasPriceRequestSchema = z.object({
289
- method: z.literal("pimlico_getUserOperationGasPrice"),
290
- params: z.tuple([])
269
+ // Combined schemas (request + response)
270
+ export const chainIdSchema = z.object({
271
+ method: z.literal("eth_chainId"),
272
+ params: z.tuple([]),
273
+ result: hexNumberSchema
291
274
  });
292
- const pimlicoSendUserOperationNowRequestSchema = z.object({
293
- method: z.literal("pimlico_sendUserOperationNow"),
294
- params: z.tuple([userOperationSchema, addressSchema])
275
+ export const supportedEntryPointsSchema = z.object({
276
+ method: z.literal("eth_supportedEntryPoints"),
277
+ params: z.tuple([]),
278
+ result: z.array(addressSchema)
295
279
  });
296
- const pimlicoExperimentalEstimateUserOperationGas7702RequestSchema = z.object({
297
- method: z.literal("pimlico_experimental_estimateUserOperationGas7702"),
280
+ export const estimateUserOperationGasSchema = z.object({
281
+ method: z.literal("eth_estimateUserOperationGas"),
298
282
  params: z.union([
299
283
  z.tuple([partialUserOperationSchema, addressSchema]),
300
284
  z.tuple([
@@ -302,45 +286,7 @@ const pimlicoExperimentalEstimateUserOperationGas7702RequestSchema = z.object({
302
286
  addressSchema,
303
287
  stateOverridesSchema
304
288
  ])
305
- ])
306
- });
307
- const pimlicoExperimentalSendUserOperation7702RequestSchema = z.object({
308
- method: z.literal("pimlico_experimental_sendUserOperation7702"),
309
- params: z.tuple([userOperationSchema, addressSchema])
310
- });
311
- export const altoVersions = z.enum(["v1", "v2"]);
312
- const bundlerRequestSchema = z.discriminatedUnion("method", [
313
- chainIdRequestSchema,
314
- supportedEntryPointsRequestSchema,
315
- estimateUserOperationGasRequestSchema,
316
- sendUserOperationRequestSchema,
317
- getUserOperationByHashRequestSchema,
318
- getUserOperationReceiptRequestSchema,
319
- bundlerClearStateRequestSchema,
320
- bundlerClearMempoolRequestSchema,
321
- bundlerDumpMempoolRequestSchema,
322
- bundlerSendBundleNowRequestSchema,
323
- bundlerSetBundlingModeRequestSchema,
324
- bundlerSetReputationsRequestSchema,
325
- bundlerDumpReputationsRequestSchema,
326
- bundlerClearReputationRequestSchema,
327
- pimlicoGetStakeStatusRequestSchema,
328
- pimlicoGetUserOperationStatusRequestSchema,
329
- pimlicoGetUserOperationGasPriceRequestSchema,
330
- pimlicoSendUserOperationNowRequestSchema,
331
- pimlicoExperimentalSendUserOperation7702RequestSchema,
332
- pimlicoExperimentalEstimateUserOperationGas7702RequestSchema
333
- ]);
334
- const chainIdResponseSchema = z.object({
335
- method: z.literal("eth_chainId"),
336
- result: hexNumberSchema
337
- });
338
- const supportedEntryPointsResponseSchema = z.object({
339
- method: z.literal("eth_supportedEntryPoints"),
340
- result: z.array(addressSchema)
341
- });
342
- const estimateUserOperationGasResponseSchema = z.object({
343
- method: z.literal("eth_estimateUserOperationGas"),
289
+ ]),
344
290
  result: z.union([
345
291
  z.object({
346
292
  callGasLimit: hexNumberSchema,
@@ -357,12 +303,19 @@ const estimateUserOperationGasResponseSchema = z.object({
357
303
  })
358
304
  ])
359
305
  });
360
- const sendUserOperationResponseSchema = z.object({
306
+ export const sendUserOperationSchema = z.object({
361
307
  method: z.literal("eth_sendUserOperation"),
308
+ params: z.tuple([userOperationSchema, addressSchema]),
362
309
  result: hexData32Schema
363
310
  });
364
- const getUserOperationByHashResponseSchema = z.object({
311
+ export const getUserOperationByHashSchema = z.object({
365
312
  method: z.literal("eth_getUserOperationByHash"),
313
+ params: z.tuple([
314
+ z
315
+ .string()
316
+ .regex(hexData32Pattern, { message: "Missing/invalid userOpHash" })
317
+ .transform((val) => val)
318
+ ]),
366
319
  result: z
367
320
  .object({
368
321
  userOperation: userOperationSchema,
@@ -373,99 +326,56 @@ const getUserOperationByHashResponseSchema = z.object({
373
326
  })
374
327
  .or(z.null())
375
328
  });
376
- const logSchema = z.object({
377
- //removed: z.boolean().optional(),
378
- logIndex: hexNumberSchema,
379
- transactionIndex: hexNumberSchema,
380
- transactionHash: hexData32Schema,
381
- blockHash: hexData32Schema,
382
- blockNumber: hexNumberSchema,
383
- address: addressSchema,
384
- data: hexDataSchema,
385
- topics: z.array(hexData32Schema)
386
- });
387
- const receiptSchema = z.object({
388
- transactionHash: hexData32Schema,
389
- transactionIndex: hexNumberSchema,
390
- blockHash: hexData32Schema,
391
- blockNumber: hexNumberSchema,
392
- from: addressSchema,
393
- to: addressSchema.or(z.null()),
394
- cumulativeGasUsed: hexNumberSchema,
395
- gasUsed: hexNumberSchema,
396
- contractAddress: addressSchema.or(z.null()),
397
- logs: z.array(logSchema),
398
- logsBloom: z.string().regex(/^0x[0-9a-f]{512}$/),
399
- //root: hexData32Schema,
400
- status: hexNumberSchema.or(z.null()),
401
- effectiveGasPrice: hexNumberSchema.nullish()
402
- //type: hexNumberSchema
403
- });
404
- const userOperationReceiptSchema = z
405
- .object({
406
- userOpHash: hexData32Schema,
407
- entryPoint: addressSchema,
408
- sender: addressSchema,
409
- nonce: hexNumberSchema,
410
- paymaster: addressSchema.optional(),
411
- actualGasCost: hexNumberSchema,
412
- actualGasUsed: hexNumberSchema,
413
- success: z.boolean(),
414
- reason: hexDataSchema.optional(), // revert reason
415
- logs: z.array(logSchema),
416
- receipt: receiptSchema
417
- })
418
- .or(z.null());
419
- const getUserOperationReceiptResponseSchema = z.object({
329
+ export const getUserOperationReceiptSchema = z.object({
420
330
  method: z.literal("eth_getUserOperationReceipt"),
331
+ params: z.tuple([
332
+ z
333
+ .string()
334
+ .regex(hexData32Pattern, { message: "Missing/invalid userOpHash" })
335
+ .transform((val) => val)
336
+ ]),
421
337
  result: userOperationReceiptSchema
422
338
  });
423
- const bundlerClearStateResponseSchema = z.object({
339
+ export const debugClearStateSchema = z.object({
424
340
  method: z.literal("debug_bundler_clearState"),
341
+ params: z.tuple([]),
425
342
  result: z.literal("ok")
426
343
  });
427
- const bundlerClearMempoolResponseSchema = z.object({
344
+ export const debugClearMempoolSchema = z.object({
428
345
  method: z.literal("debug_bundler_clearMempool"),
346
+ params: z.tuple([]),
429
347
  result: z.literal("ok")
430
348
  });
431
- const bundlerDumpMempoolResponseSchema = z.object({
349
+ export const debugDumpMempoolSchema = z.object({
432
350
  method: z.literal("debug_bundler_dumpMempool"),
351
+ params: z.tuple([addressSchema]),
433
352
  result: z.array(userOperationSchema)
434
353
  });
435
- const bundlerGetStakeStatusResponseSchema = z.object({
436
- method: z.literal("debug_bundler_getStakeStatus"),
437
- result: z.object({
438
- stakeInfo: z.object({
439
- addr: z.string(),
440
- stake: z
441
- .string()
442
- .or(z.number())
443
- .or(z.bigint())
444
- .transform((val) => Number(val).toString()),
445
- unstakeDelaySec: z
446
- .string()
447
- .or(z.number())
448
- .or(z.bigint())
449
- .transform((val) => Number(val).toString())
450
- }),
451
- isStaked: z.boolean()
452
- })
453
- });
454
- const bundlerSendBundleNowResponseSchema = z.object({
354
+ export const debugSendBundleNowSchema = z.object({
455
355
  method: z.literal("debug_bundler_sendBundleNow"),
356
+ params: z.tuple([]),
456
357
  result: z.literal("ok")
457
358
  });
458
- const bundlerSetBundlingModeResponseSchema = z.object({
359
+ export const debugSetBundlingModeSchema = z.object({
459
360
  method: z.literal("debug_bundler_setBundlingMode"),
361
+ params: z.tuple([z.enum(["manual", "auto"])]),
460
362
  result: z.literal("ok")
461
363
  });
462
- const bundlerSetReputationsResponseSchema = z.object({
364
+ export const debugSetReputationSchema = z.object({
463
365
  method: z.literal("debug_bundler_setReputation"),
366
+ params: z.tuple([
367
+ z.array(z.object({
368
+ address: addressSchema,
369
+ opsSeen: hexNumberSchema,
370
+ opsIncluded: hexNumberSchema
371
+ })),
372
+ addressSchema
373
+ ]),
464
374
  result: z.literal("ok")
465
375
  });
466
- const bundlerDumpReputationsResponseSchema = z.object({
376
+ export const debugDumpReputationSchema = z.object({
467
377
  method: z.literal("debug_bundler_dumpReputation"),
468
- // TODO: FIX
378
+ params: z.tuple([addressSchema]),
469
379
  result: z.array(z.object({
470
380
  address: addressSchema,
471
381
  opsSeen: hexNumberSchema,
@@ -473,54 +383,56 @@ const bundlerDumpReputationsResponseSchema = z.object({
473
383
  status: hexNumberSchema.optional()
474
384
  }))
475
385
  });
476
- const bundlerClearReputationResponseSchema = z.object({
386
+ export const debugClearReputationSchema = z.object({
477
387
  method: z.literal("debug_bundler_clearReputation"),
388
+ params: z.tuple([]),
478
389
  result: z.literal("ok")
479
390
  });
480
- const userOperationStatus = z.object({
481
- status: z.enum([
482
- "not_found",
483
- "not_submitted",
484
- "submitted",
485
- "rejected",
486
- "reverted",
487
- "included",
488
- "failed"
489
- ]),
490
- transactionHash: hexData32Schema.or(z.null())
391
+ export const debugGetStakeStatusSchema = z.object({
392
+ method: z.literal("debug_bundler_getStakeStatus"),
393
+ params: z.tuple([addressSchema, addressSchema]),
394
+ result: z.object({
395
+ stakeInfo: z.object({
396
+ addr: z.string(),
397
+ stake: z
398
+ .string()
399
+ .or(z.number())
400
+ .or(z.bigint())
401
+ .transform((val) => Number(val).toString()),
402
+ unstakeDelaySec: z
403
+ .string()
404
+ .or(z.number())
405
+ .or(z.bigint())
406
+ .transform((val) => Number(val).toString())
407
+ }),
408
+ isStaked: z.boolean()
409
+ })
491
410
  });
492
- const pimlicoGetUserOperationStatusResponseSchema = z.object({
411
+ export const pimlicoGetUserOperationStatusSchema = z.object({
493
412
  method: z.literal("pimlico_getUserOperationStatus"),
413
+ params: z.tuple([hexData32Schema]),
494
414
  result: userOperationStatus
495
415
  });
496
- const gasPriceSchema = z.object({
497
- slow: z.object({
498
- maxFeePerGas: z.bigint(),
499
- maxPriorityFeePerGas: z.bigint()
500
- }),
501
- standard: z.object({
502
- maxFeePerGas: z.bigint(),
503
- maxPriorityFeePerGas: z.bigint()
504
- }),
505
- fast: z.object({
506
- maxFeePerGas: z.bigint(),
507
- maxPriorityFeePerGas: z.bigint()
508
- })
509
- });
510
- const pimlicoGetUserOperationGasPriceResponseSchema = z.object({
416
+ export const pimlicoGetUserOperationGasPriceSchema = z.object({
511
417
  method: z.literal("pimlico_getUserOperationGasPrice"),
418
+ params: z.tuple([]),
512
419
  result: gasPriceSchema
513
420
  });
514
- const pimlicoSendUserOperationNowResponseSchema = z.object({
421
+ export const pimlicoSendUserOperationNowSchema = z.object({
515
422
  method: z.literal("pimlico_sendUserOperationNow"),
423
+ params: z.tuple([userOperationSchema, addressSchema]),
516
424
  result: userOperationReceiptSchema
517
425
  });
518
- const pimlicoExperimentalSendUserOperation7702ResponseSchema = z.object({
519
- method: z.literal("pimlico_experimental_sendUserOperation7702"),
520
- result: hexData32Schema
521
- });
522
- const pimlicoExperimentalEstimateUserOperation7702ResponseSchema = z.object({
426
+ export const pimlicoExperimentalEstimateUserOperationGas7702Schema = z.object({
523
427
  method: z.literal("pimlico_experimental_estimateUserOperationGas7702"),
428
+ params: z.union([
429
+ z.tuple([partialUserOperationSchema, addressSchema]),
430
+ z.tuple([
431
+ partialUserOperationSchema,
432
+ addressSchema,
433
+ stateOverridesSchema
434
+ ])
435
+ ]),
524
436
  result: z.union([
525
437
  z.object({
526
438
  callGasLimit: hexNumberSchema,
@@ -537,27 +449,58 @@ const pimlicoExperimentalEstimateUserOperation7702ResponseSchema = z.object({
537
449
  })
538
450
  ])
539
451
  });
540
- const bundlerResponseSchema = z.discriminatedUnion("method", [
541
- chainIdResponseSchema,
542
- supportedEntryPointsResponseSchema,
543
- estimateUserOperationGasResponseSchema,
544
- sendUserOperationResponseSchema,
545
- getUserOperationByHashResponseSchema,
546
- getUserOperationReceiptResponseSchema,
547
- bundlerClearStateResponseSchema,
548
- bundlerClearMempoolResponseSchema,
549
- bundlerDumpMempoolResponseSchema,
550
- bundlerGetStakeStatusResponseSchema,
551
- bundlerSendBundleNowResponseSchema,
552
- bundlerSetBundlingModeResponseSchema,
553
- bundlerSetReputationsResponseSchema,
554
- bundlerDumpReputationsResponseSchema,
555
- bundlerClearReputationResponseSchema,
556
- pimlicoGetUserOperationStatusResponseSchema,
557
- pimlicoGetUserOperationGasPriceResponseSchema,
558
- pimlicoSendUserOperationNowResponseSchema,
559
- pimlicoExperimentalSendUserOperation7702ResponseSchema,
560
- pimlicoExperimentalEstimateUserOperation7702ResponseSchema
452
+ export const pimlicoExperimentalSendUserOperation7702Schema = z.object({
453
+ method: z.literal("pimlico_experimental_sendUserOperation7702"),
454
+ params: z.tuple([userOperationSchema, addressSchema]),
455
+ result: hexData32Schema
456
+ });
457
+ export const altoVersions = z.enum(["v1", "v2"]);
458
+ // Create request and response discriminated unions from the combined schemas
459
+ export const bundlerRequestSchema = z.discriminatedUnion("method", [
460
+ chainIdSchema.omit({ result: true }),
461
+ supportedEntryPointsSchema.omit({ result: true }),
462
+ estimateUserOperationGasSchema.omit({ result: true }),
463
+ sendUserOperationSchema.omit({ result: true }),
464
+ getUserOperationByHashSchema.omit({ result: true }),
465
+ getUserOperationReceiptSchema.omit({ result: true }),
466
+ debugClearStateSchema.omit({ result: true }),
467
+ debugClearMempoolSchema.omit({ result: true }),
468
+ debugDumpMempoolSchema.omit({ result: true }),
469
+ debugSendBundleNowSchema.omit({ result: true }),
470
+ debugSetBundlingModeSchema.omit({ result: true }),
471
+ debugSetReputationSchema.omit({ result: true }),
472
+ debugDumpReputationSchema.omit({ result: true }),
473
+ debugClearReputationSchema.omit({ result: true }),
474
+ debugGetStakeStatusSchema.omit({ result: true }),
475
+ pimlicoGetUserOperationStatusSchema.omit({ result: true }),
476
+ pimlicoGetUserOperationGasPriceSchema.omit({ result: true }),
477
+ pimlicoSendUserOperationNowSchema.omit({ result: true }),
478
+ pimlicoExperimentalSendUserOperation7702Schema.omit({ result: true }),
479
+ pimlicoExperimentalEstimateUserOperationGas7702Schema.omit({
480
+ result: true
481
+ })
482
+ ]);
483
+ export const bundlerRpcSchema = z.union([
484
+ chainIdSchema,
485
+ supportedEntryPointsSchema,
486
+ estimateUserOperationGasSchema,
487
+ sendUserOperationSchema,
488
+ getUserOperationByHashSchema,
489
+ getUserOperationReceiptSchema,
490
+ debugClearStateSchema,
491
+ debugClearMempoolSchema,
492
+ debugDumpMempoolSchema,
493
+ debugSendBundleNowSchema,
494
+ debugSetBundlingModeSchema,
495
+ debugSetReputationSchema,
496
+ debugDumpReputationSchema,
497
+ debugClearReputationSchema,
498
+ debugGetStakeStatusSchema,
499
+ pimlicoGetUserOperationStatusSchema,
500
+ pimlicoGetUserOperationGasPriceSchema,
501
+ pimlicoSendUserOperationNowSchema,
502
+ pimlicoExperimentalSendUserOperation7702Schema,
503
+ pimlicoExperimentalEstimateUserOperationGas7702Schema
561
504
  ]);
562
505
  const OpEventType = z.union([
563
506
  z.object({
@@ -619,7 +562,4 @@ const OpEventType = z.union([
619
562
  })
620
563
  })
621
564
  ]);
622
- export { bundlerClearStateRequestSchema, bundlerClearMempoolRequestSchema, bundlerDumpMempoolRequestSchema, bundlerSendBundleNowRequestSchema, bundlerSetBundlingModeRequestSchema, bundlerSetReputationsRequestSchema, bundlerDumpReputationsRequestSchema, pimlicoGetStakeStatusRequestSchema, pimlicoGetUserOperationStatusRequestSchema, pimlicoGetUserOperationGasPriceRequestSchema, bundlerRequestSchema, jsonRpcSchema, jsonRpcResultSchema, userOperationSchema };
623
- export { bundlerClearStateResponseSchema, bundlerClearMempoolResponseSchema, bundlerDumpMempoolResponseSchema, bundlerGetStakeStatusResponseSchema, bundlerSendBundleNowResponseSchema, bundlerSetBundlingModeResponseSchema, bundlerSetReputationsResponseSchema, bundlerDumpReputationsResponseSchema, pimlicoGetUserOperationStatusResponseSchema, pimlicoGetUserOperationGasPriceResponseSchema, bundlerResponseSchema };
624
- export { addressSchema, hexData32Schema, hexDataSchema, logSchema, receiptSchema };
625
565
  //# sourceMappingURL=schemas.js.map