diff --git a/validator-api/tests/src/config/config.yaml b/validator-api/tests/src/config/config.yaml index a2271032bf..5981efed07 100644 --- a/validator-api/tests/src/config/config.yaml +++ b/validator-api/tests/src/config/config.yaml @@ -2,14 +2,14 @@ common: request_headers: Accept: application/json Content-Type: application/json -qa: - api_base_url: https://qa-validator-api.nymtech.net/api/v1 - mixnode_identity: DLdMKLPywEy1vnu3yPrtXvzY7fw1puiiHpA9n9UQatiQ - gateway_identity: CgQrYP8etksSBf4nALNqp93SHPpgFwEUyTsjBNNLj5WM - log_level: debug +qwerty: + api_base_url: https://qwerty-validator-api.qa.nymte.ch/v1 + mixnode_identity: 7 + gateway_identity: 336yuXAeGEgedRfqTJZsG2YV7P13QH1bHv1SjCZYarc9 + log_level: error prod: api_base_url: https://qa-validator-api.nymtech.net/api/v1 mixnode_identity: DLdMKLPywEy1vnu3yPrtXvzY7fw1puiiHpA9n9UQatiQ gateway_identity: CgQrYP8etksSBf4nALNqp93SHPpgFwEUyTsjBNNLj5WM - log_level: debug + log_level: error time_zone: utc diff --git a/validator-api/tests/src/config/configHandler.ts b/validator-api/tests/src/config/configHandler.ts index be37be979d..482282a9ed 100644 --- a/validator-api/tests/src/config/configHandler.ts +++ b/validator-api/tests/src/config/configHandler.ts @@ -22,7 +22,7 @@ class ConfigHandler { private constructor() { this.setCommonConfig(); - this.setEnvironmentConfig(process.env.TEST_ENV || "prod"); + this.setEnvironmentConfig(process.env.TEST_ENV || "qa"); } public static getInstance(): ConfigHandler { diff --git a/validator-api/tests/src/endpoints/Status.ts b/validator-api/tests/src/endpoints/Status.ts index 79eb896729..a4898a19b6 100644 --- a/validator-api/tests/src/endpoints/Status.ts +++ b/validator-api/tests/src/endpoints/Status.ts @@ -2,7 +2,9 @@ import { ActiveStatus, AvgUptime, CoreCount, + GatewayCoreCount, EstimatedReward, + RewardEstimation, InclusionProbability, NodeHistory, Report, @@ -65,7 +67,7 @@ export default class Status extends APIClient { return response.data; } - public async getGatewayCoreCount(identity_key: string): Promise { + public async getGatewayCoreCount(identity_key: string): Promise { const response = await this.restClient.sendGet({ route: `/gateway/${identity_key}/core-status-count`, }); @@ -75,7 +77,7 @@ export default class Status extends APIClient { public async getMixnodeRewardComputation( identity_key: string - ): Promise { + ): Promise { const response = await this.restClient.sendGet({ route: `/mixnode/${identity_key}/reward-estimation`, }); @@ -85,14 +87,19 @@ export default class Status extends APIClient { public async getMixnodeRewardEstimatedComputation( identity_key: string - ): Promise { + ): Promise { const response = await this.restClient.sendPost({ route: `/mixnode/${identity_key}/compute-reward-estimation`, data: { - "uptime": 0, - "is_active": true, + "performance": "", // TO-DO add a value to this + "active_in_rewarded_set": true, "pledge_amount": 0, - "total_delegation": 0 // TO-DO grab the values from the mixnode endpoint on explorer-api and use them in this request + "total_delegation": 0, // TO-DO grab the values from the mixnode endpoint on explorer-api and use them in this request + "interval_operating_cost": { + "denom": "unym", + "amount": "3000000" + }, + "profit_margin_percent": "" // TO-DO add a value to this } }); diff --git a/validator-api/tests/src/types/ContractCacheTypes.ts b/validator-api/tests/src/types/ContractCacheTypes.ts index 68381b0dca..745f1d05cb 100644 --- a/validator-api/tests/src/types/ContractCacheTypes.ts +++ b/validator-api/tests/src/types/ContractCacheTypes.ts @@ -1,18 +1,43 @@ export type AllMixnodes = { - pledge_amount: PledgeAmount; - total_delegation: TotalDelegation; - owner: string; - layer: string; - block_height: number; - mix_node: Mixnode; - proxy: string; - accumulated_rewards: string; + bond_information: BondInformation; + rewarding_details: RewardingDetails; }; -export type PledgeAmount = { +export type BondInformation = { + mix_id: number; + owner: string; + original_pledge: OriginalPledge; + layer: string; + mix_node: Mixnode; + proxy: string; + bonding_height: number; + is_unbonding: boolean; +} + +export type RewardingDetails = { + cost_params: CostParams; + operator: string; + delegates: string; + total_unit_reward: string; + unit_delegation: string; + last_rewarded_epoch: number; + unique_delegations: number; +} + +export type CostParams = { + profit_margin_percent: string; + interval_operating_cost: IntervalOperatingCost; +} + +export type IntervalOperatingCost = { denom: string; amount: string; -}; +} + +export type OriginalPledge = { + denom: string; + amount: string; +} export type TotalDelegation = { denom: string; @@ -27,33 +52,26 @@ export type Mixnode = { sphinx_key: string; identity_key: string; version: string; - profit_margin_percent: number; }; +export type MixnodeBond = { + pledge_amount: OriginalPledge; + total_delegation: TotalDelegation; + owner: string; + layer: string; + block_height: string; + mix_node: Mixnode; + proxy: string; + accumulated_rewards: string; +} + export type MixnodesDetailed = { - mixnode_bond: AllMixnodes; - stake_saturation: number; - uptime: number; - estimated_operator_apy: number; - estimated_delegators_apy: number; -}; - -export type AllGateways = { - pledge_amount: PledgeAmount; - owner: string; - block_height: number; - gateway: Gateway; - proxy: string; -}; - -export type Gateway = { - host: string; - mix_port: number; - clients_port: number; - location: string; - sphinx_key: string; - identity_key: string; - version: string; + mixnode_details: AllMixnodes; + stake_saturation: string; + uncapped_stake_saturation: string; + performance: string; + estimated_operator_apy: string + estimated_delegators_apy: string; }; export type BlacklistedMixnodes = { @@ -62,22 +80,51 @@ export type BlacklistedMixnodes = { export type BlacklistedGateways = { }; +export interface Gateway { + host: string; + mix_port: number; + clients_port: number; + location: string; + sphinx_key: string; + identity_key: string; + version: string; +} + +export interface AllGateways { + pledge_amount: OriginalPledge; + owner: string; + block_height: number; + gateway: Gateway; + proxy: string; +} + export type EpochRewardParams = { - epoch_reward_pool: string; - rewarded_set_size: string; - active_set_size: string; - staking_supply: string; - sybil_resistance_percent: number; - active_set_work_factor: number; + interval: Interval; + rewarded_set_size: number; + active_set_size: number; }; +export type Interval = { + reward_pool: string; + staking_supply: string; + staking_supply_scale_factor: string; + epoch_reward_budget: string; + stake_saturation_point: string; + sybil_resistance: string; + active_set_work_factor: string; + interval_pool_emission: string; +} + export type CurrentEpoch = { id: number; - start: string; - length: Length; + epochs_in_interval: number; + current_epoch_start: string; + current_epoch_id: number; + epoch_length: EpochLength; + total_elapsed_epochs: number; }; -export type Length = { +export type EpochLength = { secs: number; nanos: number; }; diff --git a/validator-api/tests/src/types/StatusTypes.ts b/validator-api/tests/src/types/StatusTypes.ts index d6a7d91498..1ef91de430 100644 --- a/validator-api/tests/src/types/StatusTypes.ts +++ b/validator-api/tests/src/types/StatusTypes.ts @@ -1,22 +1,47 @@ -export type Epoch = { - epoch_reward_pool: string; - rewarded_set_size: string; - active_set_size: string; +export interface Estimation { + total_node_reward: string; + operator: string; + delegates: string; + operating_cost: string; +} + +export interface Interval { + reward_pool: string; staking_supply: string; - sybil_resistance_percent: number; - active_set_work_factor: number; -}; + staking_supply_scale_factor: string; + epoch_reward_budget: string; + stake_saturation_point: string; + sybil_resistance: string; + active_set_work_factor: string; + interval_pool_emission: string; +} -export type Node = { - reward_blockstamp: number; - uptime: string; - in_active_set: boolean; -}; +export interface RewardParams { + interval: Interval; + rewarded_set_size: number; + active_set_size: number; +} -export type RewardParams = { +export interface EpochLength { + secs: number; + nanos: number; +} + +export interface Epoch { + id: number; + epochs_in_interval: number; + current_epoch_start: string; + current_epoch_id: number; + epoch_length: EpochLength; + total_elapsed_epochs: number; +} + +export interface RewardEstimation { + estimation: Estimation; + reward_params: RewardParams; epoch: Epoch; - node: Node; -}; + as_at: number; +} export type EstimatedReward = { estimated_total_node_reward: number; @@ -29,21 +54,26 @@ export type EstimatedReward = { }; export type StakeSaturation = { - saturation: number; + saturation: string; + uncapped_saturation: string; as_at: number; }; export type AvgUptime = { - identity: string; + mix_id: number; avg_uptime: number; }; -export type InclusionProbability = { - in_active: string; - in_reserve: string; +export type Report = { + mix_id: number + identity: string; + owner: string; + most_recent: number; + last_hour: number; + last_day: number; }; -export type Report = { +export type GatewayReport = { identity: string; owner: string; most_recent: number; @@ -57,12 +87,24 @@ export type History = { }; export type NodeHistory = { + mix_id: number; + identity: string; + owner: string; + history: History[]; +}; + +export type GatewayHistory = { identity: string; owner: string; history: History[]; }; export type CoreCount = { + mix_id: number; + count: number; +}; + +export type GatewayCoreCount = { identity: string; count: number; }; @@ -70,3 +112,28 @@ export type CoreCount = { export type ActiveStatus = { status: string; }; + +export interface InclusionProbabilities { + inclusion_probabilities: InclusionProbability[]; + samples: number; + elapsed: Elapsed; + delta_max: number; + delta_l2: number; + as_at: number; +} + +export interface InclusionProbability { + mix_id: number; + in_active: number; + in_reserve: number; +} + +export interface Elapsed { + secs: number; + nanos: number; +} + +export interface SingleInclusionProbability { + in_active: number; + in_reserve: number; +} \ No newline at end of file