Skip to content

Commit

Permalink
provide feedback on guess
Browse files Browse the repository at this point in the history
  • Loading branch information
otherview committed Oct 27, 2023
1 parent 05cb3e8 commit ae40014
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion guessing-game-v2/src/assets/contract/address.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"address": "0xdF269A1451Ede9f970bE9a8803e44d2942242D7E"}
{"address": "0x1FA7e9455ecc968350525332da39be3b7Ad1cD2b"}
5 changes: 5 additions & 0 deletions guessing-game-v2/src/lib/web3service.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export default class Web3Service {
const submitTx = await this.contract.guess(guessValue, { value: guessFee });
const receipt = await submitTx.wait();
messageStore.addMessage("Guess tx: "+receipt.transactionHash);
if (receipt.events[0].args.success) {
messageStore.addMessage(`[GuessingGame Contract] ${guessValue} was the right answer ! You won!`);
} else {
messageStore.addMessage(`[GuessingGame Contract] ${guessValue} was not the right answer. Try again...`);
}
} catch (e) {
if (e.reason) {
messageStore.addMessage("Failed to issue Guess - " + e.reason + " ...");
Expand Down

0 comments on commit ae40014

Please sign in to comment.