UNPKG

@ardier16/q-js-sdk

Version:

Typescript Library to interact with Q System Contracts

72 lines 3.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VotingWeightProxyInstance = void 0; const SystemContractInstance_1 = require("../SystemContractInstance"); /** * Voting weight proxy instance to interact with Voting weight proxy contract. * See [onchain documentation](@system-contracts-repo/@network/VotingWeightProxy/) for more details. * An instance of this class for a deployed network can be obtained via {@link ContractRegistryInstance.votingWeightProxy} */ class VotingWeightProxyInstance extends SystemContractInstance_1.SystemContractInstance { constructor(web3, address) { super(web3, VotingWeightProxyInstance.abi, address); } /** * [External documentation](@system-contracts-repo/@network/VotingWeightProxy/#announcenewvotingagent) */ async announceNewVotingAgent(newVotingAgentAddr, txOptions) { return this.submitTransaction(this.instance.methods.announceNewVotingAgent(newVotingAgentAddr), txOptions); } /** * [External documentation](@system-contracts-repo/@network/VotingWeightProxy/#setnewvotingagent) */ async setNewVotingAgent(txOptions) { return this.submitTransaction(this.instance.methods.setNewVotingAgent(), txOptions); } /** * [External documentation](@system-contracts-repo/@network/VotingWeightProxy/#getbasevotingweightinfo) */ async getBaseVotingWeightInfo(address, votingEndTime) { const result = await this.instance.methods.getBaseVotingWeightInfo(address, votingEndTime).call(); return { ownWeight: result[0], votingAgent: result[1], delegationStatus: result[2], lockedUntil: result[3] }; } /** * [External documentation](@system-contracts-repo/@network/VotingWeightProxy/#delegationinfos) */ async getDelegationInfo(address) { return this.instance.methods.delegationInfos(address).call(); } /** * [External documentation](@system-contracts-repo/@network/VotingWeightProxy/#getlockedamount) */ async getLockedAmount(address) { return this.instance.methods.getLockedAmount(address).call(); } /** * [External documentation](@system-contracts-repo/@network/VotingWeightProxy/#getlockinfo) */ async getLockInfo(tokenLockSource, who) { const rawLockInfo = await this.instance.methods.getLockInfo(tokenLockSource, who).call(); return { lockedAmount: rawLockInfo[0], lockedUntil: rawLockInfo[1], pendingUnlockAmount: rawLockInfo[2], pendingUnlockTime: rawLockInfo[3] }; } /** * [External documentation](@system-contracts-repo/@network/VotingWeightProxy/#getvotingweight) */ async getVotingWeight(address, votingEndTime) { return this.instance.methods.getVotingWeight(address, votingEndTime).call(); } } exports.VotingWeightProxyInstance = VotingWeightProxyInstance; VotingWeightProxyInstance.registryKey = 'governance.votingWeightProxy'; VotingWeightProxyInstance.abi = 'VotingWeightProxy.json'; //# sourceMappingURL=VotingWeightProxyInstance.js.map