Skip to content

Commit

Permalink
Fix staking derive
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Apr 23, 2024
1 parent 5a69a78 commit 1c41ab4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/json-serve/src/runcli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ function percentageFormat (top: BN, bottom: BN): string {
}

function onElectedInfo (info: DeriveStakingElected): void {
totalBonded = info.info.reduce((totalBonded, { exposure }): BN => {
return totalBonded.add(exposure?.total.unwrap() || new BN(0));
totalBonded = info.info.reduce((totalBonded, { exposurePaged }): BN => {
return totalBonded.add((exposurePaged.isSome && exposurePaged?.unwrap().pageTotal.unwrap()) || new BN(0));
}, new BN(0));
}

Expand Down Expand Up @@ -116,7 +116,7 @@ async function main (): Promise<void> {

await api.rpc.chain.subscribeNewHeads(onNewHead);
await api.query.balances.totalIssuance(onTotalInsurance);
await api.derive.staking.electedInfo(undefined, onElectedInfo);
await api.derive.staking.electedInfo(undefined, undefined, onElectedInfo);
}

process.on('unhandledRejection', (error): void => {
Expand Down

0 comments on commit 1c41ab4

Please sign in to comment.