mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-07 17:48:01 +00:00
[Staking] Runtime api if era rewards are pending to be claimed (#4301)
closes https://github.com/paritytech/polkadot-sdk/issues/426. related to https://github.com/paritytech/polkadot-sdk/pull/1189. Would help offchain programs to query if there are unclaimed pages of rewards for a given era. The logic could look like below ```js // loop as long as all era pages are claimed. while (api.call.stakingApi.pendingRewards(era, validator_stash)) { api.tx.staking.payout_stakers(validator_stash, era) } ```
This commit is contained in:
@@ -2791,6 +2791,10 @@ impl_runtime_apis! {
|
||||
fn eras_stakers_page_count(era: sp_staking::EraIndex, account: AccountId) -> sp_staking::Page {
|
||||
Staking::api_eras_stakers_page_count(era, account)
|
||||
}
|
||||
|
||||
fn pending_rewards(era: sp_staking::EraIndex, account: AccountId) -> bool {
|
||||
Staking::api_pending_rewards(era, account)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_consensus_babe::BabeApi<Block> for Runtime {
|
||||
|
||||
Reference in New Issue
Block a user