From fb2c996bfb821a824a3b087a12c908055ac95248 Mon Sep 17 00:00:00 2001 From: Filip Harald Date: Thu, 21 Nov 2024 12:09:29 +0100 Subject: [PATCH] fix: removed unecessary logs for decoding tx in block-explorer (#985) --- packages/nextjs/utils/scaffold-eth/decodeTxData.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/nextjs/utils/scaffold-eth/decodeTxData.ts b/packages/nextjs/utils/scaffold-eth/decodeTxData.ts index 65c20f789..86eac35e8 100644 --- a/packages/nextjs/utils/scaffold-eth/decodeTxData.ts +++ b/packages/nextjs/utils/scaffold-eth/decodeTxData.ts @@ -18,6 +18,7 @@ const interfaces = chainMetaData export const decodeTransactionData = (tx: TransactionWithFunction) => { if (tx.input.length >= 10 && !tx.input.startsWith("0x60e06040")) { + let foundInterface = false; for (const [, contractAbi] of Object.entries(interfaces)) { try { const { functionName, args } = decodeFunctionData({ @@ -34,12 +35,15 @@ export const decodeTransactionData = (tx: TransactionWithFunction) => { abi: contractAbi as AbiFunction[], name: functionName, })?.inputs.map((input: any) => input.type); - + foundInterface = true; break; - } catch (e) { - console.error(`Parsing failed: ${e}`); + } catch { + // do nothing } } + if (!foundInterface) { + tx.functionName = "⚠️ Unknown"; + } } return tx; };