From 0ba340427cae1852f639d0ad0a2c6e26d37ff43a Mon Sep 17 00:00:00 2001 From: Papadritta Date: Wed, 14 May 2025 10:50:32 +0700 Subject: [PATCH] Fix: Add try-catch to useTransactionWatcher to resolve TS build and ESLint errors - Wrapped handleStandardTransfer call in a try-catch block inside useTransactionWatcher.tsx - Fixed TypeScript error: Unexpected "catch" (TS1005) - Replaced invalid 'not_found' with valid MutationStatus value 'error' (TS2322) - Removed usage of `any`, replaced with `unknown` to satisfy ESLint rule `@typescript-eslint/no-explicit-any` - Verified successful build using `yarn build` --- apps/namadillo/src/hooks/useTransactionWatcher.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/namadillo/src/hooks/useTransactionWatcher.tsx b/apps/namadillo/src/hooks/useTransactionWatcher.tsx index 8e8fb6ba44..79c53623d7 100644 --- a/apps/namadillo/src/hooks/useTransactionWatcher.tsx +++ b/apps/namadillo/src/hooks/useTransactionWatcher.tsx @@ -28,8 +28,16 @@ export const useTransactionWatcher = (): void => { case "TransparentToShielded": case "ShieldedToTransparent": case "ShieldedToShielded": { - const newTx = await handleStandardTransfer(tx, fetchTransaction); - dispatchTransferEvent(transactionTypeToEventName(tx), newTx); + try { + const newTx = await handleStandardTransfer(tx, fetchTransaction); + dispatchTransferEvent(transactionTypeToEventName(tx), newTx); + } catch (error: unknown) { + console.warn("Transaction fetch failed (likely pruned):", error); + dispatchTransferEvent(transactionTypeToEventName(tx), { + ...tx, + status: "error", + }); + } break; }