From 91a888c73b3999bb0b9049198ed94508d0d672dd Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 1 Nov 2021 04:26:19 -0300 Subject: [PATCH] Migrate remaining token decoration support to the new resolver framework --- src/TokenTransferItem.tsx | 8 ++++---- src/components/AddressOrENSName.tsx | 4 ---- src/components/DecoratedAddressLink.tsx | 13 +------------ src/components/PlainAddress.tsx | 6 ++---- src/transaction/Details.tsx | 1 + 5 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/TokenTransferItem.tsx b/src/TokenTransferItem.tsx index 083f7f0..03fa198 100644 --- a/src/TokenTransferItem.tsx +++ b/src/TokenTransferItem.tsx @@ -11,11 +11,13 @@ import { TokenTransfer, TransactionData, } from "./types"; +import { ResolvedAddresses } from "./api/address-resolver"; type TokenTransferItemProps = { t: TokenTransfer; txData: TransactionData; tokenMeta?: TokenMeta | undefined; + resolvedAddresses: ResolvedAddresses | undefined; }; // TODO: handle partial @@ -23,6 +25,7 @@ const TokenTransferItem: React.FC = ({ t, txData, tokenMeta, + resolvedAddresses, }) => (
@@ -64,10 +67,7 @@ const TokenTransferItem: React.FC = ({
diff --git a/src/components/AddressOrENSName.tsx b/src/components/AddressOrENSName.tsx index 9e4b65b..62ee289 100644 --- a/src/components/AddressOrENSName.tsx +++ b/src/components/AddressOrENSName.tsx @@ -8,7 +8,6 @@ import PlainAddress from "./PlainAddress"; type AddressOrENSNameProps = { address: string; selectedAddress?: string; - text?: string; dontOverrideColors?: boolean; resolvedAddresses?: ResolvedAddresses | undefined; }; @@ -16,7 +15,6 @@ type AddressOrENSNameProps = { const AddressOrENSName: React.FC = ({ address, selectedAddress, - text, dontOverrideColors, resolvedAddresses, }) => { @@ -27,7 +25,6 @@ const AddressOrENSName: React.FC = ({ return ( @@ -40,7 +37,6 @@ const AddressOrENSName: React.FC = ({ return ( diff --git a/src/components/DecoratedAddressLink.tsx b/src/components/DecoratedAddressLink.tsx index ee88b31..cadc77f 100644 --- a/src/components/DecoratedAddressLink.tsx +++ b/src/components/DecoratedAddressLink.tsx @@ -5,36 +5,31 @@ import { faBomb } from "@fortawesome/free-solid-svg-icons/faBomb"; import { faMoneyBillAlt } from "@fortawesome/free-solid-svg-icons/faMoneyBillAlt"; import { faBurn } from "@fortawesome/free-solid-svg-icons/faBurn"; import { faCoins } from "@fortawesome/free-solid-svg-icons/faCoins"; -import TokenLogo from "./TokenLogo"; import AddressOrENSName from "./AddressOrENSName"; -import { AddressContext, TokenMeta, ZERO_ADDRESS } from "../types"; +import { AddressContext, ZERO_ADDRESS } from "../types"; import { ResolvedAddresses } from "../api/address-resolver"; type DecoratedAddressLinkProps = { address: string; selectedAddress?: string; - text?: string; addressCtx?: AddressContext; creation?: boolean; miner?: boolean; selfDestruct?: boolean; txFrom?: boolean; txTo?: boolean; - tokenMeta?: TokenMeta; resolvedAddresses?: ResolvedAddresses | undefined; }; const DecoratedAddressLink: React.FC = ({ address, selectedAddress, - text, addressCtx, creation, miner, selfDestruct, txFrom, txTo, - tokenMeta, resolvedAddresses, }) => { const mint = addressCtx === AddressContext.FROM && address === ZERO_ADDRESS; @@ -75,15 +70,9 @@ const DecoratedAddressLink: React.FC = ({ )} - {tokenMeta && ( -
- -
- )} diff --git a/src/components/PlainAddress.tsx b/src/components/PlainAddress.tsx index 6ebe634..fbc37ca 100644 --- a/src/components/PlainAddress.tsx +++ b/src/components/PlainAddress.tsx @@ -3,14 +3,12 @@ import { NavLink } from "react-router-dom"; type PlainAddressProps = { address: string; - text: string | undefined; linkable: boolean; dontOverrideColors: boolean | undefined; }; const PlainAddress: React.FC = ({ address, - text, linkable, dontOverrideColors, }) => { @@ -21,9 +19,9 @@ const PlainAddress: React.FC = ({ dontOverrideColors ? "" : "text-link-blue hover:text-link-blue-hover" } font-address truncate`} to={`/address/${address}`} - title={text ?? address} + title={address} > - <>{text ?? address} + {address} ); } diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 72f448a..6286efa 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -225,6 +225,7 @@ const Details: React.FC = ({ t={t} txData={txData} tokenMeta={txData.tokenMetas[t.token]} + resolvedAddresses={resolvedAddresses} /> ))}