Add selection highlighting support to decoded param table values
This commit is contained in:
parent
e37a5b6c02
commit
5216198b06
|
@ -18,6 +18,7 @@ export const genericSelector =
|
||||||
selection.content === content;
|
selection.content === content;
|
||||||
|
|
||||||
export const addressSelector: ContentSelector = genericSelector("address");
|
export const addressSelector: ContentSelector = genericSelector("address");
|
||||||
|
export const valueSelector: ContentSelector = genericSelector("value");
|
||||||
export const functionSigSelector: ContentSelector =
|
export const functionSigSelector: ContentSelector =
|
||||||
genericSelector("functionSig");
|
genericSelector("functionSig");
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,9 @@ import AddressDecoder from "./AddressDecoder";
|
||||||
import BooleanDecoder from "./BooleanDecoder";
|
import BooleanDecoder from "./BooleanDecoder";
|
||||||
import BytesDecoder from "./BytesDecoder";
|
import BytesDecoder from "./BytesDecoder";
|
||||||
import { ResolvedAddresses } from "../../api/address-resolver";
|
import { ResolvedAddresses } from "../../api/address-resolver";
|
||||||
|
import SelectionHighlighter, {
|
||||||
|
valueSelector,
|
||||||
|
} from "../../components/SelectionHighlighter";
|
||||||
|
|
||||||
type DecodedParamRowProps = {
|
type DecodedParamRowProps = {
|
||||||
prefix?: ReactNode;
|
prefix?: ReactNode;
|
||||||
|
@ -68,7 +71,12 @@ const DecodedParamRow: React.FC<DecodedParamRowProps> = ({
|
||||||
{help && showHelp && <div className="mt-2 text-gray-400">{help}</div>}
|
{help && showHelp && <div className="mt-2 text-gray-400">{help}</div>}
|
||||||
</td>
|
</td>
|
||||||
<td className="col-span-1 text-gray-500">{paramType.type}</td>
|
<td className="col-span-1 text-gray-500">{paramType.type}</td>
|
||||||
<td className="col-span-8 pr-1 font-code break-all">
|
<td className="col-span-8 pr-1 font-code break-all flex">
|
||||||
|
<SelectionHighlighter
|
||||||
|
myType="value"
|
||||||
|
myContent={r.toString()}
|
||||||
|
selector={valueSelector}
|
||||||
|
>
|
||||||
{paramType.baseType === "uint256" ? (
|
{paramType.baseType === "uint256" ? (
|
||||||
<Uint256Decoder r={r} />
|
<Uint256Decoder r={r} />
|
||||||
) : paramType.baseType === "address" ? (
|
) : paramType.baseType === "address" ? (
|
||||||
|
@ -86,6 +94,7 @@ const DecodedParamRow: React.FC<DecodedParamRowProps> = ({
|
||||||
) : (
|
) : (
|
||||||
r.toString()
|
r.toString()
|
||||||
)}
|
)}
|
||||||
|
</SelectionHighlighter>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{paramType.baseType === "tuple" &&
|
{paramType.baseType === "tuple" &&
|
||||||
|
|
Loading…
Reference in New Issue