@dorafactory/maci-sdk 0.0.24 → 0.0.26

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.
@@ -1,6 +1,8 @@
1
1
  import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
2
2
  import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
3
3
  import { StdFee, Coin } from '@cosmjs/amino';
4
+ import * as _cosmjs_stargate from '@cosmjs/stargate';
5
+ import * as _cosmjs_stargate_build_logs from '@cosmjs/stargate/build/logs';
4
6
  import { OfflineSigner } from '@cosmjs/proto-signing';
5
7
  export { Scalar, utils } from 'ffjavascript';
6
8
 
@@ -1589,7 +1591,15 @@ declare class Contract {
1589
1591
  feegrantOperator: string;
1590
1592
  whitelistBackendPubkey: string;
1591
1593
  constructor({ rpcEndpoint, registryAddress, maciCodeId, oracleCodeId, feegrantOperator, whitelistBackendPubkey, }: ContractParams);
1592
- createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, maxOption, voiceCreditAmount, circuitType, preDeactivateRoot, }: CreateAMaciRoundParams): Promise<string>;
1594
+ createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, maxOption, voiceCreditAmount, circuitType, preDeactivateRoot, }: CreateAMaciRoundParams): Promise<{
1595
+ contractAddress: string;
1596
+ logs: readonly _cosmjs_stargate_build_logs.Log[];
1597
+ height: number;
1598
+ transactionHash: string;
1599
+ events: readonly _cosmjs_stargate.Event[];
1600
+ gasWanted: bigint;
1601
+ gasUsed: bigint;
1602
+ }>;
1593
1603
  createMaciRound({ signer, operatorPubkey, startVoting, endVoting, whitelist, title, description, link, maxVoter, maxOption, circuitType, certSystemType, }: CreateMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
1594
1604
  createOracleMaciRound({ signer, operatorPubkey, startVoting, endVoting, title, description, link, voteOptionMap, circuitType, whitelistEcosystem, whitelistSnapshotHeight, whitelistVotingPowerArgs, }: CreateOracleMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
1595
1605
  queryRoundInfo({ signer, roundAddress, }: {
@@ -1640,6 +1650,21 @@ type FeegrantAllowanceResponse = {
1640
1650
  amount: string;
1641
1651
  }[];
1642
1652
  };
1653
+ interface SnapshotHeightInfo {
1654
+ lowestHeight: string;
1655
+ latestHeight: string;
1656
+ }
1657
+ interface Ecosystem {
1658
+ name: string;
1659
+ displayName: string;
1660
+ decimals: number;
1661
+ apiPath: string;
1662
+ snapshotHeightInfo: SnapshotHeightInfo;
1663
+ baseSlope: number;
1664
+ }
1665
+ interface EcosystemsResponse {
1666
+ ecosystems: Ecosystem[];
1667
+ }
1643
1668
 
1644
1669
  declare class OracleCertificate {
1645
1670
  private certificateApiEndpoint;
@@ -1647,6 +1672,7 @@ declare class OracleCertificate {
1647
1672
  constructor({ certificateApiEndpoint, http }: OracleCertificateParams);
1648
1673
  sign(data: SignatureRequest): Promise<SignatureResponse>;
1649
1674
  feegrantAllowance(granter: string, grantee: string): Promise<FeegrantAllowanceResponse>;
1675
+ listEcosystems(): Promise<EcosystemsResponse>;
1650
1676
  }
1651
1677
 
1652
1678
  type MixedData<T> = T | Array<MixedData<T>> | {
@@ -1841,6 +1867,7 @@ declare class MACI {
1841
1867
  signer: OfflineSigner;
1842
1868
  contractAddress: string;
1843
1869
  }): Promise<_cosmjs_cosmwasm_stargate.ExecuteResult>;
1870
+ getOracleCertificateConfig(): Promise<EcosystemsResponse>;
1844
1871
  }
1845
1872
 
1846
1873
  declare const circuits: Record<string, CircuitType>;
@@ -2001,7 +2028,15 @@ declare class MaciClient {
2001
2028
  signer: OfflineSigner;
2002
2029
  contractAddress: string;
2003
2030
  }): Promise<AMaciClient>;
2004
- createAMaciRound(params: CreateAMaciRoundParams): Promise<string>;
2031
+ createAMaciRound(params: CreateAMaciRoundParams): Promise<{
2032
+ contractAddress: string;
2033
+ logs: readonly _cosmjs_stargate_build_logs.Log[];
2034
+ height: number;
2035
+ transactionHash: string;
2036
+ events: readonly _cosmjs_stargate.Event[];
2037
+ gasWanted: bigint;
2038
+ gasUsed: bigint;
2039
+ }>;
2005
2040
  createMaciRound(params: CreateMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
2006
2041
  createOracleMaciRound(params: CreateOracleMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
2007
2042
  /**
package/dist/browser.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
2
2
  import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
3
3
  import { StdFee, Coin } from '@cosmjs/amino';
4
+ import * as _cosmjs_stargate from '@cosmjs/stargate';
5
+ import * as _cosmjs_stargate_build_logs from '@cosmjs/stargate/build/logs';
4
6
  import { OfflineSigner } from '@cosmjs/proto-signing';
5
7
  export { Scalar, utils } from 'ffjavascript';
6
8
 
@@ -1589,7 +1591,15 @@ declare class Contract {
1589
1591
  feegrantOperator: string;
1590
1592
  whitelistBackendPubkey: string;
1591
1593
  constructor({ rpcEndpoint, registryAddress, maciCodeId, oracleCodeId, feegrantOperator, whitelistBackendPubkey, }: ContractParams);
1592
- createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, maxOption, voiceCreditAmount, circuitType, preDeactivateRoot, }: CreateAMaciRoundParams): Promise<string>;
1594
+ createAMaciRound({ signer, startVoting, endVoting, operator, whitelist, title, description, link, maxVoter, maxOption, voiceCreditAmount, circuitType, preDeactivateRoot, }: CreateAMaciRoundParams): Promise<{
1595
+ contractAddress: string;
1596
+ logs: readonly _cosmjs_stargate_build_logs.Log[];
1597
+ height: number;
1598
+ transactionHash: string;
1599
+ events: readonly _cosmjs_stargate.Event[];
1600
+ gasWanted: bigint;
1601
+ gasUsed: bigint;
1602
+ }>;
1593
1603
  createMaciRound({ signer, operatorPubkey, startVoting, endVoting, whitelist, title, description, link, maxVoter, maxOption, circuitType, certSystemType, }: CreateMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
1594
1604
  createOracleMaciRound({ signer, operatorPubkey, startVoting, endVoting, title, description, link, voteOptionMap, circuitType, whitelistEcosystem, whitelistSnapshotHeight, whitelistVotingPowerArgs, }: CreateOracleMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
1595
1605
  queryRoundInfo({ signer, roundAddress, }: {
@@ -1640,6 +1650,21 @@ type FeegrantAllowanceResponse = {
1640
1650
  amount: string;
1641
1651
  }[];
1642
1652
  };
1653
+ interface SnapshotHeightInfo {
1654
+ lowestHeight: string;
1655
+ latestHeight: string;
1656
+ }
1657
+ interface Ecosystem {
1658
+ name: string;
1659
+ displayName: string;
1660
+ decimals: number;
1661
+ apiPath: string;
1662
+ snapshotHeightInfo: SnapshotHeightInfo;
1663
+ baseSlope: number;
1664
+ }
1665
+ interface EcosystemsResponse {
1666
+ ecosystems: Ecosystem[];
1667
+ }
1643
1668
 
1644
1669
  declare class OracleCertificate {
1645
1670
  private certificateApiEndpoint;
@@ -1647,6 +1672,7 @@ declare class OracleCertificate {
1647
1672
  constructor({ certificateApiEndpoint, http }: OracleCertificateParams);
1648
1673
  sign(data: SignatureRequest): Promise<SignatureResponse>;
1649
1674
  feegrantAllowance(granter: string, grantee: string): Promise<FeegrantAllowanceResponse>;
1675
+ listEcosystems(): Promise<EcosystemsResponse>;
1650
1676
  }
1651
1677
 
1652
1678
  type MixedData<T> = T | Array<MixedData<T>> | {
@@ -1841,6 +1867,7 @@ declare class MACI {
1841
1867
  signer: OfflineSigner;
1842
1868
  contractAddress: string;
1843
1869
  }): Promise<_cosmjs_cosmwasm_stargate.ExecuteResult>;
1870
+ getOracleCertificateConfig(): Promise<EcosystemsResponse>;
1844
1871
  }
1845
1872
 
1846
1873
  declare const circuits: Record<string, CircuitType>;
@@ -2001,7 +2028,15 @@ declare class MaciClient {
2001
2028
  signer: OfflineSigner;
2002
2029
  contractAddress: string;
2003
2030
  }): Promise<AMaciClient>;
2004
- createAMaciRound(params: CreateAMaciRoundParams): Promise<string>;
2031
+ createAMaciRound(params: CreateAMaciRoundParams): Promise<{
2032
+ contractAddress: string;
2033
+ logs: readonly _cosmjs_stargate_build_logs.Log[];
2034
+ height: number;
2035
+ transactionHash: string;
2036
+ events: readonly _cosmjs_stargate.Event[];
2037
+ gasWanted: bigint;
2038
+ gasUsed: bigint;
2039
+ }>;
2005
2040
  createMaciRound(params: CreateMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
2006
2041
  createOracleMaciRound(params: CreateOracleMaciRoundParams): Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
2007
2042
  /**
package/dist/browser.js CHANGED
@@ -29989,7 +29989,10 @@ var Contract = class {
29989
29989
  }
29990
29990
  }
29991
29991
  });
29992
- return contractAddress;
29992
+ return {
29993
+ ...res,
29994
+ contractAddress
29995
+ };
29993
29996
  }
29994
29997
  async createMaciRound({
29995
29998
  signer,
@@ -30203,6 +30206,19 @@ var OracleCertificate = class {
30203
30206
  spend_limit: response.allowance.allowance.allowance.spend_limit
30204
30207
  };
30205
30208
  }
30209
+ async listEcosystems() {
30210
+ const response = await this.http.fetch(
30211
+ `${this.certificateApiEndpoint}/list`,
30212
+ {
30213
+ method: "GET",
30214
+ headers: {
30215
+ "Content-Type": "application/json"
30216
+ }
30217
+ }
30218
+ );
30219
+ const signatureData = await response.json();
30220
+ return signatureData;
30221
+ }
30206
30222
  };
30207
30223
 
30208
30224
  // src/libs/circom/index.ts
@@ -31000,6 +31016,10 @@ var MACI = class {
31000
31016
  });
31001
31017
  return client.claim();
31002
31018
  }
31019
+ async getOracleCertificateConfig() {
31020
+ const ecosystems = await this.oracleCertificate.listEcosystems();
31021
+ return ecosystems;
31022
+ }
31003
31023
  };
31004
31024
 
31005
31025
  // src/maci.ts