@ardier16/q-js-sdk
Version:
Typescript Library to interact with Q System Contracts
69 lines • 3.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GeneralUpdateVotingInstance = void 0;
const QthVotingHelperInstance_1 = require("../QthVotingHelperInstance");
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(web3, address) {
super(web3, GeneralUpdateVotingInstance.abi, address);
this.qthVotingHelper = new QthVotingHelperInstance_1.QthVotingHelperInstance(web3, GeneralUpdateVotingInstance.abi, address);
}
/**
* [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#proposalcount)
*/
async proposalCount() {
return this.instance.methods.proposalCount().call();
}
/**
* [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#hasrootvetoed)
*/
async hasRootVetoed(proposalId, address) {
return this.instance.methods.hasRootVetoed(proposalId, address).call();
}
/**
* [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#hasuservoted)
*/
async hasUserVoted(proposalId, address) {
return this.instance.methods.hasUserVoted(proposalId, address).call();
}
/**
* [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#createproposal)
*/
async createProposal(remark, txOptions) {
return this.submitTransaction(this.instance.methods.createProposal(remark), txOptions);
}
/**
* [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#getvotesfor)
*/
async getVotesFor(proposalId) {
return this.instance.methods.getVotesFor(proposalId).call();
}
/**
* [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#getvotesagainst)
*/
async getVotesAgainst(proposalId) {
return this.instance.methods.getVotesAgainst(proposalId).call();
}
/**
* [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#proposals)
*/
async getProposal(proposalId) {
const proposal = await this.instance.methods.proposals(proposalId).call();
return { base: proposal };
}
/**
* [External documentation](@system-contracts-repo/@network/GeneralUpdateVoting/#getvotingweightinfo)
*/
async getVotingWeightInfo(proposalId, address) {
return await this.qthVotingHelper.getVotingWeightInfo(this.votingWeightProxy, proposalId, address, this.hasUserVoted);
}
}
exports.GeneralUpdateVotingInstance = GeneralUpdateVotingInstance;
GeneralUpdateVotingInstance.registryKey = 'governance.generalUpdateVoting';
GeneralUpdateVotingInstance.abi = 'GeneralUpdateVoting.json';
//# sourceMappingURL=GeneralUpdateVotingInstance.js.map