diff --git a/components/sc/eventCounter.tsx b/components/sc/eventCounter.tsx index 522edb9..d3e74f2 100644 --- a/components/sc/eventCounter.tsx +++ b/components/sc/eventCounter.tsx @@ -1,4 +1,4 @@ -'use client'; // Add this at the top to make this a Client Component +'use client'; import { useEffect, useState } from 'react'; import { getContract } from '@/lib/ethers'; diff --git a/components/sc/getEventImages.tsx b/components/sc/getEventImages.tsx index b7d70bf..c2303d8 100644 --- a/components/sc/getEventImages.tsx +++ b/components/sc/getEventImages.tsx @@ -1,7 +1,7 @@ 'use client'; import React, { useState } from 'react'; -import { getContract } from '@/lib/ethers'; // Adjust the path to your ethers helper +import { getContract } from '@/lib/ethers'; const GetEventImages = () => { const [eventId, setEventId] = useState(null); diff --git a/components/sc/getEventPriceFlare.tsx b/components/sc/getEventPriceFlare.tsx index 8d6003a..5f6c423 100644 --- a/components/sc/getEventPriceFlare.tsx +++ b/components/sc/getEventPriceFlare.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { ethers } from 'ethers'; -import { getContract } from '@/lib/ethers'; // Adjust the path to your ethers helper +import { getContract } from '@/lib/ethers'; const GetEventPrice = () => { const [eventId, setEventId] = useState(null); diff --git a/components/sc/getEventTickets.tsx b/components/sc/getEventTickets.tsx index dcf4067..15d151b 100644 --- a/components/sc/getEventTickets.tsx +++ b/components/sc/getEventTickets.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { ethers } from 'ethers'; -import { getContract } from '@/lib/ethers'; // Adjust the path to your ethers helper +import { getContract } from '@/lib/ethers'; const GetEventTickets = () => { const [eventId, setEventId] = useState(null); @@ -19,13 +19,8 @@ const GetEventTickets = () => { } try { - // Get the contract instance const contract = getContract(); - - // Fetch tickets for the given event ID const eventTickets = await contract.getEventTickets(eventId); - - // Convert BigNumbers to plain numbers for display setTickets( eventTickets.map((ticket: ethers.BigNumber) => ticket.toNumber()) ); diff --git a/components/sc/getFlareFeed.tsx b/components/sc/getFlareFeed.tsx index da3b935..12ccb41 100644 --- a/components/sc/getFlareFeed.tsx +++ b/components/sc/getFlareFeed.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { ethers } from 'ethers'; -import { getContract } from '@/lib/ethers'; // Adjust the path to your ethers helper +import { getContract } from '@/lib/ethers'; const FlareFeed = () => { const [feedValue, setFeedValue] = useState(null); @@ -13,13 +13,10 @@ const FlareFeed = () => { try { const contract = getContract(); const feedData = await contract.getFlareFeed(); - - // Assuming feedData[0] is BigNumber and needs conversion const _feedValue = ethers.utils.formatEther(feedData[0].toString()); - // feedData[1] and feedData[2] may be regular numbers (int8 and uint64), so no .toNumber() needed - const _decimals = feedData[1]; // No need to convert if it's already an integer - const _timestamp = new Date(feedData[2] * 1000).toLocaleString(); // Convert Unix timestamp to readable format + const _decimals = feedData[1]; + const _timestamp = new Date(feedData[2] * 1000).toLocaleString(); setFeedValue(_feedValue); setDecimals(_decimals);