Skip to content

Commit

Permalink
Modifies canBeApproved to check if results are final and fix correspo…
Browse files Browse the repository at this point in the history
…nding

exception during approval
  • Loading branch information
emmdim committed Feb 21, 2024
1 parent fc1e4be commit 6985499
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/js-client/src/internal/modules/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,9 @@ export class GaslessVotingClientMethods
const proposal = await this.getProposal(proposalId);
if (!proposal) return Promise.reject(new InvalidProposalIdError());
if (!proposal.vochain?.tally?.final)
Promise.reject(Error('No results yet'));
return Promise.reject(
new Error('Gasless Proposals results are not yet available')
);

if (proposal.approvers.length == 0) {
return this.setTally(
Expand Down
2 changes: 1 addition & 1 deletion packages/js-client/src/internal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export function toNewProposal(
},
voters,
approvers: proposal.approvers.map((x) => x.id.split('_')[1]),
canBeApproved: hasSucceeded,
canBeApproved: hasSucceeded && vochainProposal.finalResults,
} as GaslessVotingProposal;
}

Expand Down

0 comments on commit 6985499

Please sign in to comment.