get participent address
This commit is contained in:
17
index.js
17
index.js
@@ -74,8 +74,8 @@ const erc1155Abi = [
|
||||
"function ticketPrice() view returns (uint256)",
|
||||
"function startTournament(uint256 tournament_id) public",
|
||||
"function getUserTickets(address user) public view returns (uint256[] memory)",
|
||||
"function getTournamentParticipentsCount(uint256 tournamentId) public view returns(uint256)"
|
||||
|
||||
"function getTournamentParticipentsCount(uint256 tournamentId) public view returns(uint256)",
|
||||
"function getTournamentParticipants(uint256 tournamentId) public view returns(address[] memory)"
|
||||
];
|
||||
const contract = new ethers.Contract(ercContractAddress, erc1155Abi, utilWallet);
|
||||
|
||||
@@ -179,6 +179,19 @@ app.get("/getTournamentParticipentsCount", async(request,response)=>{
|
||||
try{
|
||||
const tx = await contract.getTournamentParticipentsCount(id);
|
||||
response.json({ count: tx.toString() });
|
||||
}catch(err){
|
||||
console.error("Error reading participents count for tourney:", err);
|
||||
response.status(500).json({ error: err.message });
|
||||
}
|
||||
})
|
||||
|
||||
app.get("/getTournamentParticipants", async(request,response)=>{
|
||||
const {id} = request.query;
|
||||
if(!id){response.status(400).json({error:"id is required"})}
|
||||
|
||||
try{
|
||||
const tx = await contract.getTournamentParticipants(id);
|
||||
response.json({ count: tx.toString() });
|
||||
}catch(err){
|
||||
console.error("Error reading participents for tourney:", err);
|
||||
response.status(500).json({ error: err.message });
|
||||
|
||||
Reference in New Issue
Block a user