@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
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pimlicoSendUserOperationNowHandler = void 0;
4
+ const utils_1 = require("../../utils/index.js");
5
+ const createMethodHandler_1 = require("../createMethodHandler.js");
6
+ const types_1 = require("../../types/index.js");
7
+ exports.pimlicoSendUserOperationNowHandler = (0, createMethodHandler_1.createMethodHandler)({
8
+ method: "pimlico_sendUserOperationNow",
9
+ schema: types_1.pimlicoSendUserOperationNowSchema,
10
+ handler: async ({ rpcHandler, params, apiVersion }) => {
11
+ if (!rpcHandler.config.enableInstantBundlingEndpoint) {
12
+ throw new types_1.RpcError("pimlico_sendUserOperationNow endpoint is not enabled", types_1.ValidationErrors.InvalidFields);
13
+ }
14
+ const [userOperation, entryPoint] = params;
15
+ rpcHandler.ensureEntryPointIsSupported(entryPoint);
16
+ const opHash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, rpcHandler.config.publicClient.chain.id);
17
+ await rpcHandler.preMempoolChecks(opHash, userOperation, apiVersion, entryPoint);
18
+ // Prepare bundle
19
+ const userOperationInfo = {
20
+ userOp: userOperation,
21
+ entryPoint,
22
+ userOpHash: (0, utils_1.getUserOperationHash)(userOperation, entryPoint, rpcHandler.config.publicClient.chain.id),
23
+ addedToMempool: Date.now()
24
+ };
25
+ const bundle = {
26
+ entryPoint,
27
+ userOps: [userOperationInfo],
28
+ version: (0, utils_1.isVersion06)(userOperation)
29
+ ? "0.6"
30
+ : "0.7"
31
+ };
32
+ const result = await rpcHandler.executorManager.sendBundleToExecutor(bundle);
33
+ if (!result) {
34
+ throw new types_1.RpcError("unhandled error during bundle submission", types_1.ValidationErrors.InvalidFields);
35
+ }
36
+ // Wait for receipt.
37
+ const receipt = await rpcHandler.config.publicClient.waitForTransactionReceipt({
38
+ hash: result,
39
+ pollingInterval: 100
40
+ });
41
+ return (0, utils_1.parseUserOperationReceipt)(opHash, receipt);
42
+ }
43
+ });
44
+ //# sourceMappingURL=pimlico_sendUserOperationNow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pimlico_sendUserOperationNow.js","sourceRoot":"","sources":["../../../rpc/methods/pimlico_sendUserOperationNow.ts"],"names":[],"mappings":";;;AAAA,uCAIoB;AACpB,gEAA4D;AAC5D,uCAMoB;AAEP,QAAA,kCAAkC,GAAG,IAAA,yCAAmB,EAAC;IAClE,MAAM,EAAE,8BAA8B;IACtC,MAAM,EAAE,yCAAiC;IACzC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE;QAClD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,6BAA6B,EAAE,CAAC;YACnD,MAAM,IAAI,gBAAQ,CACd,sDAAsD,EACtD,wBAAgB,CAAC,aAAa,CACjC,CAAA;QACL,CAAC;QAED,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG,MAAM,CAAA;QAE1C,UAAU,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAA;QAClD,MAAM,MAAM,GAAG,IAAA,4BAAoB,EAC/B,aAAa,EACb,UAAU,EACV,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAC1C,CAAA;QAED,MAAM,UAAU,CAAC,gBAAgB,CAC7B,MAAM,EACN,aAAa,EACb,UAAU,EACV,UAAU,CACb,CAAA;QAED,iBAAiB;QACjB,MAAM,iBAAiB,GAAe;YAClC,MAAM,EAAE,aAAa;YACrB,UAAU;YACV,UAAU,EAAE,IAAA,4BAAoB,EAC5B,aAAa,EACb,UAAU,EACV,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAC1C;YACD,cAAc,EAAE,IAAI,CAAC,GAAG,EAAE;SAC7B,CAAA;QACD,MAAM,MAAM,GAAwB;YAChC,UAAU;YACV,OAAO,EAAE,CAAC,iBAAiB,CAAC;YAC5B,OAAO,EAAE,IAAA,mBAAW,EAAC,aAAa,CAAC;gBAC/B,CAAC,CAAE,KAAe;gBAClB,CAAC,CAAE,KAAe;SACzB,CAAA;QACD,MAAM,MAAM,GACR,MAAM,UAAU,CAAC,eAAe,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;QAEjE,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,gBAAQ,CACd,0CAA0C,EAC1C,wBAAgB,CAAC,aAAa,CACjC,CAAA;QACL,CAAC;QAED,oBAAoB;QACpB,MAAM,OAAO,GACT,MAAM,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,yBAAyB,CAAC;YAC3D,IAAI,EAAE,MAAM;YACZ,eAAe,EAAE,GAAG;SACvB,CAAC,CAAA;QAEN,OAAO,IAAA,iCAAyB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrD,CAAC;CACJ,CAAC,CAAA"}
@@ -1,35 +1,27 @@
1
1
  import type { Executor, ExecutorManager } from "../executor/index.js";
2
2
  import type { EventManager, GasPriceManager } from "../handlers/index.js";
3
- import type { InterfaceReputationManager, MemoryMempool, Monitor } from "../mempool/index.js";
4
- import type { ApiVersion, BundlerClearReputationResponseResult, StateOverrides } from "../types/index.js";
5
- import { type Address, type BundlerClearMempoolResponseResult, type BundlerClearStateResponseResult, type BundlerDumpMempoolResponseResult, type BundlerDumpReputationsResponseResult, type BundlerGetStakeStatusResponseResult, type BundlerRequest, type BundlerResponse, type BundlerSendBundleNowResponseResult, type BundlerSetBundlingModeResponseResult, type BundlerSetReputationsRequestParams, type BundlingMode, type ChainIdResponseResult, type EstimateUserOperationGasResponseResult, type GetUserOperationByHashResponseResult, type GetUserOperationReceiptResponseResult, type HexData32, type InterfaceValidator, type PimlicoGetUserOperationGasPriceResponseResult, type PimlicoGetUserOperationStatusResponseResult, type SendUserOperationResponseResult, type SupportedEntryPointsResponseResult, type UserOperation } from "../types/index.js";
3
+ import type { InterfaceReputationManager, MemoryMempool, Monitor, NonceQueuer } from "../mempool/index.js";
4
+ import type { ApiVersion, BundlerRequest, StateOverrides } from "../types/index.js";
5
+ import { type Address, type InterfaceValidator, type UserOperation } from "../types/index.js";
6
6
  import type { Logger, Metrics } from "../utils/index.js";
7
7
  import { type Hex } from "viem";
8
- import type { NonceQueuer } from "./nonceQueuer.js";
9
8
  import type { AltoConfig } from "../createConfig.js";
10
- export interface IRpcEndpoint {
11
- handleMethod(request: BundlerRequest, apiVersion: ApiVersion): Promise<BundlerResponse>;
12
- eth_chainId(): ChainIdResponseResult;
13
- eth_supportedEntryPoints(): SupportedEntryPointsResponseResult;
14
- eth_estimateUserOperationGas(apiVersion: ApiVersion, userOperation: UserOperation, entryPoint: Address, stateOverrides?: StateOverrides): Promise<EstimateUserOperationGasResponseResult>;
15
- eth_sendUserOperation(apiVersion: ApiVersion, userOperation: UserOperation, entryPoint: Address): Promise<SendUserOperationResponseResult>;
16
- eth_getUserOperationByHash(userOperationHash: HexData32): Promise<GetUserOperationByHashResponseResult>;
17
- eth_getUserOperationReceipt(userOperationHash: HexData32): Promise<GetUserOperationReceiptResponseResult>;
18
- }
19
- export declare class RpcHandler implements IRpcEndpoint {
9
+ import type { MethodHandler } from "./createMethodHandler.js";
10
+ export declare class RpcHandler {
20
11
  config: AltoConfig;
21
12
  validator: InterfaceValidator;
22
13
  mempool: MemoryMempool;
23
14
  executor: Executor;
24
15
  monitor: Monitor;
25
16
  nonceQueuer: NonceQueuer;
26
- logger: Logger;
27
- metrics: Metrics;
28
17
  executorManager: ExecutorManager;
29
18
  reputationManager: InterfaceReputationManager;
30
- gasPriceManager: GasPriceManager;
19
+ metrics: Metrics;
31
20
  eventManager: EventManager;
32
- constructor({ config, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, metrics, gasPriceManager, eventManager }: {
21
+ gasPriceManager: GasPriceManager;
22
+ logger: Logger;
23
+ private methodHandlers;
24
+ constructor({ config, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, metrics, eventManager, gasPriceManager }: {
33
25
  config: AltoConfig;
34
26
  validator: InterfaceValidator;
35
27
  mempool: MemoryMempool;
@@ -42,96 +34,13 @@ export declare class RpcHandler implements IRpcEndpoint {
42
34
  eventManager: EventManager;
43
35
  gasPriceManager: GasPriceManager;
44
36
  });
45
- handleMethod(request: BundlerRequest, apiVersion: ApiVersion): Promise<BundlerResponse>;
37
+ registerHandler(handler: MethodHandler): void;
38
+ handleMethod(request: BundlerRequest, apiVersion: ApiVersion): Promise<any>;
46
39
  ensureEntryPointIsSupported(entryPoint: Address): void;
47
40
  ensureDebugEndpointsAreEnabled(methodName: string): void;
41
+ ensureExperimentalEndpointsAreEnabled(methodName: string): void;
48
42
  preMempoolChecks(opHash: Hex, userOperation: UserOperation, apiVersion: ApiVersion, entryPoint: Address): Promise<void>;
49
- eth_chainId(): ChainIdResponseResult;
50
- eth_supportedEntryPoints(): SupportedEntryPointsResponseResult;
51
- eth_estimateUserOperationGas(apiVersion: ApiVersion, userOperation: UserOperation, entryPoint: Address, stateOverrides?: StateOverrides): Promise<EstimateUserOperationGasResponseResult>;
52
- eth_sendUserOperation(apiVersion: ApiVersion, userOperation: UserOperation, entryPoint: Address): Promise<SendUserOperationResponseResult>;
53
- eth_getUserOperationByHash(userOperationHash: HexData32): Promise<GetUserOperationByHashResponseResult>;
54
- eth_getUserOperationReceipt(userOperationHash: HexData32): Promise<GetUserOperationReceiptResponseResult>;
55
- debug_bundler_clearState(): BundlerClearStateResponseResult;
56
- debug_bundler_clearMempool(): BundlerClearMempoolResponseResult;
57
- debug_bundler_dumpMempool(entryPoint: Address): Promise<BundlerDumpMempoolResponseResult>;
58
- debug_bundler_sendBundleNow(): Promise<BundlerSendBundleNowResponseResult>;
59
- debug_bundler_setBundlingMode(bundlingMode: BundlingMode): Promise<BundlerSetBundlingModeResponseResult>;
60
- debug_bundler_dumpReputation(entryPoint: Address): BundlerDumpReputationsResponseResult;
61
- debug_bundler_getStakeStatus(address: Address, entryPoint: Address): Promise<BundlerGetStakeStatusResponseResult>;
62
- debug_bundler_setReputation(args: BundlerSetReputationsRequestParams): BundlerSetBundlingModeResponseResult;
63
- debug_bundler_clearReputation(): BundlerClearReputationResponseResult;
64
- pimlico_getUserOperationStatus(userOperationHash: HexData32): PimlicoGetUserOperationStatusResponseResult;
65
- pimlico_getUserOperationGasPrice(): Promise<PimlicoGetUserOperationGasPriceResponseResult>;
66
43
  addToMempoolIfValid(userOperation: UserOperation, entryPoint: Address, apiVersion: ApiVersion): Promise<"added" | "queued">;
67
- pimlico_experimental_estimateUserOperationGas7702(apiVersion: ApiVersion, userOperation: UserOperation, entryPoint: Address, stateOverrides?: StateOverrides): Promise<{
68
- preVerificationGas: bigint;
69
- verificationGasLimit: bigint;
70
- callGasLimit: bigint;
71
- paymasterVerificationGasLimit: bigint;
72
- paymasterPostOpGasLimit: bigint;
73
- verificationGas?: undefined;
74
- } | {
75
- preVerificationGas: bigint;
76
- verificationGasLimit: bigint;
77
- callGasLimit: bigint;
78
- paymasterVerificationGasLimit?: undefined;
79
- paymasterPostOpGasLimit?: undefined;
80
- verificationGas?: undefined;
81
- } | {
82
- preVerificationGas: bigint;
83
- verificationGas: bigint;
84
- verificationGasLimit: bigint;
85
- callGasLimit: bigint;
86
- paymasterVerificationGasLimit?: undefined;
87
- paymasterPostOpGasLimit?: undefined;
88
- }>;
89
- pimlico_experimental_sendUserOperation7702(apiVersion: ApiVersion, userOperation: UserOperation, entryPoint: Address): Promise<`0x${string}`>;
90
- pimlico_sendUserOperationNow(apiVersion: ApiVersion, userOperation: UserOperation, entryPoint: Address): Promise<{
91
- sender: `0x${string}`;
92
- userOpHash: `0x${string}`;
93
- nonce: bigint;
94
- success: boolean;
95
- actualGasCost: bigint;
96
- actualGasUsed: bigint;
97
- entryPoint: `0x${string}`;
98
- logs: {
99
- address: `0x${string}`;
100
- data: `0x${string}`;
101
- blockNumber: bigint;
102
- blockHash: `0x${string}`;
103
- transactionHash: `0x${string}`;
104
- logIndex: bigint;
105
- transactionIndex: bigint;
106
- topics: `0x${string}`[];
107
- }[];
108
- receipt: {
109
- to: `0x${string}` | null;
110
- gasUsed: bigint;
111
- status: bigint | null;
112
- contractAddress: `0x${string}` | null;
113
- blockNumber: bigint;
114
- blockHash: `0x${string}`;
115
- transactionHash: `0x${string}`;
116
- transactionIndex: bigint;
117
- from: `0x${string}`;
118
- cumulativeGasUsed: bigint;
119
- logs: {
120
- address: `0x${string}`;
121
- data: `0x${string}`;
122
- blockNumber: bigint;
123
- blockHash: `0x${string}`;
124
- transactionHash: `0x${string}`;
125
- logIndex: bigint;
126
- transactionIndex: bigint;
127
- topics: `0x${string}`[];
128
- }[];
129
- logsBloom: string;
130
- effectiveGasPrice?: bigint | null | undefined;
131
- };
132
- paymaster?: `0x${string}` | undefined;
133
- reason?: `0x${string}` | undefined;
134
- }>;
135
44
  validateEip7702Auth(userOperation: UserOperation): Promise<void>;
136
45
  getNonceValue(userOperation: UserOperation, entryPoint: Address): Promise<bigint>;
137
46
  estimateGas({ apiVersion, userOperation, entryPoint, stateOverrides }: {
@@ -6,6 +6,7 @@ const utils_1 = require("../utils/index.js");
6
6
  const viem_1 = require("viem");
7
7
  const chains_1 = require("viem/chains");
8
8
  const experimental_1 = require("viem/experimental");
9
+ const methods_1 = require("./methods/index.js");
9
10
  class RpcHandler {
10
11
  config;
11
12
  validator;
@@ -13,133 +14,44 @@ class RpcHandler {
13
14
  executor;
14
15
  monitor;
15
16
  nonceQueuer;
16
- logger;
17
- metrics;
18
17
  executorManager;
19
18
  reputationManager;
20
- gasPriceManager;
19
+ metrics;
21
20
  eventManager;
22
- constructor({ config, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, metrics, gasPriceManager, eventManager }) {
21
+ gasPriceManager;
22
+ logger;
23
+ methodHandlers;
24
+ constructor({ config, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, metrics, eventManager, gasPriceManager }) {
23
25
  this.config = config;
24
26
  this.validator = validator;
25
27
  this.mempool = mempool;
26
28
  this.executor = executor;
27
29
  this.monitor = monitor;
28
30
  this.nonceQueuer = nonceQueuer;
29
- this.logger = config.getLogger({ module: "rpc" }, {
30
- level: config.rpcLogLevel || config.logLevel
31
- });
32
- this.metrics = metrics;
33
31
  this.executorManager = executorManager;
34
32
  this.reputationManager = reputationManager;
35
- this.gasPriceManager = gasPriceManager;
33
+ this.metrics = metrics;
36
34
  this.eventManager = eventManager;
35
+ this.gasPriceManager = gasPriceManager;
36
+ this.logger = config.getLogger({ module: "rpc" }, {
37
+ level: config.rpcLogLevel || config.logLevel
38
+ });
39
+ this.methodHandlers = new Map();
40
+ (0, methods_1.registerHandlers)(this);
41
+ }
42
+ registerHandler(handler) {
43
+ this.methodHandlers.set(handler.method, handler);
37
44
  }
38
45
  async handleMethod(request, apiVersion) {
39
- // call the method with the params
40
- const method = request.method;
41
- switch (method) {
42
- case "eth_chainId":
43
- return {
44
- method,
45
- result: this.eth_chainId(...request.params)
46
- };
47
- case "eth_supportedEntryPoints":
48
- return {
49
- method,
50
- result: this.eth_supportedEntryPoints(...request.params)
51
- };
52
- case "eth_estimateUserOperationGas":
53
- return {
54
- method,
55
- result: await this.eth_estimateUserOperationGas(apiVersion, request.params[0], request.params[1], request.params[2])
56
- };
57
- case "eth_sendUserOperation":
58
- return {
59
- method,
60
- result: await this.eth_sendUserOperation(apiVersion, ...request.params)
61
- };
62
- case "eth_getUserOperationByHash":
63
- return {
64
- method,
65
- result: await this.eth_getUserOperationByHash(...request.params)
66
- };
67
- case "eth_getUserOperationReceipt":
68
- return {
69
- method,
70
- result: await this.eth_getUserOperationReceipt(...request.params)
71
- };
72
- case "debug_bundler_clearMempool":
73
- return {
74
- method,
75
- result: this.debug_bundler_clearMempool(...request.params)
76
- };
77
- case "debug_bundler_clearState":
78
- return {
79
- method,
80
- result: this.debug_bundler_clearState(...request.params)
81
- };
82
- case "debug_bundler_dumpMempool":
83
- return {
84
- method,
85
- result: await this.debug_bundler_dumpMempool(...request.params)
86
- };
87
- case "debug_bundler_sendBundleNow":
88
- return {
89
- method,
90
- result: await this.debug_bundler_sendBundleNow(...request.params)
91
- };
92
- case "debug_bundler_setBundlingMode":
93
- return {
94
- method,
95
- result: await this.debug_bundler_setBundlingMode(...request.params)
96
- };
97
- case "debug_bundler_clearReputation":
98
- return {
99
- method,
100
- result: this.debug_bundler_clearReputation(...request.params)
101
- };
102
- case "debug_bundler_setReputation":
103
- return {
104
- method,
105
- result: this.debug_bundler_setReputation(request.params)
106
- };
107
- case "debug_bundler_dumpReputation":
108
- return {
109
- method,
110
- result: this.debug_bundler_dumpReputation(...request.params)
111
- };
112
- case "debug_bundler_getStakeStatus":
113
- return {
114
- method,
115
- result: await this.debug_bundler_getStakeStatus(...request.params)
116
- };
117
- case "pimlico_getUserOperationStatus":
118
- return {
119
- method,
120
- result: this.pimlico_getUserOperationStatus(...request.params)
121
- };
122
- case "pimlico_getUserOperationGasPrice":
123
- return {
124
- method,
125
- result: await this.pimlico_getUserOperationGasPrice(...request.params)
126
- };
127
- case "pimlico_sendUserOperationNow":
128
- return {
129
- method,
130
- result: await this.pimlico_sendUserOperationNow(apiVersion, ...request.params)
131
- };
132
- case "pimlico_experimental_sendUserOperation7702":
133
- return {
134
- method,
135
- result: await this.pimlico_experimental_sendUserOperation7702(apiVersion, ...request.params)
136
- };
137
- case "pimlico_experimental_estimateUserOperationGas7702":
138
- return {
139
- method,
140
- result: await this.pimlico_experimental_estimateUserOperationGas7702(apiVersion, request.params[0], request.params[1], request.params[2])
141
- };
142
- }
46
+ const handler = this.methodHandlers.get(request.method);
47
+ if (!handler) {
48
+ throw new types_1.RpcError("Method not supported", types_1.ValidationErrors.InvalidFields);
49
+ }
50
+ return await handler.handler({
51
+ rpcHandler: this,
52
+ params: request.params,
53
+ apiVersion
54
+ });
143
55
  }
144
56
  ensureEntryPointIsSupported(entryPoint) {
145
57
  if (!this.config.entrypoints.includes(entryPoint)) {
@@ -151,6 +63,11 @@ class RpcHandler {
151
63
  throw new types_1.RpcError(`${methodName} is only available in development environment`);
152
64
  }
153
65
  }
66
+ ensureExperimentalEndpointsAreEnabled(methodName) {
67
+ if (!this.config.enableExperimental7702Endpoints) {
68
+ throw new types_1.RpcError(`${methodName} endpoint is not enabled`, types_1.ValidationErrors.InvalidFields);
69
+ }
70
+ }
154
71
  async preMempoolChecks(opHash, userOperation, apiVersion, entryPoint) {
155
72
  if (this.config.legacyTransactions &&
156
73
  userOperation.maxFeePerGas !== userOperation.maxPriorityFeePerGas) {
@@ -193,208 +110,6 @@ class RpcHandler {
193
110
  }
194
111
  }
195
112
  }
196
- eth_chainId() {
197
- return BigInt(this.config.publicClient.chain.id);
198
- }
199
- eth_supportedEntryPoints() {
200
- return this.config.entrypoints;
201
- }
202
- async eth_estimateUserOperationGas(apiVersion, userOperation, entryPoint, stateOverrides) {
203
- return await this.estimateGas({
204
- apiVersion,
205
- userOperation,
206
- entryPoint,
207
- stateOverrides
208
- });
209
- }
210
- async eth_sendUserOperation(apiVersion, userOperation, entryPoint) {
211
- const hash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.config.publicClient.chain.id);
212
- this.eventManager.emitReceived(hash);
213
- let status = "rejected";
214
- try {
215
- status = await this.addToMempoolIfValid(userOperation, entryPoint, apiVersion);
216
- return hash;
217
- }
218
- catch (error) {
219
- status = "rejected";
220
- throw error;
221
- }
222
- finally {
223
- this.metrics.userOperationsReceived
224
- .labels({
225
- status,
226
- type: "regular"
227
- })
228
- .inc();
229
- }
230
- }
231
- async eth_getUserOperationByHash(userOperationHash) {
232
- const userOperationEventAbiItem = (0, viem_1.getAbiItem)({
233
- abi: types_1.EntryPointV06Abi,
234
- name: "UserOperationEvent"
235
- });
236
- let fromBlock;
237
- let toBlock;
238
- if (this.config.maxBlockRange !== undefined) {
239
- const latestBlock = await this.config.publicClient.getBlockNumber();
240
- fromBlock = latestBlock - BigInt(this.config.maxBlockRange);
241
- if (fromBlock < 0n) {
242
- fromBlock = 0n;
243
- }
244
- toBlock = "latest";
245
- }
246
- const filterResult = await this.config.publicClient.getLogs({
247
- address: this.config.entrypoints,
248
- event: userOperationEventAbiItem,
249
- fromBlock,
250
- toBlock,
251
- args: {
252
- userOpHash: userOperationHash
253
- }
254
- });
255
- if (filterResult.length === 0) {
256
- return null;
257
- }
258
- const userOperationEvent = filterResult[0];
259
- const txHash = userOperationEvent.transactionHash;
260
- if (txHash === null) {
261
- // transaction pending
262
- return null;
263
- }
264
- const getTransaction = async (txHash) => {
265
- try {
266
- return await this.config.publicClient.getTransaction({
267
- hash: txHash
268
- });
269
- }
270
- catch (e) {
271
- if (e instanceof viem_1.TransactionNotFoundError) {
272
- return getTransaction(txHash);
273
- }
274
- throw e;
275
- }
276
- };
277
- const tx = await getTransaction(txHash);
278
- if (!tx.to) {
279
- return null;
280
- }
281
- let op;
282
- try {
283
- const decoded = (0, viem_1.decodeFunctionData)({
284
- abi: [...types_1.EntryPointV06Abi, ...types_1.EntryPointV07Abi],
285
- data: tx.input
286
- });
287
- if (decoded.functionName !== "handleOps") {
288
- return null;
289
- }
290
- const ops = decoded.args[0];
291
- const foundOp = ops.find((op) => op.sender === userOperationEvent.args.sender &&
292
- op.nonce === userOperationEvent.args.nonce);
293
- if (foundOp === undefined) {
294
- return null;
295
- }
296
- const handleOpsV07AbiItem = (0, viem_1.getAbiItem)({
297
- abi: types_1.EntryPointV07Abi,
298
- name: "handleOps"
299
- });
300
- const handleOpsV07Selector = (0, viem_1.toFunctionSelector)(handleOpsV07AbiItem);
301
- if ((0, viem_1.slice)(tx.input, 0, 4) === handleOpsV07Selector) {
302
- op = (0, utils_1.toUnpackedUserOperation)(foundOp);
303
- }
304
- else {
305
- op = foundOp;
306
- }
307
- }
308
- catch {
309
- return null;
310
- }
311
- const result = {
312
- userOperation: Object.fromEntries(Object.entries(op).filter(([_, v]) => v !== null)),
313
- entryPoint: (0, viem_1.getAddress)(tx.to),
314
- transactionHash: txHash,
315
- blockHash: tx.blockHash ?? "0x",
316
- blockNumber: BigInt(tx.blockNumber ?? 0n)
317
- };
318
- return result;
319
- }
320
- eth_getUserOperationReceipt(userOperationHash) {
321
- return this.executorManager.getUserOperationReceipt(userOperationHash);
322
- }
323
- debug_bundler_clearState() {
324
- this.ensureDebugEndpointsAreEnabled("debug_bundler_clearState");
325
- this.mempool.clear();
326
- this.reputationManager.clear();
327
- return "ok";
328
- }
329
- debug_bundler_clearMempool() {
330
- this.ensureDebugEndpointsAreEnabled("debug_bundler_clearMempool");
331
- this.mempool.clear();
332
- this.reputationManager.clearEntityCount();
333
- return "ok";
334
- }
335
- debug_bundler_dumpMempool(entryPoint) {
336
- this.ensureDebugEndpointsAreEnabled("debug_bundler_dumpMempool");
337
- this.ensureEntryPointIsSupported(entryPoint);
338
- return Promise.resolve(this.mempool.dumpOutstanding());
339
- }
340
- async debug_bundler_sendBundleNow() {
341
- this.ensureDebugEndpointsAreEnabled("debug_bundler_sendBundleNow");
342
- await this.executorManager.sendBundleNow();
343
- return "ok";
344
- }
345
- async debug_bundler_setBundlingMode(bundlingMode) {
346
- this.ensureDebugEndpointsAreEnabled("debug_bundler_setBundlingMode");
347
- await this.executorManager.setBundlingMode(bundlingMode);
348
- return "ok";
349
- }
350
- debug_bundler_dumpReputation(entryPoint) {
351
- this.ensureDebugEndpointsAreEnabled("debug_bundler_setReputation");
352
- this.ensureEntryPointIsSupported(entryPoint);
353
- return this.reputationManager.dumpReputations(entryPoint);
354
- }
355
- async debug_bundler_getStakeStatus(address, entryPoint) {
356
- this.ensureDebugEndpointsAreEnabled("debug_bundler_getStakeStatus");
357
- this.ensureEntryPointIsSupported(entryPoint);
358
- return types_1.bundlerGetStakeStatusResponseSchema.parse({
359
- method: "debug_bundler_getStakeStatus",
360
- result: await this.reputationManager.getStakeStatus(entryPoint, address)
361
- }).result;
362
- }
363
- debug_bundler_setReputation(args) {
364
- this.ensureDebugEndpointsAreEnabled("debug_bundler_setReputation");
365
- this.reputationManager.setReputation(args[1], args[0]);
366
- return "ok";
367
- }
368
- debug_bundler_clearReputation() {
369
- this.ensureDebugEndpointsAreEnabled("debug_bundler_clearReputation");
370
- this.reputationManager.clear();
371
- return "ok";
372
- }
373
- pimlico_getUserOperationStatus(userOperationHash) {
374
- return this.monitor.getUserOperationStatus(userOperationHash);
375
- }
376
- async pimlico_getUserOperationGasPrice() {
377
- let { maxFeePerGas, maxPriorityFeePerGas } = await this.gasPriceManager.getGasPrice();
378
- if (this.config.chainType === "hedera") {
379
- maxFeePerGas /= 10n ** 9n;
380
- maxPriorityFeePerGas /= 10n ** 9n;
381
- }
382
- const { slow, standard, fast } = this.config.gasPriceMultipliers;
383
- return {
384
- slow: {
385
- maxFeePerGas: (maxFeePerGas * slow) / 100n,
386
- maxPriorityFeePerGas: (maxPriorityFeePerGas * slow) / 100n
387
- },
388
- standard: {
389
- maxFeePerGas: (maxFeePerGas * standard) / 100n,
390
- maxPriorityFeePerGas: (maxPriorityFeePerGas * standard) / 100n
391
- },
392
- fast: {
393
- maxFeePerGas: (maxFeePerGas * fast) / 100n,
394
- maxPriorityFeePerGas: (maxPriorityFeePerGas * fast) / 100n
395
- }
396
- };
397
- }
398
113
  // check if we want to bundle userOperation. If yes, add to mempool
399
114
  async addToMempoolIfValid(userOperation, entryPoint, apiVersion) {
400
115
  this.ensureEntryPointIsSupported(entryPoint);
@@ -449,60 +164,6 @@ class RpcHandler {
449
164
  }
450
165
  return "added";
451
166
  }
452
- async pimlico_experimental_estimateUserOperationGas7702(apiVersion, userOperation, entryPoint, stateOverrides) {
453
- if (!this.config.enableExperimental7702Endpoints) {
454
- throw new types_1.RpcError("pimlico_experimental_estimateUserOperationGas7702 endpoint is not enabled", types_1.ValidationErrors.InvalidFields);
455
- }
456
- await this.validateEip7702Auth(userOperation);
457
- return await this.estimateGas({
458
- apiVersion,
459
- userOperation,
460
- entryPoint,
461
- stateOverrides
462
- });
463
- }
464
- async pimlico_experimental_sendUserOperation7702(apiVersion, userOperation, entryPoint) {
465
- if (!this.config.enableExperimental7702Endpoints) {
466
- throw new types_1.RpcError("pimlico_experimental_sendUserOperation7702 endpoint is not enabled", types_1.ValidationErrors.InvalidFields);
467
- }
468
- this.ensureEntryPointIsSupported(entryPoint);
469
- await this.validateEip7702Auth(userOperation);
470
- await this.addToMempoolIfValid(userOperation, entryPoint, apiVersion);
471
- return (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.config.publicClient.chain.id);
472
- }
473
- async pimlico_sendUserOperationNow(apiVersion, userOperation, entryPoint) {
474
- if (!this.config.enableInstantBundlingEndpoint) {
475
- throw new types_1.RpcError("pimlico_sendUserOperationNow endpoint is not enabled", types_1.ValidationErrors.InvalidFields);
476
- }
477
- this.ensureEntryPointIsSupported(entryPoint);
478
- const opHash = (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.config.publicClient.chain.id);
479
- await this.preMempoolChecks(opHash, userOperation, apiVersion, entryPoint);
480
- // Prepare bundle
481
- const userOperationInfo = {
482
- userOp: userOperation,
483
- entryPoint,
484
- userOpHash: (0, utils_1.getUserOperationHash)(userOperation, entryPoint, this.config.publicClient.chain.id),
485
- addedToMempool: Date.now()
486
- };
487
- const bundle = {
488
- entryPoint,
489
- userOps: [userOperationInfo],
490
- version: (0, utils_1.isVersion06)(userOperation)
491
- ? "0.6"
492
- : "0.7"
493
- };
494
- const result = await this.executorManager.sendBundleToExecutor(bundle);
495
- if (!result) {
496
- throw new types_1.RpcError("unhandled error during bundle submission", types_1.ValidationErrors.InvalidFields);
497
- }
498
- // Wait for receipt.
499
- const receipt = await this.config.publicClient.waitForTransactionReceipt({
500
- hash: result,
501
- pollingInterval: 100
502
- });
503
- const userOperationReceipt = (0, utils_1.parseUserOperationReceipt)(opHash, receipt);
504
- return userOperationReceipt;
505
- }
506
167
  async validateEip7702Auth(userOperation) {
507
168
  if (!userOperation.eip7702auth) {
508
169
  throw new types_1.RpcError("UserOperation is missing eip7702auth", types_1.ValidationErrors.InvalidFields);
@@ -541,7 +202,7 @@ class RpcHandler {
541
202
  }
542
203
  async estimateGas({ apiVersion, userOperation, entryPoint, stateOverrides }) {
543
204
  this.ensureEntryPointIsSupported(entryPoint);
544
- if (userOperation.maxFeePerGas === 0n) {
205
+ if (userOperation.maxFeePerGas === 0n && !this.config.isGasFreeChain) {
545
206
  throw new types_1.RpcError("user operation max fee per gas must be larger than 0 during gas estimation");
546
207
  }
547
208
  // Check if the nonce is valid