Remove unused attribute; custom param presence msg depending on signature with or without param names

This commit is contained in:
Willian Mitsuda 2021-09-27 15:47:55 -03:00
parent af95c04c9c
commit debc046d83
3 changed files with 8 additions and 9 deletions

View File

@ -70,10 +70,10 @@ const Details: React.FC<DetailsProps> = ({
const fourBytes = rawInputTo4Bytes(txData.data); const fourBytes = rawInputTo4Bytes(txData.data);
const fourBytesEntry = use4Bytes(fourBytes); const fourBytesEntry = use4Bytes(fourBytes);
const fourBytesTxDesc = useMemo(() => { const fourBytesTxDesc = useMemo(() => {
if (!txData || !fourBytesEntry?.signatureWithoutParamNames) { if (!txData || !fourBytesEntry?.signature) {
return undefined; return undefined;
} }
const sig = fourBytesEntry?.signatureWithoutParamNames; const sig = fourBytesEntry?.signature;
const functionFragment = Fragment.fromString(`function ${sig}`); const functionFragment = Fragment.fromString(`function ${sig}`);
const intf = new Interface([functionFragment]); const intf = new Interface([functionFragment]);
return intf.parseTransaction({ data: txData.data, value: txData.value }); return intf.parseTransaction({ data: txData.data, value: txData.value });

View File

@ -28,7 +28,9 @@ const DecodedParamsTable: React.FC<DecodedParamsTableProps> = ({
{!hasParamNames && ( {!hasParamNames && (
<tr className="grid grid-cols-12 text-left gap-x-2 py-2 bg-yellow-100 text-red-700"> <tr className="grid grid-cols-12 text-left gap-x-2 py-2 bg-yellow-100 text-red-700">
<th className="col-span-12 px-1"> <th className="col-span-12 px-1">
Parameter names are not available. {paramTypes.length > 0 && paramTypes[0].name !== null
? "Parameter names are estimated."
: "Parameter names are not available."}
</th> </th>
</tr> </tr>
)} )}

View File

@ -4,14 +4,12 @@ import { fourBytesURL } from "./url";
export type FourBytesEntry = { export type FourBytesEntry = {
name: string; name: string;
signatureWithoutParamNames: string | undefined; signature: string | undefined;
signatures: string[] | undefined;
}; };
const simpleTransfer: FourBytesEntry = { const simpleTransfer: FourBytesEntry = {
name: "Transfer", name: "Transfer",
signatureWithoutParamNames: undefined, signature: undefined,
signatures: undefined,
}; };
const fullCache = new Map<string, FourBytesEntry | null>(); const fullCache = new Map<string, FourBytesEntry | null>();
@ -68,8 +66,7 @@ export const use4Bytes = (
const entry: FourBytesEntry = { const entry: FourBytesEntry = {
name: method, name: method,
signatureWithoutParamNames: sig, signature: sig,
signatures: undefined,
}; };
setEntry(entry); setEntry(entry);
fullCache.set(fourBytes, entry); fullCache.set(fourBytes, entry);