Skip to content

Commit

Permalink
fix: removed unecessary logs for decoding tx in block-explorer (#985)
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipHarald authored Nov 21, 2024
1 parent 3024992 commit fb2c996
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/nextjs/utils/scaffold-eth/decodeTxData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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;
};
Expand Down

0 comments on commit fb2c996

Please sign in to comment.