Skip to content

Commit

Permalink
fix: claim
Browse files Browse the repository at this point in the history
  • Loading branch information
cgi-bin committed May 9, 2024
1 parent 8bce5a5 commit 75dd7ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/services/bet.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ export class BetService {

async claimMyRound(game: Game): Promise<boolean> {
const curr = await this.getCurrentRound(game);
console.log(curr)
const bets = (await this.getPlayerBets(game))
.filter(b => b.epoch < curr.epoch)
.filter(b => b.epoch < curr.epoch || curr.rewardsComputed)
.filter(b => b.status === BetStatus.NOTCLAIMED)
const tx = await this.wallet.claim(bets, game);
return this.wallet.waitTx(tx);
Expand Down
4 changes: 2 additions & 2 deletions src/services/wallet.connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ export class WalletConnector implements WalletConnector {
});
return res.txId;
} else if (game.type === GameType.MULTIPLE_CHOICE) {
console.log("get bet"+game.contract.id)
console.log(bets.map(b => Number(b.epoch)))
const res = await WithdrawMultipleChoice.execute(this.window, {
initialFields: {
predict: game.contract.id,
epochParticipation: arrayEpochToBytes([0]),
epochParticipation: arrayEpochToBytes(bets.map(b => Number(b.epoch))),
addressToClaim: (await this.getAccount()).address
},
attoAlphAmount: BigInt(2) * DUST_AMOUNT,
Expand Down

0 comments on commit 75dd7ca

Please sign in to comment.