From dcc121ccc2599458bd1fbc3bf072d983a719109f Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 21 Jul 2021 01:23:44 -0300 Subject: [PATCH] Add contract creation display on transaction details page --- src/Transaction.tsx | 1 + src/components/DecoratedAddressLink.tsx | 8 ++++++ src/transaction/Details.tsx | 35 +++++++++++++++++-------- src/types.ts | 1 + 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/Transaction.tsx b/src/Transaction.tsx index ce564f9..d46f501 100644 --- a/src/Transaction.tsx +++ b/src/Transaction.tsx @@ -88,6 +88,7 @@ const Transaction: React.FC = () => { miner: _block.miner, from: _receipt.from, to: _receipt.to, + createdContractAddress: _receipt.contractAddress, value: _response.value, tokenTransfers, tokenMetas, diff --git a/src/components/DecoratedAddressLink.tsx b/src/components/DecoratedAddressLink.tsx index 6d58bf5..e39715c 100644 --- a/src/components/DecoratedAddressLink.tsx +++ b/src/components/DecoratedAddressLink.tsx @@ -1,6 +1,7 @@ import React from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { + faStar, faMoneyBillAlt, faBurn, faCoins, @@ -15,6 +16,7 @@ type DecoratedAddressLinkProps = { selectedAddress?: string; text?: string; addressCtx?: AddressContext; + creation?: boolean; miner?: boolean; selfDestruct?: boolean; txFrom?: boolean; @@ -28,6 +30,7 @@ const DecoratedAddresssLink: React.FC = ({ selectedAddress, text, addressCtx, + creation, miner, selfDestruct, txFrom, @@ -45,6 +48,11 @@ const DecoratedAddresssLink: React.FC = ({ burn ? "line-through text-orange-500 hover:text-orange-700" : "" } ${selfDestruct ? "line-through opacity-70 hover:opacity-100" : ""}`} > + {creation && ( + + + + )} {mint && ( diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 7d18098..7130f45 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -73,17 +73,30 @@ const Details: React.FC = ({ - -
- - - - -
+ + {txData.to ? ( +
+ + + + +
+ ) : ( +
+ + + + +
+ )} {internalTransfers && (
{internalTransfers.map((t, i) => ( diff --git a/src/types.ts b/src/types.ts index 29cc6bc..5b7dbc1 100644 --- a/src/types.ts +++ b/src/types.ts @@ -44,6 +44,7 @@ export type TransactionData = { miner?: string; from: string; to: string; + createdContractAddress?: string; value: BigNumber; tokenTransfers: TokenTransfer[]; tokenMetas: TokenMetas;