From 8efe230bc8e4529d6dfdd2fc0fc7ccacef12b39a Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 3 Nov 2021 09:14:52 -0300 Subject: [PATCH] Add missing resolvers support on decoded inputs and logs table --- src/transaction/Details.tsx | 1 + src/transaction/LogEntry.tsx | 1 + src/transaction/decoder/AddressDecoder.tsx | 9 ++++++++- src/transaction/decoder/DecodedParamRow.tsx | 9 ++++++++- src/transaction/decoder/DecodedParamsTable.tsx | 4 ++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 9c9e29d..85cb2fc 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -375,6 +375,7 @@ const Details: React.FC = ({ hasParamNames={resolvedTxDesc === txDesc} userMethod={userMethod} devMethod={devMethod} + resolvedAddresses={resolvedAddresses} /> )} diff --git a/src/transaction/LogEntry.tsx b/src/transaction/LogEntry.tsx index 2993e16..4e89ffd 100644 --- a/src/transaction/LogEntry.tsx +++ b/src/transaction/LogEntry.tsx @@ -114,6 +114,7 @@ const LogEntry: React.FC = ({ paramTypes={resolvedLogDesc.eventFragment.inputs} txData={txData} hasParamNames={resolvedLogDesc === logDesc} + resolvedAddresses={resolvedAddresses} /> diff --git a/src/transaction/decoder/AddressDecoder.tsx b/src/transaction/decoder/AddressDecoder.tsx index ee6369a..45fb30c 100644 --- a/src/transaction/decoder/AddressDecoder.tsx +++ b/src/transaction/decoder/AddressDecoder.tsx @@ -3,13 +3,19 @@ import AddressHighlighter from "../../components/AddressHighlighter"; import DecoratedAddressLink from "../../components/DecoratedAddressLink"; import Copy from "../../components/Copy"; import { TransactionData } from "../../types"; +import { ResolvedAddresses } from "../../api/address-resolver"; type AddressDecoderProps = { r: any; txData: TransactionData; + resolvedAddresses?: ResolvedAddresses | undefined; }; -const AddressDecoder: React.FC = ({ r, txData }) => ( +const AddressDecoder: React.FC = ({ + r, + txData, + resolvedAddresses, +}) => (
= ({ r, txData }) => ( miner={r.toString() === txData.confirmedData?.miner} txFrom={r.toString() === txData.from} txTo={r.toString() === txData.to} + resolvedAddresses={resolvedAddresses} /> diff --git a/src/transaction/decoder/DecodedParamRow.tsx b/src/transaction/decoder/DecodedParamRow.tsx index fed9ecb..b2b0baf 100644 --- a/src/transaction/decoder/DecodedParamRow.tsx +++ b/src/transaction/decoder/DecodedParamRow.tsx @@ -9,6 +9,7 @@ import AddressDecoder from "./AddressDecoder"; import BooleanDecoder from "./BooleanDecoder"; import BytesDecoder from "./BytesDecoder"; import { TransactionData } from "../../types"; +import { ResolvedAddresses } from "../../api/address-resolver"; type DecodedParamRowProps = { prefix?: ReactNode; @@ -18,6 +19,7 @@ type DecodedParamRowProps = { txData: TransactionData; arrayElem?: number | undefined; help?: string | undefined; + resolvedAddresses?: ResolvedAddresses | undefined; }; const DecodedParamRow: React.FC = ({ @@ -28,6 +30,7 @@ const DecodedParamRow: React.FC = ({ txData, arrayElem, help, + resolvedAddresses, }) => { const [showHelp, setShowHelp] = useState(false); @@ -72,7 +75,11 @@ const DecodedParamRow: React.FC = ({ {paramType.baseType === "uint256" ? ( ) : paramType.baseType === "address" ? ( - + ) : paramType.baseType === "bool" ? ( ) : paramType.baseType === "bytes" ? ( diff --git a/src/transaction/decoder/DecodedParamsTable.tsx b/src/transaction/decoder/DecodedParamsTable.tsx index f7daee5..8f4a562 100644 --- a/src/transaction/decoder/DecodedParamsTable.tsx +++ b/src/transaction/decoder/DecodedParamsTable.tsx @@ -3,6 +3,7 @@ import { ParamType, Result } from "@ethersproject/abi"; import DecodedParamRow from "./DecodedParamRow"; import { TransactionData } from "../../types"; import { DevMethod, UserMethod } from "../../useSourcify"; +import { ResolvedAddresses } from "../../api/address-resolver"; type DecodedParamsTableProps = { args: Result; @@ -11,6 +12,7 @@ type DecodedParamsTableProps = { hasParamNames?: boolean; userMethod?: UserMethod | undefined; devMethod?: DevMethod | undefined; + resolvedAddresses?: ResolvedAddresses | undefined; }; const DecodedParamsTable: React.FC = ({ @@ -19,6 +21,7 @@ const DecodedParamsTable: React.FC = ({ txData, hasParamNames = true, devMethod, + resolvedAddresses, }) => ( @@ -48,6 +51,7 @@ const DecodedParamsTable: React.FC = ({ paramType={paramTypes[i]} txData={txData} help={devMethod?.params?.[paramTypes[i].name]} + resolvedAddresses={resolvedAddresses} /> ))}