@dorafactory/maci-sdk 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4493,6 +4493,28 @@ var MACI = class {
4493
4493
  const roundInfo = await this.getRoundInfo({ contractAddress });
4494
4494
  return roundInfo.gasStationEnable;
4495
4495
  }
4496
+ parseRoundStatus(votingStart, votingEnd, status, currentTime) {
4497
+ const startTime = new Date(votingStart / 10 ** 6);
4498
+ const endTime = new Date(votingEnd / 10 ** 6);
4499
+ if (Number(votingStart) === 0) {
4500
+ return "Created";
4501
+ }
4502
+ if (Number(votingEnd) === 0) {
4503
+ if (startTime < currentTime) {
4504
+ return "Ongoing";
4505
+ }
4506
+ } else {
4507
+ if (startTime < currentTime && currentTime < endTime) {
4508
+ return "Ongoing";
4509
+ }
4510
+ if (currentTime > endTime) {
4511
+ if (status !== "Closed") {
4512
+ return "Tallying";
4513
+ }
4514
+ }
4515
+ }
4516
+ return status;
4517
+ }
4496
4518
  async requestOracleCertificate({
4497
4519
  signer,
4498
4520
  ecosystem,