Skip to content

Commit

Permalink
immediately return transaction hash and user operation hash
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Oct 16, 2024
1 parent e312a2d commit 4e0bfc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
12 changes: 1 addition & 11 deletions src/rpc/rpcHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import {
isVersion06,
isVersion07,
maxBigInt,
parseUserOperationReceipt,
scaleBigIntByPercent,
toUnpackedUserOperation
} from "@alto/utils"
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 6 additions & 1 deletion src/types/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", [
Expand Down

0 comments on commit 4e0bfc5

Please sign in to comment.