@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.d.mts CHANGED
@@ -1657,6 +1657,7 @@ declare class MACI {
1657
1657
  queryRoundGasStation({ contractAddress }: {
1658
1658
  contractAddress: string;
1659
1659
  }): Promise<boolean>;
1660
+ parseRoundStatus(votingStart: number, votingEnd: number, status: string, currentTime: Date): string;
1660
1661
  requestOracleCertificate({ signer, ecosystem, address, contractAddress, }: {
1661
1662
  signer: OfflineSigner;
1662
1663
  ecosystem: CertificateEcosystem;
package/dist/index.d.ts CHANGED
@@ -1657,6 +1657,7 @@ declare class MACI {
1657
1657
  queryRoundGasStation({ contractAddress }: {
1658
1658
  contractAddress: string;
1659
1659
  }): Promise<boolean>;
1660
+ parseRoundStatus(votingStart: number, votingEnd: number, status: string, currentTime: Date): string;
1660
1661
  requestOracleCertificate({ signer, ecosystem, address, contractAddress, }: {
1661
1662
  signer: OfflineSigner;
1662
1663
  ecosystem: CertificateEcosystem;
package/dist/index.js CHANGED
@@ -4549,6 +4549,28 @@ var MACI = class {
4549
4549
  const roundInfo = await this.getRoundInfo({ contractAddress });
4550
4550
  return roundInfo.gasStationEnable;
4551
4551
  }
4552
+ parseRoundStatus(votingStart, votingEnd, status, currentTime) {
4553
+ const startTime = new Date(votingStart / 10 ** 6);
4554
+ const endTime = new Date(votingEnd / 10 ** 6);
4555
+ if (Number(votingStart) === 0) {
4556
+ return "Created";
4557
+ }
4558
+ if (Number(votingEnd) === 0) {
4559
+ if (startTime < currentTime) {
4560
+ return "Ongoing";
4561
+ }
4562
+ } else {
4563
+ if (startTime < currentTime && currentTime < endTime) {
4564
+ return "Ongoing";
4565
+ }
4566
+ if (currentTime > endTime) {
4567
+ if (status !== "Closed") {
4568
+ return "Tallying";
4569
+ }
4570
+ }
4571
+ }
4572
+ return status;
4573
+ }
4552
4574
  async requestOracleCertificate({
4553
4575
  signer,
4554
4576
  ecosystem,