'use client'; import React, { useState } from 'react'; import { ethers } from 'ethers'; import { getContract } from '@/lib/ethers'; // Adjust the path to your ethers helper const GetEventPrice = () => { const [eventId, setEventId] = useState(null); const [priceInFlr, setPriceInFlr] = useState(null); const handleGetPrice = async () => { try { if (eventId === null) return; const contract = getContract(); const flrPrice = await contract.getEventPriceFlare(eventId); // flr price in usd cents e.g. return 36856 meaning 500 usd cents setPriceInFlr(ethers.utils.formatEther(flrPrice.toString())); } catch (error) { console.error('Error fetching event price:', error); } }; return (

Get Event Price in FLR

setEventId(Number(e.target.value))} className="border p-2 mb-2" /> {priceInFlr &&

Event Price in FLR: {priceInFlr}

}
); }; export default GetEventPrice;