mirror of
https://github.com/0xShay/ticketchain.git
synced 2026-01-11 13:13:25 +00:00
remove comments
This commit is contained in:
@@ -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 { useEffect, useState } from 'react';
|
||||||
import { getContract } from '@/lib/ethers';
|
import { getContract } from '@/lib/ethers';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React, { useState } from 'react';
|
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 GetEventImages = () => {
|
||||||
const [eventId, setEventId] = useState<number | null>(null);
|
const [eventId, setEventId] = useState<number | null>(null);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { ethers } from 'ethers';
|
import { ethers } from 'ethers';
|
||||||
import { getContract } from '@/lib/ethers'; // Adjust the path to your ethers helper
|
import { getContract } from '@/lib/ethers';
|
||||||
|
|
||||||
const GetEventPrice = () => {
|
const GetEventPrice = () => {
|
||||||
const [eventId, setEventId] = useState<number | null>(null);
|
const [eventId, setEventId] = useState<number | null>(null);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { ethers } from 'ethers';
|
import { ethers } from 'ethers';
|
||||||
import { getContract } from '@/lib/ethers'; // Adjust the path to your ethers helper
|
import { getContract } from '@/lib/ethers';
|
||||||
|
|
||||||
const GetEventTickets = () => {
|
const GetEventTickets = () => {
|
||||||
const [eventId, setEventId] = useState<number | null>(null);
|
const [eventId, setEventId] = useState<number | null>(null);
|
||||||
@@ -19,13 +19,8 @@ const GetEventTickets = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Get the contract instance
|
|
||||||
const contract = getContract();
|
const contract = getContract();
|
||||||
|
|
||||||
// Fetch tickets for the given event ID
|
|
||||||
const eventTickets = await contract.getEventTickets(eventId);
|
const eventTickets = await contract.getEventTickets(eventId);
|
||||||
|
|
||||||
// Convert BigNumbers to plain numbers for display
|
|
||||||
setTickets(
|
setTickets(
|
||||||
eventTickets.map((ticket: ethers.BigNumber) => ticket.toNumber())
|
eventTickets.map((ticket: ethers.BigNumber) => ticket.toNumber())
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { ethers } from 'ethers';
|
import { ethers } from 'ethers';
|
||||||
import { getContract } from '@/lib/ethers'; // Adjust the path to your ethers helper
|
import { getContract } from '@/lib/ethers';
|
||||||
|
|
||||||
const FlareFeed = () => {
|
const FlareFeed = () => {
|
||||||
const [feedValue, setFeedValue] = useState<string | null>(null);
|
const [feedValue, setFeedValue] = useState<string | null>(null);
|
||||||
@@ -13,13 +13,10 @@ const FlareFeed = () => {
|
|||||||
try {
|
try {
|
||||||
const contract = getContract();
|
const contract = getContract();
|
||||||
const feedData = await contract.getFlareFeed();
|
const feedData = await contract.getFlareFeed();
|
||||||
|
|
||||||
// Assuming feedData[0] is BigNumber and needs conversion
|
|
||||||
const _feedValue = ethers.utils.formatEther(feedData[0].toString());
|
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];
|
||||||
const _decimals = feedData[1]; // No need to convert if it's already an integer
|
const _timestamp = new Date(feedData[2] * 1000).toLocaleString();
|
||||||
const _timestamp = new Date(feedData[2] * 1000).toLocaleString(); // Convert Unix timestamp to readable format
|
|
||||||
|
|
||||||
setFeedValue(_feedValue);
|
setFeedValue(_feedValue);
|
||||||
setDecimals(_decimals);
|
setDecimals(_decimals);
|
||||||
|
|||||||
Reference in New Issue
Block a user