import { ActiveStatus, AvgUptime, CoreCount, DetailedGateway, DetailedMixnodes, InclusionProbabilities, InclusionProbability, NodeHistory, ErrorMsg, Report, RewardEstimation, StakeSaturation, } from "../types/StatusInterfaces"; import { APIClient } from "./abstracts/APIClient"; export default class Status extends APIClient { constructor() { super("/status"); } // GATEWAYS public async getDetailedGateways(): Promise { const response = await this.restClient.sendGet({ route: `/gateways/detailed`, }); return response.data; } public async getUnfilteredGateways(): Promise { const response = await this.restClient.sendGet({ route: `/gateways/detailed-unfiltered`, }); return response.data; } public async getGatewayStatusReport( identity_key: string ): Promise { const response = await this.restClient.sendGet({ route: `/gateway/${identity_key}/report`, }); return response.data; } public async getGatewayHistory( identity_key: string ): Promise { const response = await this.restClient.sendGet({ route: `/gateway/${identity_key}/history`, }); return response.data; } public async getGatewayCoreCount(identity_key: string): Promise { const response = await this.restClient.sendGet({ route: `/gateway/${identity_key}/core-status-count`, }); return response.data; } public async getGatewayAverageUptime( identity_key: string ): Promise { const response = await this.restClient.sendGet({ route: `/gateway/${identity_key}/avg_uptime`, }); return response.data; } // MIXNODES public async getMixnodeStatusReport( mix_id: number ): Promise { const response = await this.restClient.sendGet({ route: `/mixnode/${mix_id}/report`, }); return response.data; } public async getMixnodeStakeSaturation( mix_id: number ): Promise { const response = await this.restClient.sendGet({ route: `/mixnode/${mix_id}/stake-saturation`, }); return response.data; } public async getMixnodeCoreCount(mix_id: number): Promise { const response = await this.restClient.sendGet({ route: `/mixnode/${mix_id}/core-status-count`, }); return response.data; } public async getMixnodeRewardComputation( mix_id: number ): Promise { const response = await this.restClient.sendGet({ route: `/mixnode/${mix_id}/reward-estimation`, }); return response.data; } public async sendMixnodeRewardEstimatedComputation( mix_id: number ): Promise { const response = await this.restClient.sendPost({ route: `/mixnode/${mix_id}/compute-reward-estimation`, data: { // performance: "10", active_in_rewarded_set: true, // pledge_amount: 10, // total_delegation: 2000, // interval_operating_cost: { // denom: "unym", // amount: "250000000" // }, // profit_margin_percent: 10 }, }); return response.data; } public async getMixnodeHistory( mix_id: number ): Promise { const response = await this.restClient.sendGet({ route: `/mixnode/${mix_id}/history`, }); return response.data; } public async getMixnodeAverageUptime( mix_id: number ): Promise { const response = await this.restClient.sendGet({ route: `/mixnode/${mix_id}/avg_uptime`, }); return response.data; } public async getMixnodeInclusionProbability( mix_id: number ): Promise { const response = await this.restClient.sendGet({ route: `/mixnode/${mix_id}/inclusion-probability`, }); return response.data; } public async getMixnodeStatus(mix_id: number): Promise { const response = await this.restClient.sendGet({ route: `/mixnode/${mix_id}/status`, }); return response.data; } public async getAllMixnodeInclusionProbability(): Promise { const response = await this.restClient.sendGet({ route: `/mixnodes/inclusion_probability`, }); return response.data; } public async getDetailedMixnodes(): Promise { const response = await this.restClient.sendGet({ route: `/mixnodes/detailed`, }); return response.data; } public async getDetailedRewardedMixnodes(): Promise { const response = await this.restClient.sendGet({ route: `/mixnodes/rewarded/detailed`, }); return response.data; } public async getUnfilteredMixnodes(): Promise { const response = await this.restClient.sendGet({ route: `/mixnodes/detailed-unfiltered`, }); return response.data; } public async getDetailedActiveMixnodes(): Promise { const response = await this.restClient.sendGet({ route: `/mixnodes/active/detailed`, }); return response.data; } }