From d048b2cf463b0f3bce1b480cb61b757705f5e956 Mon Sep 17 00:00:00 2001 From: Moses <103143573+Defi-Moses@users.noreply.github.com> Date: Sat, 12 Oct 2024 10:21:41 -0400 Subject: [PATCH] adding search by origin tx (#3277) --- .../api/src/controllers/transactionIdController.ts | 7 ++++++- packages/rfq-indexer/api/src/routes/transactionIdRoute.ts | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/rfq-indexer/api/src/controllers/transactionIdController.ts b/packages/rfq-indexer/api/src/controllers/transactionIdController.ts index 586590220a..23f1496814 100644 --- a/packages/rfq-indexer/api/src/controllers/transactionIdController.ts +++ b/packages/rfq-indexer/api/src/controllers/transactionIdController.ts @@ -10,7 +10,12 @@ export const getTransactionById = async (req: Request, res: Response) => { try { const query = db .with('deposits', () => - qDeposits().where('transactionId', '=', transactionId as string) + qDeposits().where((eb) => + eb.or([ + eb('transactionId', '=', transactionId as string), + eb('transactionHash', '=', transactionId as string) + ]) + ) ) .with('relays', () => qRelays()) .with('proofs', () => qProofs({activeOnly: false})) // display proofs even if they have been invalidated/replaced by a dispute diff --git a/packages/rfq-indexer/api/src/routes/transactionIdRoute.ts b/packages/rfq-indexer/api/src/routes/transactionIdRoute.ts index ef0b4077a4..253060dcdf 100644 --- a/packages/rfq-indexer/api/src/routes/transactionIdRoute.ts +++ b/packages/rfq-indexer/api/src/routes/transactionIdRoute.ts @@ -8,7 +8,7 @@ const router = express.Router() * @openapi * /transaction-id/{transactionId}: * get: - * summary: Get transaction details by ID + * summary: Get transaction details by ID or the origin transaction hash * description: Retrieves detailed information about a transaction, including deposit, relay, proof, claim, and refund data if available * parameters: * - in: path @@ -16,7 +16,7 @@ const router = express.Router() * required: true * schema: * type: string - * description: The unique identifier of the transaction + * description: The unique identifier of the transaction or the origin transaction hash * responses: * 200: * description: Successful response