Skip to content

Commit

Permalink
feat: Add jackpot amount for play
Browse files Browse the repository at this point in the history
  • Loading branch information
Volodymyr-Kuchinskyi committed Jun 3, 2024
1 parent 5d5d77b commit 423b9e1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/public/config.js.local
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const config = {
lottery_app_contract_package_hash: '2987e0d36693cc4547d7623b5e50eec9f3e58623a3832e61d6f2c05a709deaa1',
lottery_app_contract_package_hash: '2fb56551f9015a28d83c16461cd57bbec66a0dfc51b737634ad874888b6cb15d',
lottery_play_payment_amount: '1000000',
lottery_api_url: 'https://cspr-lottery-demo-api.dev.make.services',
lottery_api_ws_url: 'wss://cspr-lottery-demo-api.dev.make.services/deploys',
Expand Down
3 changes: 3 additions & 0 deletions server/src/entity/play.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export class Play {
@Column({ name: 'prize_amount' })
prizeAmount: string;

@Column({ name: 'jackpot_amount' })
jackpotAmount: string;

@Column({ name: 'is_jackpot' })
isJackpot: boolean;

Expand Down
3 changes: 2 additions & 1 deletion server/src/event-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ async function main() {
playId: event.data.data.play_id,
roundId: event.data.data.round_id.toString(),
playerAccountHash: event.data.data.player.replace(/^account-hash-/, ''),
prizeAmount: event.data.data.prize,
prizeAmount: event.data.data.prize_amount,
jackpotAmount: event.data.data.jackpot_amount,
isJackpot: event.data.data.is_jackpot,
deployHash: event.extra.deploy_hash,
timestamp: new Date(event.data.data.timestamp),
Expand Down
3 changes: 2 additions & 1 deletion server/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ export interface PlayEventPayload {
is_jackpot: boolean;
play_id: string;
player: string;
prize: string;
prize_amount: string;
jackpot_amount: string;
round_id: number;
timestamp: number;
}
Expand Down
1 change: 1 addition & 0 deletions server/src/migration/1711623923370-Init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class Init1711623923370 implements MigrationInterface {
play_id bigint(20) UNSIGNED NOT NULL,
player_account_hash varchar(64) NOT NULL,
prize_amount varchar(128) NOT NULL,
jackpot_amount varchar(128) NOT NULL,
is_jackpot bool NOT NULL,
timestamp datetime NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion server/src/migration/1713372155154-CreateRoundsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class CreateRoundsView1713372155154 implements MigrationInterface {
select
p.round_id,
w.plays_num,
p.prize_amount as jackpot_amount,
p.jackpot_amount,
p.player_account_hash as winner_account_hash,
p.timestamp as ended_at
from plays p
Expand Down

0 comments on commit 423b9e1

Please sign in to comment.