import { PeerPoolItem, PeerAttributes, StakeInfo } from './../api/types'; import { GovernanceApi } from '../api/governance'; import { Rpc } from '../rpc/rpc'; export class GovernanceApiImp implements GovernanceApi { private rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; } registerCandidate(args: { peerPubKey: string, amount: string, gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.registerCandidate', args); } addInitPos(args: { peerPubKey: string, amount: string, gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.addInitPos', args); } reduceInitPos(args: { peerPubKey: string, amount: string, gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.reduceInitPos', args); } stakePeers(args: { peerPubKeys: string[], amounts: string[], gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.stakePeers', args); } redeemPeers(args: { peerPubKeys: string[], amounts: string[], gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.redeemPeers', args); } withdrawFeeReward(args: { gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.withdrawFeeReward', args); } withdrawUnfrozenOnt(args: { peerPubKeys: string[], amounts: string[], gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.withdrawUnfrozenOnt', args); } withdrawPeerUnboundOng(args: { gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.withdrawPeerUnboundOng', args); } setFeePercentage(args: { peerPubKey: string, peerCost: number, stakeCost: number, gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.setFeePercentage', args); } changeMaxAuthorization(args: { peerPubKey: string, maxAuthorize: string, gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.changeMaxAuthorization', args); } quitNode(args: { peerPubKey: string, gasPrice?: string, gasLimit?: string }) { return this.rpc.call('governance.quitNode', args); } getAllPeerPool() { return this.rpc.call('governance.getAllPeerPool'); } getAttributes(args: { peerPubKey: string }) { return this.rpc.call('governance.getAttributes', args); } getStakeInfo(args: { peerPubKey: string }) { return this.rpc.call('governance.getStakeInfo', args); } getRewardFeeAmount() { return this.rpc.call('governance.getRewardFeeAmount'); } }