Files
api/packages/api-derive/src/session/eraLength.ts
T
Jaco Greeff 2dfc55cb5c Update api.derive to use api.queryMulti (#911)
* session api.queryMulti

* Make a single subscription to retrieve all session info

* Adjustments

* WIP

* Seems mostly comprehensive, need to full test e2e

* e2e tests for operations

* Allow "create from empty"

* skip

* Remove comment

* Remove ancient ?'s

* Update types.ts
2019-05-16 11:36:41 +02:00

20 lines
583 B
TypeScript

// Copyright 2017-2019 @polkadot/api-derive authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import BN from 'bn.js';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterface$Rx } from '@polkadot/api/types';
import { drr } from '../util/drr';
import { info } from './info';
export function eraLength (api: ApiInterface$Rx) {
return (): Observable<BN> =>
info(api)().pipe(
map(({ eraLength }) => eraLength),
drr()
);
}