This commit is contained in:
benedettadavico
2022-11-08 12:30:27 +01:00
parent 379d593daf
commit 9790009eac
4 changed files with 52 additions and 14 deletions
@@ -130,9 +130,10 @@ describe("Get mixnode data", (): void => {
expect(typeof response.in_reserve).toBe("string");
});
it.skip("Post to compute mixnode reward estimation", async ():Promise<void> => {
it("Post to compute mixnode reward estimation", async ():Promise<void> => {
const mix_id = config.environmnetConfig.mixnode_identity;
const response = await status.getMixnodeRewardEstimatedComputation(mix_id);
const payload = {"performance": "0.2"}
const response = await status.getMixnodeRewardEstimatedComputation(mix_id, payload);
//estimation
expect(typeof response.estimation.total_node_reward).toBe("string");
@@ -163,4 +164,15 @@ describe("Get mixnode data", (): void => {
expect(typeof response.as_at).toBe("number");
})
it.skip("Post to compute mixnode reward estimation", async ():Promise<void> => {
const mix_id = config.environmnetConfig.mixnode_identity;
const payload = {"performance": "0.7"}
const response = await status.getMixnodeRewardEstimatedComputation(mix_id, payload);
// TO-DO this test needs calculations to ensure than when passing through different performance values, the reward is also changing as expected
expect(response.estimation.total_node_reward).toContain("986360");
})
});
+3 -12
View File
@@ -86,21 +86,12 @@ export default class Status extends APIClient {
}
public async getMixnodeRewardEstimatedComputation(
mix_id: number
mix_id: number,
payload: object
): Promise<RewardEstimation> {
const response = await this.restClient.sendPost({
route: `/mixnode/${mix_id}/compute-reward-estimation`,
data: {
"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
"interval_operating_cost": {
"denom": "unym",
"amount": "3000000"
},
"profit_margin_percent": "" // TO-DO add a value to this
}
data: payload
});
return response.data;