From 36b5437643091e7d2dbd0c76779490da799762b1 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Thu, 11 Nov 2021 15:51:03 -0300 Subject: [PATCH] Fix missing Sourcify decoration on token transfers --- src/TokenTransferItem.tsx | 13 ++++++++++++- src/transaction/Details.tsx | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/TokenTransferItem.tsx b/src/TokenTransferItem.tsx index eb3e0b2..5b9fc72 100644 --- a/src/TokenTransferItem.tsx +++ b/src/TokenTransferItem.tsx @@ -4,13 +4,20 @@ import { faCaretRight } from "@fortawesome/free-solid-svg-icons/faCaretRight"; import TransactionAddress from "./components/TransactionAddress"; import ValueHighlighter from "./components/ValueHighlighter"; import FormattedBalance from "./components/FormattedBalance"; -import { AddressContext, TokenMeta, TokenTransfer } from "./types"; +import { + AddressContext, + ChecksummedAddress, + TokenMeta, + TokenTransfer, +} from "./types"; import { ResolvedAddresses } from "./api/address-resolver"; +import { Metadata } from "./useSourcify"; type TokenTransferItemProps = { t: TokenTransfer; tokenMeta?: TokenMeta | undefined; resolvedAddresses: ResolvedAddresses | undefined; + metadatas: Record; }; // TODO: handle partial @@ -18,6 +25,7 @@ const TokenTransferItem: React.FC = ({ t, tokenMeta, resolvedAddresses, + metadatas, }) => (
@@ -30,6 +38,7 @@ const TokenTransferItem: React.FC = ({ address={t.from} addressCtx={AddressContext.FROM} resolvedAddresses={resolvedAddresses} + metadata={metadatas[t.from]} />
@@ -38,6 +47,7 @@ const TokenTransferItem: React.FC = ({ address={t.to} addressCtx={AddressContext.TO} resolvedAddresses={resolvedAddresses} + metadata={metadatas[t.to]} />
@@ -53,6 +63,7 @@ const TokenTransferItem: React.FC = ({
diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 2c87e79..afa2628 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -95,6 +95,11 @@ const Details: React.FC = ({ if (txData.confirmedData?.createdContractAddress) { _addresses.push(txData.confirmedData.createdContractAddress); } + for (const t of txData.tokenTransfers) { + _addresses.push(t.from); + _addresses.push(t.to); + _addresses.push(t.token); + } return _addresses; }, [txData]); const { sourcifySource } = useAppConfigContext(); @@ -227,6 +232,7 @@ const Details: React.FC = ({ t={t} tokenMeta={txData.tokenMetas[t.token]} resolvedAddresses={resolvedAddresses} + metadatas={metadatas} /> ))}