Reputation: 85
so I'm looking at this api docs on polkadot.js https://polkadot.js.org/docs/substrate/storage#staking but I could not figure which one to use to actually query all the staking rewards given an account ID / publish address.
I was thinking I would have to loop for each era. but which one returns the staking rewards. so than I can calculate a total overtime? thank you very much !
Upvotes: 0
Views: 990
Reputation: 1082
In general, the node isn't used for querying historical state. Instead you very likely want to use an indexer service that generates data that is much easier to get queries on. There are a few options, but one of the most supported is substrate archive that I would suggest you use.
Alternatively you can look to substrate compatible block explorers to see what they do for this in their source code.
Upvotes: 2