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 fourBytesEntry = use4Bytes(fourBytes);
const fourBytesTxDesc = useMemo(() => {
if (!txData || !fourBytesEntry?.signatureWithoutParamNames) {
if (!txData || !fourBytesEntry?.signature) {
return undefined;
}
const sig = fourBytesEntry?.signatureWithoutParamNames;
const sig = fourBytesEntry?.signature;
const functionFragment = Fragment.fromString(`function ${sig}`);
const intf = new Interface([functionFragment]);
return intf.parseTransaction({ data: txData.data, value: txData.value });

View File

@ -28,7 +28,9 @@ const DecodedParamsTable: React.FC<DecodedParamsTableProps> = ({
{!hasParamNames && (
<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">
Parameter names are not available.
{paramTypes.length > 0 && paramTypes[0].name !== null
? "Parameter names are estimated."
: "Parameter names are not available."}
</th>
</tr>
)}

View File

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