Merge pull request #145 from varasev/fix-123
(Fix) Checking transaction status when voting or finalizing
This commit is contained in:
commit
66a86aac19
|
@ -181,11 +181,16 @@ export class BallotCard extends React.Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.getContract(contractsStore, votingType).vote(id, choice, contractsStore.votingKey)
|
this.getContract(contractsStore, votingType).vote(id, choice, contractsStore.votingKey)
|
||||||
.on("receipt", () => {
|
.on("receipt", (tx) => {
|
||||||
commonStore.hideLoading();
|
commonStore.hideLoading();
|
||||||
|
if (tx.status === true || tx.status === '0x1') {
|
||||||
swal("Congratulations!", messages.VOTED_SUCCESS_MSG, "success").then((result) => {
|
swal("Congratulations!", messages.VOTED_SUCCESS_MSG, "success").then((result) => {
|
||||||
push(`${commonStore.rootPath}`);
|
push(`${commonStore.rootPath}`);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
swal("Warning!", messages.VOTE_FAILED_TX, "warning").then((result) => {
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.on("error", (e) => {
|
.on("error", (e) => {
|
||||||
commonStore.hideLoading();
|
commonStore.hideLoading();
|
||||||
|
@ -225,11 +230,16 @@ export class BallotCard extends React.Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.getContract(contractsStore, votingType).finalize(id, contractsStore.votingKey)
|
this.getContract(contractsStore, votingType).finalize(id, contractsStore.votingKey)
|
||||||
.on("receipt", () => {
|
.on("receipt", (tx) => {
|
||||||
commonStore.hideLoading();
|
commonStore.hideLoading();
|
||||||
|
if (tx.status === true || tx.status === '0x1') {
|
||||||
swal("Congratulations!", messages.FINALIZED_SUCCESS_MSG, "success").then((result) => {
|
swal("Congratulations!", messages.FINALIZED_SUCCESS_MSG, "success").then((result) => {
|
||||||
push(`${commonStore.rootPath}`);
|
push(`${commonStore.rootPath}`);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
swal("Warning!", messages.FINALIZE_FAILED_TX, "warning").then((result) => {
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.on("error", (e) => {
|
.on("error", (e) => {
|
||||||
commonStore.hideLoading();
|
commonStore.hideLoading();
|
||||||
|
|
|
@ -231,7 +231,7 @@ export class NewBallot extends React.Component {
|
||||||
push(`${commonStore.rootPath}`);
|
push(`${commonStore.rootPath}`);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
swal("Warning!", messages.FAILED_TX, "warning").then((result) => {
|
swal("Warning!", messages.BALLOT_CREATE_FAILED_TX, "warning").then((result) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -30,8 +30,12 @@ messages.SHOULD_BE_MORE_THAN_MIN_DURATION = (minDuration, duration, neededHours,
|
||||||
messages.SHOULD_BE_LESS_OR_EQUAL_14_DAYS = (duration) => {
|
messages.SHOULD_BE_LESS_OR_EQUAL_14_DAYS = (duration) => {
|
||||||
return `Ballot end time should not be more than 14 days from now in UTC time. Current duration is ${duration} hours.`;
|
return `Ballot end time should not be more than 14 days from now in UTC time. Current duration is ${duration} hours.`;
|
||||||
}
|
}
|
||||||
messages.FAILED_TX = `Your transaction was failed. Please make sure you set correct parameters for ballot creation.
|
messages.BALLOT_CREATE_FAILED_TX = `Your transaction was failed. Please make sure you set correct parameters for ballot creation.
|
||||||
Make sure you don't have Transaction Error. Exception thrown in contract code message in metamask before you sign it.`
|
Make sure you don't have Transaction Error. Exception thrown in contract code message in metamask before you sign it.`
|
||||||
|
messages.VOTE_FAILED_TX = `Your transaction was failed. Please make sure you haven't already voted for this ballot.
|
||||||
|
Make sure you don't have Transaction Error. Exception thrown in contract code message in metamask before you sign it.`
|
||||||
|
messages.FINALIZE_FAILED_TX = `Your transaction was failed. Make sure you don't have Transaction Error.
|
||||||
|
Exception thrown in contract code message in metamask before you sign it.`
|
||||||
messages.DESCRIPTION_IS_EMPTY = "Description cannot be empty";
|
messages.DESCRIPTION_IS_EMPTY = "Description cannot be empty";
|
||||||
messages.wrongRepo = (repo) => {
|
messages.wrongRepo = (repo) => {
|
||||||
return `There is no contracts.json in configured repo ${repo}`;
|
return `There is no contracts.json in configured repo ${repo}`;
|
||||||
|
|
Loading…
Reference in New Issue