Add contract creation display on transaction details page
This commit is contained in:
parent
a5fc5e595e
commit
dcc121ccc2
|
@ -88,6 +88,7 @@ const Transaction: React.FC = () => {
|
||||||
miner: _block.miner,
|
miner: _block.miner,
|
||||||
from: _receipt.from,
|
from: _receipt.from,
|
||||||
to: _receipt.to,
|
to: _receipt.to,
|
||||||
|
createdContractAddress: _receipt.contractAddress,
|
||||||
value: _response.value,
|
value: _response.value,
|
||||||
tokenTransfers,
|
tokenTransfers,
|
||||||
tokenMetas,
|
tokenMetas,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import {
|
import {
|
||||||
|
faStar,
|
||||||
faMoneyBillAlt,
|
faMoneyBillAlt,
|
||||||
faBurn,
|
faBurn,
|
||||||
faCoins,
|
faCoins,
|
||||||
|
@ -15,6 +16,7 @@ type DecoratedAddressLinkProps = {
|
||||||
selectedAddress?: string;
|
selectedAddress?: string;
|
||||||
text?: string;
|
text?: string;
|
||||||
addressCtx?: AddressContext;
|
addressCtx?: AddressContext;
|
||||||
|
creation?: boolean;
|
||||||
miner?: boolean;
|
miner?: boolean;
|
||||||
selfDestruct?: boolean;
|
selfDestruct?: boolean;
|
||||||
txFrom?: boolean;
|
txFrom?: boolean;
|
||||||
|
@ -28,6 +30,7 @@ const DecoratedAddresssLink: React.FC<DecoratedAddressLinkProps> = ({
|
||||||
selectedAddress,
|
selectedAddress,
|
||||||
text,
|
text,
|
||||||
addressCtx,
|
addressCtx,
|
||||||
|
creation,
|
||||||
miner,
|
miner,
|
||||||
selfDestruct,
|
selfDestruct,
|
||||||
txFrom,
|
txFrom,
|
||||||
|
@ -45,6 +48,11 @@ const DecoratedAddresssLink: React.FC<DecoratedAddressLinkProps> = ({
|
||||||
burn ? "line-through text-orange-500 hover:text-orange-700" : ""
|
burn ? "line-through text-orange-500 hover:text-orange-700" : ""
|
||||||
} ${selfDestruct ? "line-through opacity-70 hover:opacity-100" : ""}`}
|
} ${selfDestruct ? "line-through opacity-70 hover:opacity-100" : ""}`}
|
||||||
>
|
>
|
||||||
|
{creation && (
|
||||||
|
<span className="text-yellow-300" title="Contract creation">
|
||||||
|
<FontAwesomeIcon icon={faStar} size="1x" />
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
{mint && (
|
{mint && (
|
||||||
<span className="text-green-500" title="Mint address">
|
<span className="text-green-500" title="Mint address">
|
||||||
<FontAwesomeIcon icon={faMoneyBillAlt} size="1x" />
|
<FontAwesomeIcon icon={faMoneyBillAlt} size="1x" />
|
||||||
|
|
|
@ -73,17 +73,30 @@ const Details: React.FC<DetailsProps> = ({
|
||||||
<Copy value={txData.from} />
|
<Copy value={txData.from} />
|
||||||
</div>
|
</div>
|
||||||
</InfoRow>
|
</InfoRow>
|
||||||
<InfoRow title="Interacted With (To)">
|
<InfoRow title={txData.to ? "Interacted With (To)" : "Contract Created"}>
|
||||||
<div className="flex items-baseline space-x-2 -ml-1">
|
{txData.to ? (
|
||||||
<AddressHighlighter address={txData.to}>
|
<div className="flex items-baseline space-x-2 -ml-1">
|
||||||
<DecoratedAddressLink
|
<AddressHighlighter address={txData.to}>
|
||||||
address={txData.to}
|
<DecoratedAddressLink
|
||||||
miner={txData.to === txData.miner}
|
address={txData.to}
|
||||||
txTo
|
miner={txData.to === txData.miner}
|
||||||
/>
|
txTo
|
||||||
</AddressHighlighter>
|
/>
|
||||||
<Copy value={txData.to} />
|
</AddressHighlighter>
|
||||||
</div>
|
<Copy value={txData.to} />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="flex items-baseline space-x-2 -ml-1">
|
||||||
|
<AddressHighlighter address={txData.createdContractAddress!}>
|
||||||
|
<DecoratedAddressLink
|
||||||
|
address={txData.createdContractAddress!}
|
||||||
|
creation
|
||||||
|
txTo
|
||||||
|
/>
|
||||||
|
</AddressHighlighter>
|
||||||
|
<Copy value={txData.createdContractAddress!} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{internalTransfers && (
|
{internalTransfers && (
|
||||||
<div className="mt-2 space-y-1">
|
<div className="mt-2 space-y-1">
|
||||||
{internalTransfers.map((t, i) => (
|
{internalTransfers.map((t, i) => (
|
||||||
|
|
|
@ -44,6 +44,7 @@ export type TransactionData = {
|
||||||
miner?: string;
|
miner?: string;
|
||||||
from: string;
|
from: string;
|
||||||
to: string;
|
to: string;
|
||||||
|
createdContractAddress?: string;
|
||||||
value: BigNumber;
|
value: BigNumber;
|
||||||
tokenTransfers: TokenTransfer[];
|
tokenTransfers: TokenTransfer[];
|
||||||
tokenMetas: TokenMetas;
|
tokenMetas: TokenMetas;
|
||||||
|
|
Loading…
Reference in New Issue