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