From 4e0bfc5c674efab825af37de3b91aa0f8303a91f Mon Sep 17 00:00:00 2001 From: alvrs Date: Wed, 16 Oct 2024 13:16:32 +0200 Subject: [PATCH] immediately return transaction hash and user operation hash --- src/rpc/rpcHandler.ts | 12 +----------- src/types/schemas.ts | 7 ++++++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/rpc/rpcHandler.ts b/src/rpc/rpcHandler.ts index 2ee90dd7..6633cfdb 100644 --- a/src/rpc/rpcHandler.ts +++ b/src/rpc/rpcHandler.ts @@ -63,7 +63,6 @@ import { isVersion06, isVersion07, maxBigInt, - parseUserOperationReceipt, scaleBigIntByPercent, toUnpackedUserOperation } from "@alto/utils" @@ -1025,16 +1024,7 @@ export class RpcHandler implements IRpcEndpoint { this.executor.markWalletProcessed(res.value.transactionInfo.executor) - // wait for receipt - const receipt = - await this.config.publicClient.waitForTransactionReceipt({ - hash: res.value.transactionInfo.transactionHash, - pollingInterval: 100 - }) - - const userOperationReceipt = parseUserOperationReceipt(opHash, receipt) - - return userOperationReceipt + return { transactionHash: res.value.transactionInfo.transactionHash, userOpHash: opHash }; } async pimlico_sendCompressedUserOperation( diff --git a/src/types/schemas.ts b/src/types/schemas.ts index c8baec47..4af78cb3 100644 --- a/src/types/schemas.ts +++ b/src/types/schemas.ts @@ -578,9 +578,14 @@ const pimlicoSendCompressedUserOperationResponseSchema = z.object({ result: hexData32Schema }) +const userOperationNowResultSchema = z.object({ + transactionHash: hexData32Schema, + userOpHash: hexData32Schema +}) + const pimlicoSendUserOperationNowResponseSchema = z.object({ method: z.literal("pimlico_sendUserOperationNow"), - result: userOperationReceiptSchema + result: userOperationNowResultSchema }) const bundlerResponseSchema = z.discriminatedUnion("method", [