/* Copyright 2021 The caver-js Authors This file is part of the caver-js library. The caver-js library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The caver-js library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the caver-js. If not, see . */ import BN = require('bn.js') import BigNumber from 'bignumber.js' import { BlockNumber, ChainConfig, GovernanceItems, StakingInformation, } from '../../caver-core/src' export interface Tally { ApprovalPercentage: number Key: string Value: string | number } export interface MyVote { Key: string Value: string | number | boolean Casted: boolean BlockNum: number } export interface Vote { key: string validator: string value: string | number | boolean } export interface VoteItems { 'governance.governancemode'?: string 'governance.governingnode'?: string 'governance.unitprice'?: number 'governance.addvalidator'?: string 'governance.removevalidator'?: string 'istanbul.epoch'?: number 'istanbul.committeesize'?: number 'istanbul.policy'?: number 'reward.mintingamount'?: string 'reward.ratio'?: string 'reward.useginicoeff'?: boolean 'reward.deferredtxfee'?: boolean 'reward.minimumstake'?: string 'reward.proposerupdateinterval'?: number 'reward.stakingupdateinterval'?: number 'kip71.lowerboundbasefee'?: number 'kip71.upperboundbasefee'?: number 'kip71.gastarget'?: number 'kip71.maxblockgasusedforbasefee'?: number 'kip71.basefeedenominator'?: number } export class Governance { constructor(...args: any[]) vote(key: string, value: string | number | boolean, callback?: (error: Error, result: string) => void): Promise showTally(callback?: (error: Error, result: Tally[]) => void): Promise getTotalVotingPower(callback?: (error: Error, result: number) => void): Promise getMyVotingPower(callback?: (error: Error, result: number) => void): Promise getMyVotes(callback?: (error: Error, result: MyVote[]) => void): Promise getChainConfig(callback?: (error: Error, result: ChainConfig) => void): Promise getChainConfig(blockNumber: BlockNumber, callback?: (error: Error, result: ChainConfig) => void): Promise // TODO-caver getChainConfigAt will be deleted in v1.11.0 getChainConfigAt(callback?: (error: Error, result: ChainConfig) => void): Promise getChainConfigAt(blockNumber: BlockNumber, callback?: (error: Error, result: ChainConfig) => void): Promise getNodeAddress(callback?: (error: Error, result: string) => void): Promise // TODO-caver getItemsAt will be deleted in v1.11.0 getItemsAt(callback?: (error: Error, result: GovernanceItems) => void): Promise getItemsAt(blockNumber: BlockNumber, callback?: (error: Error, result: GovernanceItems) => void): Promise getParams(callback?: (error: Error, result: GovernanceItems) => void): Promise getParams(blockNumber: BlockNumber, callback?: (error: Error, result: GovernanceItems) => void): Promise getStakingInfo(callback?: (error: Error, result: StakingInformation) => void): Promise getStakingInfo(blockNumber: BlockNumber, callback?: (error: Error, result: StakingInformation) => void): Promise getPendingChanges(callback?: (error: Error, result: VoteItems) => void): Promise getVotes(callback?: (error: Error, result: Vote[]) => void): Promise getIdxCache(callback?: (error: Error, result: number[]) => void): Promise getIdxCacheFromDb(callback?: (error: Error, result: number[]) => void): Promise getItemCacheFromDb( blockNumber: number | BN | BigNumber | string, callback?: (error: Error, result: GovernanceItems) => void ): Promise }