Skip to content

Commit

Permalink
A0-4607: Fix incorrect "last era payout" on azero.dev Network > Staki… (
Browse files Browse the repository at this point in the history
#136)

…ng > Targets
  • Loading branch information
Marcin-Radecki authored Jan 30, 2025
2 parents 09b924d + 0816c7e commit b0243c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
19 changes: 15 additions & 4 deletions .yarn/patches/@polkadot-api-derive-npm-13.2.1-19d2cc1087.patch
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,21 @@ index 5d74f9b00630b7cbfe1fbab5cf584b18465be262..6261b5b397528ca376c6b60fbd4c28e5
(0, rxjs_1.map)((keys) => [...new Set(keys.map(({ args: [, accountId] }) => accountId.toString()))].map((a) => api.registry.createType('AccountId', a))))
: api.query.staking.erasStakers
diff --git a/staking/query.js b/staking/query.js
index f9448e7b554df170c96971eccbe0c3c94f0fd695..e01c0ad9cf72e9d082c3de610d03c0732bbfda06 100644
index f9448e7b554df170c96971eccbe0c3c94f0fd695..0dc18f0762732dc8f27a94f54dea577ee147486d 100644
--- a/staking/query.js
+++ b/staking/query.js
@@ -50,11 +50,17 @@ function filterRewards(stashIds, eras, claimedRewards, stakersOverview) {
@@ -37,6 +37,10 @@ function filterRewards(stashIds, eras, claimedRewards, stakersOverview) {
overviewData[id] = new Map();
overviewData[id].set(era, overview.unwrap().pageCount);
}
+ const { own, pageCount } = overview.unwrap();
+ if (pageCount.eqn(0) && own.toBn().gtn(0)) {
+ overviewData[id].set(era, pageCount.addn(1));
+ }
}
});
return stashIds.map((id) => {
@@ -50,11 +54,17 @@ function filterRewards(stashIds, eras, claimedRewards, stakersOverview) {
? era
: -1;
}
Expand All @@ -112,7 +123,7 @@ index f9448e7b554df170c96971eccbe0c3c94f0fd695..e01c0ad9cf72e9d082c3de610d03c073
return {
accountId: stashId,
claimedRewardsEras: filterClaimedRewards(api, claimedRewards),
@@ -68,8 +74,11 @@ function parseDetails(api, stashId, controllerIdOpt, nominatorsOpt, rewardDestin
@@ -68,8 +78,11 @@ function parseDetails(api, stashId, controllerIdOpt, nominatorsOpt, rewardDestin
rewardDestination: rewardDestinationCompat(rewardDestinationOpts),
stakingLedger: stakingLedgerOpt.unwrapOrDefault(),
stashId,
Expand All @@ -126,7 +137,7 @@ index f9448e7b554df170c96971eccbe0c3c94f0fd695..e01c0ad9cf72e9d082c3de610d03c073
}
function getLedgers(api, optIds, { withLedger = false }) {
const ids = optIds
@@ -129,11 +138,28 @@ function getStashInfo(api, stashIds, activeEra, { withClaimedRewardsEras, withCo
@@ -129,11 +142,28 @@ function getStashInfo(api, stashIds, activeEra, { withClaimedRewardsEras, withCo
: of(stashIds.map(() => emptyClaimedRewards)),
withExposureErasStakersLegacy && api.query.staking.erasStakers
? combineLatest(stashIds.map((s) => api.query.staking.erasStakers(activeEra, s)))
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ __metadata:

"@polkadot/api-derive@patch:@polkadot/api-derive@npm%3A13.2.1#~/.yarn/patches/@polkadot-api-derive-npm-13.2.1-19d2cc1087.patch":
version: 13.2.1
resolution: "@polkadot/api-derive@patch:@polkadot/api-derive@npm%3A13.2.1#~/.yarn/patches/@polkadot-api-derive-npm-13.2.1-19d2cc1087.patch::version=13.2.1&hash=ed990c"
resolution: "@polkadot/api-derive@patch:@polkadot/api-derive@npm%3A13.2.1#~/.yarn/patches/@polkadot-api-derive-npm-13.2.1-19d2cc1087.patch::version=13.2.1&hash=1c207a"
dependencies:
"@polkadot/api": "npm:13.2.1"
"@polkadot/api-augment": "npm:13.2.1"
Expand All @@ -1416,7 +1416,7 @@ __metadata:
"@polkadot/util-crypto": "npm:^13.1.1"
rxjs: "npm:^7.8.1"
tslib: "npm:^2.7.0"
checksum: 10/58e03e2123eb9c426e5d831bac40be105c2cd0e9370406df12f030a47bcb33b038d07d7a48c50ba612636236fa6f0c30e58464aa5abc76d44daa2a67f8384fbe
checksum: 10/76d55034fd41eba3bcbc316138302ed1f6c154b47a468f3fa602632cd72ea36e927d2ade57b81b4c8187a27e07141dfb6edda4d0ab4014021966b4993306bf8d
languageName: node
linkType: hard

Expand Down

0 comments on commit b0243c8

Please sign in to comment.