"use client"; import { Address } from "@scaffold-ui/components"; import type { NextPage } from "next"; import { formatEther } from "viem"; import { useScaffoldEventHistory } from "~~/hooks/scaffold-eth"; const Events: NextPage = () => { // BuyTokens Events const { data: buyTokenEvents, isLoading: isBuyEventsLoading } = useScaffoldEventHistory({ contractName: "Vendor", eventName: "BuyTokens", }); // // SellTokens Events // const { data: sellTokenEvents, isLoading: isSellEventsLoading } = useScaffoldEventHistory({ // contractName: "Vendor", // eventName: "SellTokens", // }); return (
{/* BuyTokens Events */}
Buy Token Events
{isBuyEventsLoading ? (
) : (
{!buyTokenEvents || buyTokenEvents.length === 0 ? ( ) : ( buyTokenEvents?.map((event, index) => { return ( ); }) )}
Buyer Amount of Tokens Amount of ETH
No events found
{formatEther(event.args?.amountOfTokens || 0n)} {formatEther(event.args?.amountOfETH || 0n)}
)}
{/* SellTokens Events */} {/*
Sell Token Events
{isSellEventsLoading ? (
) : (
{!sellTokenEvents || sellTokenEvents.length === 0 ? ( ) : ( sellTokenEvents?.map((event, index) => { return ( ); }) )}
Seller Amount of Tokens Amount of ETH
No events found
{formatEther(event.args?.amountOfTokens || 0n)} {formatEther(event.args?.amountOfETH || 0n)}
)}
*/}
); }; export default Events;