Closed AtelyPham closed 5 months ago
@AtelyPham the points are not the earnings exactly, CC @1xstj can you describe to @AtelyPham how to get the earnings from the points? Maybe there's an easier way here.
We determined the staking reward of a validator using the following formula:
Validator's reward
= (Era's total reward
* Validator's points
) / Era's total points
Therefore, we'll apply the same methodology to compute the restaking reward for a restaker.
Presently, we can utilize the
api.query.roles.erasRestakeRewardPoints
API to retrieve reward data (also referred to as earnings data) for each era.To obtain the user's reward for each era, we can iterate through all eras and filter by the user's address. The pending task involves converting the era number to a timestamp.
Screenshot