2021-07-05 03:03:01 +00:00
|
|
|
import React from "react";
|
|
|
|
import { ethers } from "ethers";
|
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { faAngleRight, faCoins } from "@fortawesome/free-solid-svg-icons";
|
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-05 03:03:01 +00:00
|
|
|
import { TransactionData, Transfer } from "../types";
|
|
|
|
|
|
|
|
type InternalTransferProps = {
|
|
|
|
txData: TransactionData;
|
|
|
|
transfer: Transfer;
|
|
|
|
};
|
|
|
|
|
|
|
|
const InternalTransfer: React.FC<InternalTransferProps> = ({
|
|
|
|
txData,
|
|
|
|
transfer,
|
|
|
|
}) => {
|
|
|
|
const fromMiner =
|
|
|
|
txData.miner !== undefined && transfer.from === txData.miner;
|
|
|
|
const toMiner = txData.miner !== undefined && transfer.to === txData.miner;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="flex items-baseline space-x-1 text-xs">
|
|
|
|
<span className="text-gray-500">
|
|
|
|
<FontAwesomeIcon icon={faAngleRight} size="1x" /> TRANSFER
|
|
|
|
</span>
|
|
|
|
<span>{ethers.utils.formatEther(transfer.value)} Ether</span>
|
2021-07-14 18:35:53 +00:00
|
|
|
<div className="flex items-baseline">
|
|
|
|
<span className="text-gray-500">From</span>
|
|
|
|
<AddressHighlighter address={transfer.from}>
|
|
|
|
<div
|
|
|
|
className={`flex items-baseline space-x-1 ${
|
|
|
|
fromMiner ? "rounded px-2 py-1 bg-yellow-100" : ""
|
|
|
|
}`}
|
|
|
|
>
|
|
|
|
{fromMiner && (
|
|
|
|
<span className="text-yellow-400" title="Miner address">
|
|
|
|
<FontAwesomeIcon icon={faCoins} size="1x" />
|
|
|
|
</span>
|
|
|
|
)}
|
2021-07-19 03:38:38 +00:00
|
|
|
<DecoratedAddressLink address={transfer.from} />
|
2021-07-14 18:35:53 +00:00
|
|
|
</div>
|
|
|
|
</AddressHighlighter>
|
|
|
|
</div>
|
|
|
|
<div className="flex items-baseline">
|
|
|
|
<span className="text-gray-500">To</span>
|
|
|
|
<AddressHighlighter address={transfer.to}>
|
|
|
|
<div
|
|
|
|
className={`flex items-baseline space-x-1 ${
|
|
|
|
toMiner ? "rounded px-2 py-1 bg-yellow-100" : ""
|
|
|
|
}`}
|
|
|
|
>
|
|
|
|
{toMiner && (
|
|
|
|
<span className="text-yellow-400" title="Miner address">
|
|
|
|
<FontAwesomeIcon icon={faCoins} size="1x" />
|
|
|
|
</span>
|
|
|
|
)}
|
2021-07-19 03:38:38 +00:00
|
|
|
<DecoratedAddressLink address={transfer.to} />
|
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);
|