Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/api/routers/v1/explorer/explorer.handler.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
import { withTrace } from "@/common/utils/trace-wrapper";
import { type GetQuoteOptions, QuotesService } from "@/quotes";
import { type GetQuoteOptions, QuotesService, getQuoteSchema } from "@/quotes";
import { type RequestHandler } from "express";
import { Container } from "typedi";
import { API_VERSION } from "../constants";

export const explorerHandler: RequestHandler<
GetQuoteOptions,
Pick<GetQuoteOptions, "hash">,
unknown,
never,
never
unknown
> = async (req, res) => {
const { params } = req;
const { params, query } = req;

// This query cannot be validated, parsed and attached to req object in validate middleware due to query being a strict readonly property in req object.
const validatedQuery = await getQuoteSchema
.pick({ confirmations: true })
.parseAsync(query);

await withTrace(
`/${API_VERSION}/explorer`,
async (_req, res) => {
res.send(await Container.get(QuotesService).getQuote(params));
res.send(
await Container.get(QuotesService).getQuote({
...params,
...validatedQuery,
}),
);
},
{
hash: params.hash,
Expand Down
4 changes: 1 addition & 3 deletions src/api/routers/v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ import { PATHS } from "./constants";
import { execHandler } from "./exec";
import { explorerHandler } from "./explorer";
import { infoHandler } from "./info";
import { openAPIHandler } from "./openapi";
import { quoteHandler, quotePermitHandler } from "./quote";

export const v1Router = Router()
.get(PATHS.index, openAPIHandler)
.get(PATHS.info, infoHandler)
.get(
`${PATHS.explorer}:hash`,
validate({
params: getQuoteSchema,
params: getQuoteSchema.pick({ hash: true }),
}),
explorerHandler,
)
Expand Down
1 change: 0 additions & 1 deletion src/api/routers/v1/openapi/index.ts

This file was deleted.

102 changes: 0 additions & 102 deletions src/api/routers/v1/openapi/openapi.doc.ts

This file was deleted.

26 changes: 0 additions & 26 deletions src/api/routers/v1/openapi/openapi.handler.ts

This file was deleted.

13 changes: 12 additions & 1 deletion src/modules/executor/executor.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class ExecutorProcessor implements Processor<ExecutorJob> {
const transactionReceipt = await withTrace(
"executionPhase.defaultBlockTxReceiptForPreviousTxHash",
async () => {
// Fallback RPC providers are skipped here to avoid timeout retries on all fallbacks which is time consuming
// Tx receipt is always fetched from primary RPC provider to make sure to avoid RPC node state sync issues in confirmations
const { client } =
this.rpcManagerService.getPrimaryRpcProvider(chainId);

Expand Down Expand Up @@ -1050,6 +1050,9 @@ export class ExecutorProcessor implements Processor<ExecutorJob> {
this.storageService.updateUserOpCustomFields(meeUserOpHash, {
txHash,
isConfirmed,
confirmations: isConfirmed
? BigInt(this.chainsService.chainSettings.waitConfirmations)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt we fetch chain specific waitConfirmations parameter?

this.chainsService.getChainSettings(chainId).waitConfirmations

: 1n,
executionFinishedAt: Date.now(),
});
}
Expand Down Expand Up @@ -1085,6 +1088,11 @@ export class ExecutorProcessor implements Processor<ExecutorJob> {
// TODO: If there are any ways to match these fee number, we should explore this in the future.
actualGasCost,
isConfirmed,
confirmations: isConfirmed
? BigInt(
this.chainsService.chainSettings.waitConfirmations,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here?

)
: 1n,
...(success
? {}
: {
Expand Down Expand Up @@ -1140,6 +1148,9 @@ export class ExecutorProcessor implements Processor<ExecutorJob> {
this.storageService.updateUserOpCustomFields(meeUserOpHash, {
txHash,
isConfirmed,
confirmations: isConfirmed
? BigInt(this.chainsService.chainSettings.waitConfirmations)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here?

: 1n,
executionFinishedAt: Date.now(),
error: "Failed to execute userOp",
});
Expand Down
Loading