Skip to content

Commit

Permalink
Merge pull request #46 from novasamatech/fix/first_paged_session
Browse files Browse the repository at this point in the history
Fixed first paged session on westend
  • Loading branch information
ERussel authored Mar 25, 2024
2 parents aeb0336 + e8c5d0f commit 9316c3b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/mappings/era/ValidatorEraInfoDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@ export class ValidatorEraInfoDataSource extends CachingEraInfoDataSource {

protected async fetchEraStakers(): Promise<StakeTarget[]> {
const era = await this.era()
let stakers: StakeTarget[]
if (api.query.staking.erasStakersOverview) {
return await this.fetchEraStakersPaged(era);
} else {
return await this.fetchEraStakersClipped(era);
stakers = await this.fetchEraStakersPaged(era);
if (stakers.length > 0) {
return stakers
}
}

stakers = await this.fetchEraStakersClipped(era);
if (stakers.length == 0) {
throw new Error("Empty era stakers fetched")
}
return stakers
}

private async fetchEraStakersClipped(era: number): Promise<StakeTarget[]> {
Expand Down

0 comments on commit 9316c3b

Please sign in to comment.