2021-07-05 03:03:01 +00:00
|
|
|
import React from "react";
|
2021-08-08 22:49:45 +00:00
|
|
|
import { formatEther } from "@ethersproject/units";
|
2021-07-05 03:03:01 +00:00
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
2021-08-08 06:51:21 +00:00
|
|
|
import { faAngleRight } from "@fortawesome/free-solid-svg-icons/faAngleRight";
|
2021-07-14 07:43:58 +00:00
|
|
|
import AddressHighlighter from "./AddressHighlighter";
|
2021-07-19 03:38:38 +00:00
|
|
|
import DecoratedAddressLink from "./DecoratedAddressLink";
|
2021-07-21 19:06:51 +00:00
|
|
|
import { TransactionData, InternalOperation } from "../types";
|
2021-07-05 03:03:01 +00:00
|
|
|
|
|
|
|
type InternalTransferProps = {
|
|
|
|
txData: TransactionData;
|
2021-07-21 19:06:51 +00:00
|
|
|
internalOp: InternalOperation;
|
2021-07-05 03:03:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const InternalTransfer: React.FC<InternalTransferProps> = ({
|
|
|
|
txData,
|
2021-07-21 19:06:51 +00:00
|
|
|
internalOp,
|
2021-07-05 03:03:01 +00:00
|
|
|
}) => {
|
|
|
|
const fromMiner =
|
2021-07-21 19:06:51 +00:00
|
|
|
txData.miner !== undefined && internalOp.from === txData.miner;
|
|
|
|
const toMiner = txData.miner !== undefined && internalOp.to === txData.miner;
|
2021-07-05 03:03:01 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="flex items-baseline space-x-1 text-xs">
|
|
|
|
<span className="text-gray-500">
|
|
|
|
<FontAwesomeIcon icon={faAngleRight} size="1x" /> TRANSFER
|
|
|
|
</span>
|
2021-08-08 22:49:45 +00:00
|
|
|
<span>{formatEther(internalOp.value)} Ether</span>
|
2021-07-14 18:35:53 +00:00
|
|
|
<div className="flex items-baseline">
|
|
|
|
<span className="text-gray-500">From</span>
|
2021-07-21 19:06:51 +00:00
|
|
|
<AddressHighlighter address={internalOp.from}>
|
2021-07-14 18:35:53 +00:00
|
|
|
<div
|
|
|
|
className={`flex items-baseline space-x-1 ${
|
|
|
|
fromMiner ? "rounded px-2 py-1 bg-yellow-100" : ""
|
|
|
|
}`}
|
|
|
|
>
|
2021-07-19 16:29:49 +00:00
|
|
|
<DecoratedAddressLink
|
2021-07-21 19:06:51 +00:00
|
|
|
address={internalOp.from}
|
2021-07-19 16:29:49 +00:00
|
|
|
miner={fromMiner}
|
2021-07-21 19:06:51 +00:00
|
|
|
txFrom={internalOp.from === txData.from}
|
|
|
|
txTo={internalOp.from === txData.to}
|
2021-07-19 16:29:49 +00:00
|
|
|
/>
|
2021-07-14 18:35:53 +00:00
|
|
|
</div>
|
|
|
|
</AddressHighlighter>
|
|
|
|
</div>
|
|
|
|
<div className="flex items-baseline">
|
|
|
|
<span className="text-gray-500">To</span>
|
2021-07-21 19:06:51 +00:00
|
|
|
<AddressHighlighter address={internalOp.to}>
|
2021-07-14 18:35:53 +00:00
|
|
|
<div
|
|
|
|
className={`flex items-baseline space-x-1 ${
|
|
|
|
toMiner ? "rounded px-2 py-1 bg-yellow-100" : ""
|
|
|
|
}`}
|
|
|
|
>
|
2021-07-19 16:29:49 +00:00
|
|
|
<DecoratedAddressLink
|
2021-07-21 19:06:51 +00:00
|
|
|
address={internalOp.to}
|
2021-07-19 16:29:49 +00:00
|
|
|
miner={toMiner}
|
2021-07-21 19:06:51 +00:00
|
|
|
txFrom={internalOp.to === txData.from}
|
|
|
|
txTo={internalOp.to === txData.to}
|
2021-07-19 16:29:49 +00:00
|
|
|
/>
|
2021-07-14 18:35:53 +00:00
|
|
|
</div>
|
|
|
|
</AddressHighlighter>
|
|
|
|
</div>
|
2021-07-05 03:03:01 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default React.memo(InternalTransfer);
|