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:
Amaury Martiny
2019-01-10 17:39:25 +01:00
committed by GitHub
parent a93b2f70c7
commit 2a2df9a1c3
26 changed files with 591 additions and 5 deletions
@@ -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))