Add value field to call tree

This commit is contained in:
Willian Mitsuda 2021-10-27 05:14:46 -03:00
parent 5188cd980e
commit e93c2953ec
2 changed files with 7 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import React from "react"; import React from "react";
import AddressHighlighter from "../components/AddressHighlighter"; import AddressHighlighter from "../components/AddressHighlighter";
import DecoratedAddressLink from "../components/DecoratedAddressLink"; import DecoratedAddressLink from "../components/DecoratedAddressLink";
import FormattedBalance from "../components/FormattedBalance";
import { TransactionData } from "../types"; import { TransactionData } from "../types";
import { rawInputTo4Bytes, use4Bytes } from "../use4Bytes"; import { rawInputTo4Bytes, use4Bytes } from "../use4Bytes";
import { TraceGroup } from "../useErigonHooks"; import { TraceGroup } from "../useErigonHooks";
@ -48,6 +49,11 @@ const TraceItem: React.FC<TraceItemProps> = ({ t, txData, last }) => {
> >
{fourBytesEntry ? fourBytesEntry.name : raw4Bytes} {fourBytesEntry ? fourBytesEntry.name : raw4Bytes}
</span> </span>
{t.value && !t.value.isZero() && (
<span className="text-red-700 whitespace-nowrap">
{"{"}value: <FormattedBalance value={t.value} /> ETH{"}"}
</span>
)}
<span>(</span> <span>(</span>
{t.input.length > 10 && ( {t.input.length > 10 && (
<span className="whitespace-nowrap"> <span className="whitespace-nowrap">

View File

@ -341,6 +341,7 @@ export const useTraceTransaction = (
for (let i = 0; i < results.length; i++) { for (let i = 0; i < results.length; i++) {
results[i].from = provider.formatter.address(results[i].from); results[i].from = provider.formatter.address(results[i].from);
results[i].to = provider.formatter.address(results[i].to); results[i].to = provider.formatter.address(results[i].to);
results[i].value = provider.formatter.bigNumber(results[i].value);
} }
// Build trace tree // Build trace tree