import React, { ReactNode } from "react"; import AddressHighlighter from "../components/AddressHighlighter"; import DecoratedAddressLink from "../components/DecoratedAddressLink"; import Copy from "../components/Copy"; import { ParamType } from "@ethersproject/abi"; import { TransactionData } from "../types"; type DecodedParamRowProps = { prefix?: ReactNode; i?: number | undefined; r: any; paramType: ParamType; txData: TransactionData; arrayElem?: number | undefined; }; const DecodedParamRow: React.FC = ({ prefix, i, r, paramType, txData, arrayElem, }) => { return ( <> {prefix && {prefix}} {arrayElem !== undefined ? ( {" "} [{arrayElem}] ) : ( <> {paramType.name ?? param_{i}}{" "} {i !== undefined && ( ({i}) )} )} {paramType.type} {paramType.baseType === "address" ? (
) : paramType.baseType === "bool" ? ( {r.toString()} ) : paramType.baseType === "bytes" ? ( {r.toString()}{" "} {r.toString().length / 2 - 1}{" "} {r.toString().length / 2 - 1 === 1 ? "byte" : "bytes"} ) : paramType.baseType === "tuple" || paramType.baseType === "array" ? ( <> ) : ( r.toString() )} {paramType.baseType === "tuple" && r.map((e: any, idx: number) => ( ))} {paramType.baseType === "array" && r.map((e: any, idx: number) => ( param_{i}} r={e} paramType={paramType.arrayChildren} txData={txData} arrayElem={idx} /> ))} ); }; export default React.memo(DecodedParamRow);