From debc046d83ad5bf9a789216939dc55d6e8cbeb3f Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 27 Sep 2021 15:47:55 -0300 Subject: [PATCH] Remove unused attribute; custom param presence msg depending on signature with or without param names --- src/transaction/Details.tsx | 4 ++-- src/transaction/decoder/DecodedParamsTable.tsx | 4 +++- src/use4Bytes.ts | 9 +++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 23f463a..bfd8747 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -70,10 +70,10 @@ const Details: React.FC = ({ 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 }); diff --git a/src/transaction/decoder/DecodedParamsTable.tsx b/src/transaction/decoder/DecodedParamsTable.tsx index 6f550f4..636dd67 100644 --- a/src/transaction/decoder/DecodedParamsTable.tsx +++ b/src/transaction/decoder/DecodedParamsTable.tsx @@ -28,7 +28,9 @@ const DecodedParamsTable: React.FC = ({ {!hasParamNames && ( - Parameter names are not available. + {paramTypes.length > 0 && paramTypes[0].name !== null + ? "Parameter names are estimated." + : "Parameter names are not available."} )} diff --git a/src/use4Bytes.ts b/src/use4Bytes.ts index 622f327..9fe9252 100644 --- a/src/use4Bytes.ts +++ b/src/use4Bytes.ts @@ -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(); @@ -68,8 +66,7 @@ export const use4Bytes = ( const entry: FourBytesEntry = { name: method, - signatureWithoutParamNames: sig, - signatures: undefined, + signature: sig, }; setEntry(entry); fullCache.set(fourBytes, entry);