mirror of
https://github.com/0xShay/ticketchain.git
synced 2026-01-12 05:33:23 +00:00
finished buyTicket and getEventTickets components
This commit is contained in:
@@ -38,10 +38,12 @@ const BuyTicket = () => {
|
|||||||
|
|
||||||
// Handle buying a ticket for the event
|
// Handle buying a ticket for the event
|
||||||
const handleBuyTicket = async () => {
|
const handleBuyTicket = async () => {
|
||||||
if (!eventId) {
|
if (eventId !== null) {
|
||||||
|
if (eventId < 0) {
|
||||||
alert('Please enter a valid Event ID.');
|
alert('Please enter a valid Event ID.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Get the provider and signer
|
// Get the provider and signer
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ contract EventManager {
|
|||||||
ticketCounter++;
|
ticketCounter++;
|
||||||
|
|
||||||
// Update number of tickets sold
|
// Update number of tickets sold
|
||||||
|
events[_eventId].tickets.push(ticketCounter - 1);
|
||||||
events[_eventId].ticketsSold++;
|
events[_eventId].ticketsSold++;
|
||||||
|
|
||||||
// Transfer FLR to event host
|
// Transfer FLR to event host
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ethers } from 'ethers';
|
|||||||
|
|
||||||
const FLARE_TESTNET_RPC_URL = 'https://coston2.enosys.global/ext/C/rpc';
|
const FLARE_TESTNET_RPC_URL = 'https://coston2.enosys.global/ext/C/rpc';
|
||||||
|
|
||||||
const CONTRACT_ADDRESS = '0xA4E90EF8f5846C568515e9120635edb1f2776842';
|
const CONTRACT_ADDRESS = '0xA171873976afaf4b1442c959C2e03b7d52656340';
|
||||||
|
|
||||||
export function getFlareProvider() {
|
export function getFlareProvider() {
|
||||||
const flareRpcUrl = FLARE_TESTNET_RPC_URL;
|
const flareRpcUrl = FLARE_TESTNET_RPC_URL;
|
||||||
|
|||||||
Reference in New Issue
Block a user