From b5c76a4e0195a1e1417347edd147964e20ba778d Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 22 Sep 2021 15:11:13 -0300 Subject: [PATCH] Fix log metadata search --- src/Transaction.tsx | 2 +- src/transaction/Logs.tsx | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Transaction.tsx b/src/Transaction.tsx index 2fc69a2..a412d0b 100644 --- a/src/Transaction.tsx +++ b/src/Transaction.tsx @@ -49,7 +49,7 @@ const Transaction: React.FC = () => { const metadata = useSourcify( txData?.to, provider?.network.chainId, - SourcifySource.CUSTOM_SNAPSHOT_SERVER // TODO: use dynamic selector + SourcifySource.CENTRAL_SERVER // TODO: use dynamic selector ); const txDesc = useTransactionDescription(metadata, txData); diff --git a/src/transaction/Logs.tsx b/src/transaction/Logs.tsx index 875f268..a274c90 100644 --- a/src/transaction/Logs.tsx +++ b/src/transaction/Logs.tsx @@ -30,10 +30,10 @@ const Logs: React.FC = ({ txData, metadata }) => { baseMetadatas, logAddresses, 1, - SourcifySource.CUSTOM_SNAPSHOT_SERVER + SourcifySource.CENTRAL_SERVER // TODO: use dynamic selector ); const logDesc = useMemo(() => { - if (!metadata || !txData) { + if (!txData) { return undefined; } @@ -45,12 +45,17 @@ const Logs: React.FC = ({ txData, metadata }) => { const abi = mt.output.abi; const intf = new Interface(abi as any); - return intf.parseLog({ - topics: l.topics, - data: l.data, - }); + try { + return intf.parseLog({ + topics: l.topics, + data: l.data, + }); + } catch (err) { + console.warn("Couldn't find function signature", err); + return null; + } }); - }, [metadatas, metadata, txData]); + }, [metadatas, txData]); return (