@dorafactory/maci-sdk 0.0.13 → 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.
@@ -1656,6 +1656,7 @@ declare class MACI {
1656
1656
  queryRoundGasStation({ contractAddress }: {
1657
1657
  contractAddress: string;
1658
1658
  }): Promise<boolean>;
1659
+ parseRoundStatus(votingStart: number, votingEnd: number, status: string, currentTime: Date): string;
1659
1660
  requestOracleCertificate({ signer, ecosystem, address, contractAddress, }: {
1660
1661
  signer: OfflineSigner;
1661
1662
  ecosystem: CertificateEcosystem;
package/dist/browser.d.ts CHANGED
@@ -1656,6 +1656,7 @@ declare class MACI {
1656
1656
  queryRoundGasStation({ contractAddress }: {
1657
1657
  contractAddress: string;
1658
1658
  }): Promise<boolean>;
1659
+ parseRoundStatus(votingStart: number, votingEnd: number, status: string, currentTime: Date): string;
1659
1660
  requestOracleCertificate({ signer, ecosystem, address, contractAddress, }: {
1660
1661
  signer: OfflineSigner;
1661
1662
  ecosystem: CertificateEcosystem;
package/dist/browser.js CHANGED
@@ -30111,6 +30111,17 @@ var Circom = class {
30111
30111
  this.chainId = getDefaultParams(network).chainId;
30112
30112
  }
30113
30113
  async signMessage(signer, address, message) {
30114
+ if (typeof window !== "undefined" && window.keplr) {
30115
+ const sig = await window.keplr.signArbitrary(
30116
+ this.chainId,
30117
+ address,
30118
+ message
30119
+ );
30120
+ return {
30121
+ signature: sig.signature,
30122
+ pubkey: sig.pub_key.value
30123
+ };
30124
+ }
30114
30125
  const accounts = await signer.getAccounts();
30115
30126
  const account = accounts.find((acc) => acc.address === address);
30116
30127
  if (!account) {
@@ -30314,6 +30325,28 @@ var MACI = class {
30314
30325
  const roundInfo = await this.getRoundInfo({ contractAddress });
30315
30326
  return roundInfo.gasStationEnable;
30316
30327
  }
30328
+ parseRoundStatus(votingStart, votingEnd, status, currentTime) {
30329
+ const startTime = new Date(votingStart / 10 ** 6);
30330
+ const endTime = new Date(votingEnd / 10 ** 6);
30331
+ if (Number(votingStart) === 0) {
30332
+ return "Created";
30333
+ }
30334
+ if (Number(votingEnd) === 0) {
30335
+ if (startTime < currentTime) {
30336
+ return "Ongoing";
30337
+ }
30338
+ } else {
30339
+ if (startTime < currentTime && currentTime < endTime) {
30340
+ return "Ongoing";
30341
+ }
30342
+ if (currentTime > endTime) {
30343
+ if (status !== "Closed") {
30344
+ return "Tallying";
30345
+ }
30346
+ }
30347
+ }
30348
+ return status;
30349
+ }
30317
30350
  async requestOracleCertificate({
30318
30351
  signer,
30319
30352
  ecosystem,