UNPKG

@q-dev/q-js-sdk

Version:

Typescript Library to interact with Q System Contracts

81 lines 3.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GeneralUpdateVotingInstance = void 0; const SystemVotingVetoableInstance_1 = require("../SystemVotingVetoableInstance"); /** * General update voting instance to interact with General update voting contract. * See [onchain documentation](@system-contracts-repo/@network/GeneralUpdateVoting/) for more details. * An instance of this class for a deployed network can be obtained via {@link ContractRegistryInstance.generalUpdateVoting} */ class GeneralUpdateVotingInstance extends SystemVotingVetoableInstance_1.SystemVotingVetoableInstance { constructor(signerOrProvider, address) { super(signerOrProvider, GeneralUpdateVotingInstance.abi, address); } /** * [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#proposalcount) */ async proposalCount() { return (await this.instance.proposalCount()).toString(); } /** * [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#hasrootvetoed) */ async hasRootVetoed(proposalId, address) { return this.instance.hasRootVetoed(proposalId, address); } /** * [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#hasuservoted) */ async hasUserVoted(proposalId, address) { return this.instance.hasUserVoted(proposalId, address); } /** * [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#createproposal) */ async createProposal(remark, txOptions) { return this.submitTransaction('createProposal', [remark], txOptions); } /** * [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#getvotesfor) */ async getVotesFor(proposalId) { return (await this.instance.getVotesFor(proposalId)).toString(); } /** * [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#getvotesagainst) */ async getVotesAgainst(proposalId) { return (await this.instance.getVotesAgainst(proposalId)).toString(); } /** * [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#proposals) */ async getProposal(proposalId) { const proposal = await this.instance.proposals(proposalId); return { base: { remark: proposal.remark, executed: proposal.executed, params: { votingStartTime: proposal.params.votingStartTime.toString(), votingEndTime: proposal.params.votingEndTime.toString(), vetoEndTime: proposal.params.vetoEndTime.toString(), proposalExecutionP: proposal.params.proposalExecutionP.toString(), requiredQuorum: proposal.params.requiredQuorum.toString(), requiredMajority: proposal.params.requiredMajority.toString(), requiredSMajority: proposal.params.requiredSMajority.toString(), requiredSQuorum: proposal.params.requiredSQuorum.toString(), }, counters: { weightFor: proposal.counters.weightFor.toString(), weightAgainst: proposal.counters.weightAgainst.toString(), vetosCount: proposal.counters.vetosCount.toString(), }, }, }; } } exports.GeneralUpdateVotingInstance = GeneralUpdateVotingInstance; GeneralUpdateVotingInstance.registryKey = 'governance.generalUpdateVoting'; GeneralUpdateVotingInstance.abi = 'GeneralUpdateVoting.json'; //# sourceMappingURL=GeneralUpdateVotingInstance.js.map