finished buyTicket and getEventTickets components

This commit is contained in:
ayomaska18
2024-10-26 12:13:37 +01:00
parent 7fa7911b88
commit 33392b4610
3 changed files with 7 additions and 4 deletions

View File

@@ -38,10 +38,12 @@ const BuyTicket = () => {
// Handle buying a ticket for the event
const handleBuyTicket = async () => {
if (!eventId) {
if (eventId !== null) {
if (eventId < 0) {
alert('Please enter a valid Event ID.');
return;
}
}
try {
// Get the provider and signer

View File

@@ -129,6 +129,7 @@ contract EventManager {
ticketCounter++;
// Update number of tickets sold
events[_eventId].tickets.push(ticketCounter - 1);
events[_eventId].ticketsSold++;
// Transfer FLR to event host

View File

@@ -2,7 +2,7 @@ import { ethers } from 'ethers';
const FLARE_TESTNET_RPC_URL = 'https://coston2.enosys.global/ext/C/rpc';
const CONTRACT_ADDRESS = '0xA4E90EF8f5846C568515e9120635edb1f2776842';
const CONTRACT_ADDRESS = '0xA171873976afaf4b1442c959C2e03b7d52656340';
export function getFlareProvider() {
const flareRpcUrl = FLARE_TESTNET_RPC_URL;