UNPKG

@q-dev/gdk-sdk

Version:

Typescript Library to interact with GDK Contracts

122 lines 5.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DAOVotingInstance = void 0; const SystemContractInstance_1 = require("../SystemContractInstance"); const types_1 = require("../../types"); class DAOVotingInstance extends SystemContractInstance_1.SystemContractInstance { constructor(signer, address) { super(signer, "ExtendedDAOVoting.json", address); } async createProposal(situation, remark, callData, txOptions) { return this.submitTransaction("createProposal", [situation, remark, callData], txOptions); } async voteFor(proposalId, txOptions) { return this.submitTransaction("voteFor", [proposalId], txOptions); } async voteAgainst(proposalId, txOptions) { return this.submitTransaction("voteAgainst", [proposalId], txOptions); } /** * Note: This method will throw an error if invoked on data from an older contract version, * prior to the introduction of external link support. */ async voteByExpertFor(proposalId, txOptions) { return this.submitTransaction("voteByExpertFor", [proposalId], txOptions); } /** * Note: This method will throw an error if invoked on data from an older contract version, * prior to the introduction of external link support. */ async voteByExpertAgainst(proposalId, txOptions) { return this.submitTransaction("voteByExpertAgainst", [proposalId], txOptions); } /** * Note: This method will throw an error if invoked on data from an older contract version, * prior to the introduction of external link support. */ async appealByUser(proposalId, txOptions) { return this.submitTransaction("appealByUser", [proposalId], txOptions); } async veto(proposalId, txOptions) { return this.submitTransaction("veto", [proposalId], txOptions); } async executeProposal(proposalId, txOptions) { return this.submitTransaction("executeProposal", [proposalId], txOptions); } async executeProposalWithSignature(proposalId, signature, txOptions) { return this.submitTransaction("executeProposalWithSignature", [proposalId, signature], txOptions); } async getProposalStatus(proposalId) { return this.instance.getProposalStatus(proposalId); } async getProposalList(offset, limit) { return this.instance.getProposalList(offset, limit); } async getProposal(proposalId) { return this.instance.getProposal(proposalId); } async getProposalVotingStats(proposalId) { return this.instance.getProposalVotingStats(proposalId); } /** * Note: This method will throw an error if invoked on data from an older contract version, * prior to the introduction of external link support. */ async getExtendedVotingStats(proposalId) { return this.instance.getExtendedVotingStats(proposalId); } /** * Note: This method will throw an error if invoked on data from an older contract version, * prior to the introduction of external link support. */ async isAppealConfigured(proposalId) { return this.instance.isAppealConfigured(proposalId); } /** * Note: This method will throw an error if invoked on data from an older contract version, * prior to the introduction of external link support. */ async isVoteByExpertConfigured(proposalId) { return this.instance.isVoteByExpertConfigured(proposalId); } async getVotingSituations() { const situationNames = await this.instance.getVotingSituations(); const internalSituationNames = Object.values(types_1.DefaultVotingSituations); return Promise.all(situationNames.map(async (situationName) => { let externalLink = ""; try { externalLink = await this.instance.getVotingSituationExternalLink(situationName); } catch (e) { console.error(`Failed to get external link for voting situation ${situationName}\n ${e}`); } return { name: situationName, isExternal: !internalSituationNames.includes(situationName), externalLink: externalLink, }; })); } async getBasicVotingSituationInfo(situationName) { return this.instance.getVotingSituationInfo(situationName); } /** * Note: This method will throw an error if invoked on data from an older contract version, * prior to the introduction of external link support. */ async proposalSituationLink(proposalId) { return this.instance.proposalSituationLink(proposalId); } /** * Retrieves a list of situation links for proposals. * This method is closely aligned with the getProposalList method. * * Note: This method will throw an error if invoked on data from an older contract version, * prior to the introduction of external link support. */ async getProposalSituationLinkList(offset, limit) { return this.instance.getProposalSituationLinkList(offset, limit); } } exports.DAOVotingInstance = DAOVotingInstance; //# sourceMappingURL=DAOVotingInstance.js.map