Add warning for input decoded from 4bytes signatures wuthout param names

This commit is contained in:
Willian Mitsuda 2021-09-25 14:45:12 -03:00
parent b57518ba96
commit e4fa639e69
3 changed files with 12 additions and 3 deletions

View File

@ -25,7 +25,7 @@ const DecodedParamRow: React.FC<DecodedParamRowProps> = ({
<tr className="grid grid-cols-12 gap-x-2 py-2 hover:bg-gray-100">
<td className="col-span-3 pl-1">
{prefix && <span className="text-gray-300">{prefix}</span>}
{paramType.name}{" "}
{paramType.name ?? <span className="italic">param_{i}</span>}{" "}
{i !== undefined && (
<span className="text-gray-400 text-xs">({i})</span>
)}
@ -65,7 +65,8 @@ const DecodedParamRow: React.FC<DecodedParamRowProps> = ({
</tr>
{paramType.baseType === "tuple" &&
r.map((e: any, idx: number) => (
<DecodedParamRow key={idx}
<DecodedParamRow
key={idx}
prefix={paramType.name + "."}
r={e}
paramType={paramType.components[idx]}

View File

@ -7,14 +7,16 @@ type DecodedParamsTableProps = {
args: Result;
paramTypes: ParamType[];
txData: TransactionData;
hasParamNames?: boolean;
};
const DecodedParamsTable: React.FC<DecodedParamsTableProps> = ({
args,
paramTypes,
txData,
hasParamNames = true,
}) => (
<table className="border rounded w-full">
<table className="border w-full">
<thead>
<tr className="grid grid-cols-12 text-left gap-x-2 py-2 bg-gray-100">
<th className="col-span-3 pl-1">
@ -23,6 +25,11 @@ const DecodedParamsTable: React.FC<DecodedParamsTableProps> = ({
<th className="col-span-1">type</th>
<th className="col-span-8 pr-1">value</th>
</tr>
{!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.</th>
</tr>
)}
</thead>
<tbody className="divide-y">
{args.map((r, i) => (

View File

@ -352,6 +352,7 @@ const Details: React.FC<DetailsProps> = ({
args={resolvedTxDesc.args}
paramTypes={resolvedTxDesc.functionFragment.inputs}
txData={txData}
hasParamNames={resolvedTxDesc === txDesc}
/>
)}
</Tab.Panel>