Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As API, I provide the possibility to fetch the jackpot round data #23

Open
melpadden opened this issue Mar 25, 2024 · 0 comments
Open
Assignees
Labels

Comments

@melpadden
Copy link
Collaborator

The following endpoint should be added:

GET /rounds/:round_id

That returns the Round entity with the following properties:

  • round_id
  • plays_num
  • jackpot_amount
  • winner_account_hash
  • winner_public_key
  • ended_at

The jackpot data should be calculated over the plays table using a query like the following one which should be provided as getRound(id) function in the Round repository:

select 
    p.round_id, 
    w.plays_num, 
    p.prize_amount as jackpot_amount, 
    p.player_account_hash as winner_account_hash, 
    p.timestamp as ended_at 
from plays p
join (
    select max(play_id) as play_id, count(*) as plays_num
    from plays 
    where round_id = :round_id
    group by round_id
) w on w.play_id = p.play_id
order by p.round_id desc;

The winner_public_key should be deanonimized from the winner_account_hash in the API handler using CSPR.cloud Account API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants