Add derive functions (#564)
* Add drr * Update headers * Lint * Copy other functions * Account indexes * accountIndexToId * accountIdAndIndex * Fees * votingBalance * votingBalances * votingBalancesNominatorsFor * validatingBalance * validatingBalances * bestNumberFinalised * eraLength * Add drr * eraProgress * votes * referendumInfos * referendumVotesFor * referendums * Clean code * Add tests * Fix lint * Fix bug eraProgress * Fix bug fees * combineLatest without array * Fix lint
This commit is contained in:
@@ -13,14 +13,14 @@ import { drr } from '../util/drr';
|
||||
|
||||
export function sessionProgress (api: ApiRx) {
|
||||
return (): Observable<BN> =>
|
||||
combineLatest([
|
||||
combineLatest(
|
||||
bestNumber(api)(),
|
||||
api.query.session.sessionLength(),
|
||||
api.query.session.lastLengthChange()
|
||||
]).pipe(
|
||||
).pipe(
|
||||
map(
|
||||
([bestNumber, sessionLength, lastLengthChange]) =>
|
||||
(bestNumber as BlockNumber || new BN(0))
|
||||
(bestNumber || new BN(0))
|
||||
.sub(lastLengthChange as BlockNumber || new BN(0))
|
||||
.add(sessionLength as BlockNumber || new BN(1))
|
||||
.mod(sessionLength as BlockNumber || new BN(1))
|
||||
|
||||
Reference in New Issue
Block a user