import { TransactionHash } from "./TransactionHash"; import { Address } from "@scaffold-ui/components"; import { formatEther } from "viem"; import { hardhat } from "viem/chains"; import { useTargetNetwork } from "~~/hooks/scaffold-eth/useTargetNetwork"; import { TransactionWithFunction } from "~~/utils/scaffold-eth"; import { TransactionsTableProps } from "~~/utils/scaffold-eth/"; export const TransactionsTable = ({ blocks, transactionReceipts }: TransactionsTableProps) => { const { targetNetwork } = useTargetNetwork(); return (
{blocks.map(block => (block.transactions as TransactionWithFunction[]).map(tx => { const receipt = transactionReceipts[tx.hash]; const timeMined = new Date(Number(block.timestamp) * 1000).toLocaleString(); const functionCalled = tx.input.substring(0, 10); return ( ); }), )}
Transaction Hash Function Called Block Number Time Mined From To Value ({targetNetwork.nativeCurrency.symbol})
{tx.functionName === "0x" ? "" : {tx.functionName}} {functionCalled !== "0x" && ( {functionCalled} )} {block.number?.toString()} {timeMined}
{!receipt?.contractAddress ? ( tx.to && (
) ) : (
(Contract Creation)
)}
{formatEther(tx.value)} {targetNetwork.nativeCurrency.symbol}
); };