Fix selfdestruct display

This commit is contained in:
Willian Mitsuda 2021-11-22 14:16:33 -03:00
parent e640d11a16
commit 637ff5c9d8
1 changed files with 37 additions and 40 deletions

View File

@ -2,7 +2,6 @@ import React, { useState } from "react";
import { Switch } from "@headlessui/react"; import { Switch } from "@headlessui/react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faBomb } from "@fortawesome/free-solid-svg-icons/faBomb"; import { faBomb } from "@fortawesome/free-solid-svg-icons/faBomb";
import { faArrowRight } from "@fortawesome/free-solid-svg-icons/faArrowRight";
import TransactionAddress from "../components/TransactionAddress"; import TransactionAddress from "../components/TransactionAddress";
import FormattedBalance from "../components/FormattedBalance"; import FormattedBalance from "../components/FormattedBalance";
import FunctionSignature from "./FunctionSignature"; import FunctionSignature from "./FunctionSignature";
@ -48,48 +47,46 @@ const TraceInput: React.FC<TraceInputProps> = ({
> >
<div className="flex items-baseline"> <div className="flex items-baseline">
<span className="text-xs text-gray-400 lowercase">{t.type}</span> <span className="text-xs text-gray-400 lowercase">{t.type}</span>
{t.type === "SELFDESTRUCT" && ( {t.type === "SELFDESTRUCT" ? (
<span className="pl-2 text-red-800" title="Self destruct">
<FontAwesomeIcon icon={faBomb} size="1x" />
</span>
) : (
<> <>
<span className="pl-2 text-red-800" title="Self destruct"> <span>
<FontAwesomeIcon icon={faBomb} size="1x" /> <TransactionAddress
address={t.to}
resolvedAddresses={resolvedAddresses}
/>
</span> </span>
<span className="pl-px pr-2 text-xs text-gray-400 lowercase"> {t.type !== "CREATE" && t.type !== "CREATE2" && (
<FontAwesomeIcon icon={faArrowRight} size="1x" /> <>
</span> <span>.</span>
</> <FunctionSignature callType={t.type} sig={sigText} />
)} {t.value && !t.value.isZero() && (
<span> <span className="text-red-700 whitespace-nowrap">
<TransactionAddress {"{"}value: <FormattedBalance value={t.value} /> ETH{"}"}
address={t.to} </span>
resolvedAddresses={resolvedAddresses} )}
/> <span className="whitespace-nowrap">
</span> (
{t.type !== "CREATE" && t.type !== "CREATE2" && ( {hasParams && (
<> <Switch
<span>.</span> className="text-xs"
<FunctionSignature callType={t.type} sig={sigText} /> checked={expanded}
{t.value && !t.value.isZero() && ( onChange={setExpanded}
<span className="text-red-700 whitespace-nowrap"> >
{"{"}value: <FormattedBalance value={t.value} /> ETH{"}"} {expanded ? (
</span> <span className="text-gray-400">[-]</span>
)} ) : (
<span className="whitespace-nowrap"> <>[...]</>
( )}
{hasParams && ( </Switch>
<Switch
className="text-xs"
checked={expanded}
onChange={setExpanded}
>
{expanded ? (
<span className="text-gray-400">[-]</span>
) : (
<>[...]</>
)} )}
</Switch> {(!hasParams || !expanded) && <>)</>}
)} </span>
{(!hasParams || !expanded) && <>)</>} </>
</span> )}
</> </>
)} )}
</div> </div>