Skip to content

Commit

Permalink
added schema
Browse files Browse the repository at this point in the history
  • Loading branch information
gagdiez committed Aug 5, 2024
1 parent 34f4499 commit 99c04f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions contract-ts/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ function simulateCoinFlip(): Side {
class CoinFlip {
points: UnorderedMap<number> = new UnorderedMap<number>("points");

/*
Flip a coin. Pass in the side (heads or tails) and a random number will be chosen
indicating whether the flip was heads or tails. If you got it right, you get a point.
*/
static schema = {
points: { class: UnorderedMap, value: 'number' }
}

@call({})
flip_coin({ player_guess }: { player_guess: Side }): Side {
// Check who called the method
Expand Down Expand Up @@ -50,7 +50,7 @@ class CoinFlip {
// View how many points a specific player has
@view({})
points_of({ player }: { player: AccountId }): number {
const points = this.points.get(player, {defaultValue: 0})
const points = this.points.get(player, { defaultValue: 0 })
near.log(`Points for ${player}: ${points}`)
return points
}
Expand Down

0 comments on commit 99c04f7

Please sign in to comment.