Skip to content

Commit

Permalink
getUserOpByHash - fetch userop from mempool too
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSulpiride committed Apr 1, 2024
1 parent 34af306 commit a269faf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 14 additions & 0 deletions packages/executor/src/modules/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,20 @@ export class Eth {
async getUserOperationByHash(
hash: string
): Promise<UserOperationByHashResponse | null> {
const entry = await this.mempoolService.getEntryByHash(hash);
if (entry) {
let transaction: Partial<ethers.providers.TransactionResponse> = {};
if (entry.transaction) {
transaction = await this.provider.getTransaction(entry.transaction);
}
return {
userOperation: entry.userOp,
entryPoint: entry.entryPoint,
transactionHash: transaction.hash,
blockHash: transaction.blockHash,
blockNumber: transaction.blockNumber,
};
}
const [entryPoint, event] = await this.getUserOperationEvent(hash);
if (!entryPoint || !event) {
return null;
Expand Down
6 changes: 3 additions & 3 deletions packages/types/src/api/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export type EstimatedUserOperationGas =
export type UserOperationByHashResponse = {
userOperation: UserOperationStruct;
entryPoint: string;
blockNumber: number;
blockHash: string;
transactionHash: string;
blockNumber?: number;
blockHash?: string;
transactionHash?: string;
};

export type GetGasPriceResponse = {
Expand Down

0 comments on commit a269faf

Please sign in to comment.